TwitterのタイムラインはJSONで流れてくるので、JSONぽい形式でデータを突っ込むMongoDBと相性が良い。
今まではtimeline.logとして書き出してたけど、GB単位に膨らんだテキストファイル重すぎて扱いづらいし最近は専らMongoDBに流し込んでます。
全部保存しとくと、誰がいつどのtweetを消したとか分かって異常に便利。こわい。
全文検索したいときがあるので、ツイイトはわかち書きでsplitして配列としても入れといてます。
MongoDBは配列で保存出来て、配列内にインデックスを貼れるので、簡単にいい感じの検索機能が作れて楽しいですね。
TLの全保存やってる人自体はそこら中に居るだろうし目新しいことは特にないでした。
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
var unekointhehousenow = function(input) { | |
var copy = function(source, buffer, pointer) { | |
for (var i = 0, l = source.length; i < l; ++i) { | |
buffer[pointer + i] = source[i]; | |
} | |
}; | |
var tokens = input.match(/うーねこいんざおうちなうよー|うーねこ|いんざ|おうち|なうよー/g) || []; | |
var buffer = [0]; | |
var pointer = 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
System.setOut(new PrintStream(new ByteArrayOutputStream()) { | |
@Override | |
public void println(String x) { | |
throw new RuntimeException("Assert使え(#゚Д゚)ゴルァ!!"); | |
} | |
}); |
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
slow 遅い | |
fast 速い | |
above より上に | |
below より下に | |
absolute 絶対的な | |
relative 相対的な | |
abstract 抽象的な |
正しい実装でt.coの見えない世界へ
document: https://dev.twitter.com/docs/streaming-api/user-streams
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 'haml' | |
require 'mongo' | |
get '/' do | |
@db = Mongo::Connection.new.db('creepy') | |
deleted = [] | |
@status = [] | |
@db['delete'].find({},{:sort=>['id', 'ascending']}).each do |s| |
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
#!/usr/bin/env ruby | |
require 'net/http' | |
EMAIL = 'メールアドレス' | |
PASS = 'パスワード' | |
HOME = 'http://kksg.tumblr.com' #アップロードするTumblrのurl | |
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
# Install this recipe with: | |
# brew install --HEAD https://raw.github.com/gist/1955470/c58bda92f07147afff64a86d0c2d8ef65adb9cd6/elixir.rb | |
require 'formula' | |
class Elixir < Formula | |
homepage 'http://elixir-lang.org/' | |
head 'https://github.com/elixir-lang/elixir.git' | |
depends_on 'erlang' |