Skip to content

Instantly share code, notes, and snippets.

View thash's full-sized avatar
🌵
⭐️ ⭐️ ⭐️ ⭐️ ⭐️

Takuya Hashimoto thash

🌵
⭐️ ⭐️ ⭐️ ⭐️ ⭐️
View GitHub Profile
@thash
thash / Gemfile
Last active August 29, 2015 14:06
source 'https://rubygems.org'
gem 'capybara'
gem 'nokogiri'
gem 'pry'
gem 'activesupport'
group :co_meeting do
gem 'poltergeist'
gem 'phantomjs'
@thash
thash / fork.rb
Last active August 29, 2015 14:05
AllAbout 018 Parallel
require 'open-uri'
(1..10).each do |i|
fork do
open("./#{i}.png", 'wb') do |f|
f.write open("http://cambelt.co/200x100/#{i}.png").read
end
end
end
@thash
thash / back.rb
Last active August 29, 2015 14:05
AllAbout 017 Regexp
/(\d{4}) - .*(\d{4})/ =~ "Francis Crick (8 June 1916 - 28 July 2004)"
$& # => "1916 - 28 July 2004"
$1 # => "1916"
$2 # => "2004"
;; install go-mode
(autoload 'go-mode "go-mode" "Mode for golang" t)
(defun my-go-mode-hooks ()
(setenv "GOPATH" (concat (getenv "HOME") "/.go")))
(add-hook 'go-mode-hook 'my-go-mode-hooks)
(add-to-list 'auto-mode-alist '("\\.go$" . go-mode))
(add-hook 'before-save-hook 'gofmt-before-save)
@thash
thash / dena.go
Last active August 29, 2015 14:05
// ヒカルのGO! hikarie.go #2 http://connpass.com/event/7914/
// https://github.com/yosuke-furukawa/golang-study
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
;; install jabber.el via elpa
(require 'jabber-autoloads)
(setq jabber-account-list '(("11111_99999@chat.hipchat.com"
(:password . "password")
(:network-server . "chat.hipchat.com")
(:port . 5222))))
;; M-x jabber-connect-all
;; => Opening STARTTLS connection to `chat.hipchat.com:5222'...failed
;; Couldn't connect to chat.hipchat.com:5222
differ(red, blue).
differ(red, green).
differ(blue, green).
coloring(Kagawa, Ehime, Tokushima, Kochi) :-
differ(Kagawa, Ehime),
differ(Kagawa, Tokushima),
differ(Kagawa, Kochi),
differ(Tokushima, Kochi),
differ(Ehime, Kochi).
#
# DO NOT MODIFY!!!!
# This file is automatically generated by Racc 1.4.11
# from Racc grammer file "".
#
require 'racc/parser.rb'
class IntpParse < Racc::Parser
##### State transition tables begin ###
@thash
thash / add.rb
Last active August 29, 2015 14:04
open('test.txt', 'a+') do |f|
f.puts 'last line'
end
$ cat test.txt
line1
line2
last line
class MyAppException < StandardError; end
def divide100(n)
100 / n
rescue
raise MyAppException.new('My application is facing exception in divide100')
end
begin
p divide100(50) #=> 2