- Write functions() in lower case, KEYWORDS in upper.
STARTeach keyword clause
ONa new line.- Use either
camelCaseorsnake_casefor node identifiers but be consistent. - Relationship type names should use
UPPER_CASE_AND_UNDERSCORES. - Label names should use
CamelCaseWithInitialCaps. MATCH (clauses)-->(should)-->(always)-->(use)-->(parentheses)-->(around)-->(nodes)- Backticks `cân éscape odd-ch@racter$ & keyw0rd$` but should be a code smell.
| <?php | |
| $file = '/path/to/file.png'; | |
| $filename = basename($file); | |
| $upload_file = wp_upload_bits($filename, null, file_get_contents($file)); | |
| if (!$upload_file['error']) { | |
| $wp_filetype = wp_check_filetype($filename, null ); | |
| $attachment = array( | |
| 'post_mime_type' => $wp_filetype['type'], | |
| 'post_parent' => $parent_post_id, |
Note: This was written using elasticsearch 0.9.
Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:
$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
"_id": 1,This is no longer a bug. I'm keeping the gist for historical reasons, as it helped to get it fixed. Make sure to read the notes by the end of the post.
- Set
-moz-appearancetonone. This will "reset" the styling of the element; - Set
text-indentto0.01px. This will "push" the text a tiny bit[1] to the right;
| /** | |
| * Creates a new Uint8Array based on two different ArrayBuffers | |
| * | |
| * @private | |
| * @param {ArrayBuffers} buffer1 The first buffer. | |
| * @param {ArrayBuffers} buffer2 The second buffer. | |
| * @return {ArrayBuffers} The new ArrayBuffer created out of the two. | |
| */ | |
| var _appendBuffer = function(buffer1, buffer2) { | |
| var tmp = new Uint8Array(buffer1.byteLength + buffer2.byteLength); |
I didn't have a great time trying to implement a simple feature involving Google Analytics in one of my projects (nodejs web application).
My humble requirement was to collect some data (events) I was pushing to Google Analytics in order to create a simple report for my users. Since it isn't a critical report, my idea was to get the data once a day and cache it.
So, as simple as it seems, it has been a tough trip for me and I want to share the whole process with the community. I hope anyone trying to achive something similar gets to this article and find it helpful.
These are the main steps I had to take:
| if ($_SERVER['REMOTE_ADDR']=='127.0.0.1') { | |
| define('WP_ENV', 'local'); | |
| } elseif ($_SERVER['HTTP_HOST']=='develop.project.com') { | |
| define('WP_ENV', 'develop'); | |
| } elseif ($_SERVER['HTTP_HOST']=='master.project.com') { | |
| define('WP_ENV', 'develop'); | |
| } else { | |
| define('WP_ENV', 'production'); | |
| } |
| // -------------------------------------------------- | |
| // Flexbox LESS mixins | |
| // The spec: http://www.w3.org/TR/css3-flexbox | |
| // -------------------------------------------------- | |
| // Flexbox display | |
| // flex or inline-flex | |
| .flex-display(@display: flex) { | |
| display: ~"-webkit-@{display}"; | |
| display: ~"-ms-@{display}box"; // IE10 uses -ms-flexbox |
| var cluster = require('cluster'); | |
| if (cluster.isWorker) { | |
| console.log('Worker ' + process.pid + ' has started.'); | |
| // Send message to master process. | |
| process.send({msgFromWorker: 'This is from worker ' + process.pid + '.'}) | |
| // Receive messages from the master process. |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
| Version 2, December 2004 | |
| Copyright (C) 2011 Jed Schmidt <http://jed.is> | |
| Everyone is permitted to copy and distribute verbatim or modified | |
| copies of this license document, and changing it is allowed as long | |
| as the name is changed. | |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |