Skip to content

Instantly share code, notes, and snippets.

View romyilano's full-sized avatar
😎
improving

Romy romyilano

😎
improving
View GitHub Profile
//
// ExtensionURLRequest.swift
//
// Created by Abhishek Maurya on 16/07/20.
// Copyright © 2020. All rights reserved.
//
import Foundation
extension URLRequest {
@romyilano
romyilano / combineSample.swift
Created January 23, 2024 22:41
ways of doing core location in the different async frameworks
// super rusty on combine
// https://brightdigit.com/tutorials/combine-corelocation-publishers-delegates/
class CLLocationManagerPublicist: NSObject, CLLocationManagerCombineDelegate {
...
let locationSubject = PassthroughSubject<[CLLocation], Never>()
func locationPublisher() -> AnyPublisher<[CLLocation], Never> {
return locationSubject.eraseToAnyPublisher()
}
func locationManager(_: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
@romyilano
romyilano / appleWatchStateTransition.md
Last active January 17, 2024 02:03
Apple watchOS state transition

Handling Common State Transitions

The watch is a little different from the phone but has the same states

  1. not running
  2. inactive
  3. active
  4. background
  5. suspended
@romyilano
romyilano / mermaid.md
Last active January 16, 2024 23:44
Drawing mermaid state machine diagrams

Add a space in a state name

stateDiagram
    classDef yourState font-style:italic,font-weight:bold,fill:white

    yswsii: Your state with spaces in it
 [*] --&gt; yswsii:::yourState
@romyilano
romyilano / documentation.md
Last active September 28, 2023 23:16
swift memory review
  • arrays and variable-size collections use copy-on-write optimization
  • multiple copies of an array share the same storage
@romyilano
romyilano / skew.swift
Created April 10, 2022 19:49
Creating a skew in SpriteKit
// https://stackoverflow.com/a/43532815/1492368
extension SKSpriteNode {
func addSkew(value: CGFloat = -1){
var effectNode = SKEffectNode()
effectNode.shouldRasterize = true
effectNode.shouldEnableEffects = true
effectNode.addChild(SKSpriteNode(texture: texture))
@romyilano
romyilano / RustNotes.md
Last active October 24, 2020 17:08
Rust Saturday Morning Fun
@romyilano
romyilano / helloworld.js
Created March 27, 2020 17:21
Basic noob web server on node.js
// from O'Reilly Web Dev with Node & Express
const http = require('http')
const fs = require('fs')
const port = process.env.PORT || 3000
function serveStaticFile(res, path, contentType, responseCode = 200) {
fs.readFile(__dirname + path, (err, data) => {
if(err) {
res.writeHead(500, { 'Content-Type': 'text/plain' })
@romyilano
romyilano / .gitattributes
Created March 24, 2020 17:54 — forked from nemotoo/.gitattributes
.gitattributes for Unity3D with git-lfs
## Unity ##
*.cs diff=csharp text
*.cginc text
*.shader text
*.mat merge=unityyamlmerge eol=lf
*.anim merge=unityyamlmerge eol=lf
*.unity merge=unityyamlmerge eol=lf
*.prefab merge=unityyamlmerge eol=lf