Installation
gem install rmagick # you'll need ImageMagick & Ruby first
gem install colormath
gem install micro-optparse
/** | |
* This code is licensed under the terms of the MIT license | |
* | |
* Deep diff between two object, using lodash | |
* @param {Object} object Object compared | |
* @param {Object} base Object to compare with | |
* @return {Object} Return a new object who represent the diff | |
*/ | |
function difference(object, base) { | |
function changes(object, base) { |
<?php | |
namespace GM\VirtualPages; | |
/** | |
* @author Giuseppe Mazzapica <giuseppe.mazzapica@gmail.com> | |
* @license http://opensource.org/licenses/MIT MIT | |
*/ | |
class Controller implements ControllerInterface { | |
private $pages; |
'use strict'; | |
// simple express server | |
var express = require('express'); | |
var app = express(); | |
var router = express.Router(); | |
app.use(express.static('public')); | |
app.get('/', function(req, res) { | |
res.sendfile('./public/index.html'); |
<ul class="events"> | |
<?php | |
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; | |
$atts = array( | |
'paged' => $paged, | |
'title' => NULL, | |
'limit' => 100, | |
'css_class' => NULL, | |
'show_expired' => FALSE, | |
'month' => NULL, |
<?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, |
// _decimal.scss | MIT License | gist.github.com/terkel/4373420 | |
// Round a number to specified digits. | |
// | |
// @param {Number} $number A number to round | |
// @param {Number} [$digits:0] Digits to output | |
// @param {String} [$mode:round] (round|ceil|floor) How to round a number | |
// @return {Number} A rounded number | |
// @example | |
// decimal-round(0.333) => 0 |
if (Meteor.is_client) { | |
Template.hello.greeting = function () { | |
return "Welcome to XYZ."; | |
}; | |
Template.hello.events = { | |
'click input' : function () { | |
// template data, if any, is available in 'this' | |
if (typeof console !== 'undefined') | |
console.log("You pressed the button"); |
// Example usage, a MIDI proxy that picks the first available MIDI input and routes its messages to the first MIDI outputs | |
navigator.getUserMedia({midi: true}, function (MIDIAccess) { | |
try { | |
var input = MIDIAccess.getInput(MIDIAccess.enumerateInputs()[0]); | |
var output = MIDIAccess.getOutput(MIDIAccess.enumerateInputs()[0]); | |
} catch (e) { | |
console.error("Couldn't find suitable MIDI devices"); | |
} |
/* | |
* This work is free. You can redistribute it and/or modify it under the | |
* terms of the Do What The Fuck You Want To Public License, Version 2, | |
* as published by Sam Hocevar. See the COPYING file for more details. | |
*/ | |
/* | |
* Easing Functions - inspired from http://gizma.com/easing/ | |
* only considering the t value for the range [0, 1] => [0, 1] | |
*/ | |
EasingFunctions = { |