Skip to content

Instantly share code, notes, and snippets.

View longnguyen2508's full-sized avatar
😐

Long Nguyen longnguyen2508

😐
View GitHub Profile
@lodestone
lodestone / eoc.rb
Created August 27, 2012 19:25
Using `EOC` in ruby code scripts.
# Using <<`EOC` in the manner lets you run a longer script from within Ruby easily.
print <<`EOC`
echo "This one is for the bitches"
echo "This ones is too"
EOC
@apieceofbart
apieceofbart / test.js
Last active August 20, 2024 23:56
Async testing with jest fake timers and promises
PLEASE CHECK THIS REPO WITH THE EXAMPLES THAT YOU CAN RUN:
https://github.com/apieceofbart/async-testing-with-jest-fake-timers-and-promises
// Let's say you have a function that does some async operation inside setTimeout (think of polling for data)
function runInterval(callback, interval = 1000) {
setInterval(async () => {
const results = await Promise.resolve(42) // this might fetch some data from server
callback(results)
}, interval)