Skip to content

Instantly share code, notes, and snippets.

View contolini's full-sized avatar
🐛
call me

Chris Contolini contolini

🐛
call me
View GitHub Profile
@contolini
contolini / frontendbuild.sh
Created April 2, 2015 16:16
derequire band-aid
#!/bin/sh
set -ev
if [ ! -f config/config.json ]; then
cp config/example-config.json config/config.json
fi
npm install

Keybase proof

I hereby claim:

  • I am contolini on github.
  • I am contolini (https://keybase.io/contolini) on keybase.
  • I have a public key whose fingerprint is 7880 93C5 1D07 58EA 8843 D826 6AE7 8927 CF2F D0A3

To claim this, I am signing this object:

@contolini
contolini / glitch.js
Created April 29, 2015 17:13
29/4/2015 binarymax listserve
((function(f){"use strict";var bdy=window.top.document.body;bdy.innerHTML="";bdy.style.backgroundRepeat="repeat";var c=document.createElement("canvas");var d=c.getContext('2d');var e="";c.width=f;c.height=f;var g=d.createImageData(f,f);var h=[f*f];var i=[];var j=function(z){var a=g.data;for(var x=0;x<f;x++){for(var y=0;y<f;y++){var b=(x+y*f)*4;a[b+0]=(h[b].r*z)%255;a[b+1]=(h[b].g*z)%255;a[b+2]=(h[b].b*z)%255;a[b+3]=255}}d.putImageData(g,0,0);e=c.toDataURL();i.push('url('+e+')')};var k=0,dir=1;var l=function(){bdy.style.backgroundImage=i[k];k+=dir;if(k===f)dir=-1;if(k===0)dir=1};for(var x=0;x<f;x++){for(var y=0;y<f;y++){var m=(x+y*f)*4;h[m]={r:parseInt((x^y)),g:parseInt((x|y)),b:parseInt((x&y))}}}for(var z=0;z<f;z++){j(z)}setInterval(l,200)})(300))
@contolini
contolini / bookmarklet.js
Last active August 29, 2015 14:21
New PR bookmarklet
javascript:!function(){var a=document.getElementById("pull_request_body");a&&(a.value+="Short description explaining the high-level reason for the pull request\n\n## Additions\n\n- List of additions made\n- To the project\n- Within this PR\n\n## Removals\n\n- List of removals made\n- To the project\n- Within this PR\n\n## Changes\n\n- List of changes made\n- To the project\n- Within this PR\n\n## Testing\n\n- List of site urls\n- Or actions to take\n- To test the changes made\n\n## Review\n\n- @user\n- @user\n- @user\n\n## Preview\n\nInclude any screenshots that will make reviewing/testing easier\n\n[Preview this PR without the whitespace changes](?w=0)\n\n## Notes\n\n- List of notes about the changes that might be necessary\n- For the reviewer to know ahead of time or of related Github issues\n- Ex. Known issues or items outside the scope of the review\n- Ex. Fixes #100\n")}();
@contolini
contolini / --steps.md
Last active August 29, 2015 14:21
cf import test
  1. git clone git@gist.github.com:/f626d744a1e0a274c37c.git cf-import-test
  2. cd cf-import-test
  3. Start a local server and load index.html in a browser.
  4. Less should complain that a CF mixin isn't present.
  5. Install CF: bower install --save cfpb/capital-framework#dev
  6. Add @import 'vendor/capital-framework/src/capital-framework.less'; to the top of main.less.
  7. Reload the page and everything should look pretty.
@contolini
contolini / index.js
Created May 26, 2015 22:28
requirebin sketch
var amortize = require('amortize');
var a = amortize({
amount: 180000,
rate: 4.25,
totalTerm: 360,
amortizeTerm: 0
});
document.write(JSON.stringify(a, null, 1))
@contolini
contolini / cf.md
Last active August 29, 2015 14:22
mocha_istanbul: {
coverage: {
src: ['test/js/*.js'], // multiple folders also works
options: {
harmony: true,
coverageFolder: 'test/coverage',
coverage: true,
excludes: ['src/static/vendor/**/*'],
check: {
lines: 50,
party
@contolini
contolini / fuck-spies.js
Last active August 29, 2015 14:28
Using mocha's native async support instead of sinon spies to test if a callback was called
it( 'should fire a callback after toggling', function(done) {
es.set.toggleExpandedState( divClosed, null, function(){
expect( true ).to.be.ok;
done();
} );
} );