Skip to content

Instantly share code, notes, and snippets.

View kainosnoema's full-sized avatar
🏠
Working from home

Evan Owen kainosnoema

🏠
Working from home
View GitHub Profile
@kainosnoema
kainosnoema / require-performance-fix.patch
Created May 28, 2011 22:32
require-performance-fix.patch - fixed for requires with multiple dots
diff --git a/.gitignore b/.gitignore
index 57557c9..7955376 100644
--- a/.gitignore
+++ b/.gitignore
@@ -129,3 +129,4 @@ y.tab.c
# /win32/
/win32/*.ico
+ext/win32ole/.document
diff --git a/array.c b/array.c
class CachedAccount < CachedDelegateClass(Recurly::Account)
self.cache_key = :account_code
cache_constructor :find
cache(:billing_info)
cache(:subscription) { subscriptions.live.first }
cache(:add_ons) { subscription.try(:add_ons).to_a }
cache(:plan) { subscription.try :plan }
cache(:balance) {
@kainosnoema
kainosnoema / rb_template_template.rb
Last active August 29, 2015 13:58
Jsonite in Rails using Ruby ActionView Template Handler
# config/initializers/rb_template_template.rb
class RbTemplateHandler
cattr_accessor :default_format
self.default_format = Mime::JSON
def self.call(template)
%{rendered = begin;#{template.source};end
unless rendered.is_a?(String)

Keybase proof

I hereby claim:

  • I am kainosnoema on github.
  • I am kainosnoema (https://keybase.io/kainosnoema) on keybase.
  • I have a public key whose fingerprint is 172E 7E39 C0A9 FF55 DB79 02AE 9BE3 0DA7 5AF9 DEEE

To claim this, I am signing this object:

@kainosnoema
kainosnoema / channel-example.swift
Last active August 30, 2023 04:34
Golang-like concurrency semantics in Swift
import Foundation
go(println("in a thread"))
// buffered channel
var c = Chan(buffer:20)
// sending routing
go {
while(true) {