Skip to content

Instantly share code, notes, and snippets.

View lotz84's full-sized avatar

Tatsuya Hirose lotz84

View GitHub Profile
@lotz84
lotz84 / app.coffee
Created July 27, 2014 03:01
Gyazo OAuth test
request = require 'request'
express = require 'express'
app = express()
client =
id : "xxxx"
secret : "xxxx"
callback: "http://localhost:3000/callback"
app.get '/', (req, res) ->
@lotz84
lotz84 / Layout.swift
Last active August 29, 2015 14:07
Table layout in Swift
import UIKit
infix operator ||| { associativity left precedence 80 }
func ||| (lhs: Layout.Panel, rhs: Layout.Panel) -> Layout.Panel {
return Layout.Panel(forkType: .Horizontal , panel1: lhs, panel2: rhs)
}
infix operator --- { associativity left precedence 80 }
func --- (lhs: Layout.Panel, rhs: Layout.Panel) -> Layout.Panel {
return Layout.Panel(forkType: .Vertical , panel1: lhs, panel2: rhs)
@lotz84
lotz84 / make10.hs
Created October 11, 2014 08:21
Solve given make 10 problem
{-
Example:
$ ./make10 7 6 9 5
(6,Plus,9,Divide,5,Plus,7)
(9,Plus,6,Divide,5,Plus,7)
-}
import System.Environment
import Control.Monad
import Data.List
(import concurrent.futures)
(import sys)
(import subprocess)
(import time)
(import [collections [defaultdict]])
(import [data [sentences]])
(defn sent2kgram [sentence &optional [k (int "2")] [delimiter " "]]
(setv sentence (str (.getoutput subprocess (.format "echo {0} | mecab -O wakati" sentence))))
var contEach = function(arr,f) {
if (arr.length == 0) {return;}
var next = function(){contEach(arr.splice(1),f);}
f(arr[0], next);
}
// Example
contEach(queries, function(query, next){
$.get("https://www.google.co.jp/search?q="+query,function(body){
// some process with body

class: center, middle #Gist Slide Gist をそのままスライドに


layout: false #Gist Slide

.font-size-large[ Gist Slide は Gist に書かれたmarkdownをそのままremark.jsに渡してスライドにする。ただそれだけのChrome Extensionです。

#include <iostream>
template <int N, int M>
struct is_factor {
static const bool value = N % M == 0;
};
template <int N, int M>
struct divide_test {
static const bool value = !is_factor<N, M>::value && divide_test<N, M-1>::value;
_ = require 'lodash'
item = (cs) ->
if cs == ""
return []
else
return [[cs[0], cs.slice(1)]]
# Monad Methods