This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
# python 2.7.5 / fabric 1.7.0 | |
from fabric.api import env, run | |
from fabric.decorators import roles, task | |
from fabric.decorators import parallel | |
env.use_ssh_config = True | |
env.colorize_errors = True | |
env.warn_only = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
00-58/2 * * * * sh /home/vagrant/tmp/test.sh >> /home/vagrant/tmp/test.txt | |
01-59/2 * * * * sh /home/vagrant/tmp/test2.sh >> /home/vagrant/tmp/test.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pythonっぽくない | |
def reverse1(data): | |
result = "" | |
for letter in list(data): | |
result = letter + result | |
return result | |
# 標準 | |
def reverse2(data): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function(length) { | |
var range = function(start, end) { | |
var result = []; | |
for(var i=start; i<=end; i++) { | |
result.push(i); | |
} | |
return result; | |
}; | |
var source = (function(src, count) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# OSX | |
git status | gsed -n '/orig$/p' | gsed -e 's/\t//g' | xargs rm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cond1 = false | |
cond2 = true | |
# nested ternary operater | |
cond1 ? 'piyo' : (cond2 ? 'baz' : 'bar') | |
# use lambda | |
[->{'piyo' if cond1}, ->{'baz' if cond1 and cond2}, ->{'bar'}].lazy.map(&:call).select(&:present?).first | |
=> 'bar' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Bingo | |
def self.generate | |
[*1..75] | |
.each_slice(15) | |
.map { |v| v.sample(5) } | |
.tap { |a| | |
a[2][2] = nil # (´;ω;`) | |
break a.unshift('BINGO'.chars) | |
} | |
.map { |v| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# only run spec | |
box: nanapi/ubuntu-rvm-with-phantomjs@0.0.2 | |
no-response-timeout: 10 | |
services: | |
- ibash/mysql5.6 | |
build: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# No.4 | |
list = [50, 2, 1, 9] | |
list.sort_by(&:to_s).reverse.join | |
# No.5 | |
[*2..9].reduce(['1']) do | |
|res, v| res.map { |r| ['', ' + ', ' - '].map { |oper| "#{r}#{oper}#{v}" } }.flatten | |
end.select { |v| eval(v) == 100 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Hoge | |
private | |
def fuga | |
'hoge' | |
end | |
end | |
module Piyo | |
def baz | |
fuga() |
OlderNewer