Skip to content

Instantly share code, notes, and snippets.

@allouis
allouis / replace-labels.js
Last active May 16, 2016 15:53 — forked from qubyte/replace-labels.js
Replace labels for a repo with standard set.
var token = '<insert token>';
var owner = '<insert owner>';
var repo = '<insert repo>';
var newLabels = [
{color: 'e11d21', name: 'Blocked'},
{color: '000000', name: 'Do Not Merge!'},
{color: 'eb6420', name: 'QA Defect'},
{color: '5319e7', name: 'Waiting for QA'},
{color: '009800', name: 'Waiting for Review'},
@puffnfresh
puffnfresh / nestedpromises.js
Created December 4, 2013 23:01
Promises as functors are useful.
var Promise = require('fantasy-promises'),
fl = "https://api.github.com/repos/fantasyland/",
// Pretend this URL is given by the user, not setTimeout
userInput = new Promise(function(resolve) {
setTimeout(function() {
resolve(fl + "fantasy-states");
}, Math.random() * 500);
}),
@kevadsett
kevadsett / Localhost mode
Last active December 22, 2015 03:38
Change local mode (file://c:/whatever) to localhost mode (http://localhost/whatever) – requires symbolic link in server's htdocs folder.
var url = document.URL,
currentLocation = url.split("//"),
newURL = "",
path = "";
if(currentLocation[0] == "file:"){
path = url.substring(11, url.length);
newURL = "http://localhost/" + path;
}
document.location = newURL;
@remy
remy / jsbin-live-clone.md
Last active October 8, 2019 09:07
The setup process to get jsbin live (in a clone environment)

Based on installing Ubuntu 10.04 (lucid) and cloning the live environment (calling local environment dev.jsbin.com)

Add core packages:

sudo apt-get update
sudo apt-get install libpcre3-dev build-essential libssl-dev git-core varnish sendmail
sudo su -
sendmailconfig
cd /opt/
@dtao
dtao / eachAsync.js
Created April 10, 2012 14:52
Function to asynchronously iterate over a collection
function eachAsync(collection, iterator, callback) {
var iterate = function(i) {
setTimeout(function() {
iterator(collection[i]);
if (i < collection.length) {
iterate(i + 1);
} else {
callback();
}
}, 0);
@nimbupani
nimbupani / index.html
Created December 2, 2011 05:00
Showing latest post on home page with Jekyll
---
layout: default
---
<div class="blog-index">
{% assign post = site.posts.first %}
{% assign content = post.content %}
{% include post_detail.html %}
</div>