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
Array.from({length: 5}, (_,index) => ++index) // length of 5, and a callback to fill a value [1,2,3,4,5] |
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
export function createProvider (vm) { | |
const provider = {} | |
return (properties) => { | |
properties.forEach((property) => { | |
const [[key, alias = null]] = typeof property === 'string' | |
? [[property]] | |
: Object.entries(property) | |
Object.defineProperty(provider, key, { | |
enumerable: true, | |
get: () => vm[alias || 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
Refer: https://github.com/debauchee/barrier/issues/597 | |
1. Start Barrier on Linux server - its IP is 192.168.1.135 | |
2. Start Barrier on MacOS client, set it to connect to 192.168.1.135 | |
Client shows "WARNING: failed to connect to sever: Timed out" | |
I verified Barrier was running and listening on the right port: | |
kit@wanderer:~$ sudo netstat -tupan | grep barrier | |
tcp6 0 0 :::24800 :::* LISTEN 31192/barriers | |
tcp6 0 0 :::35785 :::* LISTEN 31068/barrier | |
kit@wanderer:~$ |
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
/** | |
* jsonStringify | |
* Output any data structure to a string, without circular dep issues | |
* @param {*} data data to stringify | |
* @param {Number} space - indentation level | |
* @return {string} | |
*/ | |
export function jsonStringify (data, space = 2) { | |
const getCircularReplacer = () => { | |
const seen = new WeakSet() |
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
/** | |
* @param {Object} model | |
* @param {boolean} [isOptional=false] // optional | |
* @param {{startDate:string, endDate: string}} [config={startDate:'startDate', endDate: 'endDate'}] //defaults set | |
* @param {object} defaults | |
* @param {number} defaults.nested // a nested object | |
* @return {{hasAnyDataSet: boolean, isValid: boolean, errorMessage: (string | null)}} | |
*/ |
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
your machine: ssh-keygen in ~/.ssh -> all the defaults | |
your machine: pbcopy < thenewkey.pub | |
On server: append to ~/.ssh/authorized_keys the new public key - either via gui or another machine | |
your machine: ssh-add the thenewkey ( this is the private key ) | |
// another thing to try | |
your machine: sudo nano /etc/ssh/sshd_config | |
alter -> PasswordAuthentication yes | |
sudo service sshd reload |
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
now=$(date +%s) | |
oneHour=$(($now + 3600)) | |
curl 'https://slack.com/api/users.profile.set' \ | |
--header 'Authorization: Bearer YOUR_TOKEN' \ | |
--header 'Content-Type: application/json' \ | |
--data-raw "{ | |
\"profile\": { | |
\"status_text\": \"On Lunch\", | |
\"status_emoji\": \":hamburger:\", |
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
[alias] | |
squash = "!f(){ git reset --soft HEAD~${1} && git commit --edit -m\"$(git log --format=%B --reverse HEAD..HEAD@{1})\"; };f" |
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/local/bin/node | |
const https = require("https"); | |
const TOKEN = "YOUR_BITLY_TOKEN"; | |
// get the script input variable from KBM otherwise use proces.argv.slice(2)[0] instead | |
const getStdIn = async () => { | |
let result = ''; | |
process.stdin.setEncoding('utf8'); | |
for await (const chunk of process.stdin) { |
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
{ | |
"env": { | |
"browser": true, | |
"es6": true, | |
"node": true | |
}, | |
"extends": [ | |
"eslint:recommended", | |
"prettier", | |
"prettier/react" |