some tools for diagrams in software documentation
window.console.loge = function (msg) { | |
var gifs = ['wink','shake-space','peepers','prizza','hat','gradient','fat','rainbow','sunglasses','derp','shake'], | |
wow = ['', 'wow! ', 'amaze! ', 'dazzle! '], | |
adjs = ['so', 'such', 'many', 'much', 'very'], | |
randomizr = function (a) { return a[Math.floor(Math.random() * a.length)];}, | |
message = '%c ' + randomizr(wow) + randomizr(adjs) + ' ' + typeof msg + ': ', | |
css = 'background: url(http://d1e3ezyatlol8u.cloudfront.net/img/212/doge-' + randomizr(gifs) + '-212.gif) no-repeat 0 0; background-size: 80px 80px; font-family: \'Comic Sans MS\', cursive; text-shadow: 0 1px 1px rgba(0,0,0,1); font-size: 14px; padding: 25px; line-height: 70px; color: #fff; font-weight: 100;'; | |
console.log.apply(console, typeof msg === 'object' ? [message, css, msg] : [message += msg, css]); | |
}; |
Here are a few common tasks you might do in your templates, as they would be written in ExpressionEngine vs. Craft CMS.
// Anonymous empty module. | |
define(); | |
// Anonymous values. | |
define({}); | |
define(true); | |
define(1234); | |
define(null); | |
define(undefined); |
Lately I've been doing a lot of thinking around versioning in repositories. For all the convenience and ubiquity of package.json
, it does sometimes misrepresent the code that is contained within a repository. For example, suppose I start out my project at v0.1.0 and that's what's in my package.json
file in my master branch. Then someone submits a pull request that I merge in - the version number hasn't changed even though the repository now no longer represents v0.1.0. The repository is actually now in an intermediate state, in between v0.1.0 and the next official release.
To deal with that, I started changing the package.json
version only long enough to push a new release, and then I would change it to a dev version representing the next scheduled release (such as v0.2.0-dev). That solved the problem of misrepresenting the version number of the repository (provided people realize "dev" means "in flux day to day"). However, it introduced a yucky workflow that I really hate
require 'json' | |
require 'net/http' | |
# JSON parser tag, creating map for use in jekyll markdown | |
# Alex.Heneveld @ Cloudsoft Corp (remove spaces and add the .com) | |
# Released under APL 2.0 | |
# usage: {% jsonball varname from TYPE PARAM %} | |
# | |
# where TYPE is one of {data,var,file,page}, described below |
I wrote this in early January 2012, but never finished it. The research and thinking in this area led to a lot of the design of Yeoman and talks like "Javascript Development Workflow of 2013", "Web Application Development Workflow" and "App development stack for JS developers" (surpisingly little overlap in those talks, btw).
Now it's June 2013 and the state of web app tooling has matured quite a bit. But here's a snapshot of the story from 18 months ago, even if a little ugly and incomplete. :p
- Intro to tooling
stopBefore(document, 'getElementById')
stopBefore('document.getElementById') // the same as the previous
stopBefore(Element.prototype, 'removeChild')
env = (function() { | |
var flags = {}, ua = navigator.userAgent, el = document.createElement('div'), video = document.createElement('video'), audio = document.createElement('audio'), root = document.documentElement, i | |
function flag(names) { | |
names = names.split(' ') | |
for (i = 0; i < names.length; i++) | |
flags[names[i]] = true | |
} | |
function classnames() { | |
var names = [], name | |
for(name in flags) if (flags.hasOwnProperty(name)) |