Skip to content

Instantly share code, notes, and snippets.

View andrewapperley's full-sized avatar
app'n away

Andrew Apperley andrewapperley

app'n away
View GitHub Profile
@nicklockwood
nicklockwood / main.swift
Created December 1, 2017 11:04
Thread-safe cache implementation benchmark
var cache = [Int: Int]()
let queue = DispatchQueue(label: "cacheQueue", attributes: .concurrent)
let iterations = 100000
// In the first run, cache is empty so we're writing each time
do {
let start = CFAbsoluteTimeGetCurrent()
for i in 0 ... iterations {
var exists = false
queue.sync {
@miguelmota
miguelmota / setup.config
Last active July 26, 2021 15:42
Elastic Beanstalk NGINX rewrite http to https using .ebextensions
files:
"/etc/nginx/conf.d/00_elastic_beanstalk_proxy.conf":
mode: "000755"
owner: root
group: root
content: |
server {
listen 80;
gzip on;
@mathiasbynens
mathiasbynens / change-favicon.js
Created June 7, 2010 12:41
Dynamically changing favicons with JavaScript
/*!
* Dynamically changing favicons with JavaScript
* Works in all A-grade browsers except Safari and Internet Explorer
* Demo: http://mathiasbynens.be/demo/dynamic-favicons
*/
// HTML5™, baby! http://mathiasbynens.be/notes/document-head
document.head || (document.head = document.getElementsByTagName('head')[0]);
function changeFavicon(src) {