Skip to content

Instantly share code, notes, and snippets.

View v1b3m's full-sized avatar
💭
Tables turn, bridges burn, I live and learn...

Benjamin Mayanja v1b3m

💭
Tables turn, bridges burn, I live and learn...
View GitHub Profile
@v1b3m
v1b3m / recursion.js
Last active September 19, 2018 18:23
function factorial( n ) {
//terminate if x is less than one
if (n < 0) return;
//return base value for 1
if ( n === 1 ) {
return 1;
}
//recur for values greater than one
return n * factorial( n - 1 );
}
function fibonacci(num) {
if (num <= 1) return 1;
return fibonacci(num - 1) + fibonacci(num - 2);
}
@v1b3m
v1b3m / hanoi.js
Last active September 21, 2018 07:17
/* function to simuate tower of hanoi */
var hanoi = function(disc,src,aux,dst) {
if (disc > 0) {
hanoi(disc - 1,src,dst,aux);
$('#lists').append("Move disc " + disc + " from " + src + " to " + dst + "<br />");
hanoi(disc - 1,aux,src,dst);
}
};
@v1b3m
v1b3m / stack.js
Last active September 21, 2018 16:23
class Stack {
constructor() {
this.stack = [];
}
push(element) {
this.stack.push(element);
}
pop() {
@v1b3m
v1b3m / fbme.py
Created June 24, 2019 20:09 — forked from jkuruzovich/fbme.py
Facebook Graph API Example in Python
# Facebook Graph API Example in Python
# by James Thornton, http://jamesthornton.com
# Facebook API Docs
# https://developers.facebook.com/docs/graph-api/using-graph-api#reading
# Get Your Facebook Access Token Here...
# https://developers.facebook.com/tools/explorer/145634995501895/?method=GET&path=me
# Before running this script...
from flask import Flask, request, make_response, jsonify
from flask_restful import Resource, Api
from json import dumps
from authy.api import AuthyApiClient
from dotenv import load_dotenv
import os
from validators.helpers import valid_user, valid_token, requires_token
from twilio.rest import Client