Skip to content

Instantly share code, notes, and snippets.

// TODO: insert guards to use open-source version of random() if necessary
func random(x: Int) -> Int {
return Int(arc4random_uniform(UInt32(endBoundary)))
}
extension CollectionType {
/// create a lazy succession of randomly ordered indices
///
@ilyannn
ilyannn / bangbang.md
Last active June 29, 2017 17:49 — forked from erica/bangbang.md

Instead of

assert(!array.isEmpty, "Array guaranteed to be non-empty because...")
let lastItem = array.last!

guard !array.isEmpty 
    else { fatalError("Array guaranteed to be non-empty because...") }

// ... etc ...
@ilyannn
ilyannn / fold.py
Last active August 29, 2019 15:28
Almost one-liner fold
def fold(s, p = 0):
for i in [i+1 for (i, c), n in zip(enumerate(s), s[1:]+' ') if c != n]: p = print(s[p], i-p, sep="", end="") or i
@ilyannn
ilyannn / api-skill-examples.md
Last active February 21, 2026 06:20
Curated API-focused Agent Skill examples (non-MCP)

🤖 Created by Cursor / gpt-5.2-xhigh, edited by me

API-focused Agent Skill examples

Short, high-quality set of non-MCP skills that primarily act as API usage/docs for real products (auth, endpoints/operations, examples, rate limits, troubleshooting):