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
#!/usr/bin/ruby | |
# depends: nokogiri, term-ansicolor, pit | |
require 'time' | |
require 'net/https' | |
require 'nokogiri' | |
require 'term/ansicolor' | |
require 'pit' | |
class String | |
include Term::ANSIColor |
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
{-# LANGUAGE ScopedTypeVariables #-} | |
import Data.Maybe (mapMaybe) | |
import Data.List (sort) | |
import Control.Applicative ((<$>)) | |
import Control.Monad (unless) | |
import Control.Exception (SomeException) | |
import System.Environment (getArgs) | |
import GHC | |
import GHC.Paths (libdir) | |
import Outputable (ppr, defaultUserStyle) |
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
vnoremap <buffer> zf :call <SID>fold_haskell()<CR> | |
function! s:fold_haskell() range | |
let str = getline(a:firstline) | |
if empty(str) || str =~# '\s$' | |
call setline(a:firstline, str . '-- {{{') | |
else | |
call setline(a:firstline, str . ' -- {{{') | |
endif | |
let str = getline(a:lastline) |
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
commands.addUserCommand(['pixivFullNovel'], 'show full novel', | |
function(args) { | |
let doc = content.document.wrappedJSObject; | |
let win = content.window.wrappedJSObject; | |
Array.forEach(doc.querySelectorAll('.novel_article'), | |
function(e) { | |
e.style.display = 'block'; | |
e.innerHTML = win.parse_page(e.innerHTML); | |
} |
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
" plugin for neocomplcache <http://github.com/Shougo/neocomplcache> | |
" | |
" This plugin requires ghc-mod <http://www.mew.org/~kazu/proj/ghc-mod/> | |
let s:source = { | |
\ 'name' : 'ghc_complete', | |
\ 'kind' : 'ftplugin', | |
\ 'filetypes': { 'haskell': 1 }, | |
\ } |
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
-- http://projecteuler.net/index.php?section=problems&id=14 | |
{-# OPTIONS_GHC -O2 #-} | |
import Data.List (maximumBy) | |
import Data.Ord (comparing) | |
import Control.Applicative ((<$>)) | |
import Control.Monad (forM_) | |
import Data.Array.Unboxed (UArray, assocs) | |
import Data.Array.ST (runSTUArray, newArray, readArray, writeArray) | |
collatz :: Integer -> Integer |
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
{-# LANGUAGE ExistentialQuantification #-} | |
import System | |
class Hi_ a where | |
hi :: a -> String | |
data Hi = forall a. Hi_ a => Hi a | |
instance Hi_ Hi where | |
hi (Hi x) = hi x | |
data Ujihisa = Ujihisa |
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
" For test (Do quickrun on the target character!): | |
" aiu | |
" あいう | |
function! s:get_current_character() | |
if mode() ==# 'c' | |
let str = getcmdline() | |
let cur_idx = getcmdpos() - 1 | |
return matchstr(str, '.', cur_idx) |
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
function! ParseJSON(str) | |
let obj = { 'str': a:str, 'pos': 0, 'len': len(a:str) } | |
function! obj.skip_space() dict | |
let self.pos = matchend(self.str, '^\s*', self.pos) | |
endfunction | |
function! obj.parse_string() dict | |
if self.str[self.pos] != '"' | |
throw 'not a string' |
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
-- original: http://d.hatena.ne.jp/kazu-yamamoto/20100528/1275008906 | |
import Control.Applicative | |
import Control.Monad | |
import Data.Array.ST | |
import Data.Array.Unboxed | |
import Random | |
---------------------------------------------------------------- | |
type Value = Int |