Skip to content

Instantly share code, notes, and snippets.

@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active February 25, 2024 17:35
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

@amitzur
amitzur / README.md
Last active December 20, 2015 10:08
Multiple waitsFor in a jasmine test

Asynchronous Testing with [Jasmine]

Creating async tests with jasmine is quite intuitive.

If you've read the documentation, then you are aware of the [waitsFor][2] and [runs][2] helpers in Jasmine. I had more than one async action in my test, so it required an inspection on my side to verify that Jasmine would run the test in the same way I had expected.

If you specify a series of waitsFor or waits and runs callbacks, then Jasmine will start the countdown for each waitsFor at the appropriate time (in this gist - after the previous runs callback was completed).

@oraricha
oraricha / Theme editor.md
Last active December 18, 2015 08:59
List of my sublime text 2 installed packages
@kkirsche
kkirsche / Install Composer to use MAMP's PHP.md
Last active January 30, 2024 02:30
How to install Composer globally using MAMP's PHP

##Create an alias to MAMP's PHP installation

To do this, we can simply create an alias for our bash profile. We'll be doing this is nano, though you can do it in vim or a number of other editors as well.

Within the terminal, run:

nano ~/.bash_profile

This will open nano with the contents, at the top in a blank line add the following line:

@timnew
timnew / JSONView Dark Theme.css
Created March 15, 2013 03:16
This is a dark theme for JSONView chrome extension
body {
white-space: pre;
font-family: consolas;
color: white;
background: black;
}
.property {
color: orange;
font-weight: bold;
@bzerangue
bzerangue / update-hosts.sh
Last active March 3, 2020 13:54
A small shell script that will add and remove lines from the hosts file. Originally created by Claus Witt, http://clauswitt.com/319.html.
#! /bin/sh
# @author: Claus Witt
# http://clauswitt.com/319.html
# Adding or Removing Items to hosts file
# Use -h flag for help
DEFAULT_IP=127.0.0.1
IP=${3:-$DEFAULT_IP}
@getify
getify / 1.js
Created November 13, 2012 00:19
illustrating some potential issues with adding `let` to code which already has `var` used in it...
// var: poor stylistic form, but no leakage
function foo() {
bar = 3;
if (true) {
var bar = 5;
}
}
// let: will leak an auto-global
function foo() {
@twalling
twalling / jquery.touch.js
Created October 19, 2012 19:11
Zepto touch for jQuery
;(function($){
var touch = {},
touchTimeout, tapTimeout, swipeTimeout,
longTapDelay = 750, longTapTimeout
function parentIfText(node) {
return 'tagName' in node ? node : node.parentNode
}
function swipeDirection(x1, x2, y1, y2) {
@harthur
harthur / snippet.md
Created June 18, 2012 22:12
console.log() key binding for Sublime Text

Go to Sublime Text 2 > Preferences > Key Bindings - User and add this JSON to the file:

[
    { "keys": ["super+shift+l"],
      "command": "insert_snippet",
      "args": {
        "contents": "console.log(${1:}$SELECTION);${0}"
      }
 }
@jbgo
jbgo / git-recover-branch.md
Last active March 29, 2024 05:04
How to recover a git branch you accidentally deleted

UPDATE: A better way! (August 2015)

As pointed out by @johntyree in the comments, using git reflog is easier and more reliable. Thanks for the suggestion!

 $ git reflog
1ed7510 HEAD@{1}: checkout: moving from develop to 1ed7510
3970d09 HEAD@{2}: checkout: moving from b-fix-build to develop
1ed7510 HEAD@{3}: commit: got everything working the way I want
70b3696 HEAD@{4}: commit: upgrade rails, do some refactoring