Skip to content

Instantly share code, notes, and snippets.

View cympfh's full-sized avatar
🏠
Working from home

/c/ympfh cympfh

🏠
Working from home
View GitHub Profile
@cympfh
cympfh / punpukapuun.hs
Last active December 20, 2015 23:09
可変長引数の実験
{-# LANGUAGE FlexibleInstances #-}
class PType t where
hoge :: [Int] -> t
instance PType Int where
hoge = sum
instance PType r => PType (Int -> r) where
hoge xs = (\x -> hoge $ x:xs)
@cympfh
cympfh / format.hs
Last active December 21, 2015 01:58
可変数引数の実験, format (可変String -> IO())
{-# LANGUAGE FlexibleInstances #-}
class PType r where
hoge :: [String] -> r
instance PType (IO ()) where
hoge = putStr . concat . reverse
instance PType String where
hoge = concat . reverse
@cympfh
cympfh / iota.hs
Last active December 21, 2015 10:29
{-# LANGUAGE FlexibleInstances #-}
-- iota of SRFI-1
iota1 n = [0 .. n-1]
iota2 n m = [m .. m+n-1]
iota3 n m s = [m, m+s .. m+s*(n-1)]
class PType t where
iota :: t
@cympfh
cympfh / commit-comment.js
Last active December 31, 2015 11:59
コミットコメントを考えてくれます
var exec = require('child_process').exec
, fs = require('fs')
var url = 'http://データベース/';
// 今日の夕食費
var kasi = 300
, time = 20
, www = kasi-time; // com
// 時は金なり
http.createServer(app).listen(app.get('port'), function(){
console.log('Express server listening on port ' + app.get('port'));
});
var oauth = new (require('oauth').OAuth)(
'https://api.twitter.com/oauth/request_token',
'https://api.twitter.com/oauth/access_token',
'qnNRwjeo8zFjhIDfgG1F6Q', // CONSUMER_KEY (replace)
'JtKRv1e9QIEG6mKvWl0g4ygGVGzWclgfd7GaSBEGtg', // CONSUMER_SECRET (replace)
'1.0',
'http://127.0.0.1:3000/signin/twitter', // callback URL
'HMAC-SHA1'
);
@cympfh
cympfh / favorites
Created January 10, 2014 04:22
2014 / 10th Jan. (Fri.) 13:21
中卒梓 ‏@himono_ 29 Oct
「みんな、楽して生きて楽して死ねよ!」
Expand
Reply
Retweet Retweeted
Delete
Favorite Favorited
@cympfh
cympfh / e-hentai.coffee
Last active August 29, 2015 13:56
[e-hentaiにスクレイピング中にでた警告メッセージ - 座敷牢日誌](http://zashikiro.hateblo.jp/entry/2012/09/27/173402)
#!/usr/bin/env coffee
# vim: set ft=coffee:
cheerio = require 'cheerio'
http = require 'http'
url = process.argv[2]
prefix = process.argv[3] or './'
unless url
console.warn '''usage: ehentai url [prefix]
@cympfh
cympfh / ayame.hs
Created March 8, 2014 09:35
決定木のノードを一つだけ作る
import Data.List
data Ayame = SV | C deriving (Show, Eq)
datum :: [((Int, Int), Ayame)]
datum = [ ((5,4), SV) , ((2,3), C) , ((9,2), SV) , ((31, 39), SV) , ((20, 20), C) ]
main = do
let rule = findRule datum
(left, right) = partition rule datum