Skip to content

Instantly share code, notes, and snippets.

ситуации:
=======
1.
билет выписан
прямая выписка:
price_fare + price_tax
авиацентр:
price_fare + price_tax + price_blanks + price_consolidator
#local user='%{$fg[magenta]%}%n@%{$fg[magenta]%}%m%{$reset_color%}'
local pwd='%{$fg[green]%}%~%{$reset_color%}'
local rvm='%{$fg[green]%}$(rvm-prompt i v g)%{$reset_color%}'
local return_code='%(?..%{$fg[red]%}%? ↵%{$reset_color%})'
local git_branch='$(git_prompt_status)%{$reset_color%}$(git_prompt_info)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY=""
call pathogen#runtime_append_all_bundles()
" this is handled by vim-update-bundles
"call pathogen#helptags()
" Bundle: https://github.com/vim-scripts/fugitive.vim.git
" Bundle: https://github.com/vim-scripts/rails.vim.git
" Bundle: https://github.com/vim-scripts/file-line.git
" Bundle: https://github.com/vim-scripts/matchit.zip.git
" Bundle: https://github.com/vim-scripts/surround.vim.git
" Bundle: https://github.com/vim-scripts/unimpaired.vim.git
@codesnik
codesnik / deploy.rb
Created January 14, 2012 02:16 — forked from LRDesign/deploy.rb
Capistrano recipe to sync rails database and files, using remote database.yml instead of local for remote credentials
set :sync_directories, ["public/assets", "public/galleries"]
set :sync_backups, 3
# encoding: utf-8
require 'spec_helper'
# TODO написать rspec_matcher для комиссий, с более внятным выводом причин
describe Commission do
before do
Commission.stub(:skip_interline_validity_check).and_return(true)
end
@codesnik
codesnik / script
Created January 10, 2012 09:11 — forked from waaa/script
Script for refunds and charges
#!/usr/bin/env ruby
require 'rubygems'
require 'active_support/core_ext'
require 'rspec'
require 'bigdecimal'
class BigDecimal
def inspect; to_s end
end
@codesnik
codesnik / gist:1527149
Created December 28, 2011 08:47
how to make several retries
def foo
puts "trying!"
do_something_exceptional
rescue RetriableException
retries ||= 5
retries -= 1
raise if retries.zero?
retry
end
(function () {
var r20 = /%20/g,
rbracket = /\[\]$/;
// Serialize an array of form elements or a set of
// key/values into a query string
jQuery.paramDotted = function( a, traditional ) {
var s = [],
add = function( key, value ) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction( value ) ? value() : value;
module DotParams
class Middleware
def initialize(app)
@app = app
end
def call(env)
reparse_query(env["rack.request.query_hash"])
reparse_query(env["rack.request.form_hash"])
def changenode hash, keys, value
endkey = keys.pop
keys.reduce(hash) { |hash, key|
hash[key].tap {|h| h.is_a?(Hash) or raise("key '#{key}' is not a hash") }
}[endkey] = value
end
describe "changenode" do
let(:node) do