Skip to content

Instantly share code, notes, and snippets.

deepj / upgrade_to_refinery_two.rb
Created Jul 30, 2012 — forked from craigambrose/upgrade_to_refinery_two.rb
Migration to convert from refinery 1.0.8 to refinery 2.0
View upgrade_to_refinery_two.rb
class UpgradeToRefineryTwo < ActiveRecord::Migration
def self.up
# For refinerycms-authentication
rename_table :roles_users, :refinery_roles_users
rename_table :roles, :refinery_roles
rename_table :user_plugins, :refinery_user_plugins
rename_table :users, :refinery_users
remove_column :refinery_users, :persistence_token
remove_column :refinery_users, :perishable_token
remove_column :refinery_users, :remember_token
deepj / apns.rb
Created Apr 17, 2012 — forked from scotttam/apns.rb
Sends an Apple Push Notification with Ruby
View apns.rb
require "rubygems"
require "yajl"
require "openssl"
require "socket"
device_token = '39cac56f 986a0e66 3c4fd4f4 68df5598 024d2ca3 8b9f307c 741c180e 9fc30c62'
device_token = device_token.gsub(" ", "")
the_byte_token = [device_token].pack("H*")
file ="ruby_the_byte_token", "wb")
deepj / gist:1869900
Created Feb 20, 2012
rvm + xcode 4.3 + command-line tools
View gist:1869900
brew install
brew install
brew link autoconf automake
View module_test.rb
require 'test_helper'
module ::TestModule
def self.extended(base)
add_properties_to base
def self.included(base)
add_properties_to base
View gist:1331295
<h2>New project</h2>
<% if @project.errors.any? %>
<% @project.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
<% end %>
View rake.log
[2011-06-08 02:52:07] /Users/deepj/.rvm/wrappers/ruby-1.8.7-p334/rake install
/Users/deepj/.rvm/rubies/ruby-1.8.7-p334/bin/ruby vm/codegen/encoding_extract.rb /Users/deepj/.rvm/src/vm/external_libs/onig vm/gen/encoding_database.cpp
(in /Users/deepj/.rvm/src/rbx-2.0.0pre)
/Users/deepj/.rvm/rubies/ruby-1.8.7-p334/bin/ruby vm/codegen/field_extract.rb vm/builtin/basicobject.hpp vm/builtin/object.hpp vm/builtin/integer.hpp vm/builtin/fixnum.hpp vm/builtin/array.hpp vm/builtin/bignum.hpp vm/builtin/executable.hpp vm/builtin/access_variable.hpp vm/builtin/alias.hpp vm/builtin/block_environment.hpp vm/builtin/block_as_method.hpp vm/builtin/bytearray.hpp vm/builtin/chararray.hpp vm/builtin/io.hpp vm/builtin/channel.hpp vm/builtin/module.hpp vm/builtin/class.hpp vm/builtin/compiledmethod.hpp vm/builtin/data.hpp vm/builtin/dir.hpp vm/builtin/exception.hpp vm/builtin/float.hpp vm/builtin/immediates.hpp vm/builtin/iseq.hpp vm/builtin/list.hpp vm/builtin/lookuptable.hpp vm/builtin/ffi_pointer.hpp vm/builtin/methodtable.hpp
View gist:428187
c:\>gem -v
c:\>ruby -v
ruby 1.9.2dev (2010-05-31) [i386-mingw32]
irb(main):001:0> require 'sqlite3'
LoadError: no such file to load -- sqlite3/sqlite3_native
from c:/ruby/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/sqlite3-ruby-1.3.0-x86-mingw32/lib/sqlite3.rb:6:in `require'
View gist:193424
diff --git a/ext/cmain.cpp b/ext/cmain.cpp
index 76d5c4d..5004251 100644
--- a/ext/cmain.cpp
if (Fd < 0)
return errno;
// From here on, all early returns MUST close Fd.
+ #undef fstat
+ #undef stat
struct stat st;
View gist:187267
pass: 5, fail: 15, error: 3084
total: 3104 tests with 537 assertions in 110.071952 seconds
View gist:166520
* Copyright (C) 2006 VMware, Inc. All rights reserved.
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 and no later version.
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License