Skip to content

Instantly share code, notes, and snippets.

View johnhaitas's full-sized avatar

John Haitas johnhaitas

View GitHub Profile
@johnhaitas
johnhaitas / The Technical Interview Cheat Sheet.md
Last active August 12, 2019 15:06 — 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.
#!/bin/sh
# insert_git_hash.sh
# ToGoOrder
#
# Created by John Haitas on 7/9/13.
#
# Location of Info.plist in build product
INFOPLISTPATH="${TARGET_BUILD_DIR}/${EXECUTABLE_NAME}.app/Info.plist"
@johnhaitas
johnhaitas / gist:5967801
Created July 10, 2013 16:28
cleaned up the script to insert git hash into Info.plist
#!/bin/sh
# insert_git_hash.sh
# ToGoOrder
#
# Created by John Haitas on 7/9/13.
#
# Location of Info.plist in build product
INFOPLISTPATH="${TARGET_BUILD_DIR}/${EXECUTABLE_NAME}.app/Info.plist"
@johnhaitas
johnhaitas / gist:5967724
Created July 10, 2013 16:20
Insert git commit hash into Info.plist at the end of build process
#!/bin/sh
# insert_git_hash.sh
# ToGoOrder
#
# Created by John Haitas on 7/9/13.
#
# Location of Info.plist in build product
INFOPLISTPATH="${TARGET_BUILD_DIR}/${EXECUTABLE_NAME}.app/Info.plist"
@johnhaitas
johnhaitas / gist:4693189
Last active December 12, 2015 01:39
convert NSDictionary/NSMutableDictionary to literal syntax Xcode Find/Replace regex
[aDictionary objectForKey:@"Key"] -> aDictionary[@"Key"]
=========================================================
Find
\[(\w+) *objectForKey: *(@"\w+") *\]
Replace
\1\[\2\]
@johnhaitas
johnhaitas / gist:3169923
Created July 24, 2012 13:29
browser detector for FixedColumns
"_fnDetectBrowser": function ()
{
var ua = navigator.userAgent.toLowerCase();
// userAgent RegExp
var rwebkit = /(webkit)[ \/]([\w.]+)/,
ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
rmsie = /(msie) ([\w.]+)/,
rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
rsafari = /(safari)[ \/]([\w.]+)/,
@johnhaitas
johnhaitas / gist:3156488
Created July 21, 2012 17:27
conditionals for conditional binding events for browsers in FixedColumns
if ( !$.browser.mozilla )
{
// Bind 'scroll' for most browsers
} else {
// Bind 'scroll' for Mozilla browsers
}
if ( $.browser.safari )
{
// Bind 'mousewheel' for Safari
@johnhaitas
johnhaitas / delete_older_than_example.pl
Created December 21, 2011 20:20
Perl - delete files in folder older than ...
#!/usr/bin/perl
use File::Find;
my $backup_root = "/path/to/folder"
# purge backups older than AGE in days
my @file_list;
my @find_dirs = ($backup_root); # directories to search
my $now = time(); # get current time
my $days = 30; # how many days old
@johnhaitas
johnhaitas / saving-time.rb
Created December 5, 2011 17:27
"Saving Time" solution in Ruby
a='o'*12
a[gets.to_i%12]=?h
a[m=$_[3,2].to_i/5]=a[m]<?o??x:?m
b=Array.new(11){" "*17}
12.times{|i|t=i*0.523-1.57;b[(5+4.9*Math.sin(t)).round][(8+8*Math.cos(t)).round]=a[i]}
b.map{|l|puts l.rstrip}
@johnhaitas
johnhaitas / game-of-life.rb
Created December 5, 2011 16:51
Conway's Game of Life in Ruby
def neighbors(cell)
neighbors = []
x = cell[0]
y = cell[1]
(x-1..x+1).each do |xx|
(y-1..y+1).each do |yy|
next if xx==x && yy==y
neighbors.push([xx,yy])
end
end