Skip to content

Instantly share code, notes, and snippets.

View wulymammoth's full-sized avatar
processing unit

David W wulymammoth

processing unit
View GitHub Profile
@wulymammoth
wulymammoth / The Technical Interview Cheat Sheet.md
Last active July 15, 2018 17:01 — 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.
# recursion
def fib(n):
if n <= 1:
return n
return fib(n-1) + fib(n-2)
# recursion with memoization
def fib_memo(n, lookup=None):
"""
Array.from(document.getElementsByClassName('outdated-comment')).forEach(l => l.classList.add('open'));
@wulymammoth
wulymammoth / deprecation.md
Last active December 5, 2017 19:41 — forked from KronicDeth/deprecation.md
HowTo make deprecation warnings in Elixir

TIL how to make deprecation warnings:

Compiling 2 files (.ex)
warning: `Retort.Resources.timeout/2` is deprecated; call `Retort.Resources.Timeout.get_or_default/2` instead.
  lib/retort/resources.ex:197: Retort.Resources.timeout/2

Function to be replaced

@wulymammoth
wulymammoth / Map.Helpers
Created August 10, 2017 07:03 — forked from kipcole9/Map.Helpers
Helpers for Elixir Maps: underscore, atomise and stringify map keys
defmodule Map.Helpers do
@moduledoc """
Functions to transform maps
"""
@doc """
Convert map string camelCase keys to underscore_keys
"""
def underscore_keys(nil), do: nil
@wulymammoth
wulymammoth / decode_session_cookie.rb
Created August 2, 2017 17:01 — forked from pdfrod/decode_session_cookie.rb
A simple script to decode Rails 4 session cookies
@wulymammoth
wulymammoth / README.md
Created July 24, 2017 01:06 — forked from rbishop/README.md
A super simple Elixir server for sending Server Sent Events to the browser.

Generate a new Elixir project using mix and add cowboy and plug as dependencies in mix.exs:

  defp deps do
    [
      {:cowboy, "~> 1.0.0"},
      {:plug, "~> 0.8.1"}
    ]
  end
<?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.11759774386882782</real>
@wulymammoth
wulymammoth / expng.ex
Created May 13, 2017 05:38 — forked from zabirauf/expng.ex
PNG format Parser in Elixir
defmodule Expng do
defstruct [:width, :height, :bit_depth, :color_type, :compression, :filter, :interlace, :chunks]
def png_parse(<<
0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A,
_length :: size(32),
"IHDR",
width :: size(32),
height :: size(32),
@wulymammoth
wulymammoth / accounts.ex
Last active March 24, 2017 14:41
Example of new 1.3 Phoenix module generator
# foo/lib/foo/accounts/accounts.ex
defmodule Foo.Accounts do
@moduledoc """
The boundary for the Accounts system.
"""
import Ecto.{Query, Changeset}, warn: false
alias Foo.Repo