Skip to content

Instantly share code, notes, and snippets.

View nmeans's full-sized avatar

Nickolas Means nmeans

View GitHub Profile
if appIsRunning("Pandora") then
tell application "Pandora"
activate
tell application "System Events" to key code 124
end tell
else if appIsRunning("iTunes") then
tell application "iTunes" to next track
end if
on appIsRunning(appName)
$('a.showhide-trigger').click(function(){
$('div.showhide').toggle('slow');
if ($('a.showhide-trigger').text() == 'Show all archived issues'){
$('a.showhide-trigger').text('Hide archived issues');
} else {
$('a.showhide-trigger').text('Show all archived issues');
}
});
@nmeans
nmeans / UsageStats.py
Created September 19, 2011 21:09
Simple Redis usage stats plugin for ServerDensity
import redis
class UsageStats:
def __init__(self,agentConfig,checksLogger,rawConfig):
self.agentConfig = agentConfig
self.checksLogger = checksLogger
self.rawConfig = rawConfig
def run(self):
r_server = redis.Redis("localhost")
files = r_server.get("file_count")
@nmeans
nmeans / fann-test.rb
Created May 7, 2013 15:13
ruby-fann negative/positive demo
input = (-1000...1000).collect{|i| [i]}
output = input.map{|i| i > 0 ? [1,0] : [0,1]}
train = RubyFann::TrainData.new(:inputs => input, :desired_outputs => output)
fann = RubyFann::Standard.new(:num_inputs=>2, :hidden_neurons=>[3,3,3], :num_outputs=>2)
fann.train_on_data(train, 1001, 10, 0.001)
fann.run([-500]) # [0.03544681023290716, 1.0]
fann.run([500]) # [1.0, 0.0]
@nmeans
nmeans / .tmux.conf.local
Created September 5, 2013 19:40
Local config files
set -g default-terminal "screen-256color"
set -sg escape-time 0
# scrollback buffer size increase
set -g history-limit 500000
# Use up and down arrows for temporary "maximize"
unbind Up; bind Up resize-pane -Z; unbind Down; bind Down resize-pane -Z
@nmeans
nmeans / pgr_test.rb
Created September 11, 2013 13:52
A simple test of IE8 behavior re: history and POST -> GET redirect. IE does not write the '/DO_NOT_SHOW_IN_HISTORY' endpoint to history, and reloads '/' from cache when the back button is clicked. This is the desired behavior.
require 'rubygems'
require 'sinatra'
get '/' do
haml :form
end
post '/DO_NOT_SHOW_IN_HISTORY' do
redirect to('/show_in_history'), 302
end
@nmeans
nmeans / console.coffee
Last active December 31, 2015 16:09
console.log shim
# Add a no-op version of the console object so accidental
# calls to console that leak to prod won't raise errors
# in IE < 10.
if typeof(console) == "undefined"
window.console =
log: () ->
debug: () ->
info: () ->
warn: () ->
error: () ->

Keybase proof

I hereby claim:

  • I am nmeans on github.
  • I am nmeans (https://keybase.io/nmeans) on keybase.
  • I have a public key whose fingerprint is F066 E600 744C BD12 34BE 2DF2 287A 53B5 165F BA0C

To claim this, I am signing this object:

@nmeans
nmeans / geocodio.txt
Last active August 29, 2015 14:05
Slow Geocodio Response
% time wget -O - "https://api.geocod.io/v1/geocode?q=5119+Burnet+Rd+Austin+TX+78756&api_key=[REDACTED]"
--2014-08-26 11:39:21-- https://api.geocod.io/v1/geocode?q=5119+Burnet+Rd+Austin+TX+78756&api_key=[REDACTED]
Resolving api.geocod.io... 107.170.69.34
Connecting to api.geocod.io|107.170.69.34|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/json]
Saving to: ‘STDOUT’
[<=> ] 0 --.-K/s {"input":{"address_components":{"number":"5119","street":"Burnet","suffix":"Rd","city":"Austin","state":"TX","zip":"78756"},"formatted_address":"5119 Burnet Rd, Austin, TX 78756"},"results":[{"address_components":{"number":"5119","street":"Burnet","suffix":"Rd","city":"Austin","count
def parse_roles(user_hash)
custom_schemas = user_hash.fetch("customSchemas") { return [] }
roles = custom_schemas.fetch("Roles") { return [] }
roles
end
user1 = {
"email": "andrew@muvehealthlabs.com",
"customSchemas": {
"Roles": ["accountant", "admin"]