Skip to content

Instantly share code, notes, and snippets.

@sghiassy
sghiassy / reservoir_sampling.js
Created July 15, 2017 03:52
A simple JavaScript implementation of Reservoir Sampling with any K length (http://www.geeksforgeeks.org/reservoir-sampling/)
class Node {
constructor(value, next) {
this.value = value;
this.next = next;
}
}
function getRandom(list, k) {
const reservoir = new Array(k);

Disable Device Enrollment Notification on Mac.md

Restart the Mac in Recovery Mode by holding Comment-R during restart

Open Terminal in the recovery screen and type

csrutil disable
class Spec: QuickSpec {
override func spec() {
beforeSuite {
print("☕️ before suite")
}
afterSuite {
print("🗑 after suite")
}
@sghiassy
sghiassy / FontRegistry.m
Created January 29, 2020 21:03 — forked from jordiboehme/FontRegistry.m
UIFont from a CSS definition
//
// FontRegistry.h
// Tabris
//
// Created by Jordi Böhme López on 25.07.12.
// Copyright (c) 2012 EclipseSource.
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// which accompanies this distribution, and is available at
// http://www.eclipse.org/legal/epl-v10.html