🧘♂️
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('core') | |
App.IframeView = SC.View.extend({ | |
emptyElement: '<iframe></iframe>', | |
content: '', | |
noIframeText: '', | |
frameBorder: 0, | |
render: function() { | |
var content = this.get('content') |
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
begin | |
text = JSON.generate(refresh_hash) | |
render :text => Iconv.iconv('utf-8','latin1',text).to_s | |
rescue StandardError | |
logger.warn("JSON generation error in refresh controller: #{$!}") | |
render :text => "Problem reading messages, please try again", :status => 500 | |
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
export GIT_EDITOR="mate -w" | |
export LESS="-erX" # makes git diff look nicer | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" | |
} | |
export PS1='\h \[\033[1;33m\]\w\[\033[0m\]$(parse_git_branch)$ ' |
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
begin | |
# check if memcached is running; if it is, use that instead of the default memory cache | |
Timeout.timeout(0.5) { TCPSocket.open("localhost", 11211) { } } | |
config.cache_store = :mem_cache_store, %w(localhost:11211), { :namespace => 'OI', :timeout => 60 } | |
$stderr.puts "Using memcached on localhost:11211" | |
rescue StandardError | |
config.cache_store = nil | |
$stderr.puts "memcached not running, caching to memory" | |
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
# modified from http://www.mikeperham.com/2009/03/03/using-memcache-client-16x-in-rails-23 | |
# Brain surgery to use our own version of memcache-client without having to modify activesupport directly. | |
# Unload any previous instance of the class | |
if Object.const_defined? :MemCache | |
Object.instance_eval { remove_const :MemCache } | |
end | |
# Ensure that the memcache-client gem path is at the front of the loadpath | |
$LOAD_PATH.unshift(RAILS_ROOT + '/vendor/gems/memcache-client-1.7.4/lib') |
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
class Tracker | |
def track_event(a,b,c) | |
@queue ||= Queue.new | |
start_pushing_thread | |
hash = { :a => a, :b =>, :c => c } | |
@queue << hash | |
end | |
private | |
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
map <D-1> 1gt | |
map <D-2> 2gt | |
map <D-3> 3gt | |
map <D-4> 4gt | |
map <D-5> 5gt | |
map <D-6> 6gt | |
map <D-7> 7gt | |
map <D-8> 8gt | |
map <D-9> 9gt |
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 "rubygems" | |
require "v8" | |
require "ostruct" | |
require "memprof" | |
funcs = [] | |
3.times do | |
cxt = V8::Context.new | |
funcs << cxt.eval("f = function(arg) { return arg.a + arg.b }") |
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
# I have a function that looks up a monthly report which may or may not exist yet (e.g. if | |
# you look at the start of a month, before I've gotten around to generating that month's | |
# report) | |
# | |
# where the report isn't generated I just want to return "0" for each column in this report; | |
# so what I do is return an instance of the below object whenever there's no report | |
# available (thus avoiding any "try" unpleasantness) - something about this slightly | |
# bothers me though. Is there a more elegant/simpler way I should consider? | |
class NullZeroObject |
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
gem "rack-ssl", "1.3.2" | |
# when Capybara issue 409 or 422 get resolved, you can switch back to the official | |
# capybara gem | |
# https://github.com/jnicklas/capybara/pull/409 | |
# https://github.com/jnicklas/capybara/pull/422 | |
gem "capybara", git: "https://github.com/mcolyer/capybara.git", branch: "fix-ssl-redirects" |
OlderNewer