Skip to content

Instantly share code, notes, and snippets.

@ccaseiro
ccaseiro / actionable_dict.py
Created July 14, 2022 18:49 — forked from wilvk/actionable_dict.py
A Python Dictionary that can be used for notifications of nested dictionary changes
class ActionableDict(dict):
parent = None
def __init__(self, initial_dict, parent = None):
self.parent = parent
for key, value in initial_dict.items():
if isinstance(value, dict):
initial_dict[key] = ActionableDict(value, self)
super().__init__(initial_dict)

Strings

String.prototype.*

None of the string methods modify this – they always return fresh strings.

  • charAt(pos: number): string ES1

    Returns the character at index pos, as a string (JavaScript does not have a datatype for characters). str[i] is equivalent to str.charAt(i) and more concise (caveat: may not work on old engines).

@ccaseiro
ccaseiro / cards.swift
Created February 25, 2016 21:35 — forked from erica/cards.swift
Cards
/*
Erica Sadun, http://ericasadun.com
GameplayKit Available 10.11, iOS 9
*/
import Foundation
import GameplayKit // only available on OS X 10.11, iOS 9