Skip to content

Instantly share code, notes, and snippets.

@isaiah
isaiah / url.text
Created May 22, 2018 11:19
printer driver
https://drive.google.com/open?id=1_pL0-pWX833hISo__Ho-Z3KkW-eePFsQ
@isaiah
isaiah / __class__.md
Created June 3, 2016 10:21
Question regarding __class__ closure
From b34d733deefac7fb7f96bf5408ae705c49e764fa Mon Sep 17 00:00:00 2001
From: Isaiah Peng <issaria@gmail.com>
Date: Fri, 4 Mar 2016 11:17:40 +0100
Subject: [PATCH 1/1] include jquery and materializecss for test
---
karma.conf.js | 2 ++
package.json | 2 ++
src/Select.js | 67 ++++++++++++++++++++++++++++++-----------------------------
3 files changed, 38 insertions(+), 33 deletions(-)
@isaiah
isaiah / convert.rb
Created December 28, 2015 17:43
Replace file name with metadata
require 'fileutils'
require 'taglib'
NAME = "©nam"
Dir.glob("./**/*.m4a").each do |f|
TagLib::MP4::File.open(f) do |mp4|
name = mp4.tag.item_list_map[NAME]
name = name.to_string_list.first
dir = File.dirname(f)
name = "#{dir}/#{name}.m4a"
@isaiah
isaiah / keymap.cson
Created December 27, 2015 09:08
arch migration
'atom-text-editor[data-grammar~="haskell"]':
'': 'haskell-ghc-mod:check-file'
'': 'haskell-ghc-mod:lint-file'
'ctrl-alt-t': 'haskell-ghc-mod:show-type'
'ctrl-alt-i': 'haskell-ghc-mod:show-info'
'ctrl-alt-T': 'haskell-ghc-mod:insert-type'
'': 'haskell-ghc-mod:show-info-fallback-to-type'
'ctrl-alt-I': 'haskell-ghc-mod:insert-import'
'body':
@isaiah
isaiah / gist:05e1f44346bfb11df89c
Created June 1, 2015 14:04
My Vimium bindings
# Insert your prefered key mappings here.
unmap h
unmap l
map h previousTab
map l nextTab
map u restoreTab
map d removeTab
map b Vomnibar.activateTabSelection
map t Vomnibar.activateInNewTab
@isaiah
isaiah / keyword_param.rb
Created February 17, 2015 14:51
scalable keyword parameter declaration
class Base
def xtest(foo:, bar:, **extra)
puts "base: #{foo}, #{bar}"
end
end
class Artzt < Base
def xtest(foo:, bar:, blah:)
super
puts "child: #{foo}, #{bar} #{blah}"
@isaiah
isaiah / vimperator
Created January 9, 2015 21:37
Custom key mappings to turn Vimium into vimperator
unmap h
unmap l
map h previousTab
map l nextTab
map u restoreTab
map d removeTab
map b Vomnibar.activateTabSelection
map t Vomnibar.activateInNewTab
map <c-o> goBack
@isaiah
isaiah / lazy.rb
Last active August 29, 2015 14:10
Pure ruby implementation of lazy enumerator
class Enumerator
class Lazy
def initialize(coll)
@lazy = Yid.new do |yielder|
if block_given?
coll.each do |x|
yield yielder, x
end
else
@isaiah
isaiah / fib.rb
Created November 26, 2014 14:17
Lazy evaluated fibonacci sequence
class Fib
def self.fib
a, b = [0, 1]
s = 1..Float::INFINITY
Enumerator::Lazy.new(s.lazy) do |yielder, val|
a, b = b, a + b
yielder << a
end
end
end