Skip to content

Instantly share code, notes, and snippets.

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

Tomohiro Nishimura Sixeight

🏠
Working from home
View GitHub Profile
@Sixeight
Sixeight / wanco.rb
Created July 8, 2014 04:22
delete trailing white space
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 June 25, 2014 02:54
migrate_ghqroot_to_gopath
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 15:47
beer with eldritch
require "eldritch"
class Beer
def initialize(row, col)
@rows = row
@col = col
end
async def run(group)
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 August 29, 2015 13:59
こういうの欲しい
module BindTap
def btap(&block)
self.instance_eval(&block)
self
end
end
Object.include BindTap
@Sixeight
Sixeight / init.coffee
Created April 13, 2014 19:30
run ruby sample
{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 April 9, 2014 05:34
add empty line to last line
atom.project.eachEditor (editor) ->
buffer = editor.getBuffer()
atom.subscribe buffer, 'will-be-saved', ->
buffer.append("\n")
@Sixeight
Sixeight / gist:6855391
Last active December 24, 2015 20:09
Xcode5にするとUnityのプラグインのコンパイル時に警告が出る問題
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>
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>
# 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]