Skip to content

Instantly share code, notes, and snippets.

View neonstalwart's full-sized avatar

Ben Hockey neonstalwart

  • google.com
  • Boulder, CO
View GitHub Profile
@neonstalwart
neonstalwart / findFirst.js
Last active December 17, 2015 11:19
use SimpleQueryEngine to find the first match in an array
define([
'dojo/_base/array',
'dojo/store/util/SimpleQueryEngine'
], function (array, SimpleQueryEngine) {
return function findFirst(arr, query) {
var matches = SimpleQueryEngine(query).matches,
found;
array.some(arr, function (it) {
@neonstalwart
neonstalwart / define.sublime-snippet
Last active December 17, 2015 08:38
a couple of useful dojo ST2 snippets
<snippet>
<content><![CDATA[
define([
${1:'dojo/_base/declare'}
], function (${2:declare}) {
return declare(${3});
});
]]></content>
@neonstalwart
neonstalwart / pf.conf
Created March 26, 2013 16:37
this adds some virtualbox support to https://gist.github.com/neonstalwart/5246494
# /etc/pf.conf
scrub-anchor "com.apple/*"
nat-anchor "com.apple/*"
nat on { en0 en1 } from 192.168.56.0/24 to any -> { (en0) (en1) }
rdr-anchor "com.apple/*"
dummynet-anchor "com.apple/*"
anchor "com.apple/*"
load anchor "com.apple" from "/etc/pf.anchors/com.apple"
@neonstalwart
neonstalwart / config
Last active December 15, 2015 10:29
my nginx *.dev config - the first line in each file is the full path to the file because gists don't give enough context. see https://gist.github.com/neonstalwart/5246908 for some extra config for virtualbox (not included here because it's ugly)
# /usr/local/etc/nginx/common
index index.html index.htm index.json;
if_modified_since before;
location ~ /\.(svn|git|ht) {
deny all;
}
@neonstalwart
neonstalwart / test.js
Created August 9, 2012 05:03
separated concerns (presentation model)
define([
'compose/compose',
'dojo/Stateful',
'dojo/on'
], function (compose, Stateful, on) {
// TODO:
// * need a helper like this.own to help manage handles from eg watch and on
// * need a lifecycle - at least destroy/dispose
@neonstalwart
neonstalwart / dylan.profile.js
Created May 30, 2012 21:26 — forked from dylans/dylan.profile.js
Build profile draft
function copyOnly(mid) {
return (/test/.test(mid) && mid !== 'dgrid/test/data/perf') || mid in {
// There are no modules right now in dojo boilerplate that are copy-only. If you have some, though, just add
// them here like this:
// 'app/module': 1
};
}
var profile = {
basePath: './',
@neonstalwart
neonstalwart / test.html
Created April 9, 2012 15:28
dojo/hash in android
<!DOCTYPE html>
<html class="mobile dj_phone android_theme">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
<title>Populizr Mobile</title>
<link rel="stylesheet" href="populizr.css" type="text/css" />
<link rel="stylesheet" href="js/release/dojo/dojox/mobile/themes/android/android.css" type="text/css" />
</head>
<body>
$ java -jar shrinksafe.jar test.js
define(["dojo/_base/declare","dojo/domReady"],function(_1,_2){
var _3,_4="",_5=function(_6){
_3.innerHTML=(_4+=_6+"<br>");
},A=_1(null,{go:function(){
_5("A");
}}),B=_1([A],{go:function longerName(){
this.inherited(_7,arguments);
_5("B");
}});
@neonstalwart
neonstalwart / sample.dojo.html
Created December 9, 2011 03:34
dojo npmish - off the top of my head
<script>
var require = {
// adjust to root of https://github.com/pmuellr/sample-npmish-project
baseUrl: 'npmish',
packages: [
{
name: 'a',
location: 'node_modules/a',
main: 'a.js',
packageMap: {
@neonstalwart
neonstalwart / variables.less
Created September 22, 2011 19:28
claro theme simplified to a few variables (almost perfect match)
@claro-text: #000;
@claro-background: #fff;
// other colors are calculated based on these two
@claro-primary: #cfe5fa;
@claro-error: #d46464;