Skip to content

Instantly share code, notes, and snippets.

Avatar

Darren Clark darrenclark

View GitHub Profile
View Easter Bunny.sh
#/usr/bin/env bash
echo $(( ($(date -j -f "%d %B %Y" "$(cal -N -e)" +%s) - $(date +%s)) / (24 * 60 * 60) )) days until the Easter bunny comes
View snippet.java
import java.nio.ByteBuffer;
// is a byte[] under the hood
ByteBuffer buffer1 = ByteBuffer.allocate(12);
// is a block of bytes (similar to malloc)
ByteBuffer buffer2 = ByteBuffer.allocateDirect(12);
// buffers have a "position" that is advanced by read/write operations
buffer1.put((byte)1).put((byte)2).put((byte)3).put((byte)4);
@darrenclark
darrenclark / job.yaml
Created Nov 15, 2020
kubectl --as example
View job.yaml
apiVersion: batch/v1
kind: Job
metadata:
generateName: echo-job-
spec:
template:
spec:
containers:
- name: echo
image: alpine:latest
View coalescing-updates-playground-done.swift
import UIKit
import PlaygroundSupport
extension NSNotification.Name {
static let todoListItemUpdated = NSNotification.Name("TodoListItemUpdated")
}
class TodoList {
static let shared = TodoList()
View coalescing-updates-playground-initial.swift
import UIKit
import PlaygroundSupport
extension NSNotification.Name {
static let todoListItemUpdated = NSNotification.Name("TodoListItemUpdated")
}
class TodoList {
static let shared = TodoList()
@darrenclark
darrenclark / swift-default-init.sh
Last active Sep 2, 2016
Generate default swift initializer from properties
View swift-default-init.sh
#!/bin/bash
# Usage:
# 1. Copy your properties to clipboard
# 2. `pbpaste | swift-default-init.sh | pbcopy`
# 3. Paste into code
set -eu -o pipefail
# Switch to \t for tab indenting
@darrenclark
darrenclark / git-brc
Last active Sep 2, 2016
Git BRanchClean - Remove local branches that have been merged
View git-brc
#!/bin/bash
set -eu -o pipefail
## Git BRanchClean (removes local branches that have been merged into the current branch)
# List of branches to ignore separated by vertical bars/pipes (|)
IGNORED_BRANCHES="develop|master"
branches="$(git branch --no-column --no-color --merged | egrep -v '\* ' | sed 's/^[\* ] //' | (egrep -v "$IGNORED_BRANCHES" || true))"
@darrenclark
darrenclark / README.md
Last active Jun 20, 2016
genstrings for your clipboard
View README.md

(Swift only)

Easily add entries to Localizable.strings file by copy/pasting code with new NSLocalizedStrings

Usage:

  1. Copy your code containing NSLocalizedString(_:comment:) function calls

  2. Pipe it through the pbgenstrings.sh script:

@darrenclark
darrenclark / post-checkout
Created Oct 5, 2015
Update submodules on branch switch
View post-checkout
#!/bin/sh
# To skip submodule update:
# IGNORE_SUBMODULES=1 git checkout <...>
# Third arg is "1" when doing a branch checkout (as opposed to a file
# checkout)
if [ "$3" = "1" ] && [ -z "$IGNORE_SUBMODULES" ]; then
View Request Headers.md

Overview

Miscellanious information discovered from sniffing Tinder's API traffic.

See also: https://gist.github.com/rtt/10403467, has a lot of valuable information & is much better formatted

URL

Requests are made to api.gotinder.com