Skip to content

Instantly share code, notes, and snippets.

@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
class Spec: QuickSpec {
override func spec() {
beforeSuite {
print("☕️ before suite")
}
afterSuite {
print("🗑 after suite")
}

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
@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);
@sghiassy
sghiassy / dec2bin.js
Created July 1, 2017 03:53
JavaScript utility function to output full 32 bit representations of binary digits
function dec2bin(dec){
var str = (dec >>> 0).toString(2);
return (str.length < 32) ? Array(32 - str.length).fill(0).join('').concat(str) : str;
}
class Node {
constructor(value = "", parent = undefined) {
this.value = value;
this.parent = parent;
this.children = [];
if (this.parent != undefined) {
this.parent.children.push(this);
}
}
@sghiassy
sghiassy / StringPermutations.js
Last active March 19, 2018 04:56
A JavaScript (ES6) implementation of printing all Permutations of a String
// Print all permutations of a string in JavaScript (ES6)
// O(2^n) runtime
class StringSubsets {
constructor(str) {
this.str = str;
}
print() {
const map = new Map();
@sghiassy
sghiassy / StringPermutation.js
Last active June 17, 2017 05:38
A string permutation example written in JavaScript (ES6)
// NOTE: This is written using ES6 - make sure your JavaScript compiler is ES6 compliant
class StringPermutation {
constructor(str) {
this.originalString = str.slice(); // deep copy string
}
printAllPermutationsWithDuplicates() {
this.permutate(
@sghiassy
sghiassy / provisioning.sh
Created October 17, 2015 09:32
A Bash shell script for provisioning a new Ubuntu 14.04 LTS VM built for React Native
#!/bin/bash
####################################
# Setup
####################################
tmpfile="/vagrant/.capacitor/runonce"
if [ -e ${tmpfile} ]; then
echo "Provisioning already completed. Remove ${tmpfile} to run it again."
@sghiassy
sghiassy / .gitignore
Last active July 3, 2019 18:30
My default .gitignore file
# Gist at: https://gist.github.com/sghiassy/e14593a439a03028b98a
##### OSX
.DS_Store
##### Xcode
build/
*.pbxuser
!default.pbxuser
*.mode1v3