Skip to content

Instantly share code, notes, and snippets.

View batasrki's full-sized avatar

Srdjan Pejic batasrki

  • S-Squared Design & Development
  • Toronto, ON
View GitHub Profile
@bishboria
bishboria / springer-free-maths-books.md
Last active June 8, 2024 06:39
Springer made a bunch of books available for free, these were the direct links
@flyingmachine
flyingmachine / gist:4004807
Created November 2, 2012 22:41
clojure korma heroku db connection
(defdb db
(if (System/getenv "DATABASE_URL")
(let [db-uri (java.net.URI. (System/getenv "DATABASE_URL"))
user-and-password (clojure.string/split (.getUserInfo db-uri) #":")]
{:classname "org.postgresql.Driver"
:subprotocol "postgresql"
:user (get user-and-password 0)
:password (get user-and-password 1) ; may be nil
:subname (if (= -1 (.getPort db-uri))
(format "//%s%s" (.getHost db-uri) (.getPath db-uri))
*.gem
*.rbc
.bundle
.config
.yardoc
Gemfile.lock
InstalledFiles
_yardoc
coverage
doc/
@myronmarston
myronmarston / subscription.rb
Created March 8, 2012 18:17
How we do migrations with Ripple
require 'versionable'
class Subscription
include Ripple::Document
include Versionable
current_schema_version 2
migrate_schema do |data|
self.schema_version = 2
require "overlord/searchable"
module Overlord
# Mark an ActiveRecord model as having a state machine. Requires a
# string attribute called `state`. To set the default state for a
# class, set a default column value for `state` in the database.
#
# Use Symbols for all keys and values in state definitions.
RSpec.configure do |config|
config.around(:each, :max_retries => lambda { |m| !!m }) do |example|
retries = example.metadata[:max_retries]
begin
example.run
rescue => e
retries -= 1
retry if retries >= 0
raise
@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.

@justinko
justinko / gist:1684051
Created January 26, 2012 17:59
Methods to aid in testing without loading the Rails environment
def stub_model(model_name)
stub_class model_name, ActiveRecord::Base
end
def stub_class(class_name, super_class = Object)
stub_module class_name, Class.new(super_class)
end
def stub_module(module_name, object = Module.new)
module_name = module_name.to_s.camelize
SiloRackApp = Rack::Builder.new do
use Rack::Runtime # add X-Runtime header
use E20::Ops::Middleware::RevisionMiddleware, logger: Silo.logger
use E20::Ops::Middleware::TransactionIdMiddleware, logger: Silo.logger
use E20::Ops::Middleware::HostnameMiddleware, logger: Silo.logger
use Clogger,
format: Clogger::Format::Combined,
path: File.join(Silo::ROOT, 'log', 'silo.access.log'),
reentrant: true