Skip to content

Instantly share code, notes, and snippets.

Satoshi Murakami satyr

Block or report user

Report or block satyr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@blendmaster
blendmaster / gist:1897787
Created Feb 24, 2012
.hack assembler main logic in coco
View gist:1897787
code = input
.replace /\/\/.*/gm '' # remove comments
.trim!
.split /\s+/ # turn into lines
.filter (it, i) -> # build symbol table and remove labels
if it.match /\(([A-Za-z\._$:][\w\.$:]*)\)$/ # that[1] is the first capturing group
symbols[that[1]] = i - len++ # len++ adjusts the symbol's line number to the filtered array
return false
true # keep actual instructions
.map -> # parse instructions
@liaody
liaody / coffeescript_gotcha.md
Created Jan 12, 2012
Coffeescript gotchas when migrating from javascript
View coffeescript_gotcha.md

Here are some of the "gotchas" I've encountered when I converted all the javascript code into coffeescript. (BTW, this is gathered while coding for YourMechanic.com, a very cool mobile auto repair service.)

Disclaimer: Coffeescript is a great productivity booster for me personally. Even with all the things outlined below, it is still way better than javascript. None of these should discourage you from jumping into it right away.

Major gotchas

(Things that generate wrong code silently)

View gist:1444629
_ = require 'underscore'
{Assign, Value, Literal, Access, Block, Class, Op, Obj, Arr, For, Index, Call, Return, If, Throw} = nodes = require '../nodes'
exports.originals = originals = {}
exports.codeblock = codeblock = (block) ->
return block unless block?
if typeof block is 'function'
@BrendanEich
BrendanEich / minimalist-classes.js
Created Nov 1, 2011 — forked from jashkenas/minimalist-classes.js
less minimalism, richer leather
View minimalist-classes.js
// A response to jashkenas's fine proposal for minimalist JavaScript classes.
// Harmony always stipulated classes as sugar, so indeed we are keeping current
// JavaScript prototype semantics, and classes would only add a syntactic form
// that can desugar to ES5. This is mostly the same assumption that Jeremy
// chose, but I've stipulated ES5 and used a few accepted ES.next extensions.
// Where I part company is on reusing the object literal. It is not the syntax
// most classy programmers expect, coming from other languages. It has annoying
// and alien overhead, namely colons and commas. For JS community members who
@youz
youz / gist:1295813
Created Oct 18, 2011
lazy-kq.co - lazy-kq interpreter on Coco
View gist:1295813
function LazyKQ src, stdin
S = (x)->(y)->(z)-> x(z)(y(z))
K = (x)->(y)-> x
I = -> it
cons = (x)->(y)->(f)-> f(x)(y)
succ = (n)->(f)->(x)-> f(n(f)(x))
cnums = [(f)->(x)-> x]
for i from 1 to 256
@thejh
thejh / bot.coffee
Created Aug 14, 2011
My IRC bot, jhbot
View bot.coffee
coffee = require 'coffee-script'
https = require 'https'
npm = require 'npm'
Irc = require 'irc-js'
cradle = require 'cradle'
{GitHubApi} = require 'github'
request = require 'request'
gitHubApi = new GitHubApi()
githubIssueApi = gitHubApi.getIssueApi()
githubObjectApi = gitHubApi.getObjectApi()
@0mg
0mg / reanagol.md
Last active Oct 16, 2019
anagolog
View reanagol.md
View coffee-maker.js
// Coffee Script compiler wrapper for WSH JScript (must be placed in the same directory as coffee-script.js)
// Usage: cscript coffee-maker.js [--watch] file
// inspired by http://kennyj-jp.blogspot.com/2011/01/coffeescriptwindows.html
var fs = WScript.CreateObject("Scripting.FileSystemObject");
var scriptPath = WScript.ScriptFullName.slice(
0, -WScript.ScriptName.length);
eval(fs.OpenTextFile(scriptPath + "coffee-script.js", 1).ReadAll());
function compileFile(file) {
@xulapp
xulapp / Bug330458.uc.js
Created Apr 3, 2011
document.loadOverlay
View Bug330458.uc.js
// ==uc==
// @include *
// @exclude chrome://browser/content/preferences/preferences.xul
// ==/uc==
(function Bug330458() {
var orgLoadOverlay = document.loadOverlay;
var queue = [];
var loading = false;
@paulp
paulp / x.js
Created Jan 31, 2011 — forked from tssm0n/x.js
View x.js
CmdUtils.CreateCommand({
names: ["java"],
arguments: [{role: "object",
nountype: noun_arb_text,
label: "search criteria"}],
icon: "http://www.sun.com/favicon.ico",
preview: "Searches The Java 6 API.",
help: "Enter the name of the Java class or package for which you would like to see the documentation.",
author: {name: "KS", email: "tss@cornbread.com"},
You can’t perform that action at this time.