Skip to content

Instantly share code, notes, and snippets.

View netikular's full-sized avatar
🏠
Working from home

Kevin Pratt netikular

🏠
Working from home
View GitHub Profile
@netikular
netikular / merge-geojsons.py
Created May 1, 2017 16:17 — forked from migurski/merge-geojsons.py
Merge multiple GeoJSON files into one
from json import load, JSONEncoder
from optparse import OptionParser
from re import compile
float_pat = compile(r'^-?\d+\.\d+(e-?\d+)?$')
charfloat_pat = compile(r'^[\[,\,]-?\d+\.\d+(e-?\d+)?$')
parser = OptionParser(usage="""%prog [options]
Group multiple GeoJSON files into one output file.
@netikular
netikular / string_extensions.ex
Last active December 24, 2015 01:16
Increment A to B or ZZ to AAA - only works on capitol ASCII letters
defmodule Tallyj.StringExtensions do
@moduledoc """
This module provides a function that will take a uppercase ASCII letter and
return the next logical value. Wrapping back to A when Z is provided.
Examples:
next("A")
=> "B"
@netikular
netikular / install_ex.sh
Last active January 13, 2016 07:28 — forked from jimsynz/install_ex.sh
I use this to install Elixir on Codeship.
#!/bin/sh
# I use this to install Elixir on our codeship instances for testing. YMMV.
# curl -O https://gist.githubusercontent.com/netikular/335dea6bdbaa369feeff/raw/f891127521858204a67f2b1ea06c1811ad35433d/install_ex.sh
# . ~/install_ex.sh
# You can override your Elixir and Erlang versions from your shell when you call ./install_ex.sh.
ERLANG_VERSION=${ERLANG_VERSION:-18.2.1}
ELIXIR_VERSION=${ELIXIR_VERSION:-1.2.0}
@netikular
netikular / end.applescript
Last active August 29, 2015 14:07
Ruby script and AppleScript snippets for configuring a Pomodoro timer to integrate with hip chat. Inspiration from http://afitnerd.com/2013/08/19/pomodoro-hipchat-automate-availability/
tell application "System Events" to tell UI element "HipChat" of list 1 of process "Dock"
perform action "AXShowMenu"
delay 0.5
click menu item "Status" of menu 1
click menu item "Available" of menu 1 of menu item "Status" of menu 1
end tell
do shell script "<path to hipchat_notification.rb> 'is back from his pomodoro'"

Keybase proof

I hereby claim:

  • I am netikular on github.
  • I am kfpratt (https://keybase.io/kfpratt) on keybase.
  • I have a public key whose fingerprint is C296 6328 2D40 E73D 75C2 FBE5 3D5B 3BA1 B83E D232

To claim this, I am signing this object:

@netikular
netikular / Communication.as
Last active January 3, 2016 04:09
Copied from adobe forums. Comments in source citing original authors.
/*
Copied from: http://forums.adobe.com/thread/951628
Below is our communication class. This class is used for all of our RESTful calls. It handles most of the common errors so we don't have to deal with them over and over again in the applications. It always sets itself up as the listener for the RESULT event, does some initial, common processing, then calls the application RESULT function that is set for this particular instance of the communication class. It also has code to inspect the url the SWF was loaded from, and build the REST service url based on that, so we can use one class for multiple sites.
Mark
Follow up commend from "pradeep"
So I have unraveled the Truth. (I think)
It's more tortured than one would imagine
1/ All HTTP GET requests are stripped of headers. It's not in the Flex stack so it's probably the underlying Flash player runtime
@netikular
netikular / gist:4188411
Created December 2, 2012 12:24
using the fetch options hash
this.fetch(
{
data: { queryString: query },
success: function () {
debugger;
res = 'success';
console.log('success');
},
error: function () {
debugger;
@netikular
netikular / gist:4188361
Created December 2, 2012 12:04
remove from a list
clearAll: function (e) {
e.preventDefault();
var toRemove = this.collection.chain().filter(function(item){
return item.get('IsCompleted');
}).invoke('destroy');
this.collection.remove(toRemove);
},
@netikular
netikular / .vimrc
Created December 16, 2011 15:14
Ever evolving .vimrc
syntax on " Enable syntax highlighting
filetype on " Enable filetype detection
filetype indent on " Enable filetype-specific indenting
filetype plugin on " Enable filetype-specific plugins
set nocompatible " We're running Vim, not Vi!
color slate
"some sane indentation
set sw=2
set ts=2
@netikular
netikular / taxes.rb
Created September 25, 2011 12:08
Answer to Ayende's blog post
#From blog post http://ayende.com/blog/108545/the-tax-calculation-challenge
require 'test/unit'
class Rate
def initialize(rate)
@percent = rate[:percent]
@min = rate[:min].to_f
@max = rate[:max].to_f
@range = @max - @min