Skip to content

Instantly share code, notes, and snippets.

| Variable | Example | Notes |
| --- | --- | --- |
| `date` | Feb 21, 2016 | The current date |
| `time` | 14:17 | The current time |
| `order.code` | 01234567890123456 |
| `order.reference` | XXX-YYY-ZZZ |
| `order.external_reference` | BK-1112302 |
| `order.voucher_code` | XYWJ02222X |
| `customer.full_name` | John Smith |
| `customer.first_name` | John |
@ollym
ollym / gist:1662767
Created January 23, 2012 12:08
ECMA5 Object Cloning
Object.clone = function(obj) {
return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyNames(obj).reduce(function(memo, name) {
return (memo[name] = Object.getOwnPropertyDescriptor(obj, name)) && memo;
}, {}));
}
function Stream(host, port, mode) { ... }
Stream.new = function(host, port, mode) { return new Stream(host, port, mode); }
Stream.prototype = Object.create(Object.prototype, {
readable: { get: function() { ... },
writable: true, enumerable: false, configurable: true },
writable: { get: function() { ... },
writable: true, enumerable: false, configurable: true },
location / {
index index.php index.html index.htm;
try_files $uri index.php$uri?$args;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
user www-data;
worker_processes 4;
error_log /var/log/nginx/nginx.log info;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
multi_accept on;
}
@ollym
ollym / gist:664490
Created November 5, 2010 17:31
Simple ES5 Class Inheritance
// Event Emitter Class
// ringo/events.js
export('EventEmitter');
function EventEmitter() {
}
EventEmitter.prototype = Object.create(Object.prototype,
var engine = require('ringo/engine');
var script = 'var y = x * x';
var scope = engine.evaluateString(script, { x: 5 });
// scope.x = 5
// scope.y = 25
// EXAMPLE OF IMAGE
var image = require('image');
image = image.createImage(blob);
// Methods
image.resize(width, height, preserveAspectRatio);
image.crop(from_x, from_y, to_x, to_y);
image.rotate(degrees);
<?php
$a = 1;
$b = 2;
$c = 3;
$d = $c | $b;
if ($d & $a) {
// This line is reached and it shouldn't be