Skip to content

Instantly share code, notes, and snippets.

View romyilano's full-sized avatar
😎
improving

Romy romyilano

😎
improving
View GitHub Profile
@romyilano
romyilano / Unitymac.gitignore
Created March 24, 2020 17:37
Unity + Mac gitignore
# Unity gitignore is from : https://github.com/github/gitignore/blob/master/Unity.gitignore
# Created by https://www.gitignore.io/api/osx
# Edit at https://www.gitignore.io/?templates=osx
### OSX ###
# General
.DS_Store
.AppleDouble
.LSOverride
@romyilano
romyilano / gist:7fec2598d347a2c309655ca8f7467244
Created February 26, 2020 23:06 — forked from sabarasaba/gist:3080590
Remove directory from remote repository after adding them to .gitignore
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
@romyilano
romyilano / helloworld.js
Created November 29, 2019 15:26
son you must learn javascript again. at least this doesn't have all those semicolons =D
// nice quick and dirty webserver
const http = require('http')
const port = process.env.PORT || 3000
const server = http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'text/plain '})
res.end('Hello world! this is a noob server')
})
@romyilano
romyilano / atcoder.md
Last active May 19, 2019 22:19
tips for accepting input into atcoder

swift

cielavenir

let inputInt = Int(readline()!)!

let arrayInt = readlin()!.characters.split { $0== " " }.map { Int(String($0))! }
import Foundation
// async swift playground
import PlaygroundSupport
// https://min-api.cryptocompare.com/data/all/coinlist
let allCoinsPath = "/data/all/coinlist"
class CryptoApi {
// brushing up on url components
//
class CryptoApi {
static let host = "min-api.cryptocompare.com"
static let allCoinsPath = "/data/all/coinlist"
var allCoinsUrl: URL? = {
var urlComponents = URLComponents()
urlComponents.scheme = "https"
urlComponents.host = CryptoApi.host
// brushing up on url components
//
class CryptoApi {
static let host = "min-api.cryptocompare.com"
static let allCoinsPath = "/data/all/coinlist"
var allCoinsUrl: URL? = {
var urlComponents = URLComponents()
urlComponents.scheme = "https"
urlComponents.host = CryptoApi.host
// https://stackoverflow.com/questions/23806751/strong-reference-to-a-weak-references-inside-blocks
__weak typeof(self) weakSelf = self;
void (^someBlock)(id) = ^(id data){
if (weakSelf != nil) {
// last remaining strong reference released by another thread.
// weakSelf is now set to nil.
[myArray addObject:weakSelf];
}
});
@romyilano
romyilano / Retain.m
Last active April 7, 2019 21:34
retain cycle sin blocks in objective-c thru apple. //
// https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/WorkingwithBlocks/WorkingwithBlocks.html#//apple_ref/doc/uid/TP40011210-CH8-SW16
@interface XYZBlockKeeper : NSObject
@property (copy) void (^block)(void);
@end
@implementation XYZBlockKeeper
- (void)configureBlock {
self.block = ^{
[self doSomething]; // capturing a strong reference to self
@romyilano
romyilano / DoubleProtocol.swift
Created March 25, 2019 15:59
From the PanModal GitHub... interesting!
protocol RowPresentable {
var string: String { get }
// it conforms to both protocol + class
var rowVC: UIViewController & PanModalPresentable { get }
}