Skip to content

Instantly share code, notes, and snippets.

View p-sun's full-sized avatar

Paige Sun p-sun

View GitHub Profile
@khansensf
khansensf / TermTheme.scpt
Created February 1, 2012 01:09
Small script to rotate through themes in OSX Terminal Window. Great for discerning among many open windows/tabs
-- TermTheme.scpt
-- Ken Hansen 02/2012
-- Sets theme of current terminal window/tab
-----------------------
-- Arguments
-----------------------
-- If a theme name is provided on the command line then set to that
-- Example
-- osascript TermTheme.scpt Grass
@vincentmac
vincentmac / sublime-text-osx-context-menu.md
Created September 25, 2013 18:03
Sublime Text OSX Context Menu

Add Sublime Text to OS X Context Menu

  • Open Automator
  • Create a new Service
  • Add a Run Shell Script action
  • Set input to Service receives selected files or folders in any application
  • Set the script action to /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -n $@
  • Set Pass input to as arguments
  • Save as Open in Sublime Text
@JoppeSchwartz
JoppeSchwartz / MeasureBrightness.m
Created July 19, 2014 19:32
Measure brightness with the iOS front camera.
/* Assumes your class has the following instance variables:
AVCaptureSession *_videoSession;
AVCaptureDevice *_cameraDevice;
AVCaptureStillImageOutput *_imageOutput;
AVCaptureConnection *_avConnection;
*/
-(void) setupStillVideoCaptureSession
@JeOam
JeOam / Animation.md
Last active November 20, 2024 07:54
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:

👊 ✋ ✌️

You are going to create a very simple rock paper scissors game. It will consist of three buttons, one for each of the moves you can play. Tap on one of these buttons to chose your move, then the iPhone will randomly choose a move and a you either win, lose, or 👔.

Screenshot of app

Rules of Rock Paper Scissors:

  • Each sign can beat one (and only one) other:
  • Rock smashes scissors.
@JoshuaSullivan
JoshuaSullivan / CapturedImageSampler.swift
Created October 1, 2017 01:38
The source code for an object that helps you sample RGB values from ARFrames.
//
// CapturedImageSampler.swift
// ARKitTest
//
// Created by Joshua Sullivan on 9/22/17.
// Copyright © 2017 Joshua Sullivan. All rights reserved.
//
import UIKit
import ARKit
@swalkinshaw
swalkinshaw / tutorial.md
Last active November 13, 2023 08:40
Designing a GraphQL API