Skip to content

Instantly share code, notes, and snippets.

#### Exercises
1. Define and compare recursion and iteration.
Recursion is a procedure that calls itself until a certain condition (base case) is reached. Recursive solutions can be slower and are subjected to system limitations
Iteration is a procedure that uses loop to repeat a process. Iterative solutions may be harder to implement.
2. Name five algorithms that are commonly implemented by recursion.
@samjaninf
samjaninf / The Technical Interview Cheat Sheet.md
Created September 26, 2018 01:08 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@samjaninf
samjaninf / to_array.js
Created September 26, 2018 18:36 — forked from pcbje/to_array.js
Convert tabular text (csv, tsv, etc.) to javascript array
var to_array = function(text, delimeter, has_header, header_size) {
var lines = text.split('\n');
var columns = has_header ? lines[header_size - 1].split(delimeter) : null;
var rows = [];
for (var i=header_size; i<lines.length; i++) {
var array = lines[i].split(delimeter);
var row = {};
for (var j in array) {
@samjaninf
samjaninf / gist:a79a970ccf49752b786f3ac0730bd9fb
Last active January 3, 2019 16:07 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
@media (min-width: 768px){
body{ padding-top: 150px; }
}
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
@samjaninf
samjaninf / jitai.user.js
Created May 29, 2019 17:16 — forked from obskyr/jitai.user.js
Jitai (字体): A fairly full-featured font randomizer for WaniKani.
// ==UserScript==
// @name Jitai
// @version 1.3.2
// @description Display WaniKani reviews in randomized fonts, for more varied reading training.
// @author Samuel (@obskyr)
// @copyright 2016-2018, obskyr
// @license MIT
// @namespace http://obskyr.io/
// @homepageURL https://gist.github.com/obskyr/9f3c77cf6bf663792c6e
// @icon http://i.imgur.com/qyuR9bD.png
@samjaninf
samjaninf / gist:79576c477cfad153e230695b2ac93747
Created October 23, 2019 21:07 — forked from vicalloy/gist:4593240
[python] maze generator
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import random
try:
from tkinter import *
except ImportError:
from Tkinter import *
class Block(object):
@samjaninf
samjaninf / webhook.py
Created October 23, 2019 21:09 — forked from vicalloy/webhook.py
Github event handler
from bottle import abort
from bottle import post
from bottle import request
from bottle import run
from subprocess import call
def handle_pull_request(o):
pass
@samjaninf
samjaninf / gist:264892101edb63ed0b7bddfa44860d2c
Created October 23, 2019 21:09 — forked from vicalloy/gist:4603625
[coffeescript] maze generator
fmtTime = (t) ->
d = new Date(null);
d.setSeconds(t/1000);
return d.toTimeString().substr 3, 5
move = (obj, direction, step) ->
if !step?
step = 10
attr = 'left'
@samjaninf
samjaninf / .htaccess
Created December 5, 2019 03:51 — forked from seoagentur-hamburg/.htaccess
UPDATE 2019/07: Perfect .htaccess file for highspeed and security. You can use it for every WordPress-Website without problems. Highspeed and Security - testet on hundreds of Websites. If you are using a WordPress Multisite, change the last part of this file.
########################################################################
# OPTIMAL .htaccess FILE FOR SPEED AND SECURITY @Version 2019
# ----------------------------------------------------------------------
# @Author: Andreas Hecht
# @Author URI: https://andreas-hecht.com
# License: GNU General Public License v2 or later
# License URI: http://www.gnu.org/licenses/gpl-2.0.html
########################################################################
@samjaninf
samjaninf / Caddyfile
Created June 22, 2021 21:59 — forked from SkYNewZ/Caddyfile
Example Caddyfile for using as load balancer
{
# Enable Debug mode
debug
# Disable admin API
admin off
}
localhost {
# https://caddyserver.com/docs/caddyfile/directives/push