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
import UIKit | |
class Manager { | |
struct Singleton { | |
static let instance = Manager() | |
} | |
class var sharedInstance: Manager { | |
println("sharedInstance called") |
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
[7] pry(main)> Delorean.time_travel_to("10 hour ago") do | |
[7] pry(main)* DateTime.yesterday.beginning_of_day | |
[7] pry(main)* end | |
=> Tue, 22 Jul 2014 00:00:00 JST +09:00 | |
[8] pry(main)> Delorean.time_travel_to("10 hour ago") do | |
[8] pry(main)* DateTime.current.utc.yesterday.beginning_of_day | |
[8] pry(main)* end | |
=> Mon, 21 Jul 2014 00:00:00 +0000 |
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
import Cocoa | |
extension Int { | |
var seconds: NSTimeInterval { | |
return NSTimeInterval(self) | |
} | |
var minutes: NSTimeInterval { | |
return self.seconds * 60 | |
} |
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
# ディレクトリスタックを重複を省いてファイルに保存する | |
dirs -lp > $HOME/.dirs.tmp | |
cat $HOME/.dirs.tmp | sort | uniq > $HOME/.dirs | |
rm $HOME/.dirs.tmp |
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
#import <Foundation/Foundation.h> | |
@interface NSString (Snakecase) | |
@property (nonatomic, readonly) NSString *snakecaseString; | |
@end |
hr
hr
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
# built application files | |
*.apk | |
*.ap_ | |
# files for the dex VM | |
*.dex | |
# Java class files | |
*.class |
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
require "matrix" | |
class Graph | |
D = 0.85 | |
EPS = 1 * 10 ** -5 | |
def initialize(matrix) | |
@dimension = matrix.row_size | |
elements = [] |
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
require "redcarpet" | |
require "pathname" | |
require "cgi" | |
class MyRenderer < Redcarpet::Render::HTML | |
def paragraph(text) | |
if text =~ /^\s?\[.+\]\s?$/ | |
puts "parses:" | |
lines = text.split("\n") | |
lines.each do |line| |