Skip to content

Instantly share code, notes, and snippets.

View indyfromoz's full-sized avatar
🏠
Working from home

Indrajit Chakrabarty indyfromoz

🏠
Working from home
View GitHub Profile
@indyfromoz
indyfromoz / TipsView.swift
Created July 4, 2020 21:37 — forked from stammy/TipsView.swift
SwiftUI MicroAnimation example
//
// TipsView.swift
// Stonks
//
// Created by Paul Stamatiou on 7/3/20.
//
import SwiftUI
import PlaygroundSupport
import SwiftUI
import SafariServices
import PlaygroundSupport
// lil news api
let apiURL = "https://api.lil.software/news"
struct News: Codable {
var articles: [Article]
}
import SwiftUI
import PlaygroundSupport
struct Content: View {
@State var isExpanded = false
@State var wifiEnabled = true
@State var spacing: CGFloat = 12
var body: some View {
VStack(spacing: self.spacing) {
HStack(spacing: self.spacing) {
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 {
@indyfromoz
indyfromoz / Keypad.swift
Created July 2, 2020 21:05 — forked from jordansinger/Keypad.swift
Run this in Swift Playgrounds on iPad or Mac
import SwiftUI
import PlaygroundSupport
struct Keypad: View {
var body: some View {
VStack(spacing: 24) {
HStack {
Spacer()
Text("1")
import SwiftUI
import PlaygroundSupport
struct Desktop: View {
var body: some View {
ZStack {
// Image(uiImage: #imageLiteral(resourceName: "IMG_6281.JPG"))
Color(UIColor.systemBlue)
macOS()
}
// I needed to fetch all the pages from a paged endpoint.
// In this specific case, the JSON results contained a `pagingStatus` section that provided extra information which I could use:
// Hiding that behind a protocol:
import Foundation
protocol PagedReturning {
var pagingStatus: PagingStatus { get }
}
@indyfromoz
indyfromoz / Twilio Asterisk Secure Trunking HOWTO.md
Created June 12, 2020 02:15 — forked from ianthetechie/Twilio Asterisk Secure Trunking HOWTO.md
A short guide on how to set up an encrypted VoIP system using Twilio and Asterisk.

Twilio Asterisk Secure Trunking HOWTO

This is a short guide on how to set up an encrypted VoIP system using Twilio and Asterisk. I was a little annoyed that just about everything these days still uses unencrypted RTP for media (though just about everyone supports SIP over TLS). So I spent a weekend looking at options, and settled on a totally overkill solution involving Twilio's secure trunking to an Asterisk PBX. While all bets are off once it hits the PSTN, at least you won't be blasting your conversations over the internet in clear text.

@indyfromoz
indyfromoz / MacEditorTextView.swift
Created May 26, 2020 19:09 — forked from unnamedd/MacEditorTextView.swift
[SwiftUI] MacEditorTextView - A simple and small NSTextView wrapped by SwiftUI.
/**
* MacEditorTextView
* Copyright (c) Thiago Holanda 2020
* https://twitter.com/tholanda
*
* MIT license
*/
import Combine
import SwiftUI
@indyfromoz
indyfromoz / AppStoreHome.swift
Last active May 15, 2020 19:31 — forked from navsing/AppStoreHome.swift
Let’s recreate the iOS app store home screen in less than 5 minutes using SwiftUI and Swift Playgrounds on iPad
import SwiftUI
import PlaygroundSupport
struct Screen: View {
var body: some View {
ScrollView {
HStack {
VStack (alignment: .leading) {
Text("TUESDAY, MAY 12").foregroundColor(.secondary).bold().font(.footnote)