Skip to content

Instantly share code, notes, and snippets.

@tolitius
tolitius / src.multi-method.clj
Created January 29, 2012 07:04
clojure bootcamp: "defmulti" example
;; inspired by suggestion in THE doc: http://java.ociweb.com/mark/clojure/article.html
(ns bootcamp.multi-method)
(defn measure-it [size]
(cond
(< size 3) :small
(< size 6) :medium
(< size 12) :large
:else :hard-to-measure ))
@axelav
axelav / gist:1839777
Created February 15, 2012 22:51 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@lg0
lg0 / markdown.xml
Created April 10, 2012 19:58
Markdown Syntax Highlighting for Sublime text 2
<!-- copy this to YOUR_THEME.tmTheme-->
<dict>
<key>name</key>
<string>diff: deleted</string>
<key>scope</key>
<string>markup.deleted</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#EAE3CA</string>
set softtabstop=2
set shiftwidth=2
set tabstop=2
set expandtab "expandtab (whitespace)
set number "line numbers
set ai "autoindent
set si "smartindent
set tw=79 "wrap on 79
set sta "smarttab
set history=100 "remember more than 20 cmd-history
@miketheman
miketheman / zook_grow.md
Created July 22, 2013 21:36
Adding nodes to a ZooKeeper ensemble

Adding 2 nodes to an existing 3-node ZooKeeper ensemble without losing the Quorum

Since many deployments may start out with 3 nodes and so little is known about how to grow a cluster from 3 memebrs to 5 members without losing the existing Quorum, here is an example of how this might be achieved.

In this example, all 5 nodes will be running on the same Vagrant host for the purpose of illustration, running on distinct configurations (ports and data directories) without the actual load of clients.

YMMV. Caveat usufructuarius.

Step 1: Have a healthy 3-node ensemble

@gjreda
gjreda / espn-cbb.py
Created October 26, 2013 22:24
Grabs college basketball play-by-play data for a given date range. Example usage: python espn.cbb.py 2013-01-01 2013-01-07
from bs4 import BeautifulSoup
from urllib2 import urlopen
from datetime import datetime, timedelta
from time import sleep
import sys
import csv
# CONSTANTS
ESPN_URL = "http://scores.espn.go.com"
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active April 16, 2024 23:05
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.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@audionerd
audionerd / Forwarding ports from a docker container with Vagrant 1.6.md
Last active June 25, 2019 20:45
Forwarding ports from a docker container with Vagrant 1.6

Forwarding ports from a docker container with Vagrant 1.6

Vagrant 1.6 has a really nice feature which allows you to run a docker environment from any machine that can run Vagrant (even a Mac)

Behind the scenes, Vagrant creates a host VM which runs the docker containers.

The "gotcha" is: Vagrant won't automatically forward ports all the way back from the container->vagrant host VM->your mac. You have to do that step manually, by configuring your own host VM for Vagrant to use for hosting docker containers with. That host VM is told what ports to open.

Here's how I set up a local Wordpress development testing container.

Folder Structure

Please note

While this gist has been shared and followed for years, I regret not giving more background. It was originally a gist for the engineering org I was in, not a "general suggestion" for any React app.

Typically I avoid folders altogether. Heck, I even avoid new files. If I can build an app with one 2000 line file I will. New files and folders are a pain.

@paulirish
paulirish / what-forces-layout.md
Last active April 19, 2024 14:42
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent