Skip to content

Instantly share code, notes, and snippets.

View jaydenseric's full-sized avatar
🇦🇺
Deno, Node.js, GraphQL & React

Jayden Seric jaydenseric

🇦🇺
Deno, Node.js, GraphQL & React
View GitHub Profile
@paulirish
paulirish / rAF.js
Last active March 22, 2024 00:00
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
# I battled for hours trying to install imagick via macports, trying to follow various tutorials.
# If you've been battling with macports, completely uninstall everything related to
# macports (http://guide.macports.org/chunked/installing.macports.uninstalling.html)
# and trying with Home Brew instead, using the instructions below
# install brew (http://mxcl.github.com/homebrew/)
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
# install imagemagick
@stucox
stucox / mutationobserver.js
Created March 24, 2013 09:36
Mutation Observer feature detection
// http://www.w3.org/TR/dom/
// http://updates.html5rocks.com/2012/02/Detect-DOM-changes-with-Mutation-Observers
// https://developer.mozilla.org/en-US/docs/DOM/MutationObserver
var MutationObserver = (function () {
var prefixes = ['WebKit', 'Moz', 'O', 'Ms', '']
for(var i=0; i < prefixes.length; i++) {
if(prefixes[i] + 'MutationObserver' in window) {
return window[prefixes[i] + 'MutationObserver'];
}
}
@leongersen
leongersen / nouislider-inline.js
Last active August 28, 2020 07:43
A small handler to initialize noUiSlider with inline attributes. Implementation is roughly inspired by, but not fully compatible to, the specification for input[type="range"]. Attributes with or without the 'data-' prefix will be handled.
(function(){
'use strict';
$('[data-slider]').each(function(){
function d(a,b){
return parseFloat(a.attr(b) || a.attr('data-'+b));
}
@lancewalton
lancewalton / gource.sh
Last active January 11, 2018 23:37
Produces a video of the evolution of a git repository using gource (see https://code.google.com/p/gource/). Also downloads committers' gravatars to use on the video.
#!/bin/zsh
# For Macs, get gource with HomeBrew:
# brew install gource
# brew install ffmpeg
if (( !($# == 3) ))
then
echo "Usage:"
echo $0 "<gravatar directory> <output file base name> <seconds per day>"
@smockle
smockle / One Dark.terminal
Created February 18, 2015 23:34
An OS X Terminal profile to match Atom Editor's One Dark syntax theme. Thanks to https://github.com/nathanbuchar/one-dark-terminal for the inspiration!
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlackColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NGMCAw
IDAAEAGAAtIQERITWiRjbGFzc25hbWVYJGNsYXNzZXNXTlNDb2xvcqISFFhOU09iamVj
dF8QD05TS2V5ZWRBcmNoaXZlctEXGFRyb290gAEIERojLTI3O0FITltiaWttcn2GjpGa
@umidjons
umidjons / authenticate-nodejs-api-with-jsonwebtoken.md
Last active August 10, 2018 11:48
Authenticate a Node.js API with JSON Web Tokens
@helfer
helfer / apollo-1-migration.md
Last active May 31, 2017 01:09
Migrating from Apollo Client 0.x to 1.0

Migrating from Apollo Client 0.x to 1.0

Here are the main breaking changes between the 0.x and 1.0 versions of Apollo Client.

fetchMore

The structure of fetchMoreResult has been changed. Previously fetchMoreResult used to contain data and loading fields, now fetchMoreResult is what fetchMoreResult.data used to be. This means your updateQueries function has to change as follows:

updateQuery: (prev, { fetchMoreResult }) =&gt; {
@cthurston
cthurston / mongodb-facet-combine.js
Created November 3, 2017 14:21
MongoDb combine $facet results into a single result set.
db.getCollection('list').aggregate([
{
$facet: {
"events":[{
$match: {
'type': 'Event'
}
}],
"tasks": [{
$match: {