Skip to content

Instantly share code, notes, and snippets.

@willmcneilly
willmcneilly / destructuring.js
Created November 9, 2016 20:07 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
@willmcneilly
willmcneilly / writing-quotes.md
Last active September 30, 2015 12:30
Writing Quotes
  • Writer's block is for people who have the luxury of time. - Jodi Picoult
  • One reason I don't suffer Writer's Block is that I don't wait on the muse, I summon it at need. – Piers Anthony
  • It is perfectly okay to write garbage—as long as you edit brilliantly. – C. J. Cherryh
  • First, find out what your hero wants, then just follow him! – Ray Bradbury
  • Get it down. Take chances. It may be bad, but it’s the only way you can do anything really good. – William Faulkner
  • Writing is its own reward. – Henry Miller
  • There’s no such thing as writer’s block. That was invented by people in California who couldn’t write. – Terry Pratchett
  • If you write one story, it may be bad; if you write a hundred, you have the odds in your favor. – Edgar Rice Burroughs
  • Finishing a book is just like you took a child out in the back yard and shot it. – Truman Capote
  • Just write every day of your life. Then see what happens. Most… have very pleasant careers. - Ray Bradbury
var colorbrewer={YlGn:{3:["#f7fcb9","#addd8e","#31a354"],4:["#ffffcc","#c2e699","#78c679","#238443"],5:["#ffffcc","#c2e699","#78c679","#31a354","#006837"],6:["#ffffcc","#d9f0a3","#addd8e","#78c679","#31a354","#006837"],7:["#ffffcc","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],8:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],9:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"]},YlGnBu:{3:["#edf8b1","#7fcdbb","#2c7fb8"],4:["#ffffcc","#a1dab4","#41b6c4","#225ea8"],5:["#ffffcc","#a1dab4","#41b6c4","#2c7fb8","#253494"],6:["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#2c7fb8","#253494"],7:["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],8:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],9:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"]},GnBu:{3:["#e0f3db","#a8ddb5","#43a2ca"],4:["#f0f9e8","#bae4bc","#7bccc4","#2b8cbe"],5:["#f0f9e8
@willmcneilly
willmcneilly / keyboard-en.plist
Created May 30, 2015 10:39
Press and hold keyboard-en with added Esperanto characters
<?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>Roman-Accent-A</key>
<dict>
<key>Direction</key>
<string>right</string>
<key>Keycaps</key>
<string>A À Á Â Ä Æ Ã Å Ā</string>

Below is just about everything you’ll need to style in the theme. Check the source code to see the many embedded elements within paragraphs.


Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6
@willmcneilly
willmcneilly / basic-canvas.js
Created December 21, 2014 14:02
A collection of useful canvas methods
var BasicCanvas = (function() {
return {
init: function() {
this.canvas = document.getElementById('canvas');
this.ctx = this.canvas.getContext('2d');
this.setSize(window.innerWidth, window.innerHeight);
},
@willmcneilly
willmcneilly / overriding_valueOf.js
Last active August 29, 2015 14:07
Overriding valueOf in custom objects
function Counter(){
this.count = 0;
}
Counter.prototype.incr = function() {
this.count++;
}
Counter.prototype.valueOf = function() {
return this.count;
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title> - jsFiddle demo by willmcneilly</title>
<script type='text/javascript' src='//code.jquery.com/jquery-2.1.0.js'></script>
<style type='text/css'>
#my-button {
width: 100px;
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title> - jsFiddle demo by willmcneilly</title>
<script type='text/javascript' src='//code.jquery.com/jquery-2.1.0.js'></script>
<style type='text/css'>
#my-button {
width: 100px;
## Example of an abstract class
## They should be treated as a protocol for their sub classes to implement
## They shouldn't be directly instantiated
class Session
def initialize(name, time)
@time = time
@name = name
end