Skip to content

Instantly share code, notes, and snippets.

hr,
input[type=search] {
box-sizing: content-box
}
pre,
textarea {
overflow: auto
}
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="$(HOME)/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
# set rc file
RC_FILE=""
case $SHELL in
*/zsh)
RC_FILE="$HOME/.zshrc"
;;
*/bash)
RC_FILE="$HOME/.bashrc"
;;
esac
@terakilobyte
terakilobyte / requirements.txt
Created June 27, 2019 21:27
MongoDB Documentation Python 2 requirements
alabaster==0.7.12
argh==0.26.2
asn1crypto==0.24.0
Babel==2.7.0
certifi==2019.6.16
cffi==1.12.3
chardet==3.0.4
Click==7.0
cryptography==2.7
defusedxml==0.6.0
@terakilobyte
terakilobyte / .babelrc
Created February 13, 2019 13:11
Config files
{
"presets": [
"env",
"stage-1"
],
"plugins": [
"transform-runtime"
]
}
@terakilobyte
terakilobyte / flood_fill.rs
Last active December 29, 2018 16:42
borrow checker is very unhappy
fn flood_fill(board: &mut Vec<Vec<Cell>>, cell_x: usize, cell_y: usize) {
let mut queue: VecDeque<&Cell> = VecDeque::new();
queue.push_front(&board[cell_x][cell_y]);
let is: Vec<i8> = vec![-1, 0, 1];
while !queue.is_empty() {
let mut cell = queue.pop_front().unwrap();
let (x, y) = (cell.position[0] as usize, cell.position[1] as usize);
if cell.rust_count == 0 {
board[x][y].is_hidden = false; <--- mutable borrow occurs here
def count_valleys(s):
elevation = 0
valleys = 0
for i in s:
if i == "D":
elevation -= 1
if elevation == -1:
valleys += 1
else:
elevation += 1
@terakilobyte
terakilobyte / commands.py
Created November 4, 2018 00:36
rough example
admins_and_mods = ["tremorai", "swarmlogic", "firecopy"]
def do_command(message):
def command(nick):
print(message)
return command
def do_admin_command(message):
def command(nick):
if nick in admins_and_mods:
@terakilobyte
terakilobyte / request.js
Created October 20, 2018 15:39
request
/**
* Parses the JSON returned by a network request
*
* @param {object} response A response from a network request
*
* @return {object} The parsed JSON, status from the response
*/
function parseJSON(response) {
return new Promise(resolve =>
response.json().then(json =>
@terakilobyte
terakilobyte / leaf.png
Created February 18, 2018 01:23
pixelated leaf
<svg width="52px" height="95px" viewBox="0 0 52 95" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 43.2 (39069) - http://www.bohemiancoding.com/sketch -->
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Artboard" transform="translate(-117.000000, -100.000000)">
<g id="Group" transform="translate(117.000000, 100.000000)">
<rect id="Rectangle" fill="#70C70B" x="18" y="8" width="8" height="8"></rect>
<rect id="Rectangle" fill="#70C70B" x="27" y="8" width="8" height="8"></rect>