Skip to content

Instantly share code, notes, and snippets.

View reborg's full-sized avatar

reborg reborg

View GitHub Profile
#
# Will find the rdoc paths of your local gems and generate a html index frameset which will let you select
# the desired gem's rdoc from a dropdown navigation...
#
# Specify your local gems installation's doc directory and the desired html output path, open the generated index.html
# in the output path in your favorite browser and add a boomark.
# You might want to add the script into your path for easy access or put it in a cron job.
#
# Tested on Ubuntu 8.10, but really should work anywhere with proper gem install path set
# Working on Mac Os with custom Ruby install in /usr/local
require 'hotcocoa'
include HotCocoa
framework 'webkit'
ALL_TAGS_REPORT = File.join(
NSBundle.mainBundle.resourcePath.fileSystemRepresentation,
'resources/all_tags_report.html')
application do |app|
window(:frame => [100, 100, 500, 300], :title => "Reports") do |win|
$:.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 />!")
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
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)
# 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
#
##
# 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']
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
@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 []
[ [] ])
@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; }