Skip to content

Instantly share code, notes, and snippets.

@contra
contra / scss.sh
Created Aug 31, 2015
how somebody compiles a folder of scss files using make and bash
View scss.sh
#!/bin/bash
# SCSS include path
BINPATH=`dirname $0`
STATIC_DIR="$BINPATH/../root/static/scss"
# SCSS
function compile_dir {
SCSS_DIR=$1
SCSS=scss
@contra
contra / InstaxProtocol.java
Created Jul 7, 2015
Instax SP-1 Android Source
View InstaxProtocol.java
package com.Instax.sdk;
import java.io.*;
import java.util.*;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.Color;
import android.util.Log;
import com.Instax.sdk.InstaxStatus.ErrCode;
View gist:de3c0ea120437d8207ca
const os = require('os');
const fs = require('fs');
const path = require('path');
const execFile = require('child_process').execFile;
const tmpfile = path.join(os.tmpdir(), process.versions.v8+'.flags.json');
const exclusions = ['--help'];
module.exports = function (cb) {
fs.exists(tmpfile, function (exists) {
View flux.css
html {
filter: brightness(0.8) sepia(0.9);
-o-filter: brightness(0.8) sepia(0.9);
-ms-filter: brightness(0.8) sepia(0.9);
-moz-filter: brightness(0.8) sepia(0.9);
-webkit-filter: brightness(0.8) sepia(0.9);
-salesforce-filter: brightness(0.8) sepia(0.9);
-dropbox-filter: brightness(0.8) sepia(0.9);
-blink-filter: brightness(0.8) sepia(0.9);
@contra
contra / LazyLoad.js
Created Dec 2, 2014
lazy loading react components, useful for video/audio/etc
View LazyLoad.js
var React = require('react');
var events = require('add-event-listener');
var isVisible = require('../isVisible');
var LazyLoad = React.createClass({
displayName: 'LazyLoad',
propTypes: {
distance: React.PropTypes.number,
component: React.PropTypes.node.isRequired,
children: React.PropTypes.node.isRequired
View event-loop-lag.js
var last = Date.now();
var lag = 0;
setInterval(function(){
lag = Date.now() - last;
last = Date.now();
}, 0);
View react-pure-component.js
var Timer = React.createClass({
displayName: 'Timer',
propTypes: {
interval: React.PropTypes.number,
onTick: React.PropTypes.func
},
getDefaultProps: function() {
return {
interval: 1000
};
@contra
contra / after.js
Last active Aug 29, 2015
use pipelines with gulp
View after.js
var buffer = require('vinyl-buffer');
var source = require('vinyl-source-stream');
var browserify = require('browserify');
var uglify = require('gulp-uglify');
gulp.task('index', function(){
var bundler = browserify('newstimeline/livescript/index.ls');
bundler.transform('browserify-livescript');
return bundler.bundle({insertGlobals: true})
View gogoinflight.md

Stealing WiFi

/etc/hosts

This will let you access any google owned site. This includes: youtube, google cache, google translate, google search, gmail, google news, etc.

  • Install the HTTPS Everywhere extension
  • Add these rules to your /etc/hosts file
View cross-browser-filter.css
.blur {
/* modern stuff */
-webkit-filter: blur(radius);
-moz-filter: blur(radius);
-o-filter: blur(radius);
-ms-filter: blur(radius);
filter: blur(radius);
/* gecko */
filter: url(blur.svg#blur);