Skip to content

Instantly share code, notes, and snippets.

View brunodelgado's full-sized avatar

Bruno Delgado brunodelgado

View GitHub Profile
@brunodelgado
brunodelgado / loop-filter-02.swift
Created November 4, 2020 13:58
loop-filter-02
let items = [1, 2, 3, 4, 5, 6]
var subitems: [Int] = []
for item in items where item > 3 {
subitems.append(item)
}
@brunodelgado
brunodelgado / loop-filter-01.swift
Created November 4, 2020 13:56
loop-filter-01
let items = [1, 2, 3, 4, 5, 6]
var subitems: [Int] = []
for item in items {
if item > 3 {
subitems.append(item)
}
}
#!/bin/bash
# Variables
local_path="http://localhost:2368/"
github_path="https://brunodelgado.github.io"
output_folder="./Developer/brunodelgado.github.io" # Use . instead of ~ in order to properly work with wget
clear_output_folder_before_generating_files=true
# Colors
NOCOLOR='\033[0m'
@brunodelgado
brunodelgado / DiskCache.swift
Created December 2, 2019 13:59
Simple codable on disk cache implementation
class AnyDiskCache {
static func invalidate(name: String) throws {
let manager = FileManager.default
let urls = manager.urls(for: .cachesDirectory, in: .userDomainMask)
let url = urls[0].appendingPathComponent(name + ".cache")
try manager.removeItem(at: url)
}
}
final class DiskCache<T: Codable>: AnyDiskCache {