Skip to content

Instantly share code, notes, and snippets.

View terrafied's full-sized avatar
💭
Shopping for cute shoes

Terra Metta terrafied

💭
Shopping for cute shoes
  • The Trans Agenda
  • 62 West Wallaby St., The Shire
View GitHub Profile
@terrafied
terrafied / .htaccess
Created September 16, 2011 17:47
GTA Sites htaccess file
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# GTA Member Profiles
RewriteRule ^gta-member-profile/(.+) member-profile/?name=$1 [L]
# uploaded files
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
@terrafied
terrafied / DemandNodeControlViewModel.cs
Created October 21, 2011 00:16
ViewModel changed state example
using System;
using Microsoft.Practices.Unity;
using Oasis.DataModel;
using Oasis.Repository.Interfaces;
using Oasis.Presentation.Events;
using Oasis.Foundation.Events;
using Oasis.Presentation.ViewModels;
using Oasis.Presentation.Modules;
namespace Oasis.Presentation.ViewModels
@terrafied
terrafied / load.rake
Created November 8, 2011 17:32 — forked from pjb3/load.rake
namespace :load do
ZIP_CODE_DATA_URL = 'http://www.census.gov/tiger/tms/gazetteer/zips.txt'
# Swiped from ActiveRecord migrations.rb
def announce(message)
length = [0, 75 - message.length].max
puts "== %s %s" % [message, "=" * length]
end
def parse_statuses status_lst
# Create a placeholder list
big_list = []
# pop the first status onto that list so we don't have to test for nil every time
big_list << status_lst.pop
# loop through each status and...
status_lst.each do |stat|
# Check to see if the last item is an array (a group) or just a status and hold
# onto it for comparison
last_stat = big_list.last.class == Array ? big_list.last.last : big_list.last
@terrafied
terrafied / gist:1515576
Created December 23, 2011 22:42
Example of fixing weird non-fast-forward error after rebase
john@boudica:~/Dev/Ruby/rebase_workflow$ git push -u origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 205 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@github.com:mettadore/rebase_workflow.git
* [new branch] master -> master
Branch master set up to track remote branch master from origin.
john@boudica:~/Dev/Ruby/rebase_workflow$ git checkout -b branch1
Switched to a new branch 'branch1'
@terrafied
terrafied / rmb.sh
Created January 15, 2012 21:22
Remove merged branches from a git repo
#!/bin/bash
# From: http://snippets.freerobby.com/post/491644841/remove-merged-branches-in-git
current_branch=$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
if [ "$current_branch" != "master" ]; then
echo "WARNING: You are on branch $current_branch, NOT master."
fi
echo "Fetching merged branches..."
git remote prune origin
remote_branches=$(git branch -r --merged | grep -v '/master$' | grep -v "/$current_branch$")
@terrafied
terrafied / .bash_profile
Created January 24, 2012 17:38
Bash profile with RVM and coloring
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
Failures:
1) Admin::CustomersController when logged in as an administrator when logging in as a Customer by ID logs in as the customer
Failure/Error: controller.should_receive( :sign_in ).with( @customer )
#<Admin::CustomersController:0x007f90e2053438> received :sign_in with unexpected arguments
expected: ()
got: ()
# ./spec/controllers/admin/customers_controller_spec.rb:79:in `block (4 levels) in <top (required)>'
2) Admin::ProductsController when logged in as an administrator when updating limited run products when a limited run category exists saves the limited run category to clear the cache
@terrafied
terrafied / params.rb
Created February 9, 2012 15:27
Current pattern for ruby method option parsing
# Current pattern
class Coolness
def do_something_cool *args
opts = args.extract.options!
opts.assert_valid_keys(:when, :where)
#optionally set defaults
params[:when] = Time.now if params[:when].nil?
@terrafied
terrafied / database.yml
Created February 15, 2012 16:33
Sample postgres file
common: &common
adapter: postgresql
encoding: unicode
pool: 5
username: <UNAME>
password: <PWORD>
development:
<<: *common
database: ms_prod_dev