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
$ nvm use 0.8.0 | |
$ npm install -g matador | |
npm http GET https://registry.npmjs.org/matador | |
npm http 200 https://registry.npmjs.org/matador | |
npm http GET https://registry.npmjs.org/matador/-/matador-0.0.4.tgz | |
npm http GET https://registry.npmjs.org/express | |
npm http GET https://registry.npmjs.org/valentine | |
npm http GET https://registry.npmjs.org/klass | |
npm http GET https://registry.npmjs.org/colors | |
npm http GET https://registry.npmjs.org/express-hogan.js |
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
<html> | |
<head> | |
<title>hoge</title> | |
</head> | |
<body> | |
<ul class="fruit"> | |
<li>apple</li> | |
<li>orange</li> | |
<li>grape</li> | |
</ul> |
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
class CheckNfd < Thor | |
desc :search, "NFD形式で問題になる濁点、半濁点を羅列する" | |
def search | |
word1 = "\u3099" | |
word2 = "\u309A" | |
puts `git grep -e #{word1} -e #{word2}` | |
end | |
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
// ==UserScript== | |
// @name Remove Recommended Followers | |
// @namespace https://twitter.com | |
// @description Twitterのオススメユーザーを見えなくする | |
// @include https://twitter.com/* | |
// @version 1.0.3 | |
// ==/UserScript== | |
var h = document.getElementsByTagName('head')[0]; | |
var s1 = document.createElement("style"); |
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
# write .pryrc | |
Pry.config.hooks.add_hook(:before_session, :add_rails_console_methods) do | |
self.extend Rails::ConsoleMethods if defined?(Rails::ConsoleMethods) | |
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
### Mobile Expo Parser | |
# 該当ページからHTMLをローカルに持ってきて同ディレクトリにcompanies.htmlとして保存すること | |
# config.gem 'nokogiri' | |
require 'open-uri' | |
require 'rubygems' | |
require 'nokogiri' | |
require 'kconv' | |
html = Nokogiri::HTML( open("./companies.html").read, nil, 'UTF-8') | |
html.search("table[cellpadding='4']").each do |company| |
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
### LunchBoxMenuParser | |
# config.gem 'nokogiri' | |
require 'open-uri' | |
require 'rubygems' | |
require 'nokogiri' | |
require 'kconv' | |
url = 'http://www.tamagoya.co.jp/menu/menu.html' | |
user_agent = 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)' |
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
#ruby 1.8.7 | |
#1~9のうち、1つの数字を除いた8個の数字があります。この中から2個の数字を選んでならべて、ことなる2けたの整数を作ると、2の倍数は21個、4の倍数は12個、7の倍数は8個作ることができました。このとき、最初に除いた数字を求めなさい。 | |
seed = (1..9).to_a | |
result_hash = {2 => 0, 4 => 0, 7 => 0} | |
answer_hash = {2 => 21, 4 => 12, 7 => 8} | |
#各値を抜いた際のハッシュを作成 | |
#{1 => [23, 24 ....], 2 => } | |
results = Hash.new { |h, k| h[k] = [] }.tap do |hash| |
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
#ruby 1.8.7 | |
#1~9のうち、1つの数字を除いた8個の数字があります。この中から2個の数字を選んでならべて、ことなる2けたの整数を作ると、2の倍数は21個、4の倍数は12個、7の倍数は8個作ることができました。このとき、最初に除いた数字を求めなさい。 | |
(1..9).to_a.tap { |seed| Hash.new{ |h, k| h[k] = []}.tap { |hash| seed.each { |target| hash[target].tap { |array| seed.dup.tap { |l| l.delete(target) }.tap { |l| l.each {|i| l.each {|j| array << ((i * 10) + j) if i != j }}} } }}.each { |k, v| {2 => 0, 4 => 0, 7 => 0}.tap { |result| result.keys.each { |key| result[key] = v.count{|i| i % key == 0} } }.tap { |r| puts k if r == {2 => 21, 4 => 12, 7 => 8} }}} |
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
# macport用 | |
export PATH=/opt/local/bin:/opt/local/sbin:$PATH | |
# Mysql | |
export PATH=/usr/local/mysql/bin:$PATH | |
# Go 用 | |
export GOROOT=$HOME/development/go | |
export GOOS=darwin | |
export GOARCH=amd64 |