Skip to content

Instantly share code, notes, and snippets.

View lucis's full-sized avatar
🇧🇷
I can't describe what's happening

Lucis lucis

🇧🇷
I can't describe what's happening
View GitHub Profile
@lucis
lucis / pushingToRepos.ts
Created December 27, 2019 02:27
Creating repositories and pushing files to them using @octokit/rest (GitHub API)
import Octokit from '@octokit/rest'
import glob from 'globby'
import path from 'path'
import { readFile } from 'fs-extra'
const main = async () => {
// There are other ways to authenticate, check https://developer.github.com/v3/#authentication
const octo = new Octokit({
auth: process.env.PERSONAL_ACESSS_TOKEN,
})
@lucis
lucis / useShipping.ts
Created January 10, 2020 12:07
Example of a custom Hook
const useShipping = (sellers: Seller[] = [], skuId: string) => {
const [loading, setLoading] = useState(false)
const [error, setError] = useState<string>(null)
const [estimates, setEstimates] = useState<Sla[]>([])
const { culture } = useRuntime()
const client = useApolloClient()
const getEstimates = (postalCode: string) => {
setLoading(true)
setError(null)
@lucis
lucis / mongo_backup.sh
Last active June 14, 2023 20:31
Mongo DB Backup + Gdrive Upload
#!/bin/sh
cd /tmp
FILE=`date +%m%d%y%S`
DEST=mongodb-backup/$FILE.gz
DB_NAME=database-name
# This PARENT_FOLDER is a reference to a Google Drive folder in your account (like, "my-backups").
# Use gdrive list to get the ID of the folder you want
PARENT_FOLDER=186AdURawhC3qJDL7OkGL9ueJmU44pteV
mongodump -d $DB_NAME --archive=$DEST --gzip
@lucis
lucis / store-block.md
Created March 9, 2020 17:49
Store Block Summary

Conhecendo uma app VTEX IO

Introdução

Antes de começar, é necessário relembrar alguns conceitos importantes para uma maior compreensão do fluxo lógico ao desenvolver uma app.

manifest.json

vendor

Define o nome da conta VTEX que está desenvolvendo a app. Essa conta é responsável pela manutenção e distribuição da app (pode ser instalada em outras contas ou somente na própria)

import {
ExternalClient,
InstanceOptions,
IOContext,
} from '@vtex/api'
import {
ReposGetResponse,
UsersGetByUsernameResponse,
GitCreateTagParams,
@lucis
lucis / remove-git-tags.sh
Created April 3, 2020 17:42
Removing ALL git tags for a Repo
git tag -l | xargs git tag -d && git fetch && git tag -l | xargs -n 1 git push --delete origin && git tag -l | xargs git tag -d
@lucis
lucis / vtex.10s.sh
Last active September 9, 2021 21:26
VTEX information to BitBar
#!/bin/bash
TOOLBELT_CFG_FILE="$HOME/.config/configstore/vtex.json"
parse_vtex_json() {
cat "$TOOLBELT_CFG_FILE" | grep $1 | sed -n "s/^.*\"$1\": \"\(.*\)\".*$/\1/p"
}
get_vtex_account() {
parse_vtex_json "account"
}
ACCOUNT=`parse_vtex_json "account"`
WORKSPACE=`parse_vtex_json "workspace"`
@lucis
lucis / vtex.10s.sh
Created April 6, 2020 12:32
VTEX BitBar plugin (with color support)
#!/bin/bash
TOOLBELT_CFG_FILE="$HOME/.config/configstore/vtex.json"
parse_vtex_json() {
cat "$TOOLBELT_CFG_FILE" | grep $1 | sed -n "s/^.*\"$1\": \"\(.*\)\".*$/\1/p"
}
get_vtex_account() {
parse_vtex_json "account"
}
ACCOUNT=`parse_vtex_json "account"`
WORKSPACE=`parse_vtex_json "workspace"`
@lucis
lucis / io-apps.md
Last active April 8, 2020 12:38
VTEX IO Apps guidelines

VTEX IO apps naming guidelines

Audience

  • VTEX IO external developers

Prerequisites

  • Basic knowledge of how IO apps are structured

Disclaimer: These are not guidelines for apps' implementations!

@lucis
lucis / hn-dark.js
Created May 16, 2020 15:24
My Hacker News Dark Theme
var link = document.createElement( "style" );
link.type = "text/css";
link.innerText = `
html {
background-color: #454545 !important;
}
.storylink, .comment p, .comment span {
color: #eeeeee !important;
}