As configured in my dotfiles.
start new:
tmux
start new with session name:
As configured in my dotfiles.
start new:
tmux
start new with session name:
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
def self.force_refetch!(&block) | |
is_feched = false | |
while is_feched == false | |
begin | |
RcbBank.set! | |
RcbBank.fetch_rates! | |
RcbBank.store_rates | |
is_feched = true |
# Drop this file in config/initializers to run your Rails project on Ruby 1.9. | |
# This is three separate monkey patches -- see comments in code below for the source of each. | |
# None of them are original to me, I just put them in one file for easily dropping into my Rails projects. | |
# Also see original sources for pros and cons of each patch. Most notably, the MySQL patch just assumes | |
# that everything in your database is stored as UTF-8. This was true for me, and there's a good chance it's | |
# true for you too, in which case this is a quick, practical solution to get you up and running on Ruby 1.9. | |
# | |
# Andre Lewis 1/2010 | |
# encoding: utf-8 |
yes_no_conditions_creator = lambda {|yes_or_no,field_name| | |
if yes_or_no == 'yes' | |
{:conditions => "books.#{field_name.to_s} = true"} | |
elsif yes_or_no == 'no' | |
{:conditions => "books.#{field_name.to_s} = false or books.#{field_name.to_s} is null"} | |
else | |
{} | |
end | |
} | |
# server at 8081 | |
require 'rubygems' | |
require 'faye/websocket' | |
app = lambda do |env| | |
ws = Faye::WebSocket.new(env) | |
ws.onmessage = lambda do |event| | |
puts event.data | |
if event.data == 'started' |
# БЫЛО | |
# нужно создать такие коллбеки, которые могут быть скипнуты, если переменная skip_<имя_коллбека> возвращает true | |
class A | |
attr_accessor :skip_send_faye_notify | |
after_create :send_faye_notify | |
def send_faye_notify | |
unless @skip_senf_faye_notify | |
send |
# Concern | |
module SkipSpecificCallback | |
extend ActiveSupport::Concern | |
module ClassMethods | |
def with_skip(callback_name, *args) | |
options = args.extract_options! | |
raise Exception, ":on not specified" if options[:on].blank? | |
attribute_name = "skip_#{callback_name}" |
class A | |
state_machine do | |
state :active | |
state :removed | |
event :remove do | |
transition :active => :removed | |
end |