Skip to content

Instantly share code, notes, and snippets.

@jcmoore
jcmoore / app.js
Last active August 29, 2015 14:05
datagram udp sockets cause assertion
var cluster = require('cluster'),
logger = {
debug: function () {
return console.log.apply(console, arguments);
},
error: function () {
return console.log.apply(console, arguments);
},
};
@jcmoore
jcmoore / esrange.js
Last active August 29, 2015 14:16
pull character ranges of specified node types from AST
var esprima = require("esprima"),
estraverse = require("estraverse");
console.log(JSON.stringify(esrange(esprima.parse(esrange.toString(), {
range: true
})), null, 4));
/*
[
{
@jcmoore
jcmoore / hypothetical-wd-bluebird.js
Created July 1, 2015 08:59
Speculative use of bluebird coroutines with promise-based webdriver
// originally from -- https://github.com/admc/wd/blob/311c39ff2a2a3005405bc5872f420b359a5aa397/examples/promise/no-chain.js
require('colors');
var chai = require("chai");
chai.should();
var wd;
try {
wd = require('wd');
} catch( err ) {
wd = require('../../lib/main');
@jcmoore
jcmoore / index.html
Created August 1, 2015 01:00
Polymer/Polymer issue #2181
<html>
<head>
<script src="https://rawgit.com/webcomponents/webcomponentsjs/master/webcomponents.js"></script>
<link rel="import" href="https://rawgit.com/Polymer/polymer/master/polymer.html">
</head>
<body>
<dom-module id="x-view">
<template>
<span>(</span><span>{{id}}</span><span> template)</span>
@jcmoore
jcmoore / Dockerfile
Last active August 29, 2015 14:26
luvit in alpine linux
FROM alpine:3.2
RUN apk --update add git perl cmake alpine-sdk linux-headers openssl-dev pcre-dev
RUN mkdir /git \
&& git clone --recursive https://github.com/luvit/luvi.git /git/luvi
RUN echo '#!/bin/sh' > /usr/bin/entrypoint \
&& echo '# shebang directives mandatory for entrypoint scripts' >> /usr/bin/entrypoint \
&& echo 'LUVI_VERSION=${1} LUVI_MAKE=${2} sh /shared/make_luvi' >> /usr/bin/entrypoint \
&& chmod +x /usr/bin/entrypoint
VOLUME ["/shared"]
@jcmoore
jcmoore / main.go
Last active August 29, 2015 14:26
typeof: a go tool
package main
import (
"fmt"
"os"
"go/ast"
"go/token"
"log"
"strings"
@jcmoore
jcmoore / index.html
Last active August 29, 2015 14:27
polymer binding problem
<html>
<head>
<script src="https://rawgit.com/webcomponents/webcomponentsjs/master/webcomponents.js"></script>
<link rel="import" href="https://rawgit.com/Polymer/polymer/master/polymer.html">
</head>
<body>
<dom-module id="x-model">
<template>
<span>(</span><span>{{id}}</span><span>)</span>
/*
Copyright (c) jQuery Foundation, Inc. and Contributors, All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
<link rel="import" href="../polymer/polymer.html">
<dom-module id="bower-2">
<template>
<div>This is bower-2</div>
</template>
<script>
HTMLImports.whenReady(function() {
Polymer({
is: "bower-2",
<link rel="import" href="../polymer/polymer.html">
<dom-module id="bower-1">
<template>
<span>This is bower-1</span>
</template>
<script>
HTMLImports.whenReady(function() {
Polymer({
is: "bower-1",