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
gc{motion} :: Toggle comments (for small comments within one line | |
the &filetype_inline style will be used, if | |
defined) | |
gcc :: Toggle comment for the current line | |
gC{motion} :: Comment region | |
\d :: Toggle NerdTREE | |
,w ,b :: CamelCaseMotion w 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
class ApplicationController < ActionController::Base | |
def session | |
@session_wrapper ||= SessionWrapper.new(request.session) | |
end | |
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
def has_timer_for?(user) | |
Timer.where(:user_id => user.id, :todo_id => self.id).exists? | |
end | |
def timer_for(user) | |
Timer.find_or_create_by_todo_id_and_user_id(self.id, user.id) | |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
gems = Gem.source_index.search(Gem::Dependency.new(//, Gem::Requirement.default)) | |
gems.each do |gem| | |
puts "gem '#{gem.name}', '#{gem.version.to_s}'" | |
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
module ActiveRecord | |
class Relation | |
def find_or_create | |
if self.exists? | |
self.first | |
else | |
self.create | |
end | |
end | |
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
Entry.find_in_batches(:conditions => "description_text IS NULL AND id > 354000", :batch_size => 1000) do |group| | |
puts group.first.id | |
ActiveRecord::Base.transaction do | |
group.each do |e| | |
e.refresh_description! | |
Entry.update_all({:description_text => e.description_text}, ['id = ?', e.id]) | |
end | |
end | |
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
#!/usr/bin/env ruby | |
require File.expand_path('../../config/boot', __FILE__) | |
require 'zmq' | |
zmq = ZMQ::Context.new | |
socket = zmq.socket(ZMQ::PUSH) | |
socket.connect AppConfig[:email_zmq_socket] | |
#ARGF.binmode | |
#socket.send(ARGF.to_io.read) |
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
# A sample Gemfile | |
source "http://rubygems.org" | |
# gem "rails" | |
gem 'devise', :git => 'https://github.com/plataformatec/devise.git' |
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
DC.FirstRunView = DC.ContentView.design({ | |
layout: { top: 43, left: 0 }, | |
$inputs: function() { | |
return this.$('input'); | |
}.cacheable(), | |
value: function() { | |
return this.get('$inputs')[0].value; | |
}.property('$inputs'), |