Skip to content

Instantly share code, notes, and snippets.

View kylefritz's full-sized avatar

Kyle Fritz kylefritz

View GitHub Profile
@cspickert
cspickert / Sticky.py
Created February 20, 2011 22:18
A PyObjC StickiesDatabase reader.
from Foundation import *
from AppKit import NSAttributedString
import os
class Sticky(NSObject):
"""A Stickies document.
Attributes (from class dump):
int windowColor
int windowFlags
@abachman
abachman / speak.rb
Created September 27, 2011 01:52
speak: a simple interactive "say" console
#!/usr/bin/env ruby
#
# "speak" makes it easy to interact with OS X's "say" command.
#
# * "?" to show voice list
# * "-8" to select a voice
# * up and down arrows to move through history
require 'readline'
@pamelafox
pamelafox / senderror.js
Created February 21, 2012 19:20
Sending JS errors to server
function sendError(message, url, lineNum) {
var i;
// First check the URL and line number of the error
url = url || window.location.href;
lineNum = lineNum || 'None';
// If the error is from these 3rd party script URLs, we ignore
// We could also just ignore errors from all scripts that aren't our own
var scriptURLs = [
@kylefritz
kylefritz / gist:2563866
Created May 1, 2012 00:10
Delete branches that have been merged into HEAD
#all local branches that are merged into HEAD
git branch -d `git branch --merged | grep -v '^*' | tr -d '\n'`
#Delete all remote branches that are merged into HEAD
#jump back to master
git co master
#get rid of all local branches not on origin
@stevenharman
stevenharman / gist:2910960
Created June 11, 2012 16:16
Pivotal Tracker Activity Web Hook: event_type values
story_create
add_story_label
story_label_add
remove_story_label
story_label_remove
comment_create
comment_delete
story_move_multi
multi_story_delete
story_delete_multi
@ascheink
ascheink / gitmo-splash.rb
Last active December 13, 2015 20:08
Code to quickly create a mosaic image of the faces of the detainees still in Gitmo http://i.imgur.com/tIqdGtH.jpg
require 'nokogiri'
require 'httparty'
puts "Scraping ids of detainees in custody"
ids = []
(1..10).each do |n|
response = HTTParty.get "http://projects.nytimes.com/guantanamo/detainees/held?page=#{n}"
page = Nokogiri::HTML(response)
ids += page.css('#detaineesTable a').map { |link| $1 if /detainees\/(\d+)/ =~ link['href'] }.compact
end
@staltz
staltz / introrx.md
Last active November 14, 2024 11:27
The introduction to Reactive Programming you've been missing
@natchiketa
natchiketa / a Super-simple Nginx reverse proxy with Homebrew on OS X.md
Last active May 18, 2023 04:54
Super-simple Nginx reverse proxy with Homebrew on OS X

Installation

1)

brew install nginx
sudo cp /usr/local/Cellar/nginx/1.8.0/homebrew.mxcl.nginx.plist /Library/LaunchAgents

2)

Replace /usr/local/etc/nginx/nginx.conf with the nginx.conf in this gist. I'm using port 5000 for my current project. Obviously, change server_name as well, and probably the name of its access log.

import Cocoa
// for-in
func checkForIn(array: [Int], dict: [Int: String]) {
for num in array where dict[num] != nil {
num
}
}
checkForIn([1,2,3,4], dict: [1:"one", 2:"two"])
#1B2B34,#4F5B66,#5FB3B3,#ffffff,#4F5B66,#FFFFFF,#5FB3B3,#EC5f67