Index:
Table of Contents
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 json | |
import urllib.request | |
import ssl | |
username = input("Enter your GitHub username: ") | |
url = f"https://api.github.com/users/{username}/events" | |
context = ssl.create_default_context() | |
context.check_hostname = False | |
context.verify_mode = ssl.CERT_NONE |
Apps used: Cursor.so / github copilot chat / Amazon Q / codeium
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 SwiftUI | |
import UIKit | |
struct ContentView: View { | |
@State private var isLocked = false | |
@State private var isSheetVisible = false | |
var body: some View { | |
LockableView(isLocked: isLocked) { |
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 Foundation | |
import CoreData | |
extension MyCoredataObject { | |
@nonobjc public class func createFetchRequest() -> NSFetchRequest<MyCoredataObject> { | |
return NSFetchRequest<MyCoredataObject>(entityName: "MyCoredataObject") | |
} | |
@NSManaged public var sortId: Int64 |
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 Alamofire | |
func makeGetCallWithAlamofire() { | |
let todoEndpoint: String = "https://jsonplaceholder.typicode.com/todos/1" | |
Alamofire.request(todoEndpoint) | |
.responseJSON { response in | |
// check for errors | |
guard response.result.error == nil else { | |
// got an error in getting the data, need to handle it | |
print("error calling GET on /todos/1") |
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
extension String { | |
func unescapeHTMLEntities() throws -> String { | |
guard contains("&#") else { | |
return self | |
} | |
guard let data = data(using: .utf8) else { | |
return self |
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
function flatten(arr) { | |
return arr.reduce((acc, val) => acc.concat(Array.isArray(val) ? flatten(val) : val), []); | |
} |
NewerOlder