Skip to content

Instantly share code, notes, and snippets.

View lostincode's full-sized avatar
🥨

Bill Richards lostincode

🥨
View GitHub Profile
@lostincode
lostincode / ContentView.swift
Created June 15, 2024 00:24
MeshGradient Playground iOS 18
//
// ContentView.swift
// MeshGradientPlayground
//
// Created by Bill Richards on 6/14/24.
//
import SwiftUI
struct ContentView: View {
// assumes you have imagemagick installed locally
magick mogrify -format gif ositem.webp
//TODO: get the 'AVComposition asset' first ;)
let uuid = UUID().uuidString
let exportPath = NSTemporaryDirectory().appendingFormat("\(uuid).mov")
let exportUrl = URL(fileURLWithPath: exportPath)
let exporter = AVAssetExportSession(asset: asset, presetName: AVAssetExportPresetHighestQuality)
exporter?.shouldOptimizeForNetworkUse = true
exporter?.outputURL = exportUrl
exporter?.outputFileType = AVFileTypeQuickTimeMovie

Keybase proof

I hereby claim:

  • I am lostincode on github.
  • I am lostincode (https://keybase.io/lostincode) on keybase.
  • I have a public key whose fingerprint is C76D 8AC9 ADE2 9F7B 4DC8 E259 76F0 E5F6 0498 7BB7

To claim this, I am signing this object:

@lostincode
lostincode / BaseViewController.swift
Last active August 29, 2015 14:15
Child View Controller
//
// BaseViewController.swift
// Child Container ViewController Methods
//
// Created by Bill Richards on 2/11/15.
// Copyright (c) 2015 Bill Richards. All rights reserved.
//
import UIKit
@lostincode
lostincode / gist:909b72f96bfbf8d7f956
Created November 14, 2014 05:49
Google Analytics Swift Extension
import UIKit
extension UIViewController {
func setScreeName(name: String) {
self.title = name
self.sendScreenView()
}
@lostincode
lostincode / CollectionViewDataSource.swift
Last active December 27, 2018 16:38
Lighter View Controller (UICollectionViewDatasource) in Swift
//
// CollectionViewDataSource.swift
//
// Created by Bill Richards on 10/1/14.
// Copyright (c) 2014 Bill Richards. All rights reserved.
//
import Foundation
typealias CollectionViewCellConfigureBlock = (cell:UICollectionViewCell, item:AnyObject?) -> ()
@lostincode
lostincode / gist:5465456
Last active December 16, 2015 16:49
AFNetworking fade in on first load only.
__weak UITableViewCell *weakCell = cell;
[cell.imageView setImageWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]
placeholderImage:nil
success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {
if (response.statusCode == 0) return;
weakCell.imageView.alpha = 0;
weakCell.imageView.image = image;
[UIView animateWithDuration:0.5
delay:0
options:UIViewAnimationCurveEaseIn
<% [:notice, :error, :alert].each do |level| %>
<% unless flash[level].blank? %>
<div class="alert-message <%= flash_class(level) %>">
<a class="close" href="#">×</a>
<%= content_tag :p, flash[level] %>
</div>
<% end %>
<% end %>
@lostincode
lostincode / Slider.as
Created January 15, 2011 09:08
AS3: quick slider example MOUSE_MOVE instead of startDrag()
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
public class Slider extends Sprite {
private var options:Object = {width:400, height:15, minValue:0, maxValue:100, onUpdate:null, onChange:null};
private var sliderHolder:Sprite;