Skip to content

Instantly share code, notes, and snippets.

View bntzio's full-sized avatar

Enrique Benitez bntzio

View GitHub Profile
@bntzio
bntzio / postal-codes.json
Created July 22, 2022 22:25 — forked from jamesbar2/postal-codes.json
Global postal codes regex formats
[{
"Note": "The first two digits (ranging from 10–43) correspond to the province, while the last two digits correspond either to the city/delivery zone (range 01–50) or to the district/delivery zone (range 51–99). Afghanistan Postal code lookup",
"Country": "Afghanistan",
"ISO": "AF",
"Format": "NNNN",
"Regex": "^\\d{4}$"
}, {
"Note": "With Finland, first two numbers are 22.",
"Country": "Åland Islands",
"ISO": "AX",
@bntzio
bntzio / migrate.ts
Created July 12, 2022 01:41
shadow-drive - migrate.ts
import * as anchor from "@project-serum/anchor";
import { findAssociatedTokenAddress, sendAndConfirm } from "../utils/helpers";
import { isBrowser, tokenMint } from "../utils/common";
import { ShadowDriveResponse } from "../types";
/**
*
* @param {anchor.web3.PublicKey} key - PublicKey of a Storage Account
* @returns {ShadowDriveResponse} - Confirmed transaction ID
*/
@bntzio
bntzio / index.js
Created April 2, 2021 08:08 — forked from timneutkens/index.js
Clear console/terminal in node.js the right way
const readline = require('readline')
const blank = '\n'.repeat(process.stdout.rows)
console.log(blank)
readline.cursorTo(process.stdout, 0, 0)
readline.clearScreenDown(process.stdout)
@bntzio
bntzio / media-query.css
Created July 21, 2019 05:41 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
passwd bntz
osascript -e 'tell application "Finder" to sleep'
@bntzio
bntzio / delay.js
Created November 15, 2018 20:23 — forked from eteeselink/delay.js
ES7 async/await version of setTimeout
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
async function something() {
console.log("this might take some time....");
await delay(5000);
console.log("done!")
}
something();
@bntzio
bntzio / async-await.js
Created November 15, 2018 04:25 — forked from wesbos/async-await.js
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}
@bntzio
bntzio / postgres cheatsheet.md
Created August 27, 2018 23:06 — forked from apolloclark/postgres cheatsheet.md
postgres cheatsheet

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL

@bntzio
bntzio / browsersync-webpack.md
Created April 12, 2018 06:25 — forked from robinrendle/browsersync-webpack.md
Getting set up with Browsersync and Webpack

Fixing our local environment with Browsersync

Whenever we change our templates we still have to use our build script and this can get annoying. Thankfully with webpack-dev-server and BrowserSync we can fix this:

npm i -D browser-sync browser-sync-webpack-plugin webpack-dev-server

BrowserSync will act like a proxy, waiting for webpack to do its thing and then reloading the browser for us.

@bntzio
bntzio / git-author-rewrite.txt
Created February 24, 2018 23:59
Change git commit author in bulk
git filter-branch -f --env-filter "GIT_AUTHOR_NAME='Your name'; GIT_AUTHOR_EMAIL='Your email'; GIT_COMMITTER_NAME='Your name'; GIT_COMMITTER_EMAIL='Your email';" HEAD