Skip to content

Instantly share code, notes, and snippets.

View chrishough's full-sized avatar
😸
How can I help you?

Chris Hough chrishough

😸
How can I help you?
View GitHub Profile
@pehrlich
pehrlich / full_error_messages.rb
Created February 4, 2013 23:51
Print out full error messages for nested models
module FullErrorMessages
extend ActiveSupport::Concern
# includes errors on this model as well as any nested models
def all_error_messages
messages = self.errors.messages.dup
messages.each do |column, errors|
if self.respond_to?(:"#{column}_attributes=") && (resource = self.send(column))
messages[column] = resource.errors.messages
end
@gutenye
gutenye / ember-with-middleman.md
Last active December 10, 2015 01:58
Write Ember.js App With Middleman

I. Create a Middleman project with middleman-ember-template

$ middleman init hello --template=ember

II. Install ember.js package

$ bower install ember
@malarkey
malarkey / Contract Killer 3.md
Last active April 16, 2024 21:44
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@swarut
swarut / all_task.rake
Created October 31, 2012 07:48
Rails : Creating A Rake Task Which Run All Sub-Tasks
namespace :tasks do
namespace :create do
desc "Create all survey templates"
task :all => [:task1, :task2, :task3]
desc "desc1"
task :task1 => :environment do
end
@codenamev
codenamev / gist_on_tumblr.js
Created September 6, 2012 14:19
Embed GitHub gist on your Tumblr
// REQUIRES:
// http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js
// http://static.tumblr.com/fpifyru/VCxlv9xwi/writecapture.js
// Based on: https://gist.github.com/1395926
$(document).ready(function() {
$('.gist').each(function(i) {
var file_separator = $(this).text().indexOf('#');
if (file_separator != -1) {
var gist_url = $(this).text().slice(0, file_separator);
var gist_file = $(this).text().slice(file_separator).replace("#file_", "?file=");
@btjones
btjones / _config.yml
Created August 27, 2012 15:44
This is a Jekyll plugin that uses the file path to set a page variable. Then, we can use that page variable as a key to access directory wide config variables in _config.yml. This example uses the file structure conferences/[CONFERENCE_KEY].
# conference config
conferences:
conference1: {
name: Conference 1 Wow!,
date: Jan 1-6 2013
}
conference2: {
name: Conference 2 Neato!!,
date: Dec 15-20 2013
}
@lanceli
lanceli / rgba-background-mixin-output.css
Last active October 20, 2017 07:56
Compass cross-browser RGBa background mixin
.blackAlpha50 {
*zoom: 1;
filter: progid:DXImageTransform.Microsoft.gradient(gradientType=0, startColorstr='#80000000', endColorstr='#80000000');
background: transparent;
background: rgba(0, 0, 0, 0.5);
}
:root .blackAlpha50 {
filter: none\0/IE9;
}
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active May 5, 2024 13:30
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@shytikov
shytikov / commit-msg
Created July 17, 2012 21:07
commit-msg hook script
#!/bin/sh
#
# Automatically adds branch name and branch description to every commit message.
#
NAME=$(git branch | grep '*' | sed 's/* //')
DESCRIPTION=$(git config branch."$NAME".description)
TEXT=$(cat "$1" | sed '/^#.*/d')
if [ -n "$TEXT" ]
then
@IanVaughan
IanVaughan / uninstall_gems.sh
Created June 9, 2012 20:37
Uninstall all rbenv gems
#!/usr/bin/env bash
uninstall() {
list=`gem list --no-versions`
for gem in $list; do
gem uninstall $gem -aIx
done
gem list
gem install bundler
}