Skip to content

Instantly share code, notes, and snippets.

View example.js
const exampleSignals =
'acedgfb cdfbe gcdfa fbcad dab cefabd cdfgeb eafb cagedb ab';
const charCount = {};
for (const char of exampleSignals
.filter((char) => /[a-g]/.test(char))) {
charCount[char] = (charCount[char] ?? 0) + 1;
leyanlo / arrayDiff.js
Created Nov 30, 2020
cassidoo 11/29/2020
View arrayDiff.js
function arrayDiff(arr, target) {
const seen = {};
return arr.reduce((numPairs, n) => {
const targetsFromN = { [n + target]: null, [n - target]: null };
numPairs += Object.keys(targetsFromN).reduce(
(seenFromN, targetFromN) => seenFromN + (seen[targetFromN] || 0),
seen[n] = (seen[n] || 0) + 1;
return numPairs;
leyanlo / babyLisp.js
Last active Oct 13, 2020
cassidoo 10/11/2020 O(n) solution with validation
View babyLisp.js
// cassidoo 10/11/2020 O(n) solution with validation
function getValue(operator, a, b) {
switch (operator) {
case "add":
return a + b;
case "subtract":
return a - b;
case "multiply":
leyanlo /
Last active Dec 4, 2020
WebStorm vs VSCode

WebStorm vs VSCode


VSCode pros

  • Popular
  • MDX support
  • Can jump to files from console, e.g. when running eslint

VSCode cons

  • Cannot look at tab title and tell if file is new, modified, unstaged, or has errors
  • Cannot advance to next file in git view
leyanlo / index.html
Last active Feb 17, 2020
View index.html
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<title>Mom’s 70th</title>
body {
display: flex;
flex-direction: column;
align-items: center;
leyanlo /
Last active Aug 30, 2018
Script to convert camelCase filenames to snake_case
# Recurse through subdirectories and convert camelCase filenames to snake_case
for file in */**/*.* ; do
mv "$file" "$(echo $file|gsed -e 's/\([A-Z]\)/_\1/g' -e 's/^.\/_//'|awk '{print tolower($0)}')"
leyanlo /
Last active Feb 2, 2018 — forked from quagliero/
Installing cpuminer-multi on macOS 10.13.2 (High Sierra)

Installing cpuminer-multi on macOS 10.13.2 (High Sierra)

This assumes you have brew installed and are comfortable using a terminal.

Following the guide on will likely lead to errors about invalid paths to OpenSSL, and neoscrypt errors to the tune of Undefined symbols for architecture x86_64 during the build. I managed to piece together different fixes into an installation that has worked for me. So I hope it works for you.


Ensure a c compiler is installed. Type g++ in the terminal and continue with the xcode installation if necessary. If it prints clang: error: no input files, then you can proceed.


Keybase proof

I hereby claim:

  • I am leyanlo on github.
  • I am leyanlo ( on keybase.
  • I have a public key ASBdnEBzDJ--vDMLyxCy29JRMnh4nk86SOd-Pnyfa-kLygo

To claim this, I am signing this object:

# Inspired by
function pure_version() {
echo '0.1'
function version() {
echo "make-app $(pure_version)"