Skip to content

Instantly share code, notes, and snippets.

View my-slab's full-sized avatar
🌃
always tired

Mitch Stewart my-slab

🌃
always tired
  • Melbourne, Australia
View GitHub Profile

Moved

Now located at https://github.com/JeffPaine/beautiful_idiomatic_python.

Why it was moved

Github gists don't support Pull Requests or any notifications, which made it impossible for me to maintain this (surprisingly popular) gist with fixes, respond to comments and so on. In the interest of maintaining the quality of this resource for others, I've moved it to a proper repo. Cheers!

@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active February 27, 2025 16:31
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

@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active November 12, 2025 23:04
A badass list of frontend development resources I collected over time.
@ruanchao
ruanchao / safe_function.c
Created August 23, 2012 04:49
Safe-memory-functions
/*
* safe_malloc ()
*
* Call calloc () and abort if the specified amount of memory cannot be
* allocated.
*/
void *
safe_malloc(size_t size)
{
@santiagobasulto
santiagobasulto / gist:3056999
Created July 5, 2012 23:05
Mocking private methods in python
""" This is a simple gist to show how to mock
private methods. I've got lots of questions
regarding this topic. Most people seems confused.
Hope it helps.
"""
import unittest
import mock
@luangong
luangong / inversions.py
Created June 16, 2012 16:01
A Python program that calculates the inversions of a given array using the divide-and-conquer method.
#! /usr/bin/python
# coding: UTF-8
import sys
def main():
a = []
for line in sys.stdin:
a.append(int(line))
print count_inversions(a, 0, len(a) - 1)
@jrosskopf
jrosskopf / Makefile
Created January 23, 2012 15:04
14_dups
CFLAGS = -Wall -g -std=gnu99
LFLAGS = -R/usr/local/lib -lm
SHARED = -fPIC -shared
CC = gcc
DEPENDFILE = .dependencies
SRC = dups.c hashtable.c
SHSRC =
OBJ = $(SRC:%.c=%.o)
SHOBJ = $(SHSRC:%.c=%.so)
@tsabat
tsabat / zsh.md
Last active October 10, 2025 00:44
Getting oh-my-zsh to work in Ubuntu
@mathewbyrne
mathewbyrne / slugify.js
Created October 12, 2011 04:34
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
@Kilian
Kilian / annoying.js
Created January 6, 2011 15:04
How to be an asshole
/**
* Annoying.js - How to be an asshole to your users
*
* DO NOT EVER, EVER USE THIS.
*
* Copyright (c) 2011 Kilian Valkhof (kilianvalkhof.com)
* Visit https://gist.github.com/767982 for more information and changelogs.
* Visit http://kilianvalkhof.com/2011/javascript/annoying-js-how-to-be-an-asshole/ for the introduction and weblog
* Check out https://gist.github.com/942745 if you want to annoy developer instead of visitors
*