Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Tomohiro Nishimura Sixeight

🏠
Working from home
View GitHub Profile
@Sixeight
Sixeight / init.coffee
Created Apr 9, 2014
add empty line to last line
View init.coffee
atom.project.eachEditor (editor) ->
buffer = editor.getBuffer()
atom.subscribe buffer, 'will-be-saved', ->
buffer.append("\n")
@Sixeight
Sixeight / init.coffee
Created Apr 13, 2014
run ruby sample
View init.coffee
{BufferedProcess, View} = require 'atom'
class QuickrunView extends View
@content: ->
@div class: 'quickrun overlay from-top', =>
@div class: 'panel', =>
@div class: 'panel-heading', =>
@span outlet: 'heading', 'quickrun'
@div class: 'btn-toolbar pull-right', =>
@button class: 'btn close', 'X'
@Sixeight
Sixeight / bind_tap.rb
Last active Aug 29, 2015
こういうの欲しい
View bind_tap.rb
module BindTap
def btap(&block)
self.instance_eval(&block)
self
end
end
Object.include BindTap
View gist:3c525a270e0840eb26c6
ruby -e'a={};$><<"\e[2J";loop{a[rand`tput cols`.to_i]=0;a.map{|x,o|$>.dup<<"\e[#{o};#{x}H \e[#{a[x]+=1};#{x}H\u{1f37a}\e[0;0H"};sleep 0.01}'
@Sixeight
Sixeight / main.rb
Created May 1, 2014
beer with eldritch
View main.rb
require "eldritch"
class Beer
def initialize(row, col)
@rows = row
@col = col
end
async def run(group)
@Sixeight
Sixeight / cat.rb
Created Jun 25, 2014
migrate_ghqroot_to_gopath
View cat.rb
require "fileutils"
GOPATH = ENV["GOPATH"]
GO_SRC_PATH = GOPATH + "/src/github.com"
GHQ_ROOT = "/Users/tomohiro/.ghq/github.com"
def mv(src, dest)
# puts "mv #{src} #{dest}"
FileUtils.mv src, dest
@Sixeight
Sixeight / wanco.rb
Created Jul 8, 2014
delete trailing white space
View wanco.rb
Dir["app/**/*.rb"].each do |file|
File.open(file, "rb+") do |io|
result = []
body = io.read
body.split("\n").each do |line|
line.gsub!(/\s+\z/, "")
result << line
puts line
View ruby_kansai_lesson-0726.rb
class Hundred
def initialize(difficulty)
@difficulty = difficulty
@correct = 0
@error = 0
end
def question
case @difficulty
when 1
View gist:3039
puts "hello, goodbye!"
View test_rpn-lesson24.rb
require 'test/unit'
require 'rpn'
class TestRPN < Test::Unit::TestCase
def setup
@rpn = RPN.new
end
def test_1_plus_1
assert_equal(2, @rpn.calc('1 1 +'))