Skip to content

Instantly share code, notes, and snippets.

contra contra

Block or report user

Report or block contra

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@contra
contra / gulpfile.js
Created Feb 17, 2014
folder concat
View gulpfile.js
// pseudocode but something like this
var fs = require('fs');
var path = require('path');
var gulp = require('gulp');
var concat = require('gulp-concat');
var gif = require('gulp-if');
function getFolders(dir){
return fs.readdirSync(dir)
.filter(function(file){
@contra
contra / gulpfile.js
Created Feb 20, 2014
stream forking sample with gulp-if
View gulpfile.js
var gulp = require('gulp');
var gi = require('gulp-if');
gulp.src(['*.js', '*.css'])
.pipe(dostuff())
.pipe(gi('*.js', gulp.dest('js'))
.pipe(gi('*.css', gulp.dest('css'))
.pipe(gulp.dest('all'));
View commit.js
var through = require('through2');
var gutil = require('gulp-util');
var exec = require('child_process').exec;
var escape = require('any-shell-escape');
module.exports = function (message, opt) {
if(!opt) opt = {};
if(!message) throw new Error('gulp-git: Commit message is required git.commit("commit message")');
if(!opt.args) opt.args = ' ';
@contra
contra / streams-macro.sjs
Created Mar 17, 2014
Overloads the | operator to let you put streams together. This is just a fun project, don't use this.
View streams-macro.sjs
macro | {
rule infix {
$x:expr | $y ($args ...)
} => {
$x.pipe($y($args...))
}
rule infix {
$x:expr | $y
} => {
@contra
contra / helvetica-swag.styl
Created Mar 19, 2014
make every website look better
View helvetica-swag.styl
body
font-smoothing: antialiased
text-rendering: optimizeLegibility
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif
font-weight: 300
View clone.js
'use strict';
var through = require('through2');
module.exports = function () {
return through.obj(function(file, enc, cb) {
cb(null, file.clone());
});
};
View gulp-webpack.js
var util = require('loader-utils');
var File = require('vinyl');
var gulp2webpack = function(streamConstructor, opt) {
opt = opt || {};
return function(content) {
var cb = this.async();
if (opt.cacheable) this.cacheable();
View inject.js
var source = require('vinyl-source-stream')
var buffer = require('vinyl-buffer');
var queue = require('streamqueue');
gulp.task('shit', function(){
// make the fake file
var fakeFile = source('fake.js');
var buffered = fakeFile.pipe(buffer());
// join the streams
@contra
contra / fucking-run-chrome.js
Created Apr 14, 2014
Testing WebRTC in Chrome
View fucking-run-chrome.js
var os = require('os');
var path = require('path');
var randomDir = function() {
return path.join(os.tmpdir(), String(Math.floor(Math.random()*1000)));
};
var openit = function(url) {
var chromeLocation = '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome';
var args = [
View bash_profile
alias fucking=sudo
alias "npm-update"="rm -rf node_modules && npm install"
alias "update-everything"="nave usemain stable && sudo npm update -g && brew update && brew upgrade"
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\[\033[33;1m\]\w\[\033[m\] (\$(git branch 2>/dev/null | grep '^*' | colrm 1 2)) \$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls='ls -GFh'
function parse_git_dirty {
You can’t perform that action at this time.