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
// Object literal demo | |
var obj = {}; | |
var key = Symbol('foo'); | |
obj[key] = 'baz'; | |
console.log(obj); |
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
# make a folder selection using ls and pass it to echo to see command output before executing | |
ls -d muchos*dirs/ | xargs -I{} echo rm -rf {} |
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
//////////////////////////////////////////////////////////////////////////////// | |
// Exercise: | |
// | |
// - Create a chat application using the utility methods we give you | |
// | |
// Need some ideas? | |
// | |
// - Cause the message list to automatically scroll as new | |
// messages come in | |
// - Highlight messages from you to make them easy to find |
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); |
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
// 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
# 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
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
#!/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
#[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); |
OlderNewer