Skip to content

Instantly share code, notes, and snippets.

@andymasteroffish
andymasteroffish / Hau_kun_sketch.cpp
Created May 27, 2021 19:57
Source code for a plotter drawing based on a @Hau_kun tweet
// Original tweet by @Hau_kun
// https://twitter.com/Hau_kun/status/1397547848015638532
// Made in openFrameworks
// Using ofGCode
// https://github.com/andymasteroffish/ofxGCode
void ofApp::setup(){
ofxGCode gcode;
@klazuka
klazuka / fish_title.fish
Created September 26, 2015 16:40
fish shell: custom terminal title using current git repo name
# Change the terminal title automatically based on current process / working-directory
#
# The main improvement over the default 'fish_title' behavior
# is that I use the name of the current git repo, if any, as
# opposed to the raw working-directory
function fish_title
set -l command (echo $_)
if test $command = "fish"
# we are sitting at the fish prompt
@andymatuschak
andymatuschak / MultiDirectionAdjudicatingScrollView.swift
Created January 26, 2015 19:31
Source for the Khan Academy app's unusual scrolling interactions
//
// MultiDirectionAdjudicatingScrollView.swift
// Khan Academy
//
// Created by Andy Matuschak on 12/16/14.
// Copyright (c) 2014 Khan Academy. All rights reserved.
//
import UIKit
import UIKit.UIGestureRecognizerSubclass
#To install:
#
#In your git configuration (for instance, .git/config to do it at the project level), add:
#
#[merge "json_merge"]
# name = A custom merge driver for json files
# driver = coffee json_merge.coffee %O %A %B
# recursive = binary
#
#In your project's .gitattributes file, add something like:
@calebd
calebd / ArrayHelpers.swift
Last active November 4, 2022 15:17
Swift Helpers
extension Array {
func first() -> Element? {
if isEmpty {
return nil
}
return self[0]
}
func last() -> Element? {
@mattt
mattt / uiappearance-selector.md
Last active March 19, 2024 12:52
A list of methods and properties conforming to `UIAppearance` as of iOS 12 Beta 3

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep UI_APPEARANCE_SELECTOR ./*     | \
  sed 's/NS_AVAILABLE_IOS(.*)//g'     | \
  sed 's/NS_DEPRECATED_IOS(.*)//g'    | \
  sed 's/API_AVAILABLE(.*)//g'        | \
  sed 's/API_UNAVAILABLE(.*)//g'      | \
 sed 's/UI_APPEARANCE_SELECTOR//g' | \
//
// SGDeviceIdentifier.h
// Elements
//
// Created by Justin Williams on 9/28/12.
// Copyright (c) 2012 Second Gear. All rights reserved.
//
#import <Foundation/Foundation.h>
@osteslag
osteslag / version.sh
Created July 18, 2011 12:45
Script for managing build and version numbers using git and agvtool. See link in comments below.
#!/bin/sh
# Script for managing build and version numbers using git and agvtool.
# Change log:
# v1.0 18-Jul-11 First public release.
# v1.1 29-Sep-12 Launch git, agvtool via xcrun.
version() {
require 'rubygems'
require 'rmagick'
require 'color_namer'
img = Magick::ImageList.new('photo.jpg')
img.resize_to_fit!(500) # resize the image to have faster quantization
quantized = img.quantize(16) # quantize the photo to reduce number of colors
img.destroy! # prevent memory leaks