Examples and such to accompany J. Ashkenas' dotJS talk.
{ok} = require 'assert'| {spawn} = require 'child_process' | |
| fs = require 'fs' | |
| task "build", "watch and build the source", -> | |
| compiler = spawn 'coffee', ['-cw', '.'] | |
| compiler.stdout.on 'data', (data) -> console.log data.toString().trim() | |
| compiler.stderr.on 'data', (data) -> console.error data.toString().trim() | |
| # Render your literate source as a GH-highlight-able code-fenced README (a tweak of journo's Cakefile) | |
| task "readme", "render index as README", -> |
| task 'test', 'run the test suite', -> | |
| runTests() | |
| # Simple test runner, ripped from the docco Cake file. | |
| runTests = -> | |
| global.Main = require './main' # rename/require module to be tested | |
| require 'coffee-script' | |
| startTime = Date.now() | |
| currentFile = null | |
| currentTest = null |
| # My base ~/.bash_profile | |
| SHELL=/bin/bash | |
| PS1='\[\033[0;32m\]\w\[\033[0;33m\]$\[\033[0m\] ' # colored version of '\w\$ ' | |
| PS2='> ' | |
| ENV=~/.bashrc | |
| PROFILE=~/.bash_profile | |
| PATH=.:/usr/local/share/python:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/ | |
| sbin:/usr/X11/bin:/usr/texbin |
| /* basic */ | |
| #foo {} /* id */ | |
| .bar {} /* class */ | |
| a#foo.bar {} /* element attribute combinations */ | |
| /* attributes */ | |
| #foo a[href] {} /* simple */ | |
| #foo a[href=bar] {} /* attribute values */ | |
| #foo a[lang|=en] {} /* subcodes */ | |
| #foo a[title~=hello] {} /* attribute contains */ |
| <!DOCTYPE html> | |
| <meta charset="utf-8"> | |
| <style> | |
| @import url(http://fonts.googleapis.com/css?family=Source+Code+Pro:200,400,600); | |
| html { | |
| min-width: 1040px; | |
| } | |
| body { |
Examples and such to accompany J. Ashkenas' dotJS talk.
{ok} = require 'assert'| % marko.coffee -x try.python.md > try.py | |
| % python try.py | |
| hello world! | |
| yes! | |
| % marko.coffee -x try.python.md | python -s | |
| hello world! | |
| yes! |
| # Makefile for building/versioning data backend | |
| VERSION := $(shell cat VERSION) | |
| .PHONY: svn all clean | |
| all: svn joy.db update | |
| svn: | |
| svn update |