Skip to content

Instantly share code, notes, and snippets.

View jkosoy's full-sized avatar

Jamie Kosoy jkosoy

View GitHub Profile
@jkosoy
jkosoy / runner.js
Created April 16, 2024 20:25
Record a video using playwright and FFMPEG
/*
* usage
* node runner.js | ffmpeg -y -c:v png -f image2pipe -r 30 -i - -c:v libx264 -pix_fmt yuv420p -movflags +faststart output.mp4
*
*/
const { chromium } = require('playwright');
const WIDTH = 1920;
const HEIGHT = 1080;
const URL = 'URL_GOES_HERE';
@jkosoy
jkosoy / Git Flow.md
Last active February 23, 2024 22:48
Git Flow

Git Flow

I keep meeting people who struggle to wrap their heads around the proper way to use Git + Github. This snippet is designed to explain Vincent Driessen's git branching model, at least as well as I understand it. Speacial thanks to Stephen Koch for being the true master here.

This tutorial is for Linux or OSX. Feel free to use Cygwin or write a fork for windows.

A way to think about Git and Github.

@jkosoy
jkosoy / gist:5379904
Last active June 20, 2023 14:06
Raspberry Pi setup

Raspberry Pi setup

Just wanted a quick start guide for myself so that I wouldn't have to keep rooting through Google to remember all this stuff. Hopefully it helps other people.

If you had other ideas or suggestions please leave a comment.

Useful things to own before you buy a Pi

The first time I bought a Pi I was enormously frustrated with myself because I didn't own all of this stuff. Kept having to order things off of Amazon and wait to get started... very irritating. This is all good stuff to have laying around anyway:

@jkosoy
jkosoy / CGSize+AspectFunctions.swift
Last active June 3, 2023 18:11
Aspect Fill and Aspect Fit calculations in Swift
// port of http://stackoverflow.com/a/17948778/3071224
import UIKit
import Foundation
extension CGSize {
static func aspectFit(aspectRatio : CGSize, var boundingSize: CGSize) -> CGSize {
let mW = boundingSize.width / aspectRatio.width;
let mH = boundingSize.height / aspectRatio.height;
@jkosoy
jkosoy / CoreGraphics+AspectRatio.swift
Created April 14, 2016 23:54
Calculating for different device Aspect Ratios, used in Melody Jams
//
// CoreGraphics+AspectRatio.swift
// EmptySpriteKitGame
//
// Created by Jamie Kosoy on 11/6/15.
// Copyright © 2015 Arbitrary. All rights reserved.
//
import UIKit
import Foundation
@jkosoy
jkosoy / gist:3895744
Created October 15, 2012 21:42
Cinder Drawing Tips
// originally from http://redpaperheart.com/blog/2012/08/handy-snippets-for-drawing-image-textures-in-cinder/
// thanks Daniel!
// ---------------------
/* draw a texture */
gl::draw(texture);
// ---------------------
/* Draw a texture into a specified rectangle, distort texture to fill rectangle: */
@jkosoy
jkosoy / TheBigShow.json
Created April 15, 2016 00:27
Melody Jams JSON example
{
"code": 200,
"data": {
"jam": {
"status": "ready",
"jam_id": "TheBigShow",
"created": "2016-03-16T00:00:00-07:00",
"last_updated": "2016-03-16T00:00:00-07:00",
"name": "The Big Show",
"ios": {
@jkosoy
jkosoy / pseudo.js
Created March 9, 2016 20:12
Promises Explained
animateFareTextIn(function() {
animateWeatherTextIn(function() {
animateDividerIn(function() {
animateLoadingSentence1In(function() {
animateLoadingSenetence2In(function() {
// all done!
})
}
}
})
@jkosoy
jkosoy / IntroView.swift
Created March 8, 2016 23:34
Fare Weather
//
// IntroView.swift
// Fare Weather
//
// Created by Jamie Kosoy on 3/8/16.
// Copyright © 2016 Arbitrary. All rights reserved.
//
import UIKit
import CFAAction
@jkosoy
jkosoy / MainViewController.swift
Last active March 8, 2016 23:31
Fare Weather Prototype 010
//
// ViewController.swift
// Fare Weather
//
// Created by Jamie Kosoy on 2/23/16.
// Copyright © 2016 Arbitrary. All rights reserved.
//
import UIKit
import PromiseKit