Skip to content

Instantly share code, notes, and snippets.


Alan Hamlett alanhamlett

View GitHub Profile
Deub27 / UIStackView+removeAll.swift
Created Nov 25, 2017
Remove all arranged subviews from UIStackView at once
View UIStackView+removeAll.swift
import UIKit
extension UIStackView {
func removeAllArrangedSubviews() {
let removedSubviews = arrangedSubviews.reduce([]) { (allSubviews, subview) -> [UIView] in
return allSubviews + [subview]
EQuimper / vscode.txt
Last active Dec 5, 2018
View vscode.txt
1. Path Intellisense
2. Project Manager
3. Auto Rename Tag
4. JavaScript (ES6) code snippets
5. Output Colorizer
You need to have
rfadams /
Created Aug 18, 2015
created by

Company Trial Start / End Dates - Phase 1

We need to know if a company is in a "trial" status. There will be 2 phases to this project.

Phase 1 will construct the fields. Phase 2 will be to create the cron job that will automatically check for expired trial periods and mark the "trial_status" boolean to false.


alanhamlett /
Last active Jan 3, 2018
send an error email when a Celery worker raises an unhandled exception
# -*- coding: utf-8 -*-
Setup for Celery distributed task queue.
import socket
jo /
Last active May 1, 2021
List of JavaScript Crypto libraries.

JavaScript Crypto Libraries

I start with a list and plan to create a comparison table.


This specification describes a JavaScript API for performing basic cryptographic operations in web applications, such as hashing, signature generation and verification, and encryption and decryption. Additionally, it describes an API for applications to generate and/or manage the keying material necessary to perform these operations. Uses for this API range from user or service authentication, document or code signing, and the confidentiality and integrity of communications.

  • Update HISTORY.rst
  • Commit the changes:
git add HISTORY.rst
git commit -m "Changelog for upcoming release 0.1.1."
  • Update version number (can also be minor or major)
bumpversion patch
nikcub /
Created Oct 4, 2012
Facebook PHP Source Code from August 2007
rgreenjr / postgres_queries_and_commands.sql
Last active May 7, 2021
Useful PostgreSQL Queries and Commands
View postgres_queries_and_commands.sql
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
codeb2cc / gist:3302754
Created Aug 9, 2012
Sqlalchemy get_or_create implement
View gist:3302754
# -*- coding: utf-8 -*-
from sqlalchemy.exc import IntegrityError
from sqlalchemy.sql.expression import ClauseElement
def _get_or_create(session, model, defaults=None, **kwargs):
query = session.query(model).filter_by(**kwargs)
instance = query.first()
View gist:57898
Experiments in revision control: Curry recipe.
My personal recipe for Japanese curry, which has mutated over the years and is
now open-source thanks to github, hot damn. Some of the ingredients are not
very Japanese, but curry came to Japan from England which got it from India to
begin with, so whatever.
1.5 - 2 lbs. of meat, prefer thin-sliced beef (komagire), pork works, too.
Thin-sliced stuff is always best, but in a pinch stewing beef works. Bacon
works surprisingly well. Chicken will work, technically, but if you must,