Skip to content

Instantly share code, notes, and snippets.

View ashtom's full-sized avatar
:octocat:
the job is not to know; it's to become

Thomas Dohmke ashtom

:octocat:
the job is not to know; it's to become
View GitHub Profile
import SwiftUI
import PlaygroundSupport
struct ShareSheet: View {
var body: some View {
VStack(spacing: 0) {
SheetHeaderView()
.padding()
Divider()
//
// ContentView.swift
// Widgets
//
// Created by Kyle Halevi on 7/3/20.
//
import SwiftUI
struct Widget: View {
import SwiftUI
import MapKit
import PlaygroundSupport
struct Location {
var title: String
var latitude: Double
var longitude: Double
}
import SwiftUI
import PlaygroundSupport
// constants
let deviceWidth: CGFloat = 320
let deviceHeight: CGFloat = 568
let hasFaceID = true // false for TouchID
struct Device: View {
var body: some View {
@jordansinger
jordansinger / macOS.swift
Last active February 14, 2024 03:41
macOS SwiftUI Playgrounds code
import SwiftUI
import PlaygroundSupport
struct Desktop: View {
var body: some View {
ZStack {
// Image(uiImage: #imageLiteral(resourceName: "IMG_6281.JPG"))
Color(UIColor.systemBlue)
macOS()
}
@tafkey
tafkey / git_overview
Last active October 19, 2023 15:15
Print git status of all repositories under the current folder
find . -type d -name '.git' | while read dir ; do sh -c "cd $dir/../ && echo -e \"\nGIT STATUS IN ${dir//\.git/}\" && git status -s" ; done
@relistan
relistan / compress_requests.rb
Last active April 18, 2023 23:54 — forked from subdigital/compress_requests.rb
Rack Middleware to automatically unzip gzipped/deflated POST data
class CompressedRequests
def initialize(app)
@app = app
end
def method_handled?(env)
!!(env['REQUEST_METHOD'] =~ /(POST|PUT)/)
end
def encoding_handled?(env)
@zumbojo
zumbojo / bijective.rb
Created July 9, 2011 22:09
Simple bijective function (base(n) encode/decode)
# Simple bijective function
# Basically encodes any integer into a base(n) string,
# where n is ALPHABET.length.
# Based on pseudocode from http://stackoverflow.com/questions/742013/how-to-code-a-url-shortener/742047#742047
ALPHABET =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split(//)
# make your own alphabet using:
# (('a'..'z').to_a + ('A'..'Z').to_a + (0..9).to_a).shuffle.join