Skip to content

Instantly share code, notes, and snippets.

View talkaboutdesign's full-sized avatar

Maksim Petriv talkaboutdesign

View GitHub Profile
@NSExceptional
NSExceptional / AutoLayout.md
Last active December 8, 2021 06:19
The best damn AutoLayout guide I've ever seen

Edit Feb 4 5:16 PM: Skip to the bottom if you just want the article

It has been brought to my attention that rehosting someone else's content without asking them — even if you link to the original content — is not exactly polite. I did not ask the author before I rehosted his article, and while I feel I should have known better than to that, it just didn't occurr to me. It's not exactly plagarism, but it's still wrong on some level. I have reached out to him now about hosting it here publically, and if he says it's alright, I'll put it back.

You can find the original article here, on his site, and on his Medium page.

@talkaboutdesign
talkaboutdesign / index.js
Last active March 13, 2019 02:19
Serverless Stripe payment processing. Compatible with Zeit.co Now 2.0.
const stripe = require('stripe')('your-stripe-secret')
const { text } = require('micro')
module.exports = async (req, res) => {
// Need to process body from request coming in.
const body = JSON.parse(await text(req))
// Process payment using details from incoming request. You might also optionally want to create a customer before initiating a payment.
const charge = await stripe.charges
.create({
@isthisjoe
isthisjoe / MovieWriter.swift
Last active July 8, 2020 07:28
Swift 3 | macOs | Write NSImage(s) to a movie file. Modified from http://stackoverflow.com/a/36297656/1275125
import AppKit
import AVFoundation
class MovieWriter: NSObject {
func writeImagesAsMovie(_ allImages: [NSImage], videoPath: String, videoSize: CGSize, videoFPS: Int32) {
// Create AVAssetWriter to write video
guard let assetWriter = createAssetWriter(videoPath, size: videoSize) else {
print("Error converting images to video: AVAssetWriter not created")
return
}