Skip to content

Instantly share code, notes, and snippets.

View rogerdudler's full-sized avatar

Roger Dudler rogerdudler

View GitHub Profile
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
/* ---------------------------------------------------------- */
/* */
/* A media query that captures: */
/* */
/* - Retina iOS devices */
/* - Retina Macs running Safari */
/* - High DPI Windows PCs running IE 8 and above */
/* - Low DPI Windows PCs running IE, zoomed in */
/* - Low DPI Windows PCs and Macs running Firefox, zoomed in */
/* - Android hdpi devices and above */
@rogerdudler
rogerdudler / jquery.eyedrop.js
Created May 3, 2012 22:50
JQuery Eyedrop Plugin
(function($){
window.$canvas = null;
$.fn.eyedrop = function(options) {
var settings = $.extend({
'pick': function(x, y, color) {},
'pickRange': function(startx, starty, startcolor, endx, endy, endcolor) {},
'offset': 20,
'width': 5,
'height': 5,
'cursor': 'crosshair',
@rogerdudler
rogerdudler / gist:1156456
Created August 19, 2011 09:35
Terrific Socket connector
(function($) {
Tc.Connector.Socket = Tc.Connector.extend({
events: [],
init: function(connectorId) {
this._super(connectorId);
var that = this;
this.events = $('body').data('connector-socket').split(',');
@rogerdudler
rogerdudler / gist:1156446
Created August 19, 2011 09:32
Terrific fire event
this.fire('eventB', { id: 1 }, function() { });
@rogerdudler
rogerdudler / gist:1156442
Created August 19, 2011 09:30
Terrific module event handler
onEventA: function(data) {
...
}
@rogerdudler
rogerdudler / gist:1156381
Created August 19, 2011 08:56
Register socket connector in Terrific module
<!-- use connector "Socket" on channel "1" -->
<div class="mod modA" data-connectors="Socket1">
...
</div>
@rogerdudler
rogerdudler / gist:1156379
Created August 19, 2011 08:55
Define server bound events in Terrific
<!-- we listen to "eventA" and "eventB" from the server -->
<body data-connector-socket="eventA, eventB">
...
</body>
@rogerdudler
rogerdudler / gist:1156361
Created August 19, 2011 08:47
redis usage in node.js
// load redis client
var r = require('redis').createClient();
// set data for key
r.set('key', data);
// add data to key (list)
r.lpush('key', data);
// trim list to specific length
@rogerdudler
rogerdudler / gist:1156359
Created August 19, 2011 08:46
Installing redis client for node.js
npm install redis