Skip to content

Instantly share code, notes, and snippets.

View sethkrasnianski's full-sized avatar
:shipit:
Building software.

Seth Krasnianski sethkrasnianski

:shipit:
Building software.
View GitHub Profile
@sethkrasnianski
sethkrasnianski / tmux-cheatsheet.markdown
Last active August 27, 2015 15:00 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@sethkrasnianski
sethkrasnianski / The Technical Interview Cheat Sheet.md
Last active August 26, 2015 17:24 — 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.
@sethkrasnianski
sethkrasnianski / user.coffee
Last active February 15, 2019 02:17
Sample controller for user
_ = require('lodash')
Checkit = require('checkit')
User = require('../models/users')
CreateSession = require('../lib/response/create_session')
NotUniqueError = require('../lib/errors/not_unique')
IncompleteRequest = require('../lib/errors/incomplete_request')
sanitizeUser = (user)->
_.omit(user, 'password')
(deftest creating-a-duplicate-vendor
(let [admin-cs (sign-in 1)
research-cs (sign-in 0)]
(seed {:model "Vendor"})
(testing "creating a duplicate vendor"
(are [code store] (= code (:status (post "/api/vendors" {:form-params {:name "tom"} :cookie-store store})))
409 admin-cs
403 research-cs))))
(let [vendor-id
(get
(first
(json/read-str
(:body
(seed {:model "Vendor"}))))
"id")]
(let [my-cs (sign-in 1)]
(is
(deftest deleting-a-vendor
(let [admin-cs (sign-in 1)
research-cs (sign-in 0)]
(seed {:model "Vendor"})
(testing "deleting an existing vendor"
(are [code store] (= code (:status (delete "/api/vendors/1" {:cookie-store store})))
200 admin-cs
403 research-cs
404 admin-cs
:goat::goat::goat::goat::goat::goat::goat::goat:
:goat::goat::goat::goat::goat::goat::goat::goat:
:goat::goat::goat::goat::goat::goat::goat::goat:
:goat::goat: :goat::goat: :goat::goat:
:goat::goat: :goat: :goat::goat:
:goat::goat: :goat::goat:
:goat::goat: :goat: :goat: :goat::goat:
:goat::goat: :goat::goat: :goat::goat:
:goat::goat: :goat::goat: :goat::goat:
:goat::goat: :goat::goat: :goat::goat:
;(function($,sr){
// debouncing function from John Hann
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
var debounce = function (func, threshold, execAsap) {
var timeout;
return function debounced () {
var obj = this, args = arguments;
function delayed () {
Function.prototype.debounce = function (threshold, execAsap) {
var func = this, timeout;
return function debounced () {
var obj = this, args = arguments;
function delayed () {
if (!execAsap)
func.apply(obj, args);
timeout = null;
@sethkrasnianski
sethkrasnianski / gist:9560309
Last active August 29, 2015 13:57
Git Settings
## Git Shortcuts
alias gs="git status"
alias gd="git diff"
alias gb="git branch"
alias gcb "git checkout -b"
## Git detailed output
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}