Skip to content

Instantly share code, notes, and snippets.

View benstevinson's full-sized avatar
👋

Ben Stevinson benstevinson

👋
View GitHub Profile
@benstevinson
benstevinson / alfred.sh
Created May 4, 2018 02:06
Alfred Clipboard to CSV
cd ~/Library/Application\ Support/Alfred\ 3/Databases
sqlite3 -header -csv clipboard.alfdb "select * from clipboard;" > ~/Desktop/clipboard.csv
@benstevinson
benstevinson / median-identify-from-query-params.html
Last active April 10, 2018 16:00
Median Snippet -- Identify Via Query Parameters
<script>
const urlParams = () => {
const urlParams = {};
let match,
pl = /\+/g,
search = /([^&=]+)=?([^&]*)/g,
decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); },
query = window.location.search.substring(1);
@benstevinson
benstevinson / reactor.ts
Last active March 1, 2018 18:50
TypeScript Event Dispatcher
class ReactorEvent {
private name: string;
public callbacks: Function[];
constructor (name: string) {
this.name = name;
this.callbacks = [];
}
public addCallback(cb: Function) {

Keybase proof

I hereby claim:

  • I am benstevinson on github.
  • I am benstevinson (https://keybase.io/benstevinson) on keybase.
  • I have a public key ASBpEv4uTdDEobyvnReZMYO1KIgkxXXmmkWjgK-RSfbywwo

To claim this, I am signing this object:

# Define all sales agents. To add an agent, just add them to this list.
sales_agents = ["Sales Agent 1", "Sales Agent 2", "Sales Agent 3"]
# Client secret for our one stored value.
store = StoreClient('{Generate a random 30ish character passphrase and put it here}')
# Grab the previous sales agent
previous_agent = store.get('agent')
# This is a bit janky because Zapier doesn't support itertools.
@benstevinson
benstevinson / NWS-weather-forecast-office-identifiers.csv
Last active September 21, 2015 04:31
CSV of the shortcodes the NWS uses to identify NWS offices. Data retrieved from: http://forecast.weather.gov/product_sites.php?site=FWD&product=AFD
NWS Weather Forecast Office Identifier Location
ABQ Albuquerque, NM
ABR Aberdeen, SD
AFC Anchorage, AK
AFG Fairbanks, AK
AJK Juneau, AK
AKQ Wakefield, VA
ALY Albany, NY
AMA Amarillo, TX
APX Gaylord, MI
@benstevinson
benstevinson / national-weather-service-alert-types.csv
Last active August 29, 2015 14:27
CSV of National Weather Service weather event hazards. Taken from here: http://www.weather.gov/help-map (Accidentally put this up on GH without being logged in, so there's an anonymous one too.)
Hazard / Weather Event Color Name RGB HEX
911 Telephone Outage Silver 192 192 192 C0C0C0
Administrative Message White 255 255 255 FFFFFF
Air Quality Alert Gray 128 128 128 808080
Air Stagnation Advisory Gray 128 128 128 808080
Arroyo and Small Stream Flood Advisory Springgreen 0 255 127 00FF7F
Ashfall Advisory Dimgray 105 105 105 696969
Ashfall Warning Darkgray 169 169 169 A9A9A9
Avalanche Advisory Peru 205 133 63 CD853F
Avalanche Warning Dodgerblue 30 144 255 1E90FF
@benstevinson
benstevinson / PushNotification.alfredworkflow
Last active August 29, 2015 14:03
This Alfred workflow allows you to send push notifications of arbitrary text to your phone.
curl -X POST \
-H "x-instapush-appid: APP_ID" \
-H "x-instapush-appsecret: APP_SECRET" \
-H "Content-Type: application/json" \
-d '{"event":"Pusher","trackers":{"message":"{query}"}}' \
https://api.instapush.im/v1/post
exit