Skip to content

Instantly share code, notes, and snippets.

Avatar

Alan Hamlett alanhamlett

View GitHub Profile
@Deub27
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
self.removeArrangedSubview(subview)
return allSubviews + [subview]
}
@EQuimper
EQuimper / vscode.txt
Last active Dec 5, 2018
VS CODE PACKAGES
View vscode.txt
5 TOP PACKAGES
1. Path Intellisense
2. Project Manager
3. Auto Rename Tag
4. JavaScript (ES6) code snippets
5. Output Colorizer
You need to have
@rfadams
rfadams / project3.md
Created Aug 18, 2015
created by github.com/tr3buchet/gister
View project3.md

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.

Backend

@alanhamlett
alanhamlett / amqp.py
Last active Jan 3, 2018
send an error email when a Celery worker raises an unhandled exception
View amqp.py
# -*- coding: utf-8 -*-
"""
wakatime.amqp
~~~~~~~~~~~~~
Setup for Celery distributed task queue.
"""
import socket
@jo
jo / js-crypto-libraries.md
Last active Oct 25, 2020
List of JavaScript Crypto libraries.
View js-crypto-libraries.md

JavaScript Crypto Libraries

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

WebCryptoAPI

http://www.w3.org/TR/WebCryptoAPI/

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.

View pypi-release-checklist.md
  • 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
nikcub / README.md
Created Oct 4, 2012
Facebook PHP Source Code from August 2007
View README.md
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active Oct 28, 2020
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
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):
try:
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,
You can’t perform that action at this time.