Skip to content

Instantly share code, notes, and snippets.

dic = Hash.new(0)
while line = ARGF.gets
line.downcase!
while line.sub!(/[a-z]+/,"")
word = $&
dic[word] += 1
end
end
p dic.sort{|a,b|b[1] <=> a[1]}[0...5]
/**
* UIStoryboard (InstantiateViewController)
*/
UIKIT_STATIC_INLINE __kindof UIViewController *InstantiateViewControllerOnStoryboard(NSString *storyboardName, NSString *identifier) {
return [[UIStoryboard storyboardWithName:storyboardName bundle:nil] instantiateViewControllerWithIdentifier:identifier];
}
UIKIT_STATIC_INLINE __kindof UIViewController *InstantiateInitialViewControllerOnStoryboard(NSString *storyboardName) {
return [[UIStoryboard storyboardWithName:storyboardName bundle:nil] instantiateInitialViewController];
}
@bright23
bright23 / DeviceConst.swift
Created November 26, 2016 05:34
DeviceConst.swift
//
// AppConst.swift
// AdBlockSample
//
// Created by bright on 2016/11/26.
// Copyright © 2016年 bright. All rights reserved.
//
import Foundation
import UIKit
@bright23
bright23 / CodePiece.swift
Created November 12, 2016 04:31
swiftのerrorってこれで出せるんやぁ。 catch のとこで補完出してほしい... #swift #CodePiece
```
do {
try jsonData.write(toFile: url.path, atomically: true, encoding: String.Encoding.utf8)
} catch let error as NSError {
print("error:::\(error)")
fatalError()
}
```