Skip to content

Instantly share code, notes, and snippets.

@rneuo
rneuo / fish.md
Last active September 5, 2019 15:26

Install

brew install fish
sudo vi /etc/shells   #  末尾に /usr/local/bin/fish を追加
chsh -s /usr/local/bin/fish 
@rneuo
rneuo / ogp.go
Created October 24, 2018 04:18
ogp.go
package text2ogp
import (
"bytes"
"github.com/golang/freetype"
"github.com/golang/freetype/truetype"
"golang.org/x/image/font"
"golang.org/x/image/math/fixed"
"image"
"image/color"
@rneuo
rneuo / tokenizer.py
Last active July 16, 2018 11:06
MeCabを使って形態素解析用のPythonクラス
from itertools import chain
from collections import Counter
import MeCab
flatten = lambda array: list(chain.from_iterable(array))
strip = lambda text: text.lstrip().rstrip()
"""
USAGE
@rneuo
rneuo / mecab-install.md
Last active July 16, 2018 06:52
mecabをmacにインストール

インストール

brew install mecab mecab-ipadic
git clone --depth https://github.com/neologd/mecab-ipadic-neologd.git
cd mecab-ipadic-neologd
./bin/install-mecab-ipadic-neologd -n -a

確認

- Install
```
wget https://dl.eff.org/certbot-auto
chmod a+x ./certbot-auto
./certbot-auto certonly --webroot -w {webroot} --agree-tos --email {email} -d {domain}
```
- crontabへの登録
@rneuo
rneuo / scrollViewDidScroll.swift
Created March 31, 2016 04:55
テーブルViewの一番下に到達した場合
func scrollViewDidScroll(scrollView: UIScrollView) {
if self.tableView.contentOffset.y >= (self.tableView.contentSize.height - self.tableView.bounds.size.height) {
} else {
}
}
@rneuo
rneuo / ヘッダを透明にする.swift
Created February 16, 2016 01:19
ヘッダを透明にする
self.navigationController!.navigationBar.translucent = false
for parent in self.navigationController!.navigationBar.subviews {
for childView in parent.subviews {
childView.removeFromSuperview()
}
}
// 特定のViewを取り除かない場合。特定のViewのtagに999などの値を設定しておく
self.navigationController!.navigationBar.translucent = false
for parent in self.navigationController!.navigationBar.subviews {
@rneuo
rneuo / 他のStoryboardにある画面を開く.swift
Created February 16, 2016 01:15
他のStoryboardにある画面を開く
let anotherStoryboard = UIStoryboard(name: "Another", bundle: nil)
let vc = anotherStoryboard.instantiateViewControllerWithIdentifier("AnotherViewController") as! AnotherViewController
@rneuo
rneuo / ACAccountStore.swift
Last active October 31, 2015 09:10
ACAccountStore
import Social
var twAccount: ACAccount?
let accountType = ACAccountStore().accountTypeWithAccountTypeIdentifier(ACAccountTypeIdentifierTwitter)
let accountStore = ACAccountStore()
accountStore.requestAccessToAccountsWithType(accountType, options: nil) { (granted:Bool, error:NSError?) -> Void in
if error != nil {
// エラー処理
print("error! \(error)")
return
}
@rneuo
rneuo / swift_status_bar_color.swift
Last active September 2, 2015 06:48
iOSステータスバーの文字色を白に変更する
View controller-based status bar appearanceをNOに設定
UIApplication.sharedApplication().setStatusBarStyle(.LightContent, animated: true)