Skip to content

Instantly share code, notes, and snippets.

View whatgoodisaroad's full-sized avatar

Wyatt Allen whatgoodisaroad

View GitHub Profile
@whatgoodisaroad
whatgoodisaroad / roar.sh
Created July 18, 2016 01:51
Plays a short video of a roaring tiger three times
#!/bin/bash
for i in {1..3}
do
clear;
echo "--.............-.-..............-.->>:CC\$\$CQCCCCQCC>QQQQQQQHHHQ\$\$\$\$\$\$QQ\$\$\$\$\$CCCC
-::.-:-...:.....................--:>C>\$C>CQCCCCC>\$C\$CQQQHHHHH\$\$\$?7\$\$\$\$QQQ\$\$CC>-.
-................................-!:CCC>>CCC>CQCCCCQQQQQHHHH.-7!!-!:-->-!!---...
-..............................-.--->>>:>\$>CCC>C\$\$CQQQQHHHQ.......:....:C?-.--..
.............-.-..............-.---:>C:>C>>>\$CCCQCCQQQQQC:..-........\$\$QC..-::--
..............-..............--:--->C:>:>>CCCCCCQCCCQCCC-...--.....7CQQC....-:..
@whatgoodisaroad
whatgoodisaroad / gist:7376830
Last active December 27, 2015 19:29
Nondeterminism in Haskell with concatMap

Say we have two deterministic functions:

f :: b -> c
g :: a -> b

f takes a value of type b and deterministically produces a value of type c. g takes a value of type a and deterministically produces a value of type b.

Say we want to make a function h :: a -> c that applies f to the result of

(function($) {
$.validity.outputs.tooltipBelow = {
tooltipClass:"validity-tooltip",
start:function() {
$("." + $.validity.outputs.tooltip.tooltipClass)
.remove();
},
end:function(results) {
@whatgoodisaroad
whatgoodisaroad / gist:5493025
Last active December 16, 2015 20:29
Validity File Size Validation
// This depends on a feature in modern browser as described in:
// http://stackoverflow.com/questions/3717793/javascript-file-upload-size-validation
// Add file uploads to validity's element support:
$.validity.settings.elementSupport += ", :file";
// Create a validator for minimum file size (also requires the file):
// Using assert http://validity.thatscaptaintoyou.com/Demos/index.htm#Assert
$.fn.minFileSize = function(min) {
@whatgoodisaroad
whatgoodisaroad / BigSignificantFigures.js
Created July 10, 2011 02:13
Big numbers can store any number of significant figures
// Creating a Big object is easy, simply pass the number you want
// as a string argument to the constructor.
var myBig = new Big("2.00000000000000000000000000000000000001");
// When we want to see its value, all digits are preserved.
myBig.toString();
// = "2.00000000000000000000000000000000000001"
@whatgoodisaroad
whatgoodisaroad / FixedPrecisionProblems.js
Created July 10, 2011 01:57
JavaScript Primitive Numbers have Fixed Precision
// Numbers with many significant figures may be truncated:
var primitive = 2.00000000000000000000000000000000000001;
// Immediately after creation, the low digits are truncated away.
primitive;
// = 2
// Performing math on primitives will not include truncated digits.