Skip to content

Instantly share code, notes, and snippets.

View sgerrand's full-sized avatar
🧑‍✈️
Manual controls

Sasha Gerrand sgerrand

🧑‍✈️
Manual controls
View GitHub Profile

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@darkhelmet
darkhelmet / cscript
Created March 9, 2011 05:51
Run *.c files as scripts. Put this in ~/bin/cscript
#!/usr/bin/env bash
tail -n `wc -l $1 | awk '{ print $1 }'` $1 | gcc -xc - -o ~/.cscript && ~/.cscript
@jeresig
jeresig / .vimrc
Created May 4, 2011 16:46
VIM Config
au BufRead,BufNewFile jquery.*.js set ft=javascript syntax=jquery
set nocompatible
set autoindent
set tabstop=2
set showmatch
set vb t_vb=
set ruler
set nohls
set incsearch
syntax on
@chitchcock
chitchcock / 20111011_SteveYeggeGooglePlatformRant.md
Created October 12, 2011 15:53
Stevey's Google Platforms Rant

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

Proposal for Improving Mass Assignment

For a while, I have felt that the following is the correct way to improve the mass assignment problem without increasing the burden on new users. Now that the problem with the Rails default has been brought up again, it's a good time to revisit it.

Sign Allowed Fields

When creating a form with form_for, include a signed token including all of the fields that were created at form creation time. Only these fields are allowed.

To allow new known fields to be added via JS, we could add:

class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private
@3kwa
3kwa / .tmux.conf
Created March 23, 2012 05:02
my tmux conf
# ctrl-b -> ctrl-a
set -g prefix C-a
# ctrl-a ctrl-a last window
bind-key C-a last-window
# we are humans numbering from 1
set -g base-index 1
# faster input (not waiting for escape)
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@mipearson
mipearson / unfixable.md
Created April 2, 2012 01:44
Request for Comments: Fixing Ruby, Python and Node.js packaging on Debian, Redhat and variants

Request for Comments

Fixing Ruby, Python and Node.js packaging on Debian, Redhat and variants.

Canonical URL: http://bit.ly/wtfpackages

It's unfixable.

You shouldn't be using distribution provided packages for your primary language runtime.

@bradfitz
bradfitz / blast.pl
Created April 16, 2012 04:56
Cognac Hacking
#!/usr/bin/perl
use strict;
my $rockettop = <<'END';
.
/ \
/ \
END