var redis = require("redis") | |
, subscriber = redis.createClient() | |
, publisher = redis.createClient(); | |
subscriber.on("message", function(channel, message) { | |
console.log("Message '" + message + "' on channel '" + channel + "' arrived!") | |
}); | |
subscriber.subscribe("test"); |
Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.
In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.
Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j
- Recipes
- Anonymous GET access
- Anonymous GET access - match HTTP referrer
- Full access for specific IAM user/role
- GET/PUT/DELETE access to specific path within a bucket
- Restricted LIST & PUT/DELETE access to specific path within a bucket
- Full access (and S3 console) for specific IAM users
- Bucket and object delete deny
configureDragDrop(registerType) { | |
var imageThreshold = Math.max(120, window.innerHeight / 4), | |
sectionThreshold = Math.max(140, window.innerHeight / 4), | |
currentDY = 0, | |
frame; | |
function makeScrollingHandler(threshold) { | |
function getScrollDY(clientY) { | |
var speed; | |
if (clientY < threshold) { |
function randomDate(start, end) { | |
return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime())) | |
} | |
console.log(randomDate(new Date(2012, 0, 1), new Date())) |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
,elem.offsetTop
,elem.offsetWidth
,elem.offsetHeight
,elem.offsetParent
String.prototype.chunkBy = function(len) { | |
var current = len; | |
var previous = 0; | |
var stack = []; | |
while (this[current]) { | |
if (this[current++].match(/s+/)) { | |
stack.push(this.substring(previous, current)); | |
previous = current; | |
current += len; |
(function($) { | |
var result = $('#result'); | |
var base = $('#base'); | |
var list = $('#list'); | |
$('#calc').click(function() { | |
var baseVal = base.val(); | |
var px = list.val().split(','); | |
var html = []; | |
$.each(px, function(i, v) { | |
var px = parseInt(v); |
// allows YYYY/M/D and periods instead of slashes | |
// http://stackoverflow.com/questions/24989065/trying-to-validate-yyyy-mm-dd | |
/^\d{4}[\/.]\d{1,2}[\/.]\d{1,2}$/ | |
// YYYY-MM-DD and YYYY-M-D | |
// http://stackoverflow.com/questions/6177975/how-to-validate-date-with-format-mm-dd-yyyy-in-javascript | |
/^\d{4}\-\d{1,2}\-\d{1,2}$/ | |
// YYYY-MM-DD | |
// https://gist.github.com/arth2o/8471150 |