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
| ls -1 *.png | xargs -n 1 bash -c 'convert "$0" "${0%.png}.jpg" && rm "$0"' |
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 proxy = require('node-global-proxy').default; | |
| // For charles proxy | |
| proxy.setConfig("http://127.0.0.1:8888"); | |
| proxy.start(); |
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
| curl https://api.github.com/repos/mrdoob/three.js/issues?per_page=100 | \ | |
| jq 'map({ title: .title, number: .number, labels: .labels | length }) | \ | |
| map(select(.labels > 0))' | |
| # array constructor | |
| jq '[ .[] | { title: .title, number: .number, labels: .labels | length } ]' |
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) |
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
| // 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
| 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
| 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 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
| 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 |
NewerOlder