Skip to content

Instantly share code, notes, and snippets.

View eonist's full-sized avatar
🎯
Focusing

André J eonist

🎯
Focusing
View GitHub Profile
@eonist
eonist / github_stats.py
Last active October 25, 2023 01:48
github_stats.py
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
@zhwayne
zhwayne / EditMenu.swift
Created September 21, 2023 09:44
EditMenu for SwiftUI
//
// EditMenu.swift
// CalcApp
//
// Created by iya on 2023/6/9.
// Copyright © 2023 wayne. All rights reserved.
//
import SwiftUI
import UIKit
@eonist
eonist / My_favorite_ai_coding_prompts.md
Last active March 26, 2024 10:31
My_favorite_ai_coding_prompts.md

The art of prompt coding 🦾

Visitors

Apps used: Cursor.so / github copilot chat

img

⚠️️ Before you disregard the idea of prompt coding ⚠️️ Don't! Because everyone will be prompt-coding soon enough.

This is like when humanity stopped using horses for transportation and started using cars. 🐴 👉 🚗

@sroebert
sroebert / LockableViewExample.swift
Created September 8, 2023 22:08
SwiftUI LockableView
import SwiftUI
import UIKit
struct ContentView: View {
@State private var isLocked = false
@State private var isSheetVisible = false
var body: some View {
LockableView(isLocked: isLocked) {
@novinfard
novinfard / MyCoredataObject+CoreDataProperties.swift
Last active December 5, 2022 23:10
[Auto increment in Core Data] How to implement auto-increment in core data while saving it #coredata
import Foundation
import CoreData
extension MyCoredataObject {
@nonobjc public class func createFetchRequest() -> NSFetchRequest<MyCoredataObject> {
return NSFetchRequest<MyCoredataObject>(entityName: "MyCoredataObject")
}
@NSManaged public var sortId: Int64
@cmoulton
cmoulton / Simple Alamofire Calls in Swift 4
Last active December 8, 2020 09:29
Simple Alamofire Calls in Swift 4
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")
@ollieatkinson
ollieatkinson / String+HTML.swift
Last active March 3, 2017 04:39
Unescape HTML entities in Swift 3 == &#163; -> £
extension String {
func unescapeHTMLEntities() throws -> String {
guard contains("&#") else {
return self
}
guard let data = data(using: .utf8) else {
return self
function flatten(arr) {
return arr.reduce((acc, val) => acc.concat(Array.isArray(val) ? flatten(val) : val), []);
}
@reitzig
reitzig / Data.swift
Last active April 15, 2022 03:47
Reading InputStream into Data
extension Data {
/**
Consumes the specified input stream, creating a new Data object
with its content.
- Parameter reading: The input stream to read data from.
- Note: Closes the specified stream.
*/
init(reading input: InputStream) {
self.init()
input.open()