background preloader

SQL (Structured Query Language) in one page : SQL.SU

Related:  twimm

Probably Wrong | Avoid Else, Return Early tldr; Return as soon as you know your method cannot do any more meaningful workReduce indentation by using if/return instead of a top-level if/elseTry keep the “meat” of your method at the lowest indentation level.Error handling is noise. Programmers are often taught to have a ‘single exit point’ in their methods, i.e. only return from a single location. function () { var result; if () { result = x } else { if () { result = y } else { result = z } } return result // this return is single and lonely } This is a poor guideline in my opinion: “assign a result” doesn’t explain the intent: “this is the final value, processing stops here”Leaves question open “is the result object finished? Example if/else refactoring Consider this typical node callback code: function(err, results) { if (! There’s a few problems here. Let’s try keep the “meat” of the code at the bottom of the method, and keep any special cases together at the top: function(err, results) { if (err) return void handleError(err) // ... }

Syntax Diagrams For SQLite Syntax Diagrams For SQLite Basic SQLite Statements: All SQLite Statements: sql-stmt-list: References: sql-stmt See also: lang.html sql-stmt: Used by: sql-stmt-list References: alter-table-stmt analyze-stmt attach-stmt begin-stmt commit-stmt create-index-stmt create-table-stmt create-trigger-stmt create-view-stmt create-virtual-table-stmt delete-stmt delete-stmt-limited detach-stmt drop-index-stmt drop-table-stmt drop-trigger-stmt drop-view-stmt insert-stmt pragma-stmt reindex-stmt release-stmt rollback-stmt savepoint-stmt select-stmt update-stmt update-stmt-limited vacuum-stmt See also: lang.html lang_explain.html alter-table-stmt: Used by: sql-stmt References: column-def See also: lang_altertable.html analyze-stmt: Used by: sql-stmt See also: lang_analyze.html attach-stmt: Used by: sql-stmt See also: lang_attach.html begin-stmt: Used by: sql-stmt See also: lang_transaction.html commit-stmt: Used by: sql-stmt See also: lang_transaction.html rollback-stmt: savepoint-stmt: release-stmt: create-index-stmt:

Codecademy Labs Named Constructors in PHP Don't limit yourself by PHP's single constructor. Use static factory methods. Published on 12 June 2014 by @mathiasverraes PHP allows only a single constructor per class. <? The only correct answer is “it depends”. This is terribly ugly. <? Or if we want to support numeric strings as well as integers? <? (Note: in production code, I would make my Time class a lot more idiot-proof.) Refactor to named constructors Let’s add some public static methods to instantiate Time. Every method now satisfies the Single Responsibility Principle. Well, something is bothering me: __construct($hours, $minutes) kinda sucks: it exposes the internals of the Time value object, and we can’t change the interface because it is public. This is ugly: we go through all the trouble of splitting up the string, only to rebuild it in the constructor. Do we even need a constructor now that we have named constructors? <? <? Ubiquitous Language <? Notice anything? fromString => fromTime fromValues => fromHoursAndMinutes <?

JavaScript in one page : JavaScript.SU 30 free programming eBooks - citizen428.blog() Since this post got quite popular I decided to incorporate some of the excellent suggestions posted in the comments, so this list now has more than 50 books in it. BTW: I’m not very strict on the definition of “ebook”, some of them are really just HTML versions of books. [UPDATED: 2012-01-18] Learning a new programming language always is fun and there are many great books legally available for free online. Here’s a selection of 30 of them: Lisp/Scheme:Common Lisp: A Gentle Introduction to Symbolic ComputationHow to Design ProgramsInterpreting Lisp (PDF, suggested by Gary Knott)Let Over LambdaOn LispPractical Common LispProgramming in Emacs LispProgramming Languages. Ruby:The Bastards Book of Ruby (suggested by Dan Nguyen)Clever Algorithms (suggested by Tales Arvelos)Data Structures and Algorithms with Object-Oriented Design Patterns in RubyLearn Ruby the Hard WayLearn to ProgramMacRuby: The Definitive GuideMr. Erlang:Concurrent Programming in ErlangLearn You Some Erlang for Great Good

Prettier for PHP 0.1: First alpha release □ · Prettier After more than 200 merged pull requests since mid December 2017, we're happy to announce the first alpha release of Prettier for PHP. In this blog post, we'd like to give a short overview of how the plugin works, its philosophy, and what to expect in the future. How does it work? Adding support for a new language to Prettier requires two things: A parser, which turns your source code into an abstract syntax tree (AST). While we could benefit from existing work on the parsing side, the printer had to be developed from scratch to support all of PHP's various AST node types. If you'd like to read more about the plugin API, see the docs. Philosophy When building a code formatter, it can be tempting to add many options to account for all the different code styles there are. From the experience gained with Prettier for JavaScript, we believe that offering as few configuration options as possible is one of Prettier's biggest strengths. What's next Are you excited about Prettier for PHP?

CSS3 Cheat Sheet (PDF) Advertisement Just last week we released an extensive printable HTML 5 Cheat Sheet that lists all currently supported HTML 5 tags, their descriptions, their attributes and their support in HTML 4. In comments to this post we received many requests for a similar CSS 3 cheat sheet that would present the main features of CSS 3 in a handy, printable reference card. So we asked our friend Chris Hanscom from Veign.com (who created the HTML 5 cheat sheet) to create a quick reference card for CSS 3. We already encouraged you to experiment with CSS 3 in our last posts and now you can use this handy cheat sheet to use the new CSS 3 features in some modern browsers (Firefox 3.5, Opera 9.6, Safari 3+, Google Chrome and Co.). The result is a printable CSS 3 scrib sheet, created and released exclusively for the readers of Smashing Magazine. The cheat sheet was done in the same format as the CSS 2 Reference Guide that you may want to use for your projects as well. Thank you very much, Chris Hanscom!

code snippet: Add a New Table to an Access Database Category: Database Type: Snippets Difficulty: Beginning Author: Intelligent Solutions Inc. Version Compatibility: Instructions: Copy the declarations and code below and paste directly into your VB project. Declarations: ' (None) Code: A list of cool Chrome DevTools Tips and Tricks The Chrome DevTools provide an amazing set of tools to help you develop on the Web platform. Here are a few tips you might not know yet Check out the overview of Chrome DevTools if you're new to them Drag and Drop in the Elements panel In the Elements panel you can drag and drop any HTML element and change its position across the page Reference the currently selected element in the Console Select a node in the Elements panel, and type $0 in the console to reference it. Tip: if you're using jQuery, you can enter $($0) to access the jQuery API on this element. Use the value of the last operation in the Console Use $_ to reference the return value of the previous operation executed in the Console Add CSS and edit the element state In the Elements panel there are 2 super useful buttons. The first lets you add a new CSS property, with any selector you want but pre-filling the currently selected element: Find where a CSS property is defined Save to file the modified CSS Screenshot a single element

Related: