Skip to content

Instantly share code, notes, and snippets.

View joshk's full-sized avatar
🥸

Josh Kalderimis joshk

🥸
  • Valued
  • Wellington, NZ
  • 01:37 (UTC +02:00)
View GitHub Profile
@funny-falcon
funny-falcon / patch-1.9.2-gc.patch
Created March 5, 2011 11:11
GC tunning simple patch ruby 1.9.2 p180
diff --git a/gc.c b/gc.c
--- a/gc.c
+++ b/gc.c
@@ -77,6 +77,41 @@ void *alloca ();
#ifndef GC_MALLOC_LIMIT
#define GC_MALLOC_LIMIT 8000000
#endif
+#define HEAP_MIN_SLOTS 10000
+#define FREE_MIN 4096
+
@alloy
alloy / NSURLConnection.rb
Created March 24, 2011 14:16
MacRuby NSURLConnection example.
framework 'AppKit'
class Download
attr_reader :response, :responseBody
def start(request)
puts "START!"
NSURLConnection.connectionWithRequest(request, delegate:self)
end
@karmi
karmi / elastic_search_ngram_analyzer_for_urls.sh
Created May 24, 2011 15:32
NGram Analyzer in ElasticSearch
# ========================================
# Testing n-gram analysis in ElasticSearch
# ========================================
curl -X DELETE localhost:9200/ngram_test
curl -X PUT localhost:9200/ngram_test -d '
{
"settings" : {
"index" : {
"analysis" : {
@dhh
dhh / gist:1014971
Created June 8, 2011 18:09
Use concerns to keep your models manageable
# autoload concerns
module YourApp
class Application < Rails::Application
config.autoload_paths += %W(
#{config.root}/app/controllers/concerns
#{config.root}/app/models/concerns
)
end
end
@jeroenvandijk
jeroenvandijk / ack.rb
Created June 18, 2011 19:41
ack your gems
#!/usr/bin/env ruby
# Usage:
#
# ./ack.rb your-query
require 'rubygems'
require 'bundler'
if query = ARGV[0]
gem_dirs = Bundler.load.specs.map(&:full_gem_path).join(' ')
module Round
end
module Rectangular
end
class Thing
extend Round
class << self
def metaclass
@kilaulena
kilaulena / js_steps.rb
Created July 7, 2011 22:10
test capybara visibility
Then /^"([^\"]+)" should be visible$/ do |text|
assert page.has_xpath?("//*[not(descendant-or-self::script)][ancestor::*[contains(@style,'display: none;')]][contains(normalize-space(.),'#{text}')]")
end
Then /^"([^\"]+)" should not be visible$/ do |text|
assert page.has_xpath?("//*[not(descendant-or-self::script)][ancestor::*[contains(@style,'display: none;')]][contains(normalize-space(.),'#{text}')]")
end
@indirect
indirect / better_logger.rb
Created July 19, 2011 07:00
Rails 3 logs with severity and PIDs
# You must require this file in application.rb, above the Application
# definition, for this to work. For example:
#
# # Syslog-like Rails logs
# if Rails.env.production?
# require File.expand_path('../../lib/better_logger', __FILE__)
# end
#
# module MyApp
# class Application < Rails::Application
@franckverrot
franckverrot / gist:1105103
Created July 25, 2011 20:27
Travis-CI CFP

"Travis CI - Distributed, Continous Integration for the Ruby community

""The future is already here — it's just not very evenly distributed."" (William Gibson)

The Ruby community is where a lot of this future already happens. We not only set the bar higher and higher every day, we've also built most of the infrastructure use day to day. Twitter, Github, Gemcutter, Pusher to just name a few projects that changed the world, the way we live and work.

With Travis CI, an open source continous integration service for the Ruby community, we are