Skip to content

Instantly share code, notes, and snippets.

OliverJAsh / main.scpt
Last active Mar 7, 2017
AppleScript to launch a network drive prior to launching an application. Useful if your iTunes or Aperture library is stored remotely.
View main.scpt
# Options
set networks to {"YOUR_SSID"}
set diskName to "YOUR_DISK_NAME"
set mountPath to "afp://" & diskName
set applicationName to "YOUR_APPLICATION_NAME"
# Get wireless network SSID
set SSID to do shell script "/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I | awk '/ SSID: / {print $2}'"
# Test if we are connected to the right network(s)
OliverJAsh / currying.js
Last active Dec 20, 2015
An example of currying and partial application
View currying.js
// Manual currying (no abstraction; right to left)
function prop(key) {
return function (object) {
return object[key]
var nameProp = prop('name');
[ { name: 'Bob' } ].map(nameProp);
OliverJAsh /
Last active Dec 24, 2015
JS Bin Settings

JS Bin Settings

JSBin internally uses the CodeMirror library for it's HTML, JavaScript, and CSS code editors. JSBin exposes the Configuration Settings of CodeMirror and allows you to set them yourself. The settings are stored in localStorage so they are available the next time you use JSBin. CodeMirror supports a whole suite of settings, but the following are the ones that I am most interested in:

  • theme - Color scheme that will be used for the editor. Currently the following themes exist: solarized-light, solarized-dark, monokai, vibrant-ink, cobalt, blackboard, ambiance, & jsbin (default)
  • indentUnit - The number of spaces inside a block of code
  • smartIndent - Automatically indent based on the context of what you are doing
  • tabSize - This defines the width of the tab character
  • indentWithTabs - Determines if you want to use tabs instead of spaces when you intent
  • autoClearEmptyLines - Clears lines that only have whitespace
OliverJAsh / chrome-history-select-bulk.js
Last active Dec 25, 2015
A script to select multiple history entries (in Chrome) that match against a given string — handy for bulk deletions
View chrome-history-select-bulk.js
// Go to chrome://history-frame and run the following script from the console:
var url = window.prompt('Enter a URL to match');
var entries = document.querySelectorAll('.entry');, function (entry) {
var test = new RegExp(url)
if (test.exec(entry.querySelector('.title a').attributes.getNamedItem('href').value)) {
entry.querySelector('input[type="checkbox"]').checked = true;
OliverJAsh / foo.js
Last active Dec 27, 2015
Functional programming experiment
View foo.js
* Goal: add 10 to each persons age using functions from Lodash and curry only.
* I have provided a custom version of curry, instead of using _.curry, as
* the one in Lodash sadly doesn't play nicely here.
* Transform:
* [ { name: 'Foo', age: 20 }, { name: 'Baz', age: 21 } ]
* into:
* [ { name: 'Foo', age: 30 }, { name: 'Baz', age: 31 } ]
OliverJAsh /
Last active Aug 29, 2015
`git stash pop` not merging

If you’re trying to pop a stash and Git won’t merge for you because you have changes in your index to the same file(s) (Git needs to use the index to do a merge at all), i.e.:

❯ gsp
error: Your local changes to the following files would be overwritten by merge:
Please, commit your changes or stash them before you can merge.
OliverJAsh / Plumbing.js
Last active Aug 29, 2015
The Plumber equivalent of the Gruntfile from
View Plumbing.js
var all = require('plumber-all');
var glob = require('plumber-glob');
var bower = require('plumber-bower');
var uglifyjs = require('plumber-uglifyjs')();
var concat = require('plumber-concat');
var filter = require('plumber-filter');
var mincss = require('plumber-mincss');
var rename = require('plumber-rename');
OliverJAsh / foo.js
Created Apr 12, 2014
Uncompress a HTTP response when needed
View foo.js
var request = require('request');
var stream = require('stream');
var zlib = require('zlib');
var websiteRequest = request('', {
headers: {
'Accept-Encoding': 'gzip,deflate'
OliverJAsh / SassMeister-input-HTML.html
Created May 9, 2014
Generated by
View SassMeister-input-HTML.html
<div class="l-row l-desktop-row">
<div class="l-desktop-row__item flex-2">
<section class="island">
<h1>We build in pursuit of a cause that is greater than ourselves.</h1>
<div class="l-row l-tablet-row l-tablet-row--max-2">
<div class="l-tablet-row__item">
<section class="island">
<h1 class="h3">Empowering journalists</h1>
<p>We build products that make it easier for journalists to publish informative and delightful stories.</p>
<div class="l-row l-default-row l-default-row--max-2">
View a.rb
@mixin font-size($percent, $min-font-size, $max-font-size) {
// Min
font-size: $min-font-size;
@include breakpoint($min-font-size/$percent * 100) {
font-size: #{$percent}vw;
@include breakpoint($max-font-size/$percent * 100) {
font-size: $max-font-size;