- ✅ You probably have Make installed by default, your CI does too;
- ✅ When you write a Makefile, you are just defining your dependency graph;
- ✅ It is incremental, so it only create files, compile, run tasks that are necessary;
- ✅ Efficient. It can run jobs in parallel;
- ✅ Easily integrates with any CLI tool;
- ✅ Superfast, it's made in C;
- ✅ A boring tool: stable, reliable, predictable, fast and powerful;
- ✅ Your CI will love it;
- ✅ Full control over your workflow;
- ✅ Used for compiling large C, Go and many other codebase for decades;
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function textToSlackEmoji(text: string): string { | |
return text.split('').reduce((phrase, char) => { | |
if (char) return phrase + `:alphabet-white-${char}:` | |
else return phrase + ' ' | |
}, '').replaceAll(':alphabet-white- :', ' ') | |
} | |
textToSlackEmoji('ladies and gentleman the weekend') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use rand::Rng; | |
use std::cmp::Ordering; | |
use std::io; | |
fn main() { | |
println!("Guess the number!"); | |
let secret_number = rand::thread_rng().gen_range(1..101); | |
loop { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getIndexOfMin(list: number[]) { | |
let current = list[0]; | |
let index = 0; | |
for (let i = 0; i < list.length; i++) { | |
if (list[i] < current) { | |
current = list[i]; | |
index = i; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// O(logn) | |
const binarySearch = (list: number[], item) => { | |
let [from, to] = [0, list.length - 1]; | |
if (!item) return | |
while (from <= to) { | |
const index = Math.ceil((from + to) / 2); | |
const guess = list[index]; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fib = n => { | |
if (n <= 2) return 1 | |
return fib(n - 1) + fib(n - 2) | |
} | |
function fib2(n, mem = {}) { | |
let fibonacci; | |
if (n in mem) return mem[n] | |
fibonacci = n <= 2 ? 1 : fib2(n - 1, mem) + fib2(n - 2, mem) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function max(target: Array<Number>): Number { | |
const reducer = (greatest, current) => current > greatest ? current : greatest | |
return target.reduce(reducer) | |
} | |
function crush(length, queries) { | |
const zeroes = Array(length).fill(0) | |
for (let i = 0; i < queries.length; i++) { | |
const [a, b, k] = queries[i]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function min(target: Array<Number>): Number { | |
const reducer = (lowerest, current) => current < lowerest ? current : lowerest | |
return target.reduce(reducer) | |
} | |
function max(target: Array<Number>): Number { | |
const reducer = (greatest, current) => current > greatest ? current : greatest | |
return target.reduce(reducer) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const generate = (length = 1000) => Array(length).fill().map(() => | |
Math.floor(Math.random() * Math.floor(100)) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const twoDimensionsArray = [ | |
[-9, -9, -9, 1, 1, 1], | |
[ 0, -9, 0, 4, 3, 2], | |
[-9, -9, -9, 1, 2, 3], | |
[ 0, 0, 8, 6, 6, 0], | |
[ 0, 0, 0, -3, 0, 0], | |
[ 0, 0, 1, 2, 4, 0], | |
] | |
const twoDimensionsArray2 = [ |
NewerOlder