Skip to content

Instantly share code, notes, and snippets.

View sumskyi's full-sized avatar

Vladyslav Sumskyi sumskyi

View GitHub Profile
json = {
:as_of => @search.until.in_time_zone.xmlschema
}
if @updates.max_distance
json[:next_offset] = @search.next_offset
json[:distance] = @updates.max_distance
end
json[:updates] = @updates.map do |el|
Feature: When a user associates social network accounts with their postpone.it account
Background:
Given I am a new, authenticated user
Then I go to the accounts page
Scenario: User can authorize Facebook
Then I should see "Facebook (0)"
And we authorize with "Facebook"
Then I should have been authorized with "Facebook"
And I should see "Facebook (1)"
@sumskyi
sumskyi / magent.yml
Created June 23, 2011 17:07
replica set yml
development: &dev
host:
- 127.0.0.1
27017
- 0.0.0.0
27017
database: queue
@sumskyi
sumskyi / .pryrc.rb
Created July 22, 2011 06:22
my .pryrc
Pry.config.editor = "gvim --remote-silent"
Pry.hooks.add_hook(:after_session, :say_bye) do
puts "fuck off Gnida"
end
Pry.prompt = [Proc.new{ |obj, nest_level| "#{RUBY_VERSION}-#{RUBY_PATCHLEVEL} (#{obj}):#{nest_level} > " },
Proc.new{ |obj, nest_level| "#{RUBY_VERSION} (#{obj}):#{nest_level} * " } ]
/usr/bin/firefox -new-tab $1
@sumskyi
sumskyi / froro.rb
Created November 9, 2011 21:26
======== и этот даун пишет мне "Please use one soft tab (2 spaces) when indenting" ========
def user_timeline(uid)
- request(:get, "/statuses/user_timeline.json", {'user_id' => uid, 'count' => 100, 'trim_user' => true})
+ request(:get, "/statuses/user_timeline.json",
+ user_id: uid,
+ count: 100,
+ trim_user: true,
+ include_rts: 1
+ )
end
@sumskyi
sumskyi / README.md
Last active June 7, 2022 18:49
rails STI with custom "type" field and storing there value different from ClassName

GeoEntity.last

SELECT geo_entities.* FROM geo_entities ORDER BY geo_entities.id DESC LIMIT 1

returns:

County id: 4, eid: nil, pid: nil, ename: nil, etype: 2, created_at: "2011-11-21 06:26:37", updated_at: "2011-11-21 06:26:37"

@sumskyi
sumskyi / node-and-npm-in-30-seconds.sh
Created November 22, 2011 12:19 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://npmjs.org/install.sh | sh
@sumskyi
sumskyi / initializer_qu.rb
Created November 24, 2011 15:02
immediately performing Qu backend
if %w(test development).include? Rails.env
Qu.backend = Qu::Backend::RightNow.new
else
@sumskyi
sumskyi / condition.rb
Created December 3, 2011 08:15
hash driven conditional statements
#!/usr/bin/env ruby
class A
CONDITION = {
nil => :a,
false => :b,
true => :c
}
def abc(val)