This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'net/telnet' | |
cache_dump_limit = 100 | |
localhost = Net::Telnet::new("Host" => "localhost", "Port" => 11211, "Timeout" => 3) | |
slab_ids = [] | |
localhost.cmd("String" => "stats items", "Match" => /^END/) do |c| | |
matches = c.scan(/STAT items:(\d+):/) | |
slab_ids = matches.flatten.uniq | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- ~/Library/Application\ Support/iTerm/Scripts/setup_rails.scpt | |
-- Thanks to http://www.worldgoneweb.com/2011/iterm2-advanced-features/#comment-20560 | |
-- http://www.iterm2.com/#/section/documentation/scripting | |
tell application "iTerm" | |
activate | |
set myterm to (make new terminal) | |
set cd_to_my_project_path to ("cd ~/Projekte/my_awesome_project") | |
-- you can altenativly tell the first terminal | |
tell the first terminal | |
launch session "Panes" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zh-TW: | |
admin: | |
home: | |
name: "網站首頁" | |
pagination: | |
previous: "« 前頁" | |
next: "次頁 »" | |
truncate: "…" | |
misc: | |
filter_date_format: "mm/dd/yy" # a combination of 'dd', 'mm' and 'yy' with any delimiter. No other interpolation will be done! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Log | |
module Minimal | |
[:fatal, :error, :warn, :info, :debug].each do |method| | |
define_method "#{method}f" do |message| | |
time = Time.now.iso8601 | |
level = method.to_s.upcase | |
caller = "%s#%s:%s" % [self.class, action_name, caller(1)[0].scan(/:(\d+):/)] | |
logger.send(method, "%s [%s] %s %s" % [time, level, caller, message]) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Fix for a Rails - Ruby 1.9 bug | |
# Rails Router, now that it's UTF-8 default, blows up when routing requests | |
# with invalid chars in the URL; it should properly return a 400 error | |
# Have to monkey-patch the fix in, since it's not scheduled for release until | |
# Rails 4.0. | |
# Adapted Andrew White (pixeltrix)'s fix at | |
# https://github.com/rails/rails/commit/3fc561a1f71edf1c2bae695cafa03909d24a5ca3, | |
# but edited to work in 3.0.x. | |
# 3.1.x, 3.2.x compatibility unknown | |
require 'action_dispatch/routing/route_set' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){script = document.createElement("script");script.src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js";document.body.appendChild(script);})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rest-core' | |
module RestCore | |
middleware = Class.new | |
middleware.module_eval do | |
def initialize app | |
@app = app | |
end | |
def call env, &k |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
raise "Remove patch after rails 3.2" if Rails.version =~ /\A4/ | |
# copy of lib/active_record/relation/spawn_methods.rb | |
# Because updating to this version 3.2.16 might change the behaviour of some of our queries, | |
# we took a copy of this class and remove the behaviour where | |
module ActiveRecord | |
module SpawnMethods | |
def merge(r) | |
return self unless r | |
return to_a & r if r.is_a?(Array) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Jbuilder.encode do |json| | |
json.content format_content(@message.content) | |
json.(@message, :created_at, :updated_at) | |
json.author do |json| | |
json.name @message.creator.name.familiar | |
json.email_address @message.creator.email_address_with_name | |
json.url url_for(@message.creator, format: :json) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
after "deploy:stop", "clockwork:stop" | |
after "deploy:start", "clockwork:start" | |
after "deploy:restart", "clockwork:restart" | |
namespace :clockwork do | |
desc "Stop clockwork" | |
task :stop, :roles => clockwork_roles, :on_error => :continue, :on_no_matching_servers => :continue do | |
run "if [ -d #{current_path} ] && [ -f #{pid_file} ]; then cd #{current_path} && kill -INT `cat #{pid | |
_file}` ; fi" | |
end |
OlderNewer