Skip to content

Instantly share code, notes, and snippets.

View metacritical's full-sized avatar
Creating Black holes.

Pankaj Doharey metacritical

Creating Black holes.
View GitHub Profile
@metacritical
metacritical / .tmux.clipboard
Created September 10, 2012 10:45 — forked from napcs/.tmux.clipboard
My tmux config
# configuration for osx clipboard support
set-option -g default-command "reattach-to-user-namespace -l sh"
@metacritical
metacritical / quantize.js
Created September 22, 2012 08:33 — forked from nrabinowitz/quantize.js
Javascript module for color quantization, based on Leptonica
/*!
* quantize.js Copyright 2008 Nick Rabinowitz.
* Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
*/
// fill out a couple protovis dependencies
/*!
* Block below copied from Protovis: http://mbostock.github.com/protovis/
* Copyright 2010 Stanford Visualization Group
* Licensed under the BSD License: http://www.opensource.org/licenses/bsd-license.php
@metacritical
metacritical / ruby_skype_api_example.rb
Created November 19, 2012 13:08 — forked from ebisawa/ruby_skype_api_example.rb
Skype API example in Ruby
require 'dbus'
MYNAME = 'com.example.skype_api_client'
class SkypeAPI
def initialize(name = MYNAME)
bus = DBus.session_bus
service = bus.service("com.Skype.API")
objs = service.object("/com/Skype")
objs.introspect
@metacritical
metacritical / exporter.rb
Created December 5, 2012 10:36 — forked from jcasimir/exporter.rb
Export ActiveRecord Tables to CSV
require 'csv'
module Exporter
DEFAULT_EXPORT_TABLES = [ Invoice, InvoiceItem, Item, Merchant, Transaction, User ]
DESTINATION_FOLDER = "tmp/"
def self.included(klass)
klass.extend ClassLevelMethods
end
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
<html>
<head>
<script type="text/javascript">
window.onload = draw;
function draw(){
@metacritical
metacritical / apns.rb
Created October 15, 2013 14:36 — forked from scotttam/apns.rb
require "rubygems"
require "yajl"
require "openssl"
require "socket"
device_token = '39cac56f 986a0e66 3c4fd4f4 68df5598 024d2ca3 8b9f307c 741c180e 9fc30c62'
device_token = device_token.gsub(" ", "")
the_byte_token = [device_token].pack("H*")
file = File.open("ruby_the_byte_token", "wb")
require 'delegate'
class Base
def foo
"foo"
end
def bar
"bar"
end
end

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@metacritical
metacritical / batman.py
Last active August 29, 2015 14:16 — forked from traeblain/batman.py
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 16 09:30:30 2011
Python Batman Equation
@author: Trae Blain
"""
from __future__ import division
import matplotlib.pyplot as plt