Skip to content

Instantly share code, notes, and snippets.

View giacomorebonato's full-sized avatar

Giacomo Rebonato giacomorebonato

View GitHub Profile
local wezterm = require 'wezterm'
local action = wezterm.action
local act = wezterm.action
-- This will hold the configuration.
local config = wezterm.config_builder()
-- Notification when the configuration is reloaded
local function toast(window, message)
window:toast_notification('wezterm', message .. ' - ' .. os.date('%I:%M:%S %p'), nil, 1000)
@giacomorebonato
giacomorebonato / rotateMatrix.js
Last active February 29, 2024 18:27
Rotate matrix clockwise 90
function rotateMatrix (matrix = []) {
return matrix[0].map(
(_row, i) => getRotatedRow(i, matrix)
)
}
function getRotatedRow (i, matrix) {
return matrix.map(
(_row, y) => matrix[(matrix.length - 1) - y][i]
)
var path = require('path')
module.exports = {
'config': path.resolve('server', 'config', 'database.json'),
'migrations-path': path.resolve('server', 'migrations'),
'models-path': path.resolve('server', 'models'),
'seeders-path': path.resolve('server', 'seeders'),
}
{
"title": "Giacomo qwerty to functional",
"rules": [
{
"description": "lctrl + qwerty > F keys",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "q",
@giacomorebonato
giacomorebonato / Auth.d.ts
Created May 30, 2020 13:24
useAuth authentication hook for React and Apollo
interface Auth {
user?: UserData
login(
email: string,
password: string
): Promise<ExecutionResult<{ login: LOGIN_USER_DATA }>>
logout(): Promise<ExecutionResult<any>>
}
import { FieldNode } from 'graphql'
export const doesPathExists = (
nodes: readonly FieldNode[],
path: string[]
): boolean => {
if (!nodes) {
return false
}
@giacomorebonato
giacomorebonato / sequelize-schema-file-generator.js
Last active October 18, 2019 20:32 — forked from manuelbieh/sequelize-schema-file-generator.js
Automatically generates migration files from your sequelize models
import db from './models'
import del from 'del'
import fs from 'fs'
import path from 'path'
let { sequelize } = db
const migrations_path = path.join(__dirname, '/migrations/')
del([migrations_path])
.then(() => {
@giacomorebonato
giacomorebonato / personal.sh
Created October 7, 2019 13:22
Personal shell
alias cbn="git branch | grep '^\*' | cut -d' ' -f2 | pbcopy && echo \"branch name copied to clipboard\""
alias burp="brew upgrade && brew update"
### Keybase proof
I hereby claim:
* I am giacomorebonato on github.
* I am grebonato (https://keybase.io/grebonato) on keybase.
* I have a public key ASCjqKFvulYeQyfZVXCFg1kBEiTMXMvyJyuDMqRrR4grtAo
To claim this, I am signing this object:
@giacomorebonato
giacomorebonato / Component_With_Loader.js
Last active August 17, 2016 12:33
ReactJS Component with Loader
import React from 'react'
class Component_1 extends React.Component {
constructor (props) {
super(props)
this.state = {
loading: true
}
}