Skip to content

Instantly share code, notes, and snippets.

View lilyball's full-sized avatar

Lily Ballard lilyball

View GitHub Profile
@lilyball
lilyball / !||.swift
Last active August 29, 2015 14:04
`x !|| y` operator to provide the equivalent of `x ? x! : y`
operator infix !|| {
associativity right
precedence 100
}
func !||<T>(left: T?, right: @auto_closure () -> T) -> T {
if let val = left {
return val
}
return right()
@lilyball
lilyball / shuffle.swift
Last active August 29, 2015 14:27
Fisher-Yates Shuffle for Swift
import Darwin // for arc4random_uniform
extension SequenceType {
@warn_unused_result(mutable_variant="shuffleInPlace") func shuffle() -> [Generator.Element] {
// this is more efficient than building an array and shuffling it
// and it works on sequences too!
var ary: [Generator.Element] = []
ary.reserveCapacity(underestimateCount())
for var x in self {
let j = Int(arc4random_uniform(UInt32(ary.count+1)))
@mamiu
mamiu / .promptline.fish
Last active October 29, 2015 15:44
This is a fish script for a powerline like prompt in the fish shell. To use it, just source this script with ". /path/to/.promptline.fish" (without the quotation marks) in your ~/.config/fish/config.fish! Have fun :)
# to use this script you need the latest fish version (2.1.x)
begin
########## USER CONFIG ##########
# enable or disable the different parts of promptline with yes or no
set show_only_left_prompt no
set show_hostname no
set show_virtual_env yes
set show_username yes
set show_current_working_directory yes
set show_git_branch yes
@JensAyton
JensAyton / ClassCrawler.m
Created November 28, 2010 20:24
Generate a GraphViz file showing the hierarchy of Objective-C classes in a given bundle, super- and subclasses of a given class, or all loaded classes. Requires GraphViz for viewing, http://www.pixelglow.com/graphviz/ Hack notice: this is one.
Moved to a repo: https://github.com/Ahruman/ClassCrawler
@John07
John07 / HLS_to_mp4
Last active October 11, 2020 01:20
Save/record HTTP Live Stream (short HLS, the kind of live stream that can be played by iOS devices) to disk as mp4 file
ffmpeg -re -i http://url.com/playlist.m3u8 -c copy -bsf:a aac_adtstoasc output.mp4

This page is now depreacted!

Check out the repo instead. The Wisdom of Quinn Now with 100% more archived PDFs.

The Wisdom of Quinn

Informative DevForum posts from everyone's favorite DTS member.

(Arranged newest to oldest)

@crkochan
crkochan / 4button-pico-bp.yaml
Last active March 21, 2023 05:01
Home Assistant Blueprint
blueprint:
name: Lutron Caseta Four-Button Scene Pico Actions
description: Short and long press automations for the Pico four-button remote.
domain: automation
input:
pico_remote:
name: Pico Four-Button Scene Remote
description: Select the Pico four-button scene remote to configure.
selector:
device:
@incanus
incanus / GitTagBundleVersion.sh
Created December 22, 2010 02:23
This is an Xcode build script that will automatically change your app's Info.plist CFBundleVersion string to match the latest git tag for the working copy. If you have commits beyond the last tagged one, it will append a 'd' to the number.
#/bin/sh
INFO=$( echo $PWD )/MyApp-Info
TAG=$( git describe --tags `git rev-list --tags --max-count=1` )
COMMIT=
GITPATH=/usr/bin:/usr/local/bin:/usr/local/git/bin
PATH=$PATH:$GITPATH; export PATH
if [ -z $( which git ) ]; then
echo "Unable to find git binary in \$GITPATH"
@liclac
liclac / hewwo.pl
Last active October 1, 2023 11:48
Hewwo? (Based on leafysweetsgarden's OWO extension)
#!/usr/bin/env -S perl -p
tr/rlRL/wwWW/; s/([nN])([aeiou])/\1y\2/g; s/(N)([AEIOU])/\1Y\2/g; s/ove/uv/g;
s/\!+/" ".("(・`ω´・)",";;w;;","owo","UwU",">w<","^w^")[rand(6)]." "/eg;
@rrbutani
rrbutani / .macos-sandbox-notes
Last active October 18, 2023 02:19
macOS sandbox notes
(placeholder to set the gist name)