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 'uri' | |
require 'net/http' | |
require 'json' | |
puts 'post data' | |
puts 'url parsed.' | |
urls = ['http://www.youtube.com/watch?v=webZ80CGezY', 'http://www.youtube.com/watch?v=wCnLeg04LEU','http://www.youtube.com/watch?v=WXUEeecBcsU','http://www.youtube.com/watch?v=75fXFouP8mo' ] | |
data = { |
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 'open-uri' | |
require 'nokogiri' | |
uri = URI("https://gdata.youtube.com/feeds/api/standardfeeds/JP/most_recent?time=today&v=2").read | |
docs = Nokogiri::XML(uri) | |
entry = docs.search("entry") | |
entry.each do |attr| | |
puts attr.search("title") | |
puts attr.xpath("media:group").xpath("media:thumbnail").attr("url") | |
puts attr.xpath("media:group").xpath("yt:videoid").text |
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
#!/usr/bin/env ruby | |
#-*- coding: utf-8 -*- | |
def insert_sort(arr) | |
if arr.nil? | |
return arr | |
end | |
(arr.length).times do |i| | |
j = i |
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 select_sort(arr) | |
if arr.nil? | |
return arr | |
end | |
size = arr.length | |
(size-1).times do |i| | |
min_index = i | |
(i..size-1).each do |j| |
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
#!/usr/bin/env ruby | |
#-*- coding: utf-8 -*- | |
def bubble_sort(arr) | |
if arr.nil? | |
return | |
end | |
n = arr.length |
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
#!/usr/bin/env python | |
# coding: utf-8 | |
import cv | |
import numpy | |
import scipy.misc | |
image_name = 'hinomaru.jpg' | |
gray_image_name = 'gray.jpg' | |
binarized_image_name = 'binarized.jpg' | |
contours_image_name = 'contours.jpg' |
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
Lisa_Rose: | |
Lady_in_the_Water: 2.5 | |
Snakes_on_a_Plane : 3.5 | |
Just_My_Luck: 3.0 | |
Superman_Returns: 3.5 | |
You_Me_and_Dupree: 2.5 | |
The_Night_Litener: 3.0 | |
Gene_Seymour: | |
Lady_in_the_Water: 3.0 |
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
#!/usr/bin/env ruby | |
#-*- coding: utf-8 -*- | |
require 'tweetstream' | |
require 'uri' | |
TweetStream.configure do |config| | |
config.consumer_key = 'YOUR_CONSUMER_KEY' | |
config.consumer_secret = 'YOUR_CONSUMER_SECRET' | |
config.oauth_token = 'YOUR_OAUTH_TOKEN' | |
config.oauth_token_secret = 'YOUR_OAUTH_SECRET' | |
config.auth_method = :oauth |
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
#!/usr/bin/env ruby | |
#-*- coding: utf-8 -*- | |
require 'rubygems' | |
require 'tiqav' | |
require 'twitter' | |
require 'open-uri' | |
require 'tempfile' | |
Twitter.configure do |config| | |
config.consumer_key = "YOUR_CONSUMER_KEY" |
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
task :default => :new | |
desc "Create a new article." | |
task :new do | |
title = ask("Title: ") | |
article = "<pre><code class=\"prettyprint lang-ruby\"> | |
</code></pre>" | |
path = "./#{title}.txt" |