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
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
<!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
#[derive(Debug)] | |
struct Action { | |
_type: String, | |
amount: u32 | |
} | |
fn update_counter(state:u32, action: Action) -> u32 { | |
let Action {_type, amount} = action; | |
println!("{} {} {}", _type, amount, state); |
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 python3 | |
# | |
# prepare the commit log message using the JIRA Ticket code. | |
# | |
# Given that the your branch is called something like bugfix/PROJETO-21012 | |
# Then your commit message will look like | |
# | |
# [PROJETO-21012] Fixes the bug | |
# |
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
getReactElement = (dom) => { | |
for (var key in dom) { | |
if (!key.startsWith("__reactInternalInstance$")) continue; | |
var compInternals = dom[key]._currentElement; | |
var compWrapper = compInternals._owner; | |
var comp = compWrapper._instance; | |
return comp; | |
} | |
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
# remap prefix from 'C-b' to 'C-a' | |
unbind C-b | |
set-option -g prefix C-a | |
bind-key C-a send-prefix | |
# Start window numbering at 1 | |
set -g base-index 1 |
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
// HOF to do an automatic catch over functions that return promises | |
const handleErrors = fn => (...args) => fn(...args).catch(err => console.error(`Ohh the horror ${err}`)) | |
// A buggy sleep | |
const riskySleep = (ms) => | |
new Promise((resolve, reject) => { | |
if (Math.random() < 0.7) { reject(ms) } | |
setTimeout(() => resolve(ms), ms) | |
}); |
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
#Taken from https://dev.to/ricardomol/note-taking-from-the-command-line-156 | |
note() { | |
if [ ! -z "$1" ]; then | |
echo $(date +"%Y%m%d-%H%M%S") $@ >> $HOME/notes/TempNotes.wiki | |
else | |
echo $(date +"%Y%m%d-%H%M%S") "$(cat)" >> $HOME/notes/TempNotes.wiki | |
fi | |
} |
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
var webdriverio = require("webdriverio"); | |
var options = { | |
desiredCapabilities: { | |
browserName: "chrome" | |
} | |
}; | |
var client = webdriverio.remote(options); |