Skip to content

Instantly share code, notes, and snippets.

Shaheen Ghiassy sghiassy

View GitHub Profile
@sghiassy
sghiassy / FontRegistry.m
Created Jan 29, 2020 — forked from jordiboehmelopez/FontRegistry.m
UIFont from a CSS definition
View FontRegistry.m
//
// 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
View SpecFlowExample.swift
class Spec: QuickSpec {
override func spec() {
beforeSuite {
print("☕️ before suite")
}
afterSuite {
print("🗑 after suite")
}
View Disable Device Enrollment Notification on Mac.md

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 Jul 15, 2017
A simple JavaScript implementation of Reservoir Sampling with any K length (http://www.geeksforgeeks.org/reservoir-sampling/)
View reservoir_sampling.js
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 Jul 1, 2017
JavaScript utility function to output full 32 bit representations of binary digits
View dec2bin.js
function dec2bin(dec){
var str = (dec >>> 0).toString(2);
return (str.length < 32) ? Array(32 - str.length).fill(0).join('').concat(str) : str;
}
View FindMinDepthOfTree.js
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 Mar 19, 2018
A JavaScript (ES6) implementation of printing all Permutations of a String
View StringPermutations.js
// 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 Jun 17, 2017
A string permutation example written in JavaScript (ES6)
View StringPermutation.js
// 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 Oct 17, 2015
A Bash shell script for provisioning a new Ubuntu 14.04 LTS VM built for React Native
View provisioning.sh
#!/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 Jul 3, 2019
My default .gitignore file
View .gitignore
# Gist at: https://gist.github.com/sghiassy/e14593a439a03028b98a
##### OSX
.DS_Store
##### Xcode
build/
*.pbxuser
!default.pbxuser
*.mode1v3
You can’t perform that action at this time.