This file contains hidden or 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
removeNonUppercase :: [Char] -> [Char] | |
removeNonUppercase st = [ c | c <- st, c `elem` ['A'..'Z']] |
This file contains hidden or 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
on alfred_script(q) | |
if application "iTerm" is running then | |
run script " | |
on run {q} | |
tell application \":Applications:iTerm.app\" | |
activate | |
tell the first terminal | |
tell current session to write text q | |
end tell | |
end tell |
This file contains hidden or 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
rightTriangles =[(a,b,c)|c<-[1..10],a<-[1..c],b<-[1..a] | |
, a^2+b^2==c^2, a+b+c==24] | |
--- Prelude> rightTriangles #=> [(8,6,10)] |
This file contains hidden or 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
fonts = [1,2,3] | |
fonts.each do |font_id| | |
filename = "font_ss_#{font_id}.jpg" | |
system "curl [URL] -o #{filename}" | |
end |
This file contains hidden or 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 Fibo | |
def calc(n) | |
a = 0 | |
b = 1 | |
return [1] if n == 1 | |
result = [1] | |
while a + b <= n | |
result << a + b | |
a = result[-2] |
This file contains hidden or 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
株式会社 spice life | |
[株式会社 spice life](http://spicelife.jp/)がつくるのはECの分野、ちょっと変わった、ちょっと新しい、ちょっと世の中を良くするサービスです。[オリジナルTシャツ作成サービスtmix](http://tmix.jp/)はスタッフTシャツづくりを通じて各地のRubyKaigiを応援しています。 | |
# [ ]( ) をリンクに置き換えてください |
This file contains hidden or 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
str = "a\nb\nc" | |
File.open("dumped.txt","w") do |f| | |
f.puts Marshal.dump(str) | |
end | |
str_reloaded = File.open("dumped.txt", "r") do |f| | |
Marshal.load(f.read) | |
end | |
p str_reloaded #=> "a\nb\nc" |
This file contains hidden or 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
;; C-o の改行した先をインデントする版 | |
(provide 'insert-new-line) | |
(defun insert-new-line() | |
(interactive) | |
(save-excursion ;ポインタ位置を記憶して終了したら元に戻す | |
(open-line 1) | |
(forward-line) | |
(indent-for-tab-command) | |
) | |
) |