Skip to content

Instantly share code, notes, and snippets.

View OliverJAsh's full-sized avatar

Oliver Joseph Ash OliverJAsh

View GitHub Profile
@OliverJAsh
OliverJAsh / README.md
Last active December 24, 2015 09:39
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
OliverJAsh / currying.js
Last active December 20, 2015 21:58
An example of currying and partial application
// 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
OliverJAsh / main.scpt
Last active March 7, 2017 13:10
AppleScript to launch a network drive prior to launching an application. Useful if your iTunes or Aperture library is stored remotely.
# Options
set networks to {"YOUR_SSID"}
set diskName to "YOUR_DISK_NAME"
set mountPath to "afp://192.168.0.2/" & 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)