Skip to content

Instantly share code, notes, and snippets.

View mwhuss's full-sized avatar

Marshall Huss mwhuss

View GitHub Profile
@alexbaldwin
alexbaldwin / zshrc.local
Last active January 15, 2016 20:48
Whiteboard cleaning command
# converts an image to png, extracts strokes, traces etc.
whiteboard() {
convert "$1" "$1.converted.png"
echo "Converted"
convert "$1.converted.png" \
-morphology Convolve DoG:15,100,0 \
-negate -normalize -blur 0x1 -channel RBG \
-level 60%,91%,0.1 \
"$1.cleaned.png"
echo "Cleaned"
@JeOam
JeOam / Animation.md
Last active July 11, 2024 03:30
iOS Core Animation: Advanced Techniques, Part 1: The Layer Beneath

Author: https://www.cyanhall.com/

1. The Layer Tree

Core Animation's original name is Layer Kit

Core Animation is a compositing engine; its job is to compose different pieces of visual content on the screen, and to do so as fast as possible. The content in question is divided into individual layers stored in a hierarchy known as the layer tree. This tree forms the underpinning for all of UIKit, and for everything that you see on the screen in an iOS application.

In UIView, tasks such as rendering, layout and animation are all managed by a Core Animation class called CALayer. The only major feature of UIView that isn’t handled by CALayer is user interaction.

There are four hierarchies, each performing a different role:

// See: https://devforums.apple.com/message/1000934#1000934
import Foundation
// Logic
operator prefix ¬ {}
@prefix func ¬ (value: Bool) -> Bool {
return !value
}
@flatpickles
flatpickles / SKShapeNode Tiled Fill Texture
Last active October 23, 2024 10:46
SKShapeNode scales a fill texture by default, instead of repeating the pattern. This snippet extends SKShapeNode to support setting a tiled fill-texture.
import SpriteKit
extension SKShapeNode {
func setTiledFillTexture(imageName: String, tileSize: CGSize) {
let targetDimension = max(self.frame.size.width, self.frame.size.height)
let targetSize = CGSizeMake(targetDimension, targetDimension)
let targetRef = UIImage(named: imageName).CGImage
UIGraphicsBeginImageContext(targetSize)
let contextRef = UIGraphicsGetCurrentContext()
class ActiveSupport::TestCase
def apple_receipt
'MIIbggYJKoZIhvcNAQcCoIIbczCCG28CAQExCzAJBgUrDgMCGgUAMIILMwYJKoZIhvcNAQcBoIILJASCCyAxggscMAoCAQgCAQEEAhYAMAoCARICAQEEAhYAMAoCARMCAQEEAgwAMAoCARQCAQEEAgwAMAsCAQECAQEEAwIBADALAgEDAgEBBAMMATEwCwIBCwIBAQQDAgEAMAsCAQ4CAQEEAwIBUTALAgEPAgEBBAMCAQAwCwIBEAIBAQQDAgEAMAsCARkCAQEEAwIBAzAMAgEKAgEBBAQWAjQrMA0CAQ0CAQEEBQIDARF0MA4CAQkCAQEEBgIEUDIyODAYAgEEAgECBBDuabE5Lbauzrsk8WLovHihMBsCAQACAQEEEwwRUHJvZHVjdGlvblNhbmRib3gwHAIBAgIBAQQUDBJjb20uYnlsaW5lci53ZWVrbHkwHAIBBQIBAQQUJFMs7reH3yBJ+xyOKQJSMPtTPDYwHgIBDAIBAQQWFhQyMDEzLTEyLTE3VDIxOjAxOjA4WjA6AgEHAgEBBDKL7sS/v5o6iHSWioLnE0PRcGF9r4SZ0OXjm+zXGm6EBPwesGEbEV9m/JfBEA6GXrPHYDBXAgEGAgEBBE+6ua/rbzgdYRU9Um5aaDQdu0s0rjmUuDVFz5Mp48wU48PbIUQUEzfkeqArZsEJpVZuvcVk2kj/W65UZfxZyWzNoOqynqdAaTQ/pY5lId7XMIIBhgIBEQIBAQSCAXwxggF4MAsCAgatAgEBBAIMADALAgIGsAIBAQQCFgAwCwICBrICAQEEAgwAMAsCAgazAgEBBAIMADALAgIGtAIBAQQCDAAwCwICBrUCAQEEAgwAMAsCAga2AgEBBAIMADAMAgIGpQIBAQQDAgEBMAwCAgarAgEBBAMCAQMwDAICBq4CAQEEAwIBADAMAgIGsQIBAQQDAgEAMBICAgavAgEBBAkCBwON
@ianklatzco
ianklatzco / Zelda Chest Noise
Last active September 12, 2019 09:03
Plays the chest noise from Legend of Zelda to a speaker or piezoelectric. Should be used with arduino; also works with a 1MHz attiny if you use the second script.
/* This code is derived from:
* http://www.arduino.cc/en/Tutorial/Melody
* This plays the chest noise from the Legend of Zelda on a piezo buzzer connected to pin 9 and ground. It has been tuned to a buzzer I had on hand, but you may want to adjust the values, testing against a tuner.
*/
int speakerPin = 0;
const int switchPin = 1;
char notes[] = "gabygabyxzCDxzCDabywabywzCDEzCDEbywFCDEqywFGDEqi azbC"; // a space represents a rest
int length = sizeof(notes); // the number of notes
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active November 11, 2024 22:46
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@LeSpocky
LeSpocky / rounded_corner.scad
Last active September 24, 2024 18:39
rounded square in openscad
module rounded_square( width, radius_corner ) {
translate( [ radius_corner, radius_corner, 0 ] )
minkowski() {
square( width - 2 * radius_corner );
circle( radius_corner );
}
}
module alternative_square( width, r_c ) {
hull() {
//
// SKNode+TouchPriority.h
// ButtonLab
//
// Created by Fille Åström on 10/20/13.
// Copyright (c) 2013 IMGNRY. All rights reserved.
//
#import <SpriteKit/SpriteKit.h>
@calebd
calebd / Readme.markdown
Last active December 20, 2015 05:18
Rdio table view scrolling

Step 1: Configure the table view.

  • Set a view as the table footer
  • Set the background color to clear.

Step 2: Set the default table view values when your view loads. The values and variables seen here are explained below.

- (void)viewDidLoad {
    [super viewDidLoad];