Skip to content

Instantly share code, notes, and snippets.

View vshvedov's full-sized avatar
💾
1.44MB

Vladyslav Shvedov vshvedov

💾
1.44MB
View GitHub Profile
@vshvedov
vshvedov / ngrams-and-tire.rb
Created October 5, 2012 10:43 — forked from olivoil/ngrams-and-tire.rb
An example of using ngram analysis in ElasticSearch with the Tire rubygem
# An example of using ngram analysis in ElasticSearch with the Tire rubygem
# ==========================================================================
# The original, raw example: https://gist.github.com/988923
require 'rubygems'
require 'tire'
require 'yajl/json_gem'
class URL
def initialize(attributes={})
Can you write a ruby script (hello.rb), which would give me such outputs:
$> ./hello.rb
01) Hello
02) Hello
03) Hello
04) Hello
05) Hello
06) Hello
gem install ruby-debug19 -- --with-ruby-include=$rvm_path/src/ruby-1.9.2-p290
@vshvedov
vshvedov / gist:1473332
Created December 13, 2011 18:52
geekdb-0
<div class="container">
<div class="sixteen columns">
...
</div>
</div>
@vshvedov
vshvedov / gist:1473027
Created December 13, 2011 17:27
geekdb-0
rails g skeleton:install
provider :idnet, APP_CONFIG[:app_id], APP_CONFIG[:app_secret],
{:custom_fields => { "camzap_field1", "camzap_custom2", "something_else"}}
@vshvedov
vshvedov / gist:1371422
Created November 16, 2011 21:13
Rails 3: global variable (bad ass ;)
module MyAppName
class Application < Rails::Application
YOUR_GLOBAL_VAR = "test"
end
end
MyAppName::Application::YOUR_GLOBAL_VAR
@vshvedov
vshvedov / pixen_to_gameQuery.rb
Created November 16, 2011 17:05 — forked from robesris/pixen_to_gameQuery.rb
Pixen to gameQuery sprites converter
module PixenToGameQuery
require 'RMagick'
include Magick
FPR = 12 # Frames per row in a sprite sheet generated by Pixen
COLPAD = 2 # Pix between each column of images on the sprite sheet
ROWPAD = 2 # Pix between each row of images on the sprite sheet
LEFTPAD = 4 # Extra pix on left of sprite sheet
RIGHTPAD = 20 # Extra pix on right of sprite sheet
BOTTOMPAD = 2 # Extra pix on bottom of sprite sheet
@vshvedov
vshvedov / gist:1370650
Created November 16, 2011 17:00
Sublime Text Edit 2 for Debian (from PPA)
wget http://blog.anantshri.info/content/uploads/2010/09/add-apt-repository.sh.txt
sudo mv add-apt-repository.sh.txt /usr/sbin/add-apt-repository
sudo chmod o+x /usr/sbin/add-apt-repository
sudo chown root:root /usr/sbin/add-apt-repository
sudo add-apt-repository ppa:webupd8team/sublime-text-2
@vshvedov
vshvedov / gist:1319641
Created October 27, 2011 14:09
ID.NET OmniAuth Strategy
require 'omniauth/oauth'
require 'multi_json'
module OmniAuth
module Strategies
class IdNet < OmniAuth::Strategies::OAuth2
def initialize(app, api_key = nil, secret_key = nil, options = {}, &block)
client_options = {
:site => IDNET_PROVIDER_URL,