Skip to content

Instantly share code, notes, and snippets.

View jmazzi's full-sized avatar

Justin Mazzi jmazzi

View GitHub Profile
@jmazzi
jmazzi / zone2json.patch
Created August 10, 2012 18:32
PowerDns zone2json
diff -urN a/pdns/backends/bind/Makefile.am b/pdns/backends/bind/Makefile.am
--- a/pdns/backends/bind/Makefile.am 2012-08-04 20:50:29.515826404 +0300
+++ b/pdns/backends/bind/Makefile.am 2012-08-04 20:49:57.009928123 +0300
@@ -16,7 +16,7 @@
libbind2backend_la_CFLAGS=$(AM_CFLAGS)
libbind2backend_la_LDFLAGS=-module -avoid-version
-bin_PROGRAMS = zone2sql zone2ldap
+bin_PROGRAMS = zone2sql zone2ldap zone2json
@gmcmillan
gmcmillan / chef.rb
Created July 26, 2012 22:25
Simple Ruby class for manually querying the Chef REST API (using Net::HTTP instead of Chef's REST resources)
require 'base64'
require 'time'
require 'digest/sha1'
require 'openssl'
require 'net/https'
require 'json'
class ChefAPI
# Public: Gets/Sets the http object.
module Cacher
def self.extended(base)
base.class_eval do
before do
if subject.respond_to?(:caches_action) && cache_path = example.metadata[:cache]
subject.caches_action cache_path
end
end
end
end
@solnic
solnic / osx_rails_env_setup_in_6_steps.md
Created March 29, 2012 12:33
6 steps to get up'n'running with Rails on OS X

6 steps to set up a rails development environment on OS X:

  • install Apple Command Line Tools
  • install homebrew[1]: /usr/bin/ruby -e "$(/usr/bin/curl -fksSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
  • install rvm: bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
  • install ruby rvm install 1.9.3
  • install rails
@jmazzi
jmazzi / README.md
Created March 27, 2012 19:31 — forked from svenfuchs/README.md
minimal activerecord standalone migrations

In your Gemfile add:

group :development, :test do
  gem 'micro_migrations', :git => 'git@gist.github.com:33e9f92c229eb808a4fa.git'
end

You might want to add something like this to the Rakefile of apps that use a gem that uses micro_migrations:

ENV['SCHEMA'] = "#{Gem.loaded_specs['your-gem-name'].full_gem_path}/db/schema.rb"

@svenfuchs
svenfuchs / README.md
Created March 19, 2012 00:45
minimal activerecord standalone migrations

In your Gemfile add:

group :development, :test do
  gem 'micro_migrations', :git => 'git@gist.github.com:33e9f92c229eb808a4fa.git'
end

You might want to add something like this to the Rakefile of apps that use a gem that uses micro_migrations:

ENV['SCHEMA'] = "#{Gem.loaded_specs['your-gem-name'].full_gem_path}/db/schema.rb"

@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@alloy
alloy / gist:1281203
Created October 12, 2011 13:17
ActiveRecord::Relation#merge example
class Edition < ActiveRecord::Base
scope :published, where(arel_table[:published_at].not_eq(nil))
scope :generated, where(arel_table[:generated_at].not_eq(nil))
scope :available, published.generated
end
class Magazine < ActiveRecord::Base
# This is where #merge works its magic, by allowing you to merge scopes from other models.
scope :with_available_editions, includes(:editions).merge(Edition.available)
end
#!/bin/sh
echo "Building Titanium Mobile"
[[ ! -f ~/Code/Mobile/titanium_mobile ]] && mkdir -p ~/Code/Mobile/titanium_mobile
cd ~/Code/Mobile/titanium_mobile
git pull origin master
case "$1" in
iphone)
scons -Q iphone=1
;;
@ryanb
ryanb / rails_3_1_rc4_changes.md
Created May 6, 2011 01:10
The Changelogs for Rails 3.1 Beta 1

Railties 3.1 RC4

  • The new rake task assets:clean removes precompiled assets. [fxn]

  • Application and plugin generation run bundle install unless --skip-gemfile or --skip-bundle. [fxn]

  • Fixed database tasks for jdbc* adapters #jruby [Rashmi Yadav]

  • Template generation for jdbcpostgresql #jruby [Vishnu Atrai]