Skip to content

Instantly share code, notes, and snippets.

@lambdaydoty
lambdaydoty / copy-repo.md
Created December 14, 2021 14:23
Copy a repo without forking

How to copy a GitHub repo without forking

GitHub only lets you fork a repo once, if you want to make more than one copy of a project here's how you can do it. Useful for starter code.

  1. Create a new empty folder for your project and initialize git

    cd where-you-keep-your-projects

mkdir your-project-name

@lambdaydoty
lambdaydoty / 01.bash_shortcuts_v2.md
Created December 6, 2021 03:23 — forked from tuxfight3r/01.bash_shortcuts_v2.md
Bash keyboard shortcuts

Bash Shortcuts

visual cheetsheet

Moving

command description
ctrl + a Goto BEGINNING of command line
@lambdaydoty
lambdaydoty / gist:eef96c887c090bccb80bc764e3e7a0fb
Created November 26, 2021 12:22 — forked from psayre23/gist:c30a821239f4818b0709
Runtime Complexity of Java Collections
Below are the Big O performance of common functions of different Java Collections.
List | Add | Remove | Get | Contains | Next | Data Structure
---------------------|------|--------|------|----------|------|---------------
ArrayList | O(1) | O(n) | O(1) | O(n) | O(1) | Array
LinkedList | O(1) | O(1) | O(n) | O(n) | O(1) | Linked List
CopyOnWriteArrayList | O(n) | O(n) | O(1) | O(n) | O(1) | Array
@lambdaydoty
lambdaydoty / example.js
Created February 29, 2020 10:35 — forked from briancavalier/example.js
Infinite "lists" in es6 using generators and yield
// Requires traceur
import { iterate, take, map, foldl } from './list-out-of-yield';
// Sum of squares of integers 1..100
var values = take(100, iterate(x => x + 1, 1));
var result = foldl((x, y) => x + y, 0, map(x => x * x, values));
console.log(result);
@lambdaydoty
lambdaydoty / reader.js
Created February 25, 2020 14:41 — forked from dypsilon/reader.js
Example usage of the reader monad.
/**
* This short program will encrypt the user password
* and insert a new record into a mock database.
*/
const Reader = require('fantasy-readers');
const R = require('ramda');
const crypto = require('crypto');
// our mock database
const database = [
@lambdaydoty
lambdaydoty / combinators.js
Created February 23, 2020 16:41 — forked from Avaq/combinators.js
Common combinators in JavaScript
const I = x => x;
const K = x => y => x;
const A = f => x => f(x);
const T = x => f => f(x);
const W = f => x => f(x)(x);
const C = f => y => x => f(x)(y);
const B = f => g => x => f(g(x));
const S = f => g => x => f(x)(g(x));
const P = f => g => x => y => f(g(x))(g(y));
const Y = f => (g => g(g))(g => f(x => g(g)(x)));
@lambdaydoty
lambdaydoty / db-alt.js
Created February 20, 2020 03:01 — forked from i-am-tom/db-alt.js
Database failover modelled with the `alt` typeclass.
const Task = require('data.task')
Task.prototype.alt = function (that) {
return new Task((rej, res) =>
this.fork(_ => that.fork(rej, res), res))
}
const hosts = [
[ 'db1.mysite.com', 'user', 'password' ],
[ 'db2.mysite.com', 'user', 'password' ],
@lambdaydoty
lambdaydoty / gist:12a98ca93f4fdb4dd857870f13c9177c
Created October 10, 2019 05:14 — forked from jb55/gist:2253102
Lambda and arrow digraphs in vim
" lambda λ
imap <C-j> <C-k>l*
" right arrow →
imap <C-l> <C-k>->
" left arrow ←
imap <C-h> <C-k><-
" compose ∘