Skip to content

Instantly share code, notes, and snippets.

View pzelnip's full-sized avatar
🤷‍♂️

Adam Parkin pzelnip

🤷‍♂️
View GitHub Profile
@joram
joram / testing in python.md
Last active March 15, 2021 19:22
Thoughts on testing in python

Testing

test_all_the_things

  • These are some thoughts I threw together (with a little help from my friends) around testing, and more specifically unit tests.
  • Everything here is an opinionated statement. There are a zillion exceptions to these rules

Talk outline

  • the following sections
  • a review of an untested section of code, describe tests we would want to write for it.
  • a review of hard-to-test code, refactor to make it testable.
@khalidx
khalidx / simple_http_server_cors.py
Last active September 21, 2023 02:24
Python SimpleHTTPServer with CORS, supporting both Python 2 and 3
#!/usr/bin/env python
# Usage: python simple_http_server_cors.py <port>
try:
# try to use Python 3
from http.server import HTTPServer, SimpleHTTPRequestHandler, test as test_orig
import sys
def test (*args):
test_orig(*args, port=int(sys.argv[1]) if len(sys.argv) > 1 else 8000)
@nagelflorian
nagelflorian / buckets.tf
Last active February 12, 2024 07:44
Terraform config for static website hosting on AWS
# AWS S3 bucket for static hosting
resource "aws_s3_bucket" "website" {
bucket = "${var.website_bucket_name}"
acl = "public-read"
tags {
Name = "Website"
Environment = "production"
}
@scottmagdalein
scottmagdalein / clickable-element.html
Last active March 15, 2023 18:01
Make the Mailchimp Subscriber popup appear on click
<!-- This is the HTML element that, when clicked, will cause the popup to appear. -->
<button id="open-popup">Subscribe to our mailing list</button>
@ordnungswidrig
ordnungswidrig / .git_hooks_commit-msg
Created May 26, 2014 19:59
Git commit-msg hook to check for maximum line lengths
#!/bin/sh
#
# .git/hooks/commit-msg
#
# Check for maximum line lengths
#
# A git hook script to check the commit log message.
# Called by "git commit" with one argument, the name of the file
# that has the commit message. The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
@mbbroberg
mbbroberg / iterm2.textile
Last active February 21, 2017 07:05
A gathering of useful shortcuts for others new to iTerm2

iTerm2 – Useful Shortcuts (Mac OS X)

with a hat tip to Sublime Text 2 Shortcuts

The Awesome

⌘; autocomplete
⌘⌥B instant replay
⌘⌥E search across all tabs
@built
built / gist:2896420
Created June 8, 2012 16:00
Dictionary comprehension in C#
// Initial version w/ explicit types:
Dictionary<string, string> users = db.Users.Where(u => u.Account.Id == accountID).ToDictionary<User, string, string>(u => u.Id.ToString(), u => u.Login.Username);
// Without explicit type info.
var users = db.Users.Where(u => u.Account.Id == accountID).ToDictionary(u => u.Id.ToString(), u => u.Login.Username);
@endolith
endolith / Has weird right-to-left characters.txt
Last active June 1, 2024 10:58
Unicode kaomoji smileys emoticons emoji
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶