Skip to content

Instantly share code, notes, and snippets.

View ioxua's full-sized avatar
🎏
Existing

Yehoshua Oliveira ioxua

🎏
Existing
View GitHub Profile
@ioxua
ioxua / setup.sh
Created May 5, 2024 13:30
Personal Git setup
#!/bin/bash
# Aliases
git config --global alias.c commit
git config --global alias.s status
@ioxua
ioxua / node-modules-file-location-npm-workspace.md
Created January 25, 2024 17:46
Referencing node_modules files on a JS monorepo using NPM Workspaces

Consider the following JS monorepo folder structure:

.
├── apps
│   ├── backend
│   └── react-app
│       ├── node_modules      <-- INNER NODE_MODULES
│       ├── package-lock.json
│ └── package.json
@ioxua
ioxua / .env
Last active June 20, 2023 16:37
Unsplash cache for Astro (or any other SSG really)
UNSPLASH_ACCESS_KEY=<your_key>
@ioxua
ioxua / index.ts
Created August 9, 2022 12:45
Canvas with Font Face example
const fontUrl = 'https://fonts.gstatic.com/s/robotomono/v22/L0xuDF4xlVMF-BfR8bXMIhJHg45mwgGEFl0_Of2_ROW-AJi8SJQt.woff'
const robotoFont = new FontFace('Roboto Mono', `url(${fontUrl})`);
// Canvas variables
const canvas = document.createElement('canvas')
const ctx = canvas.getContext('2d')
robotoFont.load().then((font: FontFace) => {
// This is REQUIRED
document.fonts.add(font);
@ioxua
ioxua / Glue inside VPC.md
Created July 6, 2021 18:40
AWS CloudFormation Recipes

So, in order to create a Glue Job that's able to connect to ANYTHING AT ALL inside a VPC, you'll have to create a AWS::Glu::Connection as such:

  GlueJobVPCConnection:
    Type: AWS::Glue::Connection
    Properties:
      CatalogId: !Ref AWS::AccountId
      ConnectionInput:
        Name: !Sub "${AWS::StackName}-vpc-connection"
        ConnectionType: NETWORK
 PhysicalConnectionRequirements:
@ioxua
ioxua / i-hope-this-is-the-last-one.js
Last active December 23, 2018 20:33
Dwemthy's Array ES6 -- medium post 4
const dwemthysArrayOf = (...creatures) => {
return new Proxy(creatures, {
get: function(target, prop, _) {
if (target.length == 0) {
console.log("[Whoa. You decimated Dwemthy's Array!]"); return;
}
let enemy = target[0];
if (enemy.life <= 0) {
target.shift();
@ioxua
ioxua / why-r-u-reading-this.js
Last active December 23, 2018 20:09
Dwemthy's Array ES6 -- medium post 3
const Rabbit = creatureFactory("Rabbit", 10, 2, 44, 4, /* more here */);
const littleRabbit = new Rabbit();
@ioxua
ioxua / focus-on-the-code.js
Last active December 23, 2018 21:04
Dwemthy's Array ES6 -- medium post 2
const creatureFactory = (
name, life, strength, charisma, weapon, customProps
) => function create() {
return {
name, life, strength,
charisma, weapon
// ...
}
};
const Rabbit = creatureFactory("Rabbit", 10, 2, 44, 4 /* more here */);
@ioxua
ioxua / code-example-here.js
Last active December 23, 2018 20:06
Dwemthy's Array ES6 -- medium post 1
class Creature {
constructor() {
this.traits("life", "strength", "charisma", "weapon");
}
traits(...args) {
args.forEach(name => {
Object.defineProperty(this, name, {
writable: true
});
});
@ioxua
ioxua / main.scala
Created October 29, 2018 22:32
Gympass test
// https://github.com/Gympass/interview-test
// Setup
import java.util.Arrays
import java.time.{LocalTime,Duration}
import java.time.format.DateTimeFormatter
import scala.collection.mutable.ListBuffer
// Test input
var INPUT = """Hora Piloto Nº Volta Tempo Volta Velocidade média da volta