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
import Foundation | |
public protocol Observer: Equatable { | |
associatedtype EventType | |
func listen(_ event: EventType) | |
} | |
public protocol Observable { | |
associatedtype ObserverType: Observer | |
associatedtype EventType |
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
require 'erb' | |
title = ARGV[0] | |
categories = ARGV[1] | |
now = Time.new() | |
file_name = "#{now.strftime('%Y-%m-%d')}-#{title}.markdown" | |
puts "title: #{file_name}" |
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/env ruby | |
require 'xcodeproj' | |
lang = ARGV[0] | |
if lang.nil? | |
puts "no language is specified" | |
exit 1 | |
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
protocol ObserverProtocol: Equatable { | |
func notified() | |
} | |
class Observable: NSObject { | |
var observers: [ObserverProtocol] = [] | |
override init() { | |
super.init() | |
} | |
func addObserver(observer: ObserverProtocol) { |
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
esprima = require 'esprima' | |
escodegen = require 'escodegen' | |
estraverse = require 'estraverse' | |
fs = require 'fs' | |
_funcID = 0 | |
logger = (funcID, fileName, node, parent, loc) -> | |
name = 'anonymous' | |
if node.id? |
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
esprima = require 'esprima' | |
escodegen = require 'escodegen' | |
fs = require 'fs' | |
estraverse = require('estraverse') | |
source = process.argv[2] | |
fs.readFile source, (err, origCode) -> | |
logger = esprima.parse( | |
'console.log("trace: " + arguments.callee.name, arguments);' |
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 = require 'http' | |
fs = require 'fs' | |
url = require 'url' | |
path = require 'path' | |
port = process.argv[2] || 8888; | |
mime = | |
".html": "text/html", | |
".css" : "text/css", | |
".js" : "application/javascript", |
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
#include <cstdio> | |
#include <algorithm> | |
#include <cassert> | |
using namespace std; | |
int main() | |
{ | |
int count; | |
scanf("%d", &count); |
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 DOMTreeUtil = (function() { | |
var visitAll = function(root, func) { | |
_visit(root, func); | |
}; | |
var _visit = function(elem, func) { | |
if (!elem.hasChildNodes) return; | |
var i, l; | |
var child = elem.childNodes; | |
for (i = 0, l = child.length; i < l; i++) { | |
func(child[i]); |
NewerOlder