This file contains hidden or 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 'sinatra' | |
| require 'open-uri' | |
| require 'json' | |
| OAUTH_URL = 'https://foursquare.com/oauth2' | |
| BASE_URL = 'https://api.foursquare.com/v2' | |
| REDIRECT_URI = 'http://localhost:9292/auth' | |
| CLIENT_ID = 'YOUR_CLIENT_ID' | |
| CLIENT_SECRET = 'YOUR_CLIENT_SECRET' |
This file contains hidden or 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
| #spec/routing/pages_routing_spec.rb | |
| require 'spec_helper' | |
| describe 'routes to the pages controller' do | |
| describe 'GET root_path' do | |
| subject { {:get => root_path} } | |
| it { should be_routable } | |
| it { should route_to :controller => 'pages', :action => 'home' } |
This file contains hidden or 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
| command :zenra do |m| | |
| require 'open-uri' | |
| require 'rexml/document' | |
| sentence = m[1] | |
| appid = 'YOUR_YAHOO_APPID' | |
| position = '動詞' | |
| text = '全裸で' | |
| base_url = 'http://jlp.yahooapis.jp/MAService/V1/parse' |
This file contains hidden or 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
| #coding: utf-8 | |
| require 'open-uri' | |
| require 'rexml/document' | |
| Earthquake.init do | |
| config[:zenra] = { | |
| :appid => 'YOUR_YAHOO_APPID', | |
| :position => '動詞', | |
| :text => '全裸で', |
This file contains hidden or 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
| #coding: utf-8 | |
| Earthquake.init do | |
| config[:notify] = [/ruby/i, /#earthquake.gem/i] | |
| output do |item| | |
| next unless item["stream"] | |
| if config[:notify].any?{|pattern| pattern =~ item["text"]} | |
| notify item["text"], :title => item["user"]["screen_name"] | |
| end |
This file contains hidden or 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
| #coding: utf-8 | |
| require 'open-uri' | |
| require 'RMagick' | |
| Earthquake.init do | |
| command :icon do |m| | |
| url = twitter.show(m[1])["profile_image_url"] | |
| blob = open(url).read | |
| image = Magick::Image.from_blob(blob).shift |
This file contains hidden or 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
| #coding: utf-8 | |
| require 'open-uri' | |
| require 'RMagick' | |
| Earthquake.init do | |
| command :image do |m| | |
| url = m[1] | |
| blob = open(url).read | |
| image = Magick::Image.from_blob(blob).shift |
This file contains hidden or 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 'mscorlib' | |
| require 'System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' | |
| require 'System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' | |
| include System::Drawing | |
| include System::Windows::Forms | |
| class MyForm < Form | |
| def initialize | |
| button = Button.new |
This file contains hidden or 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 'mscorlib' | |
| require 'System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' | |
| require 'System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' | |
| include System::Net | |
| include System::Text | |
| include System::Windows::Forms | |
| include System::Xml | |
| class MyForm < Form |
This file contains hidden or 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 AwesomePrintMongoid | |
| def self.included(base) | |
| base.send :alias_method, :printable_without_mongoid, :printable | |
| base.send :alias_method, :printable, :printable_with_mongoid | |
| end | |
| # Add Mongoid class names to the dispatcher pipeline. | |
| #------------------------------------------------------------------------------ | |
| def printable_with_mongoid(object) |