Skip to content

Instantly share code, notes, and snippets.

View wyaeld's full-sized avatar
🐣
work in progress

Brad Murray wyaeld

🐣
work in progress
View GitHub Profile
# In general, there are many places in the file where you can leave off the parens in function calls, if you like.
unless typeof exports is "undefined" # `unless ... else` reads poorly in English. Better to stick to `if ... else`.
Spine = exports
else
Spine = @Spine = {}
Spine.version = "0.0.4"
$ = Spine.$ = @jQuery || @Zepto || -> arguments[0] # In Coffee, `or` is preferred over `||`.
@bergie
bergie / README.md
Created May 18, 2011 11:33
Falsy Values tutorials
@dalecaru
dalecaru / innobackupex-restore.sh
Created April 20, 2011 13:42
Scripts to create and restore full and incremental backups (for all databases on server) using innobackupex from Percona.
#!/bin/sh
#
# Script to prepare and restore full and incremental backups created with innobackupex-runner.
#
# This script is provided as-is; no liability can be accepted for use.
#
INNOBACKUPEX=innobackupex-1.5.1
INNOBACKUPEXFULL=/usr/bin/$INNOBACKUPEX
TMPFILE="/tmp/innobackupex-restore.$$.tmp"
# vmc update is great for test and development, however it stops your old app and stages and starts the new one,
# resulting in dropped requests.
# If you want to update an application without dropping user requests, see below.
# NOTE: This change assumes your application can share services, etc with the new version.
# Assume my app is named foo
vmc push foo-v2 --url foov2.cloudfoundry.com
anonymous
anonymous / jspec_with.coffee
Created April 13, 2011 16:41
jspec with coffeescript
JSpec.describe 'ShoppingCart', ->
before_each ->
cart = new ShoppingCart
describe 'addProducts', ->
it 'should add several products', ->
cart.addProducts('cookie')
cart.addProducts('icecream')
expect(cart).to(have, 2, 'products')
@jhannah
jhannah / gist:855947
Created March 5, 2011 00:07
mylvmbackup
sudo apt-get install lvm2
sudo apt-get install mylvmbackup
jhannah@li202-203:~/src$ sudo mylvmbackup --socket=/home/cm_satin/mysql-repl/mysql.sock
20110304 23:19:14 Info: Connecting to database...
20110304 23:19:14 Info: Running hook 'preflush' as perl module.
20110304 23:19:14 Info: Flushing tables with read lock...
20110304 23:19:14 Info: Taking position record into /tmp/mylvmbackup-backup-20110304_231914_mysql-hfUKiZ.pos...
20110304 23:19:14 Info: Running: lvcreate -s --size=5G --name=data_snapshot /dev/mysql/data
File descriptor 4 (socket:[113294]) leaked on lvcreate invocation. Parent PID 1669: /usr/bin/perl
@chyld
chyld / Install Ruby, MySql on Ubuntu 10.10 on Amazon EC2
Created February 9, 2011 02:11
Install Ruby, Rails, MySql, Apache, Passenger on Ubuntu 10.10 on Amazon EC2
#amazon ec2 image
#ubuntu 10.10, 64bit
#east-coast : ami-cef405a7
#west-coast : ami-af7e2eea
#ssh to ec2
ssh -i <key-file>.pem ubuntu@<ip-address-to-ec2>
#change ssh timeouts
sudo vi /etc/ssh/sshd_config
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//
@dnagir
dnagir / rspec-syntax-cheat-sheet.rb
Created November 5, 2010 09:29
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active April 14, 2025 11:07
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh