Read an interesting article about multiline strings in JavaScript over on Stack Overflow, which referenced the Google JavaScript Style Guide which I thought was interesting.
Tag Archives: syntax
jQuery document ready
I’m always forgetting the syntax for the jQuery ‘document ready’ event. Which is an embarrassment because it’s so simple:
$( document ).ready( handler ) $().ready( handler ) (this is not recommended) $( handler )
I used to use the $( document ).ready( handler ) syntax, but starting today I use the $( handler ) syntax.
MySQL modify column syntax
I needed to modify some columns on a MySQL table today and found myself having to lookup the syntax and found this article which explains it.
PHP heredoc syntax
Today I found myself looking up the PHP heredoc syntax. It was cool to learn that you can use {$var} syntax to embed variable data in a heredoc.
Inserting multiple rows with an insert statement in MySQL
Today I had to double-check the syntax for doing multiple row inserts in a MySQL insert statement, because my first guess at the syntax was wrong. I found this article which explained the syntax which is basically:
INSERT INTO example (example_id, name, value, other_value) VALUES (100, 'Name 1', 'Value 1', 'Other 1'), (101, 'Name 2', 'Value 2', 'Other 2'), (102, 'Name 3', 'Value 3', 'Other 3'), (103, 'Name 4', 'Value 4', 'Other 4');
MySQL IF syntax
Found myself looking up the MySQL IF Syntax.
PHP heredoc syntax
Today I used the PHP for the first time.
$data = <<<EOF my data EOF; echo $data;