Skip to content

Instantly share code, notes, and snippets.

View czxtm's full-sized avatar
💭
{d'}

cooper czxtm

💭
{d'}
View GitHub Profile
@czxtm
czxtm / find-appointment.js
Created September 16, 2016 22:41
Finding an Appointment (JS)
// The businesspeople among you will know that it's often not easy to find an
// appointment. In this kata we want to find such an appointment automatically.
// You will be given the calendars of our businessperson and a duration for the
// meeting. Your task is to find the earliest time, when every businessperson is
// free for at least that duration.
//
// Example Schedule:
//
// Person | Meetings
// -------+-----------------------------------------------------------
@czxtm
czxtm / memory-manager.js
Last active June 10, 2017 08:31
Memory Manager
// Description:
//
// One of the services provided by an operating system is memory management.
// The OS typically provides an API for allocating and releasing memory in a
// process's address space. A process should only read and write memory at
// addresses which have been allocated by the operating system. In this kata you
// will implement a simulation of a simple memory manager.
//
// JavaScript has no low level memory API, so for our simulation we will simply
// use an array as the process address space. The memory manager constructor
@czxtm
czxtm / rescursiveReduce.js
Last active May 27, 2016 00:41
ES6: Recursive vertical reducer
//
// * Given some data that looks like this:
//
// let data = [
// {
// key: 'a',
// value: 'a1',
// children: [
// {
// key: 'b',
@czxtm
czxtm / compare_collections.js
Created May 12, 2016 23:41
ES6: Check if array contains an item in another array
const arr = [1,2,3];
const otherArr = [3,4,5];
arr.some(a => otherArr.some(b => a === b)); // => true
// using a collection and comparing with keys
const collection = [{a: 1}, {a: 2}, {a: 3}];
const collection2 = [{a: 3}, {a: 4}, {a: 5}];
collection.some(a => collection2.some(b => a.a === b.a)); // => true
@czxtm
czxtm / vim-notes
Created December 10, 2015 00:10
My VIM Notes
# manually specify syntax
:set syntax=js
// view 'recent' files
:buffers // open a 'recent' file
:buffer nameFromList
// diff file against any arbitrary text in v-split
@czxtm
czxtm / .eslintrc
Last active November 21, 2015 22:18
UI Team ESLint (+ Miguel's suggestions)
{
"root": true,
"env": {
"es6": true,
"browser": true
},
"rules": {
"indent": [2, "tab"],
"strict": [2, "global"],
"no-use-before-define": 0,
@czxtm
czxtm / utilities.scss
Created November 19, 2015 09:02
Utils SASS file
/*=============================================================================
= Scales
=============================================================================*/
//
// Text
//
$textSizes: (
(xxs, .8rem),
(xs, 1rem),
(sm, 1.2rem),
/*=============================================================================
= Scales
=============================================================================*/
.text-xxs {
font-size: 0.8rem;
}
.text-xs {
font-size: 1rem;
}
@czxtm
czxtm / docker-notes.sh
Last active August 29, 2015 14:26
Docker Notes
# --------------------------------------------------------------------------------------------------------
# BASIC ACTIONS
# -------------------------------------------------------------------------------------------------------
# start up a new machine
docker-machine create --driver virtualbox dev
# list VMs
docker-machine ps