Skip to content

Instantly share code, notes, and snippets.

View copenhas's full-sized avatar

Sean Copenhaver copenhas

  • Amazon, Inc.
  • Colorado
View GitHub Profile
@copenhas
copenhas / Tupfile
Created March 25, 2014 17:09
Playing around with Tup
: foreach app/*.coffee |> ./node_modules/coffee-script/bin/coffee -c -o _build/coffee/ %f |> _build/coffee/%B.js
: foreach _build/coffee/*.coffee |> ./node_modules/istanbul/lib/cli.js --output _build/instrumented/ %f |> _build/instrumented/%B.js
@copenhas
copenhas / router.js
Created April 7, 2014 03:17
A couple of hacks in the Traceur compiler was able to get named AMD modules without the localizing `./`
define("app/router", [], function() {
"use strict";
var __moduleName = "app/router";
var Router = Ember.Router.extend({location: 'history'});
Router.map(function() {});
var $__default = Router;
return {
get default() {
return $__default;
},
{ urlRoot: '/', file: '_build/dev/index.html' } ' -> ' '_build/dev/index.html'
{ urlRoot: '/', directory: '_build/dev' } ' -> ' '_build/dev/index.html'
events.js:72
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at errnoException (net.js:904:11)
at TCP.onread (net.js:558:19)
....
#region StateMachine
static ServiceController()
{
Define(() =>
{
Initially(
When(OnStart)
" When we fold or unfold a block of text determine the block
" delimiters via syntax. You can use 'za' to toggle a fold.
" There are several other commands as well.
" 'zM' to close all folds
" 'zR' to open all folds
set foldmethod=syntax
" Lets map 'za' to spacebar while in NORMAL mode
nnoremap <space> za<space>
@copenhas
copenhas / vimlang.mkd
Created November 11, 2010 21:12
Excerpt from my VIM presentation - the language of editing

Language of Text Editing

vimsentence := [count]vimexpression

vimexpression := vimcommand | <operator><motion>

vimcommand := <action> | <motion>

That is while in NORMAL mode

WTF? (examples)

Delete next 3 words: 3dw

Nonterminals expression.
Terminals number '+' '-' '/' '*' '(' ')'.
Rootsymbol expression.
Endsymbol '$end'.
Left 300 '+'.
Left 300 '-'.
Left 400 '*'.
Left 400 '/'.
[0-9]+ :
{token, {number, TokenLine, list_to_integer(TokenChars)}}.
[0-9]+\.[0-9]+ :
{token, {number, TokenLine, list_to_float(TokenChars)}}.
\+ : {token, {'+', TokenLine}}.
\- : {token, {'-', TokenLine}}.
/ : {token, {'/', TokenLine}}.
\* : {token, {'*', TokenLine}}.
-module(generator).
-export([generate/1]).
generate([Root, Left, Right]) ->
LeftExp = generate(Left),
RightExp = generate(Right),
RootExp = generate(Root),
LeftExp ++ RightExp ++ RootExp;
generate({number, _Line, Value}) ->
{ok, Tokens, _EndLine} = lexical:string("2 + 1 * 3").
{ok, Ast} = grammar:parse(Tokens).
Program = generator:generate(Ast).
vm:start().
vm:load(Program).
vm:stop().
receive {return, Value} => Value end.