Skip to content

Instantly share code, notes, and snippets.

View HaiTo's full-sized avatar
🏠
Working from home

HaiTo HaiTo

🏠
Working from home
View GitHub Profile
@HaiTo
HaiTo / 0_reuse_code.js
Last active August 29, 2015 14:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
object.method do |block_var|
block_var.method!
end
object.method {|block_var| block_var.method! }
/@\w*eight/
@HaiTo
HaiTo / gist:9afc564ccfaba80040bc
Created May 8, 2014 08:50
都道府県にマッチする正規表現
(東京都|北海道|(?:京都|大阪)府|.{2,3}県)
@HaiTo
HaiTo / AttachServer.java
Created February 8, 2014 14:05
58行目でエラー。さて、また洗おう。
public class AttachServer extends AsyncTask<String, Void, JSONArray> {
// Builder configuration
// Uri.Builderを使うとエンコードもやってくれるみたい
// Field
private Uri.Builder builder;
Context context;
// Constructor
public AttachServer(Context context){
this.context = context;
this.builder = new Uri.Builder();
# uniq_key=>count
# 必要になったのでメモみたいな形。
class Array
# return hash
def rollup
r_hs = {}
self.uniq.each do |sep|
r_hs[sep] = self.count sep
end
r_hs
@HaiTo
HaiTo / run.rb
Created November 24, 2013 09:25
class Run
## ローカルrequire
require 'yaml'
require 'twitter'
require '../OnLine/universal_search'
def initialize
@configure = YAML.load_file('configure.yaml')
@twitter_client = Twitter::REST::Client.new do |config|
config.consumer_key = @configure["iphone"]["consumer_key"]
config.consumer_secret = @configure["iphone"]["consumer_secret"]