Skip to content

Instantly share code, notes, and snippets.

View benjaminreid's full-sized avatar
💭
🦕 are my jam

Benjamin Reid benjaminreid

💭
🦕 are my jam
View GitHub Profile
@benjaminreid
benjaminreid / gist:5040174
Created February 26, 2013 17:09
SSH keypair
cat ~/.ssh/id_rsa.pub | ssh [email protected] 'cat - >> ~/.ssh/authorized_keys'
@benjaminreid
benjaminreid / breaking_bad.rb
Last active December 16, 2015 02:28
A Git hook (commit-msg) to append a Breaking Bad quote to end of your commit messages, obviously.
#!/usr/bin/env ruby
message_file = ARGV[0]
message = File.read(message_file)
def range_rand(min,max)
min + rand(max-min)
end
bads = [
"Yeah, bitch! Magnets!",
var data, id, that, type, url;
that = this;
id = this.$el.attr('id');
url = this.$el.attr('action');
type = this.$el.attr('method');
data = this.$el.serialize();
$.ajax({
url: url,
@benjaminreid
benjaminreid / gulp.js
Created October 22, 2014 19:45
Gulp example
var gulp = require('gulp');
var bower = require('main-bower-files');
var rename = require('gulp-rename');
gulp.task('copy', function() {
gulp
.src(bower())
.pipe( rename({ extname: '.scss'}) )
.pipe( gulp.dest('./scss') );
});
@benjaminreid
benjaminreid / header.html
Created October 24, 2014 08:12
include example
<h2 id="{{ include.id }}">
<a class="header-link" href="#{{ include.id }}">
<i class="fa fa-link"></i>
</a>
{{ include.title }}
</h2>
(this will presume you have migrations table already created, e.g. CREATE TABLE schema_migrations (migrations TEXT);)
Migration 1.
key: foobar
up: CREATE TABLE table_name (column_1 INT); INSERT INTO schema_migrations (migrations) VALUES ('foobar');
down: DROP TABLE table_name; DELETE FROM schema_migrations WHERE migrations = 'foobar';
Migation 2.
mkdir tmp
touch tmp/foo.txt tmp/bar.txt
zip -r tmp.zip tmp
mv tmp.zip /Volumes/External-Drive
cd /Volumes/External-Drive
unzip tmp.zip
ls -l tmp
.
..
foo.txt
// javascripts/components/foo.js
export default function() {
console.log('foo');
}
@benjaminreid
benjaminreid / compare.js
Created August 27, 2015 13:54
Gulp vs Grunt
// gulp
var gulp = require('gulp');
var sass = require('gulp-sass');
gulp.task('sass', function () {
gulp.src('./sass/**/*.scss')
.pipe(sass())
.pipe(gulp.dest('./css'));
});
@benjaminreid
benjaminreid / gulpfile.js
Created October 14, 2015 11:07
Current favourite Sass compilation with gulp, it also sucks in bower depdencies
var gulp = require('gulp');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var concat = require('gulp-concat');
var filter = require('gulp-filter');
var streamify = require('gulp-streamify');
var watch = require('gulp-watch');
var bower = require('main-bower-files');
var es = require('event-stream');