Skip to content

Instantly share code, notes, and snippets.

View reborg's full-sized avatar

reborg reborg

View GitHub Profile
@reborg
reborg / ants.clj
Created July 13, 2012 20:50 — forked from jjcomer/ants.clj
Ant Simulation -- From Clojure Concurrency Presentation
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
; which can be found in the file CPL.TXT at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
;As shown in the presentation: http://blip.tv/clojure/clojure-concurrency-819147
@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']
#
# 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