Skip to content

Instantly share code, notes, and snippets.

View jlongster's full-sized avatar
💭
Workin on my app

James Long jlongster

💭
Workin on my app
View GitHub Profile
for(var i=0; i<10; i++) {
try {
var z = 0;
break;
}
catch(e) {
console.log(e);
}
finally {
console.log('gosh, finally');
@jlongster
jlongster / Gruntfile.js
Last active August 29, 2015 13:56
example Gruntfile for grunt-sweet.js
module.exports = function(grunt) {
grunt.initConfig({
sweetjs: {
options: {
modules: ['es6-macros'],
sourceMap: true,
nodeSourceMapSupport: true
},
src: {
Now I can do this:
% ./build/bin/sjs -p -n 1 destructure.sjs
destruct_next var ( arr ) [ x , y ];
Whereas it used to throw an error because it kept trying to convert to a TermTree:
% ./bin/sjs -p -n 1 destructure.sjs
/Users/james/projects/sweet.js/lib/sweet.js:99
;; unicode in terminals
(defadvice multi-term (after advise-ansi-term-coding-system)
(set-buffer-process-coding-system 'utf-8-unix 'utf-8-unix))
(ad-activate 'multi-term)
;; no bell
(setq visible-bell nil)
macro foo1 {
rule { $x } => {
var $x
}
}
let var = macro {
rule { $x } => {
bar($x)
}
macro _update {
rule { ( .push($val) ) } => {
{ $push: $val }
}
rule { ( .unshift($val) ) } => {
{ $unshift: $val }
}
@jlongster
jlongster / app.js
Last active August 29, 2015 13:57
var dom = React.DOM;
var App = React.createClass({
getInitialState: function() {
return { todos: [] };
},
addTodo: function() {
this.setState(update(this.state) {
todos.push({ value: 'hello' });
macro _string {
case { _ $x } => {
var stx = #{$x};
var val = stx[0].token.value;
return [makeValue(val, #{_})];
}
}
macro foo {
rule { $x } => {
@jlongster
jlongster / onerror.js
Last active August 29, 2015 13:57
onerror
window.onerror = function(msg, url, line, col, err) {
console.log(err);
};
// #1 - err is null:
function foo1() {
var x = null
x.foo;
}
*** You have joined channel #webcomponents [12:03]
*** Users on #webcomponents: jlongster jkomoros_ ericbidelman Guest76083
joshbavari geekles pickachu cyee GeekShadow Ablu brainproxy qmx
kcherkashin__ eddh dfreedm higgins dglazkov mmalecki Domenic_ leptonix
addyo mathiasbynens sindresorhus thiagopnts Tudmotu1 bterlson theefer
kentaromiura
*** #webcomponents modes: +cnt
*** #webcomponents was created on 2012-06-29 09:34:49
<dglazkov> yay jlongster!!!
<jlongster> haha hi!