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
require "yaml" | |
require "json" | |
str = <<~DOC | |
{ | |
"banana": "dog", | |
# We can do the thing | |
"aardvark": [ | |
1, 2, # we need the next | |
3, |
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
mercerTable = mercerTable or {} | |
function mercerTable.whatTheTimerDoes() | |
local sound1 = HoweverSoundsWork() | |
play(sound1) | |
end | |
function mercerTable.makeATimer() | |
if type(mercerTable.thisCoolTimer) == "number" then |
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
# My least favorite valid Ruby code | |
"abc" "xyz" | |
# => "abcxyz" | |
# Truly cursed reminder that whitepsace doesn't matter for method invocation | |
# and that ary[index] syntax is just a fancy way to do ary.[](index) | |
[1] [2] | |
# => nil | |
foo = "abc" |
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
class MyComponent extends React.Component { | |
this.handleClick = (event) => { | |
console.log(event); // do something | |
} | |
function render() { | |
<input onClick={this.handleClick} /> | |
} |
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
function coolCallback(event) { | |
console.log(event); | |
} | |
function iAcceptACallback(callback) { | |
callback("GOTCHA") | |
} | |
iAcceptACallback(coolCallback); |
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
lines = File.readlines('./foo.txt', 'r') | |
File.open('./foo_formatted.txt', 'w') do |f| | |
lines.each do |line| | |
newline = line.gsub("\\", "\\\\\\\\") | |
f << newline | |
end | |
end |