Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Tomohiro Nishimura Sixeight

🏠
Working from home
View GitHub Profile
@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
@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 / 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)
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 / 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
@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 / 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 / gist:6855391
Last active Dec 24, 2015
Xcode5にするとUnityのプラグインのコンパイル時に警告が出る問題
View gist:6855391
diff --git a/Info.plist b/Info.plist
index 30cb05c..d856ed8 100644
--- a/Info.plist
+++ b/Info.plist
@@ -42,6 +42,10 @@
<true/>
<key>XCPluginHasUI</key>
<false/>
+ <key>DVTPlugInCompatibilityUUIDs</key>
+ <array>
View gist:4771462
Preference-ENGINE:/Users/tomohiro:(---) 2.0.0-rc2
2:16:> irb
irb(main):001:0> require 'fiddle'
=> true
irb(main):002:0> DL
NameError: uninitialized constant DL
from (irb):2
from /Users/tomohiro/.rbenv/versions/2.0.0-rc2/bin/irb:12:in `<main>'
irb(main):003:0>
View cat_removes_branch.rb
# coding: utf-8
require 'readline'
branches = `git branch -r`
branches = branches.split(/\n/).map {|b| b.strip }
branches.shift
branches.delete_if {|branch| branch == 'origin/master' }
candidates = %w[check log grep open delete tag skip exit]