Skip to content

Instantly share code, notes, and snippets.

View shaliko's full-sized avatar

Shalva Usubov shaliko

View GitHub Profile
@shaliko
shaliko / h2russia.txt
Created September 12, 2012 11:05
Poetry
Пять самых клевых чуваков,
Которых нет милей и краше,
Пять гениальнейших умов,
Творят на Благо Эйч2Раша.
Вот Шалико - надежный друг,
В беде поможет всем вокруг,
Ему усталость не почем,
Он лидер и знаток во всем.
@shaliko
shaliko / Command
Created September 7, 2012 11:14
Update mysql2 for ruby 1.9.3
gem install activerecord-mysql2-adapter
@shaliko
shaliko / user_countries_codes
Created August 20, 2012 14:26
User countries codes
AX => Aaland Islands
AF => Afghanistan
AL => Albania
DZ => Algeria
AD => Andorra
AO => Angola
AI => Anguilla
AQ => Antarctica
AG => Antigua & Barbuda
AR => Argentina
@shaliko
shaliko / routes.rb
Created June 26, 2012 10:08
Update user status
resources :users do
put :toggle_status, :on => :member
end
@shaliko
shaliko / each.rb
Created April 22, 2012 12:32
Test each
?> a = [1,2,3,4]
=> [1, 2, 3, 4]
>> a.object_id
=> 2245796340
>> puts a.each {|e| puts e }.object_id
1
2
3
4
2245796340
@shaliko
shaliko / facebook_controller.rb
Created October 10, 2011 17:28
Facebooker2 for iframe FB app
class FacebookController < ApplicationController
before_filter :set_p3p_header_for_third_party_cookies
before_filter :ensure_authenticated_to_facebook
def index
end
protected
#each time a user visits apps.facebook.com/xxx_app, we will refresh their access token
@shaliko
shaliko / gist:1160899
Created August 21, 2011 17:44
Seven Languages in Seven Weeks - IO day 1
Shaliko := Object clone
Shaliko inspectzero := method( (0 and true) ifTrue("0 is true" println) ifFalse("0 is false" println) )
Shaliko inspectstr := method( ("" and true) ifTrue("\"\" is true" println) ifFalse("\"\" is false" println) )
Shaliko slotes := method( Shaliko slotNames println)
Shaliko sayname := method("My name is Shalva" println)
Shaliko sayname
Shaliko inspectzero
Shaliko inspectstr
@shaliko
shaliko / application.js
Created August 18, 2011 13:00
DEPRECATION WARNING: :popup has been deprecated
//jQuery
$('a[data-popup]').live('click', function(e) {
window.open($(this).href);
e.preventDefault();
});
//Prototype.js
document.on("click", "a[data-popup]", function(event, element) {
if (event.stopped) return;
window.open($(element).href);
@shaliko
shaliko / gist:1104710
Created July 25, 2011 17:54
convertor.rb
require 'yaml'
class Convertor
def initialize(text)
@text = text
end
def prepare
response = ""
@shaliko
shaliko / gist:963270
Created May 9, 2011 20:06
git config
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.unstage 'reset HEAD --'
git config --global alias.last 'log -1 HEAD'