Skip to content

Instantly share code, notes, and snippets.

View ferreiratiago's full-sized avatar
🌍

Tiago Ferreira ferreiratiago

🌍
View GitHub Profile
@ferreiratiago
ferreiratiago / gist:1a388d605e0cba7cd570289ddf60d2e7
Created December 11, 2023 15:02 — forked from levelsio/gist:5bc87fd1b1ffbf4a705047bebd9b4790
Secret of Monkey Island: Amsterdam (by @levelsio) or how to create your own ChatGPT image+text-based adventure game
# 2023-11-27 MIT LICENSE
Here's the open source version of my ChatGPT game MonkeyIslandAmsterdam.com.
It's an unofficial image+text-based adventure game edition of Monkey Island in Amsterdam, my home town.
Please use it however you want. It'd be nice to see more ChatGPT-based games appear from this. If you get inspired by it, please link back to my X https://x.com/levelsio or this Gist so more people can do the same!
Send me your ChatGPT text adventure game on X, I'd love to try it!
@ferreiratiago
ferreiratiago / .gitconfig
Created June 19, 2023 17:11
.gitconfig simple
[alias]
st = status
@ferreiratiago
ferreiratiago / .gitconfig
Last active June 19, 2023 17:21
.gitconfig
[alias]
# list aliases
alias = "!git config -l | grep alias | cut -c 7-"
# one-line log
ls = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
# graph log
la = log --oneline --graph --decorate --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
@ferreiratiago
ferreiratiago / reviewpad.yml
Created April 18, 2023 16:17
Use case based on file paths
# Define the groups of reviewers to use in the workflows.
groups:
- name: cloudplatform-admin
groups: '["@myorg/cloudplatform-admin"]'
- name: appteam1
groups: '["@myorg/appteam1"]'
# Define the rules to use in the workflows.
# This is useful to avoid repeating the same logic in multiple workflows.
rules:
var asyncIterable = {
[Symbol.asyncIterator]: async function* asyncGenerator() {
var array = [Promise.resolve(1), Promise.resolve(2)];
while (array.length) {
// it waits for the promise to resolve
// before yield the value
yield await array.shift();
}
}
var asyncIterable = {
[Symbol.asyncIterator]: asyncIterator
};
(async function() {
for await (const item of asyncIterable) {
console.log(item);
// 1 2
}
})();
function asyncIterator() {
const array = [1, 2];
return {
next: function() {
if (array.length) {
return Promise.resolve({
value: array.shift(),
done: false
});
} else {
(async function async() {
var one = await Promise.resolve(1);
var two = await Promise.resolve(2);
console.log(one, two); // 1 2
})();
@ferreiratiago
ferreiratiago / for-of.js
Created June 14, 2018 08:41
for...of example
var iterable = {
[Symbol.iterator]: function* generatorWithPromise() {
// define an array of async data
const promises = [Promise.resolve(1), Promise.resolve(2)];
while (promises.length) {
yield promises.shift();
}
}
};
@ferreiratiago
ferreiratiago / for-of.js
Created June 14, 2018 08:40
for...of example
var iterable = {
[Symbol.iterator]: myGenerator
};
for (let item of iterable) {
console.log(item);
// 1 2
}