Skip to content

Instantly share code, notes, and snippets.

View wilmoore's full-sized avatar

Wil (₩) Moore III wilmoore

View GitHub Profile
@wilmoore
wilmoore / 2013-11-18.md
Last active December 28, 2015 15:49
My Open Source Report Cards Over Time (http://osrc.dfm.io/wilmoore)

2013-11-18

@wilmoore
wilmoore / Gruntfile.small.coffee
Last active December 28, 2015 02:09
Modular Gruntfile Examples
module.exports = (grunt) ->
####################################################
# diagnostic
####################################################
# use if `--time` is present
require('time-grunt')(grunt) if grunt.option 'time'
####################################################
@wilmoore
wilmoore / greeter.erl
Last active December 26, 2015 23:09
Strategy vs Pattern Matching (compare to: http://www.dofactory.com/javascript-strategy-pattern.aspx)
-module(greeter).
-export([say_hi/1]).
say_hi({bored}) -> "Sup...";
say_hi({polite}) -> "Welcome sir.";
say_hi({friendly}) -> "Hey...".
% erl
% c(greeter).
% greeter:say_hi({polite}).
@wilmoore
wilmoore / branch-organization.md
Last active October 23, 2018 22:30
Branch Organization

Scenario

Work is done within a feature branch created from master. You've incrementally gotten the feature branch working as expected; however, you'd prefer to re-organize your commits so that you can better reason about the changes.

Setup

Let's create a new repository in order to set the stage:

 % mkdir repo
 % cd repo

% git init

@wilmoore
wilmoore / errors.txt
Created October 13, 2013 22:23
I've spent way too much time on this already...
less-than-100.rs:1:128: 1:136 error: mismatched types: expected `&fn<no-bounds>(&&<VI5>) -> bool` but found `()` (expected fn but found ())
} assert_eq!(out, ~[5, 50, 35]);(100));ro; };
^~~~~~~~
<std-macros>:89:22: 89:47 error: binary operation == cannot be applied to type `std::iter::Filter<,&<VI5>,std::vec::VecIterator<,<VI5>>>`
<std-macros>:89 if !((given_val == expected_val) && (expected_val == given_val)) {
^~~~~~~~~~~~~~~~~~~~~~~~~
<std-macros>:83:4: 94:5 note: in expansion of assert_eq!
less-than-100.rs:1:141: 1:171 note: expansion site
<std-macros>:89:69: 89:78 error: mismatched types: expected `~[<VI9>]` but found `std::iter::Filter<,&<VI5>,std::vec::VecIterator<,<VI5>>>` (expected vector but found struct std::iter::Filter)
<std-macros>:89 if !((given_val == expected_val) && (expected_va
try {
throw { name: 'error', message: 'hello' }
} catch (e) {
console.log('caught this:', e.message)
}
//=> caught this: hello
@wilmoore
wilmoore / $.ajax.js
Last active December 22, 2015 17:28
XMLHttpRequest vs. $.ajax
// does anyone like this API
$.ajax({
type: "POST",
url: url,
data: data,
success: success,
dataType: dataType
});
@wilmoore
wilmoore / cannot-do-dynamic-property-assignment.php
Last active December 22, 2015 01:28
Such an arbitrary limitation -- this should be enough to convince you to switch to a language that has a sane level of expressiveness.
<?php
class WordProblem {
/**
* sorry, but this won't work
*/
private $BINARY_OPERATORS = [
'plus' => function($l, $r) { return $l + $r; },
@wilmoore
wilmoore / 2013.08.04.md
Created August 4, 2013 21:35
Open Source Report Card

@wilmoore
wilmoore / first-go.md
Last active July 25, 2024 03:59
Software Engineering :: Programming :: Languages :: GoLang :: Your First Go Program

Software Engineering :: Programming :: Languages :: GoLang :: [Your First Go Program]

⪼ Made with 💜 by Polyglot.

research

[Your First Go Program]

create a project directory