View advanced-swiftui-animations.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//------------------------------------------------------------------------ | |
// The SwiftUI Lab: Advanced SwiftUI Animations | |
// https://swiftui-lab.com/swiftui-animations-part1 (Animating Paths) | |
// https://swiftui-lab.com/swiftui-animations-part2 (GeometryEffect) | |
// https://swiftui-lab.com/swiftui-animations-part3 (AnimatableModifier) | |
//------------------------------------------------------------------------ | |
import SwiftUI | |
struct ContentView: View { | |
View node-tcp.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Net = require("net"); | |
// The port on which the server is listening. | |
const port = 8080; | |
// Use net.createServer() in your code. This is just for illustration purpose. | |
// Create a new TCP server. | |
const server = new Net.Server(); | |
// The server listens to a socket for a client to make a connection request. | |
// Think of a socket as an end point. | |
server.listen(port, function () { |
View swiftid-usersme.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct MeResponseData: Decodable { | |
let id: Int | |
let username: String | |
let email: String | |
} | |
func me(authToken: String? = nil) async throws -> MeResponseData { | |
let meData: MeResponseData = try await URLSession.shared.get(pathname: "/users/me", authToken: authToken) | |
return meData | |
} |
View swiftid-login.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct LoginRequestData: Encodable { | |
let identifier: String | |
let password: String | |
} | |
struct LoginResponseData: Decodable { | |
let jwt: String | |
} | |
func login(_ loginRequest: LoginRequestData) async throws -> String { | |
// URLSession.shared.post is an extension which you can find here https://gist.github.com/nicnocquee/f0a0dbe345f0a18a378d9022c7d11e9c#gistcomment-3964831 | |
let loginData: LoginResponseData = try await URLSession.shared.post(pathname: "/auth/local", data: loginRequest) |
View swiftid-register.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct RegisterRequestData: Encodable { | |
let username: String | |
let email: String | |
let password: String | |
} | |
struct LoginResponseData: Decodable { | |
let jwt: String | |
} |
View EnumListView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct EnumListView<Enum: RawRepresentable & | |
CaseIterable & | |
CustomStringConvertible> : View where | |
Enum.RawValue: Hashable, | |
Enum.AllCases: RandomAccessCollection { | |
var title: String = "" | |
@Binding var selectedItem: Enum? | |
var body: some View { |
View pokemon-fetch-combine.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import Combine | |
struct PokemonResponse: Codable{ | |
let results: [Pokemon] | |
} | |
struct Pokemon: Codable{ | |
let name: String |
View next.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('dotenv').config() | |
const getEnvWithPrefixes = (prefixes = ['REACT_APP_', 'FIREBASE_']) => { | |
return Object.keys(process.env).reduce((prev, curr) => { | |
if (prefixes.some(p => curr.startsWith(p))) { | |
return { | |
...prev, | |
[curr]: process.env[curr], | |
} | |
} |
View uicollectionview-playground.playyground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import PlaygroundSupport | |
let cellSize = CGSize(width: 100, height: 100) | |
class Cell: UICollectionViewCell { | |
var imageView: UIImageView? | |
var identifier: String? | |
required init?(coder aDecoder: NSCoder) { | |
super.init(coder: aDecoder) |
View my_alias.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Color LS | |
colorflag="-G" | |
alias ls="command ls ${colorflag}" | |
alias l="ls -lF ${colorflag}" # all files, in long format | |
alias la="ls -laF ${colorflag}" # all files inc dotfiles, in long format | |
alias lsd='ls -lF ${colorflag} | grep "^d"' # only directories | |
alias lsa="command ls -la | lolcat" | |
# Quicker navigation | |
alias ..="cd .." |
NewerOlder