This file contains 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
String.prototype.toHtml = function () { | |
let element = new DOMParser().parseFromString(this, 'text/html').body.firstChild; | |
return element; | |
}; |
This file contains 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 | |
# Colors | |
RED='\033[0;31m' | |
GREEN='\033[0;32m' | |
NO_COLOR='\033[0m' | |
BLUE='\033[0;34m' | |
YELLOW='\033[0;33m' | |
NO_COLOR='\033[0m' |
This file contains 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
[user] | |
email = your_email | |
name = your_username | |
[alias] | |
# view your global git config Aliases from CLI | |
aliases = config --get-regexp '^alias\\.' | |
# git clone | |
cl = !git clone | |
# Git shallow clone for large repos | |
clq= !git clone --depth=1 |
This file contains 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
/** | |
* Definition for a binary tree node. | |
* public class TreeNode { | |
* int val; | |
* TreeNode left; | |
* TreeNode right; | |
* TreeNode() {} | |
* TreeNode(int val) { this.val = val; } | |
* TreeNode(int val, TreeNode left, TreeNode right) { | |
* this.val = val; |
This file contains 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
# boolean values, use if | |
if expression, do: this(), else: that() | |
# non-boolean multi-value single expressions, use case | |
case expression do | |
value1 -> one() | |
value2 -> two() | |
value3 -> three() | |
_ -> anything_else() | |
end |
This file contains 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
# Some of the tests for this fail, in a way that's surprising to Python users... | |
# Why? | |
class List | |
def initialize(*elements) | |
@elements = elements | |
@elements.each do |e| | |
return if e.nil? | |
end | |
end |