Skip to content

Instantly share code, notes, and snippets.

@rbarazi
rbarazi / how-to-set-up-stress-free-ssl-on-os-x.md
Created January 5, 2016 17:10 — forked from jed/how-to-set-up-stress-free-ssl-on-os-x.md
How to set up stress-free SSL on an OS X development machine

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

@rbarazi
rbarazi / import_weightbot_csv_to_fitbit.rb
Last active August 29, 2015 14:18
Import Weightbot CSV to Fitbit
# 1) Backup your wieghtbot data and then download it from: https://weightbot.com/
# 2) Get a consumer_key and a consumer_secret from: https://dev.fitbit.com/apps/new
# 3) Use the key/secret from step 2 on https://dev.fitbit.com/apps/oauthtutorialpage to obtain a user_id/token/secret
# 4) install fitgem `gem install fitgem`
# 5) run the following from the console/irb
require 'fitgem'
c = Fitgem::Client.new(
:consumer_key => "",
:consumer_secret => "",
@rbarazi
rbarazi / cool_ruby_gists
Created April 18, 2013 13:29
Cool ruby gists
ruby -e '(0..23).cycle{|f|print "\r"+[128336+f].pack("U")+" ";sleep 0.2}'
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the branch/status of the current git repository
# * the branch of the current subversion repository
# * the return value of the previous command
#
# USAGE:
@rbarazi
rbarazi / airbrake_adapter.rb
Created July 4, 2012 16:26
Yell Airbrake Adapter
require 'yell'
require 'toadhopper'
class AirbrakeAdapter < Yell::Adapters::Base
setup do |options|
@env = options[:environment]
@airbrake = Toadhopper(options[:api_key])
end
write do |event|
if event.message.respond_to?(:backtrace)
@rbarazi
rbarazi / gist:2937541
Created June 15, 2012 16:51
.DS_Store git removal
find .-name .DS_Store -print0 | xargs -0 git-rm --ignore-unmatch
@rbarazi
rbarazi / haml2handlebars.rb
Created February 13, 2012 19:35
Converts haml to handlebars
#!/usr/bin/env ruby
require "rubygems"
require "haml"
class MethodMissingString < String
def method_missing(m, *args, &block)
args = args.collect do |arg|
arg.is_a?(MethodMissingString) ? arg : "\"#{arg}\""
end
(function() {
// Usage:
//
// <script src='http://pressly.com/redirect.js' type='text/javascript'></script>
// <script>Pressly.redirect("http://tablet.domain.com");</script>
//
/* >> Generated code from Issue Config */
// Supported devices to redirect
@rbarazi
rbarazi / dabblet.css
Created December 16, 2011 19:09
Untitled
p:hover:after {
content: attr(data-small);
display: block;
border: 1px solid red;
position:absolute;
bottom: 0;
right: 0;
}
@rbarazi
rbarazi / dabblet.css
Created December 16, 2011 19:09
Untitled
p:hover:after {
content: attr(data-small);
display: block;
border: 1px solid red;
position:absolute;
bottom: 0;
right: 0;
}