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
# 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={}) |
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
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 |
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
gem install ruby-debug19 -- --with-ruby-include=$rvm_path/src/ruby-1.9.2-p290 |
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
<div class="container"> | |
<div class="sixteen columns"> | |
... | |
</div> | |
</div> |
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
rails g skeleton:install |
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
provider :idnet, APP_CONFIG[:app_id], APP_CONFIG[:app_secret], | |
{:custom_fields => { "camzap_field1", "camzap_custom2", "something_else"}} |
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 MyAppName | |
class Application < Rails::Application | |
YOUR_GLOBAL_VAR = "test" | |
end | |
end | |
MyAppName::Application::YOUR_GLOBAL_VAR |
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 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 |
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
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 |
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
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, |