As configured in my dotfiles.
start new:
tmux
start new with session name:
| /*! | |
| * Dynamically changing favicons with JavaScript | |
| * Works in all A-grade browsers except Safari and Internet Explorer | |
| * Demo: http://mathiasbynens.be/demo/dynamic-favicons | |
| */ | |
| // HTML5™, baby! http://mathiasbynens.be/notes/document-head | |
| document.head || (document.head = document.getElementsByTagName('head')[0]); | |
| function changeFavicon(src) { |
| // Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible). | |
| // Tweak the makePrettyJSON_ function to customize what kind of JSON to export. | |
| var FORMAT_ONELINE = 'One-line'; | |
| var FORMAT_MULTILINE = 'Multi-line'; | |
| var FORMAT_PRETTY = 'Pretty'; | |
| var LANGUAGE_JS = 'JavaScript'; | |
| var LANGUAGE_PYTHON = 'Python'; |
As configured in my dotfiles.
start new:
tmux
start new with session name:
| var p1 = { | |
| x: 20, | |
| y: 20 | |
| }; | |
| var p2 = { | |
| x: 40, | |
| y: 40 | |
| }; |
| /** | |
| * Given "0-360" returns the nearest cardinal direction "N/NE/E/SE/S/SW/W/NW" | |
| */ | |
| export function getCardinal(angle) { | |
| /** | |
| * Customize by changing the number of directions you have | |
| * We have 8 | |
| */ | |
| const degreePerDirection = 360 / 8; |
| /* | |
| limitLoop.js - limit the frame-rate when using requestAnimation frame | |
| Released under an MIT license. | |
| When to use it? | |
| ---------------- | |
| A consistent frame-rate can be better than a janky experience only | |
| occasionally hitting 60fps. Use this trick to target a specific frame- | |
| rate (e.g 30fps, 48fps) until browsers better tackle this problem |
| function random_text( $type = 'alnum', $length = 8 ) | |
| { | |
| switch ( $type ) { | |
| case 'alnum': | |
| $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
| break; | |
| case 'alpha': | |
| $pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
| break; | |
| case 'hexdec': |
| Usage: | |
| var myLatLng = new google.maps.LatLng(point.lat, point.lng); | |
| var myMarker = new CustomMarker(myLatLng,map); | |
| Implementation (mostly from googles example): | |
| function CustomMarker(latlng, map) { | |
| this.latlng_ = latlng; |
| See my DASH-IF presentation from October, 2014: | |
| https://s3.amazonaws.com/misc.meltymedia/dash-if-reveal/index.html#/ | |
| 1. encode multiple bitrates with keyframe alignment: | |
| ffmpeg -i ~/Movies/5D2_Portrait.MOV -s 1280x720 -c:v libx264 -b:v 1450k -bf 2 \ | |
| -g 90 -sc_threshold 0 -c:a aac -strict experimental -b:a 96k -ar 32000 out.mp4 | |
| My input was 30 fps = 3000 ms. If it were 29.97, then a GOP size of 90 frames will yield a base segment | |
| size of 3003 milliseconds. You can make the segment size some multiple of this, e.g.: 6006, 9009, 12012. |
| /* | |
| ** Copyright (c) 2012, Romain Dura romain@shazbits.com | |
| ** | |
| ** Permission to use, copy, modify, and/or distribute this software for any | |
| ** purpose with or without fee is hereby granted, provided that the above | |
| ** copyright notice and this permission notice appear in all copies. | |
| ** | |
| ** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
| ** WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
| ** MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |