This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Recursive Component in React</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.11.0/umd/react.development.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.11.0/umd/react-dom.development.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.21.1/babel.min.js"></script> | |
</head> |
This file contains hidden or 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 equals(a, b) { | |
if (a === b) return true; | |
if (a instanceof Date && b instanceof Date) return a.getTime() === b.getTime(); | |
if (!a || !b || (typeof a !== 'object' && typeof b !== 'object')) return a === b; | |
if (a.prototype !== b.prototype) return false; | |
const keys = Object.keys(a); | |
if (keys.length !== Object.keys(b).length) return false; | |
return keys.every(k => equals(a[k], b[k])); | |
}; |
This file contains hidden or 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
#!/bin/bash | |
# Color Escape sequence to use in bash scripts | |
RCol='\e[0m' # Text Reset | |
# Regular Bold Underline High Intensity BoldHigh Intens Background High Intensity Backgrounds | |
Bla='\e[0;30m'; BBla='\e[1;30m'; UBla='\e[4;30m'; IBla='\e[0;90m'; BIBla='\e[1;90m'; On_Bla='\e[40m'; On_IBla='\e[0;100m'; | |
Red='\e[0;31m'; BRed='\e[1;31m'; URed='\e[4;31m'; IRed='\e[0;91m'; BIRed='\e[1;91m'; On_Red='\e[41m'; On_IRed='\e[0;101m'; | |
Gre='\e[0;32m'; BGre='\e[1;32m'; UGre='\e[4;32m'; IGre='\e[0;92m'; BIGre='\e[1;92m'; On_Gre='\e[42m'; On_IGre='\e[0;102m'; | |
Yel='\e[0;33m'; BYel='\e[1;33m'; UYel='\e[4;33m'; IYel='\e[0;93m'; BIYel='\e[1;93m'; On_Yel='\e[43m'; On_IYel='\e[0;103m'; | |
Blu='\e[0;34m'; BBlu='\e[1;34m'; UBlu='\e[4;34m'; IBlu='\e[0;94m'; BIBlu='\e[1;94m'; On_Blu='\e[44m'; On_IBlu='\e[0;104m'; |
This file contains hidden or 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
for k in $(git branch -r --merged| sed /\*/d | egrep -v "(^\*|master|dev)"); do | |
if [ -n "$(git log -1 --before='2 weeks ago' -s $k)" ]; then | |
echo $k | |
fi | |
done |
This file contains hidden or 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 createElem(name, attrs) { | |
const elem = document.createElement(name); | |
return Object.assign(elem, attrs); | |
} | |
// Example usage | |
const newDiv = createElem('div', { className: 'lol', style: 'width: 100px'}) |
This file contains hidden or 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
version: 1 | |
update_configs: | |
- package_manager: "javascript" | |
directory: "/" | |
update_schedule: "weekly" | |
default_labels: | |
- "dependencies" | |
automerged_updates: | |
- match: | |
update_type: "in_range" |
This file contains hidden or 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 traverse(obj, callback) { | |
const stack = []; | |
stack.push(obj); | |
while (stack.length) { | |
const current = stack[0]; | |
for (const key of Object.keys(current)) { | |
if (current[key] != null && typeof current[key] === 'object') { | |
stack.push(current[key]); |
This file contains hidden or 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
// Generates an array containing the interval [lower, max) a la python | |
const range = (lower, max) => Array.from({ length: max - lower }, (x, i) => lower + i); |
This file contains hidden or 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
#!/usr/bin/env java --source=11 | |
import java.util.List; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.time.Duration; | |
import java.io.BufferedReader; | |
import java.util.ArrayList; | |
import java.util.Collection; | |
class ListDurations { |
This file contains hidden or 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 formatDateAsString = date => { | |
const fmt = new Intl.NumberFormat('en-US', { | |
minimumIntegerDigits: 2, | |
useGrouping: false, | |
}); | |
const dateStr = [date.getFullYear(), date.getMonth() + 1, date.getDate()] | |
.map(fmt.format) | |
.join(''); | |
const time = [date.getHours(), date.getMinutes()] | |
.map(fmt.format) |