Skip to content

Instantly share code, notes, and snippets.

@saimonmoore
saimonmoore / gist:1901405
Created February 24, 2012 14:48
Unescape double escaped hex encoded ASCII-8Bit and convert to UTF-8
puts "afasgfdsfbuz\\xC3\\xB3n".gsub(/\\x([A-F0-9][A-F0-9])/) {|h| [$1.hex].pack("C*")}.force_encoding('UTF-8')
@saimonmoore
saimonmoore / gist:1883590
Created February 22, 2012 09:29
Clear out your dev db (with protection from #epicfailure)
function cleardb {
DEVDB="`ruby -e "require 'yaml'; puts YAML.load(File.open('config/database.yml'))['development']['database']"`"
if [[ $DEVDB =~ "production" ]]; then
echo 'WATCHOUT! cleardb running against production dump';
else
bundle exec rake db:drop db:create db:schema:load db:seed && bundle exec rake db:test:clone;
fi
}
task_list.save(data.task_list, {success: self.render, error: onError});
/*
* Run validations
*/
TaskList.validate = function (attrs) {
//check for required attributes
var errors = {}
, i18n = Teambox.helpers.jade.i18n;
_(['name']).each(function(attr) {
{
"predef": [
"Teambox",
"_",
"Backbone",
"Templates",
"Handlebars",
"Juggernaut",
"Cookie",
"jasmine",
// i.schlueter's comma-first style
var o =
{ a : "ape"
, b : "bat"
, c : "cat"
, d : "dog"
, e : "elf"
, f : "fly"
, g : "gnu"
, h : "hat"
Setup
=====
[stunnel acccept port 443 connect 8443]
||
[haproxy
* accept port 80
default: connect 8080 (nginx)
host: 'push.*' => connect 8090 (node)
* accept port 8443
#!/bin/bash
while read LINE
do
grep -q "$LINE" <(git diff --cached) && echo "Fail words found: '$LINE'
Fix your commit damn it..." && exit 1
done < .git_fail_words
exit 0
#!/bin/bash
while read LINE
do
grep -q "$LINE" <(git diff --cached) && echo "Fail words found: '$LINE'
Fix your commit damn it..." && exit 1
done < .git_fail_words
#!/bin/bash
while read LINE
do
grep -q "$LINE" <(git diff --cached) && echo "Fail words found: '$LINE' \nFix your commit..." && exit 1
done < ../../.git_fail_words