Skip to content

Instantly share code, notes, and snippets.

William Bowers willurd

Block or report user

Report or block willurd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@willurd
willurd / gist:8ae804f51aa6f3ea1708
Last active Aug 29, 2015
Parametric partial function creation
View gist:8ae804f51aa6f3ea1708
// I had this idea of implementing Scala-ish automatic partial function generation
// based on placeholders, and Clojure-ish positional and rest argument replacement
// in anonymous functions created with the shorthand syntax `#()`.
// In Scala, if you have an expression such as `doSomething(_ + 1)`, Scala will
// turn that into a function of one argument that evaluates to `arg + 1`. In
// Clojure, if you use `#()` to create an anonymous function, you can reference
// arguments with `%num` (e.g. `%1`, `%2`, etc). `%` evaluates to the first
// argument and `%&` evaluates to all arguments.
@willurd
willurd / dotpath.sh
Last active Nov 29, 2016
Manage your PATH with a nice, one-directory-per-line file, rather than a gargantuan blob of colon-delimited text.
View dotpath.sh
# Read the contents of ~/.path into $PATH, if ~/.path exists. ~/.path should be a file
# consisting of one path on each line, such as:
#
# ~$ cat ~/.path
# # vim: ft=sh
# ~/usr/bin
# /opt/local/bin
# ... etc ...
#
# Note that comments begin with a hash (#).
@willurd
willurd / bookmarklet_select_all.js
Last active Jan 23, 2017
Select All: A bookmarklet for those annoying sites that block you from selecting stuff
View bookmarklet_select_all.js
javascript:(function()%7Bvar style%3Ddocument.createElement("style")%3Bstyle.type%3D"text/css"%3Bstyle.innerText%3D"* %7B -webkit-user-select: all !important%3B -moz-user-select: all !important%3B user-select: all !important%3B %7D"%3Bvar head%3Ddocument.getElementsByTagName("head")%5B0%5D%3Bhead.appendChild(style)%3B%7D)()%3B
@willurd
willurd / playground.rs
Created Jul 26, 2018 — forked from rust-play/playground.rs
Code shared from the Rust Playground
View playground.rs
trait Json {
fn to_string(&self) -> String;
}
trait Xml {
fn to_string(&self) -> String;
}
#[derive(Debug)]
struct Point2 {
@willurd
willurd / set-wallpaper.sh
Last active Oct 12, 2019
Set the Desktop Background for all of your open Spaces in Mountain Lion
View set-wallpaper.sh
read -e IMAGE;
defaults write com.apple.desktop Background "{default = {ImageFilePath='$IMAGE'; };}"
killall Dock
@willurd
willurd / Getting started with requirejs.md
Last active Oct 30, 2019
A short introduction to require.js
View Getting started with requirejs.md

This is a small collection of scripts showing how to use require.js. It's only one of several ways of setting up a require.js project, but it's enough to get started.

At its core, require.js is about three things:

  1. Dependency management
  2. Modularity
  3. Dynamic script loading

The following files show how these are achieved.

@willurd
willurd / web-servers.md
Last active Nov 19, 2019
Big list of http static server one-liners
View web-servers.md

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
You can’t perform that action at this time.