This document is a scratchpad for helping me learn commonly used actions in Xcode's VIM mode.
Commands are case-sensitive. A command of N
means pressing shift + n
on the keyboard.
[Formatting is a WIP]
import AVFoundation | |
import Foundation | |
// The maximum number of audio buffers in flight. Setting to two allows one | |
// buffer to be played while the next is being written. | |
private let kInFlightAudioBuffers: Int = 2 | |
// The number of audio samples per buffer. A lower value reduces latency for | |
// changes but requires more processing but increases the risk of being unable | |
// to fill the buffers in time. A setting of 1024 represents about 23ms of |
// https://www.cs.rit.edu/~ncs/color/t_convert.html | |
struct RGB { | |
// Percent | |
let r: Float // [0,1] | |
let g: Float // [0,1] | |
let b: Float // [0,1] | |
static func hsv(r: Float, g: Float, b: Float) -> HSV { | |
let min = r < g ? (r < b ? r : b) : (g < b ? g : b) | |
let max = r > g ? (r > b ? r : b) : (g > b ? g : b) |
Spherical cap cone analytic solution is a 1d problem, since the cone cap sphere slides along the ray. The intersection point to empty space sphere is always on the ray. | |
S : radius of cone cap sphere at t=1 | |
r(d) : cone cap sphere radius at distance d | |
r(d) = d*S | |
p = distance of current SDF sample | |
SDF(p) = sdf function result at location p | |
x = distance after conservative step |
kernel vec4 coreImageKernel(__color startColor, __color endColor) | |
{ | |
vec2 point = destCoord(); | |
float angle = atan(point.y, point.x) + radians(180.0); | |
//Start from the upper middle, not the left middle | |
angle += radians(90.0); | |
angle = mod(angle, radians(360.0)); | |
float fraction = angle / radians(360.0); |
Original link: http://www.concentric.net/~Ttwang/tech/inthash.htm
Taken from: http://web.archive.org/web/20071223173210/http://www.concentric.net/~Ttwang/tech/inthash.htm
Reformatted using pandoc
Thomas Wang, Jan 1997
last update Mar 2007
In August 2007 a hacker found a way to expose the PHP source code on facebook.com. He retrieved two files and then emailed them to me, and I wrote about the issue:
http://techcrunch.com/2007/08/11/facebook-source-code-leaked/
It became a big deal:
http://www.techmeme.com/070812/p1#a070812p1
The two files are index.php (the homepage) and search.php (the search page)
package main | |
import ( | |
"image" | |
"image/color" | |
"math" | |
"github.com/peterhellberg/gfx" | |
) |
const delta = sqrt(eps(Float64)) | |
immutable Vec | |
x::Float64 | |
y::Float64 | |
z::Float64 | |
end | |
+(a::Vec, b::Vec) = Vec(a.x+b.x, a.y+b.y, a.z+b.z) | |
-(a::Vec, b::Vec) = Vec(a.x-b.x, a.y-b.y, a.z-b.z) | |
*(a::Float64, b::Vec) = Vec(a*b.x, a*b.y, a*b.z) |
#Originally created by AdrianV and can be found here: https://gist.github.com/AdrianV/5774141 | |
#Modified by me, hcorion to add sdl2 support and bring it up to speed with version 0.14.2 of Nim (nim-lang.org). | |
import math | |
import sequtils | |
import sdl2 | |
import times | |
const | |
width = 1280 |