Skip to content

Instantly share code, notes, and snippets.

View parndt's full-sized avatar

Philip Arndt parndt

View GitHub Profile
@parndt
parndt / gist:880545
Created March 22, 2011 00:45
json sucks
$ gem install json --source http://rubygems.org
Successfully installed json_pure-1.5.1
1 gem installed
#=> 'agony'
@parndt
parndt / gist:882306
Created March 22, 2011 23:18
Useful unix functions
# Find files recursively in/under the current directory
function findin()
{
find . -exec grep $@ '{}' \; -print
}
# Rails 2 and Rails 3 console
function rc {
if [ -e "./script/console" ]; then
./script/console $@
else
@parndt
parndt / gist:882317
Created March 22, 2011 23:24
Gemfile without refinerycms doing all the magic authentication
# This is how to use Refinery CMS without our authentication
# What is happening here is I'm manually listing all of the other engines
# You will need to comply with all of the methods that anything else in Refinery is accessing
# That were being provided by refinerycms-authentication
gem 'refinerycms-dashboard', '~> 2.0.4'
gem 'refinerycms-images', '~> 2.0.4'
gem 'refinerycms-pages', '~> 2.0.4'
gem 'refinerycms-resources', '~> 2.0.4'
@parndt
parndt / gist:958385
Created May 6, 2011 03:19 — forked from mhaylock/gist:958381
Setting up GIT Bash autocompletion

Run the following to create ~/.git-completion.bash:

curl https://github.com/git/git/raw/master/contrib/completion/git-completion.bash > ~/.git-completion.bash

Then add the following to your ~/.bashrc or ~/.bash_profile after PATH:

# Set the base PS1
export PS1="\t: \W$ "

Source the git bash completion file

@parndt
parndt / my-gh-issues.rb
Created May 8, 2011 03:35 — forked from copiousfreetime/my-gh-issues.rb
My Github Issues
#!/usr/bin/env ruby
#
# A quick script to dump an overview of all the open issues in all my github projects
#
require 'octokit'
require 'awesome_print'
require 'rainbow'
# Put in your ~/.bash_profile
# This pulls (with rebase) the current branch from origin.
# Enjoy
# Thanks to Malcolm Locke
alias gpr="git pull --rebase origin `git branch | awk '/^\*/{print $2}'`"
@parndt
parndt / gist:988127
Created May 24, 2011 04:09 — forked from djones/gist:720672
4 views in Refinery that use a new type of content_page
rendering a custom plugin
<% content_for :page_title do %>
<%= @destination.title %>
<% end %>
<% content_for :page_body do %>
<section>
<h1>Choose from our most popular recommended itineraries below</h1>
</section>
def capture_stdout(stdin_str = '')
begin
require 'stringio'
$o_stdin, $o_stdout, $o_stderr = $stdin, $stdout, $stderr
$stdin, $stdout, $stderr = StringIO.new(stdin_str), StringIO.new, StringIO.new
yield
{:stdout => $stdout.string, :stderr => $stderr.string}
ensure
$stdin, $stdout, $stderr = $o_stdin, $o_stdout, $o_stderr
end
require 'spec_helper'
module Refinery
describe Page do
let(:page) do
Page.create!({
:title => 'RSpec is great for testing too',
:deletable => true
})
@parndt
parndt / gist:996446
Created May 28, 2011 00:19
RefineryCMS 1.0.0 application Gemfile
source 'http://rubygems.org'
gem 'rails', '3.0.7'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2', '~> 0.2.7'
# Use unicorn as the web server