Skip to content

Instantly share code, notes, and snippets.

View malkomalko's full-sized avatar

Robert Malko malkomalko

  • Doximity
  • Atlanta, GA
View GitHub Profile
@malkomalko
malkomalko / gist:3600741
Created September 2, 2012 15:46
js testing cheatsheet
sinon / chai / mocha / js-tests
_____________________________________
#### chai
expect(subject).not.equal(expected)
.a('string')
.instanceof(Foo)
var empty_list = function(selector) {
return selector(undefined, undefined, true);
};
var prepend = function(el, list) {
return function(selector) {
return selector(el, list, false);
};
};
var head = function(list) {
@malkomalko
malkomalko / Macros.h
Last active May 4, 2017 12:19 — forked from numo16/Macros.h
#define ApplicationDelegate ((AppDelegate *)[[UIApplication sharedApplication] delegate])
#define UserDefaults [NSUserDefaults standardUserDefaults]
#define NotificationCenter [NSNotificationCenter defaultCenter]
#define SharedApplication [UIApplication sharedApplication]
#define Bundle [NSBundle mainBundle]
#define MainScreen [UIScreen mainScreen]
#define ShowNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = YES
#define HideNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = NO
#define NetworkActivityIndicatorVisible(x) [UIApplication sharedApplication].networkActivityIndicatorVisible = x
#define NavBar self.navigationController.navigationBar
@malkomalko
malkomalko / lisp.c
Created April 5, 2014 14:27 — forked from sanxiyn/lisp.c
#include <assert.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
enum type {
NIL,
@malkomalko
malkomalko / scale.rb
Created April 14, 2014 23:31 — forked from caged/scale.rb
# Returns a lambda used to determine what number is at t in the range of a and b
#
# interpolate_number(0, 500).call(0.5) # 250
# interpolate_number(0, 500).call(1) # 500
#
def interpolate_number(a, b)
a = a.to_f
b = b.to_f
b -= a
lambda { |t| a + b * t }
# Recursively diff two hashes, showing only the differing values.
# By Henrik Nyh <http://henrik.nyh.se> 2009-07-14 under the MIT license.
#
# Example:
#
# a = {
# "same" => "same",
# "diff" => "a",
# "only a" => "a",
# "nest" => {
@malkomalko
malkomalko / autocurry.js
Last active August 29, 2015 14:06 — forked from torgeir/javascript-autocurry-partial-application-of-any-level.js
Autocurry functions in javascript
function curry(fn) {
var numargs = fn.length;
return createRecurser([]);
function createRecurser(acc) {
return function () {
var args = Array.prototype.slice.call(arguments);
return recurse(acc, args);
};
}
@malkomalko
malkomalko / .vimrc
Last active September 29, 2021 15:22
" Section: init {{{1
set nocompatible
filetype off
filetype indent plugin on
scriptencoding utf-8
syntax on
runtime macros/matchit.vim
@malkomalko
malkomalko / master.vim
Created May 12, 2018 21:41 — forked from gmccreight/master.vim
A script that gives you a playground for mastering vim
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
@malkomalko
malkomalko / tcp_flags.txt
Created October 19, 2018 21:40 — forked from tuxfight3r/tcp_flags.txt
tcpdump - reading tcp flags
##TCP FLAGS##
Unskilled Attackers Pester Real Security Folks
==============================================
TCPDUMP FLAGS
Unskilled = URG = (Not Displayed in Flag Field, Displayed elsewhere)
Attackers = ACK = (Not Displayed in Flag Field, Displayed elsewhere)
Pester = PSH = [P] (Push Data)
Real = RST = [R] (Reset Connection)
Security = SYN = [S] (Start Connection)