Skip to content

Instantly share code, notes, and snippets.

View bryanforbes's full-sized avatar

Bryan Forbes bryanforbes

View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Button test</title>
<link rel="stylesheet" href="dijit/themes/claro/claro.css">
</head>
<body>
<button id="button" type="button" data-dojo-type="dijit/form/Button">My Button</button>
/// ice/logging/advanced.js
define(function (require, exports) {
exports.log = function (message, options) {
// ...
};
exports.error = function (message, options) {
// ...
};
});
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Test</title>
<style>
#test {
width: 300px;
height: 300px;
@bryanforbes
bryanforbes / hostit.zsh
Created March 26, 2013 15:46
Placed in ~/.zsh/functions/hostit
# vim: set filetype=zsh:
if [[ $# -eq 0 ]]; then
echo "Usage: hostit [-l] [[-d -f] hostname]"
return
fi
REMOVE_HOST=0
FORCE_HOST=0
LIST_HOSTS=0
function secretSanta(array) {
var year = (new Date).getYear(),
offset = year % array.length,
map = {};
array.forEach(function (item, index) {
map[item] = array[index + offset] || array[array.length - (index + offset)];
});
return map;
@bryanforbes
bryanforbes / css-user-select.js
Created November 29, 2012 15:22
css-user-select
has.add("css-user-select", function(global, doc, element){
var style = element.style;
if(typeof style.userSelect !== "undefined"){
// Unlikely; user-select is non-standard, but might as well be future-proof...
return "userSelect";
}
var prefixes = ["Khtml", "O", "ms", "Moz", "Webkit"],
i = prefixes.length,
prefix, name;
@bryanforbes
bryanforbes / cmd.js
Created October 23, 2012 16:57
bdLoad Dojo node command line
#!/usr/bin/env node
var repl = require('repl'),
vm = require('vm'),
useGlobal = true;
function evalWithHistory(code, context, file, callback){
// TOOD: write history saving routines
var err, result;
try{
if(useGlobal){
@bryanforbes
bryanforbes / cmd.js
Created October 22, 2012 18:11
Dojo node command line
#!/usr/bin/env node
var repl = require('repl'),
vm = require('vm'),
useGlobal = true;
function evalWithHistory(code, context, file, callback){
// TOOD: write history saving routines
var err, result;
try{
if(useGlobal){
@bryanforbes
bryanforbes / hostit.sh
Created October 15, 2012 14:56
hostit
# vim: set filetype=zsh:
if [[ $# -eq 0 ]]; then
echo "Usage: hostit [-l] [[-d -f] hostname]"
return
fi
REMOVE_HOST=0
FORCE_HOST=0
LIST_HOSTS=0
@bryanforbes
bryanforbes / data.js
Created October 3, 2012 16:51
data-* bindings for Dojo
define([
'exports',
'dojo/has',
'dojo/dom'
], function(exports, has, dom){
has.add('dom-dataset', function(global, document, element){
return typeof element.dataset === 'object' && !!element.dataset;
});
var ccRE = /(-+)([^-])/g;