Skip to content

Instantly share code, notes, and snippets.

View bradfordcp's full-sized avatar

Christopher Bradford bradfordcp

View GitHub Profile
@bradfordcp
bradfordcp / blog_pusher.rb
Created July 13, 2011 22:40
Retrieve nodes from a D6 installation and push them to the services module on D7
#! /usr/bin/env ruby
require 'rubygems'
require 'uri'
require 'net/http'
require 'json'
require 'pp'
require 'mysql'
SERVER = "http://drupal.example.com/api/blog"
@bradfordcp
bradfordcp / RemoteEntity.h
Created August 3, 2011 01:32
RemoteEntity Example - Assumes the AppDelegate has a connection to the ManagedObjectContext.
//
// RemoteEntity.h
//
// Created by Christopher Bradford on 5/6/10.
// Copyright 2010 INM United. All rights reserved.
//
@interface RemoteEntity : NSManagedObject
{
@bradfordcp
bradfordcp / .gitignore
Created August 7, 2011 02:54
Scratch work on a neat idea
.DS_Store
@bradfordcp
bradfordcp / tunneler.rb
Created August 24, 2011 07:58
Setting up an SSH tunnel with Net::SSH::Gateway then working through that tunnel
require 'net/ssh'
require 'net/ssh/gateway'
# Connect to the gateway machine
gateway = Net::SSH::Gateway.new('host.to.tunnel.from', 'user.name')
# Open the tunnel (in this example we are using port 5900 locally)
gateway.open('host.to.tunnel.to', 22, 5900)
# SSH through our tunnel and grab the list of vault contents
@bradfordcp
bradfordcp / sample_erb_usage.rb
Created November 23, 2011 07:24
ERB usage in a rake task
require 'rake'
require 'erb'
desc 'Builds manifest.js files for models, and collections.'
task :build_class_manifests do
STDOUT.sync = true
# Build Class Manifests First
classes = ['initializers', 'config', 'models', 'collections']
@bradfordcp
bradfordcp / 960gs.scss
Created April 4, 2012 03:58 — forked from jmblog/960gs.scss
960gs.scss
/*-----------------------------------------------------
960 Grid System ~ Core CSS.
Learn more ~ http://960.gs/
Licensed under GPL and MIT.
-------------------------------------------------------*/
/* Grid Settings
---------------------------*/
// 12-column grid
@bradfordcp
bradfordcp / Gemfile
Created June 3, 2012 03:08
Dynamic Site Caching Using Guard
source 'https://rubygems.org'
# Note this was running on a Fedora 16 box
gem 'ruby-inotify'
gem 'guard'
gem 'activerecord'
gem 'mysql2'
@bradfordcp
bradfordcp / package.json
Created August 28, 2012 23:46
package.json Example for Node / NPM
{
"name": "dbox-poller",
"version": "0.0.1",
"dependencies": {
"dbox": "0.4.1",
"coffee-script": "1.3.1",
"mongodb": "1.0.0",
"mongoose": "2.6.0",
"bson": "0.0.7"
},
@bradfordcp
bradfordcp / post-commit.sh
Created September 6, 2012 19:13
lolcommits post-commit hook using rvm
#!/bin/bash
# Load RVM into a shell session *as a function*
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
# First try to load from a user install
source "$HOME/.rvm/scripts/rvm"
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
# Then try to load from a root install
source "/usr/local/rvm/scripts/rvm"
else
@bradfordcp
bradfordcp / alias.sh
Created September 7, 2012 20:50
Aliases
alias be="bundle exec"
alias te="RAILS_ENV=test bundle exec"
alias sr="redis-server /usr/local/etc/redis.conf"