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
# install build dependencies | |
sudo yum install -y git-core zlib zlib-devel gcc-c++ patch readline readline-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison curl sqlite-devel | |
# clone and install rbenv environment | |
cd ~ | |
git clone git://github.com/sstephenson/rbenv.git .rbenv | |
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build | |
echo 'export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bash_profile | |
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile |
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-oauth2' | |
module OmniAuth | |
module Strategies | |
class Weibo < OmniAuth::Strategies::OAuth2 | |
option :name, 'weibo' | |
option :client_options, { | |
:site => "https://api.weibo.com", |
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
# encoding: utf-8 | |
require "omniauth-oauth2" | |
module OmniAuth | |
module Strategies | |
class Wechat < OmniAuth::Strategies::OAuth2 | |
option :name, "wechat" | |
option :client_options, { |
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-oauth2" | |
module OmniAuth | |
module Strategies | |
class Tqq < OmniAuth::Strategies::OAuth2 | |
option :name, 'tqq' | |
option :client_options, { | |
:site => "https://graph.qq.com", |
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 Imon | |
module DynamicQuery | |
# def find_by_expression(all_or_first, exp, options={}) | |
# conditions=expression.params | |
# conditions.insert(0, exp.expression) | |
# options.merge :conditions=>conditions | |
# find(all_or_first, options) | |
# end |
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
def counter(n) | |
return 0 if n<=0 | |
(n%10) == 1 ? 1+counter(n/10) : counter(n/10) | |
end |