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
public class Product implements Cachable{ | |
public Product(String type, String key){ | |
mType = type; | |
mKey = key; | |
} | |
public String cacheId() { | |
return mKey; | |
} |
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
task :my_task => :environment do | |
File.open(ENV['PIDFILE'], 'w') { |f| f << Process.pid } if ENV['PIDFILE'] | |
Model.perform_task! | |
end |
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(w){ | |
// doi.viewController(config) | |
// config.viewDelegate | |
var homeController = doi.ViewController(function(){ | |
// doi.view.TableView(config) | |
// config.tableViewDelegate | |
// config.tableViewDatasource | |
var tableView = doi.view.TableView({ |
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
<!doctype html> | |
<!--[if IE 6]> | |
<html id="ie6" dir="ltr" lang="zh-TW"> | |
<![endif]--> | |
<!--[if IE 7]> | |
<html id="ie7" dir="ltr" lang="zh-TW"> | |
<![endif]--> | |
<!--[if IE 8]> | |
<html id="ie8" dir="ltr" lang="zh-TW"> | |
<![endif]--> |
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
module Memory | |
# sizes are guessed, I was too lazy to look | |
# them up and then they are also platform | |
# dependent | |
REF_SIZE = 4 # ? | |
OBJ_OVERHEAD = 4 # ? | |
FIXNUM_SIZE = 4 # ? | |
# informational output from analysis | |
MemoryInfo = Struct.new :roots, :objects, :bytes, :loops |
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
#!/bin/env ruby | |
# lazy hack from Robert Klemme | |
module Memory | |
# sizes are guessed, I was too lazy to look | |
# them up and then they are also platform | |
# dependent | |
REF_SIZE = 4 # ? | |
OBJ_OVERHEAD = 4 # ? |
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
chrome-cli list links \ | |
| grep localhost:3000 \ | |
| sed -E "s/\\[([0-9]+:)?(.*)\\](.*)/\\2/" \ | |
| xargs -L1 chrome-cli reload -t |
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
{ | |
"name": "my-app", | |
"version": "0.0.0", | |
"dependencies": { | |
"browserify": "~2.36.1", | |
"less": "~1.5.1" | |
}, | |
"devDependencies": { | |
"watchify": "~0.4.1", | |
"catw": "~0.2.0" |
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
func add(x: Int) (_ y: Int) -> Int{ | |
return x + y; | |
} | |
add(1)(2); // 3 |
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
var deepAssignFactory = function(weirdMode){ | |
return function deepAssign(){ | |
var objs = Array.prototype.slice.apply(arguments); | |
return objs.reduce(function(exObj, curObj){ | |
if(Object.keys(curObj).length == 0) return exObj; | |
// merge whatever in curObj to exObj | |
return mergeSecondObjectToFirst(exObj, curObj) | |