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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> | |
<link type="text/css" rel="stylesheet" href="style.css"/> | |
<div id="chartContainer"> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<script src="http://dimplejs.org/dist/dimple.v1.1.1.min.js"></script> | |
<script type="text/javascript"> | |
var svg = dimple.newSvg("#chartContainer", 1890, 900); |
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
# Description: | |
# hubot answer the FizzBuzz Question | |
# | |
# Commands: | |
# hubot fizzbuzz N - Reply result of FizzBuzz | |
module.exports = (robot) -> | |
robot.respond /fizzbuzz( (\d+))?/i, (msg) -> | |
count = msg.match[2] || 100 | |
msg.send ['Fizz' unless i%3] + ['Buzz' unless i%5] or i for i in [1..count] |
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
cron = require('cron').CronJob | |
module.exports = (robot) -> | |
robot.enter -> | |
new cron | |
cronTime: "0 0 9 * * *" | |
start: true | |
timeZone: "Asia/Tokyo" | |
onTick: -> | |
robot.send {room: "#hoge"}, "朝会の時間です。" |
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.exports = (robot) -> | |
robot.hear /tired/, (msg) -> | |
robot.brain.data.count = 0 unless robot.brain.data.count | |
robot.brain.data.count += 1 | |
robot.brain.save | |
if robot.brain.data.count < 3 then msg.send "Let's take a short break." else msg.send "You must take a break." | |
robot.hear /fine/, (msg) -> | |
robot.brain.data.count = 0 | |
robot.brain.save |
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
Colour0="131,148,150" | |
Colour1="147,161,161" | |
Colour2="0,43,54" | |
Colour3="7,54,66" | |
Colour4="0,43,54" | |
Colour5="238,232,213" | |
Colour6="7,54,66" | |
Colour7="0,43,56" | |
Colour8="220,50,47" | |
Colour9="203,75,22" |
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 'digest/md5' | |
hash = "4b364677946ccf79f841114e73ccaf4f" | |
salt = "hoge$" | |
0.upto(999999) { |num| | |
pass = "%06d"%num | |
digest = Digest::MD5.new.update(salt + pass).to_s | |
if digest == hash | |
puts "Solved: #{pass}" | |
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
; via http://qiita.com/ka_/items/a3f79b761e25d485f2a9 | |
; Clojure 超入門 | |
(println "Hello World!") | |
; 四則演算 | |
(+ 1 2) | |
(* (+ 1 2) 3) ; (1 + 2) * 3 | |
(* (+ 1 2) (- 3 4)) ; (1 + 2) * (3 - 4) |
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' | |
# proxy設定 | |
proxy = "http://YOUR_PROXY:8080" | |
proxy_user = "PROXY_USER" | |
proxy_pass = "PROXY_PASS" | |
options = { proxy_http_basic_authentication: [proxy, proxy_user, proxy_pass] } | |
# スクレイピング先のURL |
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
from urllib import request | |
from pyquery import PyQuery as pq | |
resp = request.urlopen("http://cookpad.com/recipe/1069312") | |
html = resp.read().decode("utf-8") | |
query = pq(html) | |
results = [] | |
# レシピのメイン部を取得 |
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
from elasticsearch import Elasticsearch | |
es = Elasticsearch() | |
res = es.search( | |
index = 'ldgourmet', | |
doc_type = 'restaurants', | |
body= { | |
"query" : { | |
'simple_query_string': { | |
"query": "白金台 カフェ ボエム", |