Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
| class ActiveRecord::ConnectionAdapters::MysqlAdapter | |
| def create_partitioned_table(table_name, &block) | |
| partition_sql = <<-sql | |
| ENGINE=InnoDB AUTO_INCREMENT=610925 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci | |
| partition by range (to_days(created_at)) | |
| ( | |
| partition p_0 values LESS THAN (to_days('2000-01-01')), | |
| sql | |
| partitions = (-4..4).collect do |i| |
| AZHU.storage = { | |
| save : function(key, jsonData, expirationMin){ | |
| if (!Modernizr.localstorage){return false;} | |
| var expirationMS = expirationMin * 60 * 1000; | |
| var record = {value: JSON.stringify(jsonData), timestamp: new Date().getTime() + expirationMS} | |
| localStorage.setItem(key, JSON.stringify(record)); | |
| return jsonData; | |
| }, | |
| load : function(key){ | |
| if (!Modernizr.localstorage){return false;} |
| require 'net/http' | |
| require 'xmlsimple' | |
| url = "http://www.user-agents.org/allagents.xml" | |
| xml_data = Net::HTTP.get_response(URI.parse(url)).body | |
| data = XmlSimple.xml_in(xml_data) | |
| agents = data['user-agent'].select{|agent| type = agent["Type"].first; type.include?("R") || type.include?("S")} | |
| agent_names = agents.collect {|agent| agent["String"].first} |
| #!/usr/bin/env ruby | |
| # List all keys stored in memcache. | |
| # Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place. | |
| require 'net/telnet' | |
| headings = %w(id expires bytes cache_key) | |
| rows = [] |
| module MyApp | |
| class Application < Rails::Application | |
| if Rails.env == 'test' | |
| require 'diagnostic' | |
| config.middleware.use(MyApp::DiagnosticMiddleware) | |
| end | |
| end | |
| end |
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
| #!/usr/bin/env sh | |
| ## | |
| # This is script with usefull tips taken from: | |
| # https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
| # | |
| # install it: | |
| # curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
| # |
Sublime Text 2 plugin for running ruby tests! (Unit, RSpec, Cucumber)