Skip to content

Instantly share code, notes, and snippets.

View MichaelPaulukonis's full-sized avatar

Michael Paulukonis MichaelPaulukonis

View GitHub Profile
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if(mutation.addedNodes.length > 0 && mutation.addedNodes[0].nodeName == "CANVAS"){
// do stuff after the sketch loaded
}
});
});
var config = { attributes: false, childList: true, characterData: false }
target = document.getElementById("myDiv")
@jashmenn
jashmenn / self-eq-this-vs-bind.md
Last active September 6, 2022 23:11
Javascript var self = this; vs. .bind

The Problem

In Javascript this is bound in unexpected ways. Functions, in particular, create a new 'this' and so when you want to keep a reference to an "outer" object you sometimes see the pattern:

var self = this;

as in:

var self = this;
@ftrain
ftrain / bing-gobble.pl
Created April 27, 2015 02:54
Get the counts for words on sites with bing!
#!/usr/bin/perl
# Copyright (c) 2015, Paul Ford, ford@ftrain.com
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
@VinGarcia
VinGarcia / walksync.js
Last active September 9, 2020 11:18 — forked from kethinov/walksync.js
// List all files in a directory in Node.js recursively in a synchronous fashion
var walkSync = function(dir, filelist) {
if( dir[dir.length-1] != '/') dir=dir.concat('/')
var fs = fs || require('fs'),
files = fs.readdirSync(dir);
filelist = filelist || [];
files.forEach(function(file) {
if (fs.statSync(dir + file).isDirectory()) {
anonymous
anonymous / gist:10675250
Created April 14, 2014 19:11
Motion Blur + Chromatic Aberration
// by dave @ beesandbombs.tumblr.com >:)
void setup() {
setup_();
result = new int[width*height][3];
result_ = new int[width*height][3];
}
int[][] result, result_;
float time;
@h3xx
h3xx / glitch-jpeg.pl
Created December 26, 2013 07:15
Add deliberate errors to JPEG files (or any files)
#!/usr/bin/perl -w
use strict;
use Getopt::Std qw/ getopts /;
sub HELP_MESSAGE {
my $fh = shift || *STDOUT;
print $fh qq%
Usage: $0 IMG_IN IMG_OUT
Cause deliberate errors in an image file (or any file).
@tullyhansen
tullyhansen / gist:7621632
Last active October 10, 2022 13:11
Draft spec 0.3 for a bot taxonomy (see also http://i.imgur.com/bKXNQ0V.png) #botALLY
# Towards a Taxonomy of Twitter Bots
## Intro
- towards a definition - autonomous non-human agents on Twitter
- critical thinking - MECE, rabbit rule, holding hands
- patterns of behaviour, rather than content
- Twitter largely a textual medium
- crossover between two broadest categories (automated/event-driven), but largely one or the other (maybe?)
- some bots will exhibit both behaviours (active/reactive), but tend to favour one (most commonly, tweeters will also exhibit conversationalist behaviours)
@anthonyringoet
anthonyringoet / Gruntfile.js
Created November 22, 2013 08:37
Auto compile browserify with Grunt and watch
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
browserify: {
dist: {
files: {
'build/module.js': ['js/**/*.js']
}
}
@jbenet
jbenet / simple-git-branching-model.md
Last active April 9, 2024 03:31
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@leommoore
leommoore / node_build_automation.md
Last active December 13, 2015 17:58
Node - Build Automation

#Node - Build Automation

##Setup

Jake is the JavaScript equivilent of the Ruby Rake tool. It prefers to be installed globally but for build purposes it is better to install it into node_modules. For more info see http://howtonode.org/intro-to-jake

npm install jake