Skip to content

Instantly share code, notes, and snippets.

@tal
tal / BaseStackView.swift
Created July 22, 2022 00:54
A basic implementation of a stack of cards tied to a model.
//
// BaseStackView.swift
// Sport Range
//
// Created by Tal Atlas on 7/20/22.
//
import SwiftUI
class NavStack: ObservableObject {
{
"features": {
"my_feature": false,
"other_feature": true
},
"experiments": {
"likes_are_boops": "control-likes",
"dashboard_sideways": "sideways-1"
}
}
#compdef hub
# Zsh will source this file when attempting to autoload the "_hub" function,
# typically on the first attempt to complete the hub command. We define two new
# setup helper routines (one for the zsh-distributed version, one for the
# git-distributed, bash-based version). Then we redefine the "_hub" function to
# call "_git" after some other interception.
#
# This is pretty fragile, if you think about it. Any number of implementation
# changes in the "_git" scripts could cause problems down the road. It would be
# fixme - the load process here seems a bit bizarre
zmodload -i zsh/complist
WORDCHARS=''
unsetopt menu_complete # do not autoselect the first completion entry
unsetopt flowcontrol
setopt auto_menu # show completion menu on successive tab press
setopt complete_in_word
setopt always_to_end
@tal
tal / actions.swift
Last active June 29, 2016 04:06
Redux swift example
import Foundation
struct DashResponse {}
enum AppActions {
case dashAction(DashActions)
case envAction(EnvActions)
}
enum DashActions {

Keybase proof

I hereby claim:

  • I am tal on github.
  • I am tal (https://keybase.io/tal) on keybase.
  • I have a public key whose fingerprint is BE5E 1663 DA9A 13AA D4E8 3AFC C639 B882 E874 41AE

To claim this, I am signing this object:

extension CollectionType {
/// Return a copy of `self` with its elements shuffled
func shuffle() -> [Generator.Element] {
var list = Array(self)
list.shuffleInPlace()
return list
}
}
extension CollectionType where Index == Int {
@tal
tal / DoubleRange.swift
Created October 20, 2015 14:47
I would like to define variables whos type is a protocol but limited such that the internal type is of a specific type.
struct DoubleRange:Scalable {
typealias ScalableType = Double
let start:Double
let end:Double
func scale(dub: Double) -> Double? {
return start + (dub * diff)
}
func scale(dub:Double) -> CGFloat? {
@tal
tal / charlist.json
Created January 8, 2015 17:24
Mask characcters with lookalikes
{
"A": "Α",
"a": "α",
"B": "Β",
"C": "Ç",
"c": "ç",
"D": "Đ",
"d": "ԁ",
"E": "Ε",
"e": "ė",
@tal
tal / facebook groups.html
Created November 19, 2014 15:14
This si the base 64 decoded version of the homepage link facebook groups made: http://hastebin.com/icumureqeh.hs
<!DOCTYPE HTML>
<html>
<head id="htmlHead">
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="apple-mobile-web-app-capable" content="no" />
<title>The Maderas Villagers</title>
<link rel="apple-touch-icon-precomposed" href="data:image/png;base64,/9j/4AAQSkZJRgABAQAAkACQAAD/4QCMRXhpZgAATU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAACQAAAAAQAAAJAAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAAHigAwAEAAAAAQAAAHgAAAAA/+0AOFBob3Rvc2hvcCAzLjAAOEJJTQQEAAAAAAAAOEJJTQQlAAAAAAAQ1B2M2Y8AsgTpgAmY7PhCfv/AABEIAHgAeAMBEQACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQ