Skip to content

Instantly share code, notes, and snippets.

View monzou's full-sized avatar

Takuro Monji monzou

  • Tokyo
View GitHub Profile
main = print largest
largest :: Integer
largest = head (filter p [ 100000, 99999 .. ])
where p x = x `mod` 3829 == 0
@monzou
monzou / qsort2.hs
Created June 16, 2012 08:56
qsort @ Haskell
main = print $ quicksort [ 10, 2, 5, 3, 1, 6, 7, 2, 3, 4, 8, 9 ]
quicksort :: (Ord a) => [a] -> [a]
quicksort [] = []
quicksort (x:xs) =
let
le = filter (<= x) xs
gt = filter (> x) xs
in quicksort le ++ [x] ++ quicksort gt
@monzou
monzou / sc1.png
Created June 10, 2012 06:49
Donuts README images
dummy
@monzou
monzou / SummaryMail.markdown
Created June 3, 2012 13:24
How to send Summary mail @ Donuts
  • configure application.rb
  • configure production.rb
  • rails runner "SummaryMailer.summary.deliver" -e production
@monzou
monzou / backuper.rb
Created February 12, 2012 06:35
Day One Backuper
require 'fssm'
require 'time'
require 'nokogiri'
USER_DIR = "/Users/monzou"
BACKUP_DIR = "#{USER_DIR}/Dropbox/DayOne"
BACKUP_EXTENSION = "txt"
DAYONE_ENTRIES_PATH = "#{USER_DIR}/Library/Mobile Documents/5U8NS4GX82~com~dayoneapp~dayone/Documents/Journal_dayone/entries"
def monitor
@monzou
monzou / monitor.rb
Created December 29, 2011 14:13
Ruby でファイルをモニタリングするとこんな感じなのかなぁ?
require 'fssm'
require 'thread'
PATH = "/Users/monzou/sample.txt"
class Monitor
def start(&block)
puts "start monitoring @ #{Thread.current}"
monitor = FSSM::Monitor.new
@monzou
monzou / gist:1378968
Created November 19, 2011 15:37
複数のはてなダイアリのデータをマージするスクリプト
# encoding: utf-8
require 'rubygems'
require 'nokogiri'
hash = Hash.new
names = [ "account1", "account2" ]
names.each do |name|
doc = Nokogiri::XML(File.open("#{name}.xml"))
@monzou
monzou / rvm.sublime-build
Created November 19, 2011 14:35
Sublime Text 2 rvm build system
{
"cmd": ["/Users/monzou/.rvm/bin/rvm-auto-ruby", "$file"],
"file_regex": "^(…*?):([0-9]*):?([0-9]*)",
"selector": "source.ruby"
}
@monzou
monzou / gist:1369944
Created November 16, 2011 12:14
Nottingham Web Preview Template
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>{{html-title}}</title>
<style>
@charset "UTF-8";
/* begin: This code block is released into public domain */
html, body, div, span, applet, object, h1, h2, h3, h4, h5, h6, p,
blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn,
package school
object ScalaSchoolAdvancedTypes {
implicit def strToInt(x: String) = x.toInt
/*
* クラスの型パラメータ
*
* A <% B : A が B として見れる