Skip to content

Instantly share code, notes, and snippets.

View joyrexus's full-sized avatar

J. Voigt joyrexus

View GitHub Profile
@joyrexus
joyrexus / README.md
Last active May 3, 2024 10:41 — forked from liamcurry/gist:2597326
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@joyrexus
joyrexus / README.md
Last active December 29, 2015 08:29 — forked from max-mapper/readme.md
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 remote source deletes a bunch of data,

@joyrexus
joyrexus / README.md
Last active August 29, 2015 14:00 — forked from mbostock/.block
Convert images to thumbnails

Finds PNG images in the source folder, and saves corresponding thumbnails to the target folder.

Use with gistup to create gists (and blocks) from the command line. The directory containing your gist files gets initialized as a git repo. See this tutorial for a quick overview.

For additional tips on generating block thumbnails, see this HOWTO.

@joyrexus
joyrexus / README.md
Last active August 29, 2015 14:01 — forked from max-mapper/index.js
Load and render a remote CSV
@joyrexus
joyrexus / README.md
Last active April 27, 2022 00:49 — forked from tristanwietsma/auth.go
golang web examples
@joyrexus
joyrexus / README.md
Last active August 29, 2015 14:07 — forked from max-mapper/index.js
Prototype vs object style

Prototype style

function Person(first, last) {
    this.first = first;
    this.last = last;
}

Person.prototype.greet = function () {
@joyrexus
joyrexus / iteration.md
Last active August 29, 2015 14:12 — forked from tmcw/iteration.md
javascript iteration options

What kind of iteration to use when in JavaScript?

for (var i = 0; i < array.length; i++) {
}
@joyrexus
joyrexus / README.md
Last active January 21, 2024 21:51 — forked from btoone/curl.md
curl tutorial

An introduction to curl using GitHub's API.

Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin

Includes HTTP-Header information in the output

@joyrexus
joyrexus / premailerfixup.py
Created January 26, 2016 02:14 — forked from texuf/premailerfixup.py
fix for "WARNING Property: Unknown Property name." error from cssutils
from cssutils import profile
from cssutils.profiles import Profiles, properties, macros
#patch um up
properties[Profiles.CSS_LEVEL_2]['-ms-interpolation-mode'] = r'none|bicubic|nearest-neighbor'
properties[Profiles.CSS_LEVEL_2]['-ms-text-size-adjust'] = r'none|auto|{percentage}'
properties[Profiles.CSS_LEVEL_2]['mso-table-lspace'] = r'0|{num}(pt)'
properties[Profiles.CSS_LEVEL_2]['mso-table-rspace'] = r'0|{num}(pt)'
properties[Profiles.CSS_LEVEL_2]['-webkit-text-size-adjust'] = r'none|auto|{percentage}'
#re-add
profile.addProfiles([(Profiles.CSS_LEVEL_2,
@joyrexus
joyrexus / http-errors.js
Created June 6, 2016 23:30 — forked from moleike/http-errors.js
HTTP Error classes in Node.js
'use strict';
const statusCodes = require('http').STATUS_CODES;
function createError(code, name) {
return function(message) {
Error.captureStackTrace(this, this.constructor);
this.name = name;
this.message = message;
this.statusCode = code;
}