Skip to content

Instantly share code, notes, and snippets.

var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
gulp.task('default', ['watchJs', 'watchTests']);
// make sure you do not start a path with ./
// there's some bug in gaze that causes globs with ./ to not fire
var unitTestPaths = [
'tests/**/*_tests.js'
];
Remove osxfuse if installed via homebrew:
> brew uninstall osxfuse
Install osxfuse binary and choose to install the MacFUSE compatibility layer:
http://sourceforge.net/projects/osxfuse/files/latest/download?source=files
Reboot (optional but recommended by osxfuse)
Install ntfs-3g via homebrew:
> brew update && brew install ntfs-3g
@diffused
diffused / gulpfile.js
Created March 25, 2015 23:54
Gulpfile to transpile ES6 using babel and browserify
// npm install --save-dev gulp gulp-babel babelify through2 gulp-rename gulp-load-plugins
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var browserify = require('browserify');
var through2 = require('through2');
var babelify = require('babelify');
var srcApp = './src/app.js';
var srcWatchPath = './src/**/*.js'
@diffused
diffused / wipedb
Created April 1, 2015 11:46
EF + Sql Server wipe data in all tables listed in __MigrationHistory
context.Database.ExecuteSqlCommand("sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL'");
context.Database.ExecuteSqlCommand("sp_MSForEachTable 'IF OBJECT_ID(''?'') NOT IN (ISNULL(OBJECT_ID(''[dbo].[__MigrationHistory]''),0)) DELETE FROM ?'");
context.Database.ExecuteSqlCommand("EXEC sp_MSForEachTable 'ALTER TABLE ? CHECK CONSTRAINT ALL'");
#!/usr/bin/ruby
require 'date'
class Girl
def initialize(name, date_of_birth, weight_in_kg)
@name = name
@date_of_birth = date_of_birth
@weight_in_kg = weight_in_kg
end
@diffused
diffused / sb2_rbenv_osx.js
Last active December 16, 2015 12:39
SublimeText 2, rbenv, osx and the build command
{
// These are the old commands
//"cmd": ["ruby", "$file"],
//"cmd": ["/usr/local/bin/ruby", "$file"],
"cmd": ["/Users/kiwidev/.rbenv/shims/ruby", "$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.ruby"
}
@diffused
diffused / gist:5458784
Last active December 16, 2015 15:49
Postgresql array column types in python peewee orm
from peewee import *
db = PostgresqlDatabase(None)
# custom type for postgres Text[] array column
class TextArrayField(Field):
db_field = 'Text[]'
def db_value(self, value):
return value
@diffused
diffused / parallel_process_images.py
Last active December 16, 2015 16:29
Perform distributed image processing, such as resizing, using an IPython cluster
# Start a basic, 4 node, local, ipython cluster, using:
# ipcluster start -n 4
#
# then run:
# ipython parallel_process_images.py
#
# this example reads in ./test_images/*.jpg
# and outputs a bunch of .png files to ./resized_test_images/
@diffused
diffused / gist:5480993
Created April 29, 2013 11:12
regex for search/replace to find all classic asp.net id attributes in html.
(id="Content\w*")
@diffused
diffused / start_colors_env.sh
Created June 22, 2013 18:12
Xubuntu shell script that starts a development environment / setup for one of my projects. To run: source ~/start_colors_env.sh It loads up a a bunch of *interactive* xfce4-terminals, sets virtualenv in each one, terminal tabs named "scratch" and "pry", loads sublime text from "scratch", web apps are started in "public_site" and "color_finder". …
#!/bin/sh
xfce4-terminal \
-T scratch \
--working-directory=/opt/colors/ \
-e 'env PROMPT_COMMAND="unset PROMPT_COMMAND; source ./_env/bin/activate; s . &" bash' \
--tab -T pry \
--working-directory=/opt/colors/ \
-e 'env PROMPT_COMMAND="unset PROMPT_COMMAND; source ./_env/bin/activate; cd ./apps ; ./pry_with_models.sh" bash' \
--window -T public_site \
--working-directory=/opt/colors/ \