Skip to content

Instantly share code, notes, and snippets.

View srowhani's full-sized avatar

Seena Rowhani srowhani

View GitHub Profile
@srowhani
srowhani / curry.js
Last active December 17, 2018 19:14
function sum (...args) {
return Object.assign(
sum.bind(null, ...args),
{ valueOf: () => args.reduce((a, c) => a + c, 0) }
)
}
// console.log(+add(1)(2)(3)(1, 2, 3)) = 12
const peak = items => items[items.length - 1];
const isEmpty = items => items.length < 1;
const isPromise = v => v instanceof Promise;
const isFunction = v => typeof v === 'function';
const isGeneratorFunction = v=> isFunction(v) && v.constructor.name === 'GeneratorFunction';
function resolve(iterator) {
function _resolve (iteratorStack, previousValue) {
if (isEmpty(iteratorStack)) {
return previousValue;
@srowhani
srowhani / default.itermcolors
Last active June 7, 2018 17:40
iTerm Preferences
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.0</real>
REMOTE=$(git config --get remote.origin.url);
VERSION=$(node -e "console.log(require('./package.json').version)");
cd docs;
rm -rf .git;
git init;
git remote add origin $REMOTE;
git checkout -b gh-pages;
git add -A .;
git commit -m "docs($VERSION)";

Getting environment set up

easy_install pip
pip install videodigest
pip install autosub
pip install nltk
  • Go enroll for Google Cloud Translation API
  • Grab key, store in bashrc / zshrc

Compiling C -> WASM

Take your sample input file:

#include <webassembly.h>
 
export int add(int a, int b) {
  return a + b;
}
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@srowhani
srowhani / 2 Connected Graphs
Last active February 27, 2024 06:16
COMP3804 - Final Exam Review
A graph is said to be 2 connected if from every pair of vertices (u,v), there exists a vertex disjoint path from u to v.
That is to say that for every vertex x in V(G), G - x is still connected.
Theorem 1 (Whitney, 1927)
A connected graph G with at least
three vertices is 2-connected iff for every two vertices x, y ∈
V (G), there is a cycle containing both.
If every two vertices belong to
@srowhani
srowhani / Dijkstra's Algorithm Base Impl
Created December 3, 2016 21:15
Dijkstra's Algorithm Runtime Analysis
Given
G = (V,E)
s = some arbitrary starting vertex v in V
wt = function that returns the weight of e given edge
d = {}
S = {} -> Result set
Q = V
for each v in V
d[v] = Infinity