Skip to content

Instantly share code, notes, and snippets.

@tancredi
tancredi / onceAnimationFinished.js
Created October 17, 2013 18:09
Function to attach a callback to the end of the current/next CSS animation. Useful when dealing with chained animations.
function getPrefixedEvents (str) {
var prefixes = [ '', 'webkit', 'o', 'MS', 'moz' ],
out = [],
i, prefix, cur;
for (i = 0; i < prefixes.length; i += 1) {
prefix = prefixes[i];
cur = prefix + str;
if (prefix.length < 2) {
@tancredi
tancredi / zap.zsh-theme
Created October 17, 2013 18:18
Simplest possible oh-my-zsh theme with git branch and dirty flag
#!/usr/bin/env zsh
PROMPT='%{$terminfo[bold]$fg[red]%}> %{$reset_color%}'
RPROMPT='%{$terminfo[bold]$fg[red]%}$(git_prompt_info) %{$fg[green]%}$(echo $USER)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}✗%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_PREFIX="("
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
@tancredi
tancredi / tooltip.stylus
Created October 24, 2013 10:03
Stylus mixin for creation of tooltips with pure CSS tail. Will use the `background-color`, `border-width` and `border-color` properties of the parent element to work out how to define and style the pseudo elements. All you will have to specify is the tail direction and size
tooltip-tail(direction = bottom, color = black, size = 10px)
if direction is bottom
dir = 'top'
top 100%
left 50%
margin-left ( - size )
else if direction is top
dir = 'bottom'
(function () {
var requestAnimFrame = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function (callback) {
setTimeout(callback, 1000 / 60);
},
easing = {
@tancredi
tancredi / boom.js
Created December 11, 2013 00:08
Node.js Super Mario build complete ASCII log
module.exports = function () {
console.log(
' \n\n' +
' ███████ ███████\n' +
' ████------████ ██\n' +
' ██------------██ ██\n' +
' ██------████████████ ██\n' +
' ██------████████████████ ██\n' +
' ██--████ ██████\n' +
' ████████ ██ ██ ██----██ ██████████████████████████████████████████████\n' +
@tancredi
tancredi / boom.coffee
Last active December 30, 2015 23:49 — forked from adlawson/boom.js
module.exports = -> console.log '''
███████ ███████
████------████ ██
██------------██ ██
██------████████████ ██
██------████████████████ ██
██--████ ██████
████████ ██ ██ ██----██ ██████████████████████████████████████████████
██ ████ ██ ██ ██----██ ██ ██
@tancredi
tancredi / extend.js
Last active January 2, 2016 09:59
Quick, stand-alone deep extend implementation
function extend () {
var out = arguments[0],
i, key, obj, val;
for (i = 1; i < arguments.length; i += 1) {
obj = arguments[i];
for (key in obj) {
if (obj.hasOwnProperty(key)) {
val = obj[key];

Kano tech-stack:

  • Stylus
  • Jade
  • Browserify
  • Superangent
  • Vue.js
  • Custom build tools
  • Gulp.js
@tancredi
tancredi / gist:11379407
Last active August 29, 2015 14:00
Waving Kano Judoka ASCII frames
_________
.' '.
/| \
| \_______ \
| / _ \_ |
'-' >- ( ) \./
| _____ | .----.
\ \___/ / ___ .' |
'.__ __.' __----' '. /
_____| |_____----' |----'
@tancredi
tancredi / mirror-text.js
Created May 1, 2014 11:32
Quick script to flip text horizontally (Needed to fix some ASCII art)
var fs = require('fs');
var src = process.argv[2],
out = '',
text;
if (!src) {
console.error('Arguments: source_file');
process.exit(1);
}