Skip to content

Instantly share code, notes, and snippets.

View neenjaw's full-sized avatar
:shipit:
Shippin' code

Tim Austin neenjaw

:shipit:
Shippin' code
View GitHub Profile
@SleeplessByte
SleeplessByte / aoc-2020-d5.rb
Last active December 5, 2020 06:41
Advent of Code 2020: Day 5 - Binary Boarding
require 'benchmark'
class BoardingPass
def self.from_binary(binary_position)
rows = binary_position[0...7].tr("FB", "01")
columns = binary_position[7..].tr("LR", "01")
BoardingPass.new((rows + columns).to_i(2))
end
@wesbos
wesbos / download-shows.ts
Created November 11, 2020 02:07
deno syntax episode downloader
// deno run --allow-net --allow-write download-shows.ts
import { download } from "https://deno.land/x/download/mod.ts";
const showList = 'https://syntax.fm/api/shows';
async function getShowList(): Promise<Show[]> {
const list = await (await fetch(showList)).json();
return list;
}
@apal21
apal21 / ES5 class.js
Last active March 7, 2023 08:06
Example for blog to show the difference between ES5 and ES6 javascript classes using inheritance and prototypes use cases.
'use strict';
/**
* Person class.
*
* @constructor
* @param {String} name - name of a person.
* @param {Number} age - age of a person.
* @param {String} gender - gender of a person.
*/
@seanh
seanh / netrw.md
Last active April 23, 2024 18:13
Netrw Cheatsheet (Vim's Built-in Directory Browser)

Netrw Cheatsheet (Vim's File Browser)

See also:

  • vinegar.vim, which makes - open netrw in the directory of the current file, with the cursor on the current file (and pressing - again goes up a directory). Vinegar also hides a bunch of junk that's normally at the top of netrw windows, changes the default order of files, and hides files that match wildignore.

    With vinegar, . in netrw opens Vim's command line with the path to the file under the cursor at the end of the command. ! does the same but also prepends ! at the start of the command. y. copies the absolute path of the file under the cursor. ~ goes to your home dir. Ctrl+6 goes back to the file (buffer) that you had open before you opened netrw.

To launch netrw:

@Shmarkus
Shmarkus / elk-docker-compose.yml
Last active February 1, 2022 13:41
ELK stack (version 7.16.3) Docker compose bundle
version: "3"
services:
elasticsearch:
image: elasticsearch:7.16.3
container_name: elasticsearch
restart: unless-stopped
environment:
- node.name=elasticsearch
- discovery.seed_hosts=elasticsearch
- cluster.initial_master_nodes=elasticsearch
if (preg_match('~MSIE|Internet Explorer~i', $_SERVER['HTTP_USER_AGENT']) || (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0; rv:11.0') !== false)) {
//is IE 11 or below
}
@pbojinov
pbojinov / canada_states_titlecase.json
Last active March 1, 2024 22:24 — forked from mshafrir/states_hash.json
US states & Canadian Provinces in JSON form
[
{
"name": "Alberta",
"abbreviation": "AB"
},
{
"name": "British Columbia",
"abbreviation": "BC"
},
{
@danidiaz
danidiaz / netrw.txt
Created October 7, 2016 20:57
Vim's netrw commands.
--- ----------------- ----
Map Quick Explanation Link
--- ----------------- ----
< <F1> Causes Netrw to issue help
<cr> Netrw will enter the directory or read the file |netrw-cr|
<del> Netrw will attempt to remove the file/directory |netrw-del|
<c-h> Edit file hiding list |netrw-ctrl-h|
<c-l> Causes Netrw to refresh the directory listing |netrw-ctrl-l|
<c-r> Browse using a gvim server |netrw-ctrl-r|
<c-tab> Shrink/expand a netrw/explore window |netrw-c-tab|
@vaibhavmule
vaibhavmule / first-things.sh
Last active March 22, 2023 17:58
First Thing To Do After Installing Any Linux OS.
echo "Updating" &&
sudo apt-get update
echo "Upgrading" &&
sudo apt-get dist-upgrade
echo "Cleaning Up" &&
sudo apt-get -f install &&
sudo apt-get autoremove &&
sudo apt-get -y autoclean &&
@DarinM223
DarinM223 / Concepts.md
Last active February 9, 2024 16:02
Rust concept explanations

My explanation of the main concepts in Rust

There are three main concepts with Rust:

  1. Ownership (only one variable "owns" the data at one time, and the owner is in charge of deallocating)
  2. Borrowing (you can borrow a reference to an owned variable)
  3. Lifetimes (all data keeps track of when it will be destroyed)

These are fairly simple concepts, but they are often counter-intuitive to concepts in other languages, so I wanted to give a shot at