Skip to content

Instantly share code, notes, and snippets.

View davidpelayo's full-sized avatar
✌️

David Pelayo davidpelayo

✌️
View GitHub Profile
@kristopolous
kristopolous / SJT-Permutation.js
Last active August 28, 2016 16:01
The Steinhaus-Johnson-Trotter permutation algorithm in Javascript
function permute(array) {
// Identity
if(!array.length) {
return [];
}
var ret = [array],
len = array.length,
modlen = len - 1,
mover = array[modlen],
@max-mapper
max-mapper / readme.md
Created September 28, 2011 02:01
SLEEP - syncable.org

Your API does REST, but can it SLEEP?

SLEEP (Syncable Lightweight Event Emitting Persistence) is an emerging standard for distributed data sync using HTTP and JSON. A generalized version of CouchDB's much lauded built-in replication, SLEEP extends the REST architecture to define a way in which databases can offer syncable JSON APIs that foster open data innovation by allowing developers to replicate entire databases over the net.


SLEEP comes from the Apache CouchDB project which is now widely known for it's multi-master streaming HTTP + JSON replication. This is possible in part because of the CouchDB _changes feed, which is a particular API that lets you see if there have been any changes made to the database since last time you synchronized. CouchDB can efficiently implement the _changes feed because of one subtle difference between it and most other databases: it stores a history of all changes that happen to the database, including deletes.

If you synchronize data from a remote source and then the

@eculver
eculver / .gitignore
Created October 21, 2011 21:35
.gitignore boilerplate
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
*.pyc
@gerbenvandijk
gerbenvandijk / z-index-mixin.less
Last active December 13, 2019 07:03
Z-index mixin for LESS
@z-index-order: 'contact', 'lightbox', 'nav';
.zindex(@elementName) {
.loop(@elementName, @counter) when (@counter > 0) {
.loop(@elementName, @counter - 1);
.pickIndex(@elementName, @counter);
}
@solace
solace / MapComponent.jsx
Last active March 5, 2021 07:57
Updating map bounds using react-google-maps
/* Only the necessary information to address
* https://github.com/tomchentw/react-google-maps/issues/183#issuecomment-220705977
* has been included here.
*
* YMMV.
*/
import React from 'react';
// Need these to muck around with bounds
@joshareed
joshareed / GithubClient.groovy
Last active March 2, 2023 21:26
Fetch list of issues from Github and draft an email
//#!/usr/bin/env groovy
import groovy.json.JsonSlurper
import java.text.SimpleDateFormat
// fetches a Github API URL and parses the result as JSON
def fetch(addr, params = [:]) {
def auth = "<personal api token>"
def json = new JsonSlurper()
return json.parse(addr.toURL().newReader(requestProperties: ["Authorization": "token ${auth}".toString(), "Accept": "application/json"]))
@stereobooster
stereobooster / 0-react-maps.md
Last active August 16, 2023 12:19
React Maps
[Raster tiles][rt] [Vector tiles][vt] GeoJSON virtual-dom offline map quality React component React Native
google maps + + good [4 unsupported][gm-react] [+][gm-native]
leaflet * + [+][ll-vt] + [+/-][ll-offline] depends [+][ll-rect]
d3 * + [+/-][d3-vdom] +/- depends [+][d3-react]
MapboxGL + + depends [+][mb-react] [+][mb-native]
Yandex Maps +
@markSci5
markSci5 / Git checkout remote branch
Created July 3, 2013 07:08
Git checkout remote branch
//To fetch a branch, you simply need to:
git fetch origin
//This will fetch all of the remote branches for you. With the remote branches
//in hand, you now need to check out the branch you are interested in, giving
//you a local working copy:
git checkout -b test origin/test
@akesterson
akesterson / gist:11391984
Created April 29, 2014 06:22
Why I switched from bamboo to jenkins
TL;DR - It was proving to be more buildsystem than I needed,
and I had found that there were other buildsystems that met my needs
that I felt were lighter and more nimble. It's still a fine product
that I continue to recommend to this day, I just no longer see it as
"The One True Way".
=========================
1: Bamboo was consuming a significant amount of system resources,