Skip to content

Instantly share code, notes, and snippets.

View reborg's full-sized avatar

reborg reborg

View GitHub Profile
@reborg
reborg / ctags.rb
Created March 8, 2012 06:30
Custom formula pointing at a patched ctags version for objc support.
# Instructrions:
# click on "raw" and copy the link to the .rb file
# from your terminal type: brew install <copy-link>
require 'formula'
class Ctags < Formula
url 'https://github.com/fishman/ctags.git'
homepage 'http://ctags.sourceforge.net/'
version '1.2'
@reborg
reborg / vim.rb
Created December 21, 2011 22:06
Vim Formula with Latest available VIM
require 'formula'
class Vim < Formula
# Get stable versions from hg repo instead of downloading an increasing
# number of separate patches.
url 'https://vim.googlecode.com/hg/', :revision => '601dffb4a18c'
version '7.3.382'
homepage 'http://www.vim.org/'
head 'https://vim.googlecode.com/hg/'
@reborg
reborg / ExampleTest.m
Created December 17, 2011 19:36 — forked from pk/ExampleTest.m
Using method swizzling and blocks to test Class methods in Objective-C.
#import "SenTestCase+MethodSwizzling.m"
@interface ExampleTest : SenTestCase {}
+ (BOOL)trueMethod;
+ (BOOL)falseMethod;
@end
@implementation ExampleTest
+ (BOOL)trueMethod { return YES; }
@reborg
reborg / gist:1226884
Created September 19, 2011 16:24 — forked from marick/gist:1226882
(ns scratch.core
(:use midje.sweet
[clojure.set :only [union intersection]]
))
(unfinished booking-transaction bookings)
(defn empty-history []
[ [] ])
class AppServer
attr_accessor :port, :admin_password
end
class Configuration
attr_accessor :tail_logs, :max_connections, :admin_password
def app_server
@a ||= AppServer.new
block_given? ? yield(@a) : @a
end
##
# Ideas for this CSV export comes from:
# - http://dominikgrabiec.com/111-simple-dataset-exportimport-for-rails/
#
namespace :teamly do
namespace :export do
desc 'CSV Export of the relevant user data'
task :users => :environment do
excludes = ['crypted_password','password_salt','persistence_token','single_access_token','perishable_token','ancestry','time_zone','hide_announcement_time','reminder_hour','reminder_min']
# CoreDataUtilityTutorial
#
# Copyright 2009, Reborg
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
otool -L Embedded.app/Contents/Frameworks/MacRuby.framework/Versions/0.4/usr/lib/ruby/1.9.1/universal-darwin9.5/stringio.bundle
Embedded.app/Contents/Frameworks/MacRuby.framework/Versions/0.4/usr/lib/ruby/1.9.1/universal-darwin9.5/stringio.bundle:
@executable_path/../Frameworks/MacRuby.framework/Versions/Current/usr/lib/libmacruby.dylib (compatibility version 0.4.0, current version 0.4.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.3)
task :embed => [:deploy] do
`rm -rf ./#{AppConfig.name}.app/Contents/Frameworks/MacRuby.framework/Versions/0.3`
`find ./#{AppConfig.name}.app/Contents -name "1.9.0" -type d | xargs rm -rf`
`rm -rf ./#{AppConfig.name}.app/Contents/Frameworks/MacRuby.framework/Versions/Current/usr/include/ruby-1.9.0`
`rm -rf ./#{AppConfig.name}.app/Contents/Frameworks/MacRuby.framework/Versions/Current/usr/lib/libmacruby.1.9.0.dylib`
`find ./#{AppConfig.name}.app/Contents -name "*.bundle" -exec install_name_tool -change /Library/Frameworks/MacRuby.framework/Versions/0.4/usr/lib/libmacruby.dylib @executable_path/../Frameworks/MacRuby.framework/Versions/Current/usr/lib/libmacruby.dylib {} \\;`
end
$:.unshift File.join('.','radius/lib')
require 'radius'
context = Radius::Context.new do |c|
c.define_tag 'hello' do
'Hello world'
end
end
parser = Radius::Parser.new(context, :tag_prefix => 'r')
parsed = parser.parse("A small example: <r:hello />!")