Skip to content

Instantly share code, notes, and snippets.

View smt's full-sized avatar

Stephen Tudor smt

View GitHub Profile
@smt
smt / output.txt
Created September 25, 2012 03:12
Default Yeoman custom generator can't find globally-installed Yeoman when run
~ ❯ mkdir test && cd test
~/test ❯ yeoman init generator foo
Running "init:yeoman" (init) task
This task will create one or more files in the current directory, based on the
environment and the answers to a few questions. Note that answering "?" to any
question will show question-specific help and answering "none" to most questions
will leave its value blank.
"yeoman" template notes:
snippet get "Get Elements"
getElement${1/(T)|.*/(?1:s)/}By${1:T}${1/(T)|(I)|.*/(?1:agName)(?2:d)/}('$2')
endsnippet
snippet '':f "object method string"
'${1:${2:#thing}:${3:click}}': function(element){
$0
}${10:,}
endsnippet
// credit: http://davidshariff.com/blog/javascript-inheritance-patterns/
(function () {
'use strict';
/***************************************************************
* Helper functions for older browsers
***************************************************************/
if (!Object.hasOwnProperty('create')) {
Object.create = function (parentObj) {
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.07884746789932251</real>
<key>Green Component</key>
<real>0.081504985690116882</real>
table.ranks tr {
background: red;
color: white;
}
@smt
smt / ok.cljs
Last active August 29, 2015 14:01
Clojure learnings...
;; let expression is an IIFE (provides lexical scope)
(let [name "Vick"
msg "Much appreciated"]
(println (str "Thanks, " name))
(println msg))
;; => Thanks, Vick
;; => Much appreciated!
@smt
smt / im.js
Created May 20, 2014 17:04
node + imagemagick example
var im = require('imagemagick-native');
var fs = require('fs');
var buffer = fs.readFileSync('./test.gif');
// test.gif --> http://c.2dr.me/Vckz
var resizedBuffer = im.convert({
srcData: buffer,
width: 48,
height: 48,
@smt
smt / stache.js
Last active August 29, 2015 14:08
Stache
(function (window, document, undefined) {
"use strict";
var _cache;
var _local = window.localStorage;
var _session = window.sessionStorage;
/**
* Validate a well-formed cache/storage object (used internally).
* @function
class RouterModel extends Store.Model {
constructor() {
this.defaults = {
route: conf.ROUTE_DEFAULT,
params: []
};
super();
}
initialize() {
@smt
smt / index.html
Last active May 29, 2017 11:49
Mesmerizing
<!DOCTYPE html>
<html>
<!--
Based on: http://www.reddit.com/r/gifs/comments/2on8si/connecting_to_server_so_mesmerizing/
See also: http://codepen.io/anon/pen/OPMvOb
http://jsbin.com/xecosiyomo/1/edit?js,output
-->
<head>
<title>Mesmerizing</title>
<style>