Skip to content

Instantly share code, notes, and snippets.

@ricardoaguiar
ricardoaguiar / update-repos.fish
Created September 24, 2022 09:46 — forked from phette23/update-repos.fish
Shell script to run `git pull` inside all subdirectories which are git repositories. I keep a number of projects in a folder & this helps me avoid manually updating each.
#!/usr/bin/env fish
# similar script in Fish
# still under construction, need to quiet `git status` more effectively
function update -d 'Update git repo'
git stash --quiet
git pull
git stash apply --quiet
end
@ricardoaguiar
ricardoaguiar / root em with pixel fallback with scss
Created September 8, 2022 19:58 — forked from pavenuto/root em with pixel fallback with scss
Note: the font-size: 62.5% thing on the html element is for switching to base 10 for the ease of calculations (default 16px * 62.5 / 100 = 10). From there, it’s easy to say 1.3rem + 13px.
.font-size($pxValue){
@remValue: (@pxValue / 10);
font-size: ~"@{pxValue}px";
font-size: ~"@{remValue}rem";
}
html { font-size: 62.5%; }
.my-element {
.font-size(13px);
@ricardoaguiar
ricardoaguiar / astro.config.mjs
Created September 8, 2022 17:10 — forked from jaames/astro.config.mjs
Injecting global SCSS variables in Astro (https://astro.build), using additionalData and a path alias
import { fileURLToPath } from 'url';
import path, { dirname } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
export default {
// all the usual config goes here...
@ricardoaguiar
ricardoaguiar / countries.json
Created January 25, 2022 18:13 — forked from tiagodealmeida/countries.json
List of countries with country code, name, currency code, population, capital and continent name in JSON format
{
"countries": {
"country": [
{
"countryCode": "AD",
"countryName": "Andorra",
"currencyCode": "EUR",
"population": "84000",
"capital": "Andorra la Vella",
"continentName": "Europe"
@ricardoaguiar
ricardoaguiar / postal-codes.json
Created January 19, 2022 08:23 — 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",
@ricardoaguiar
ricardoaguiar / introrx.md
Created January 5, 2022 21:05 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@ricardoaguiar
ricardoaguiar / SassMeister-input.scss
Created December 17, 2021 20:48
Precise control over responsive typography for Sass
// ----
// Sass (vundefined)
// Compass (vundefined)
// dart-sass (v1.6.2)
// ----
// =============================================================================
//
// PRECISE CONTROL OVER RESPONSIVE TYPOGRAPHY FOR SASS
// ---------------------------------------------------
@ricardoaguiar
ricardoaguiar / WebGL-WebGPU-frameworks-libraries.md
Created November 18, 2021 09:09 — forked from dmnsgn/WebGL-WebGPU-frameworks-libraries.md
A collection of WebGL and WebGPU frameworks and libraries

A non-exhaustive list of WebGL and WebGPU frameworks and libraries. It is mostly for learning purposes as some of the libraries listed are wip/outdated/not maintained anymore.

Engines and libraries

  • three.js: JavaScript 3D library
  • stack.gl: an open software ecosystem for WebGL, built on top of browserify and npm.
  • PixiJS: Super fast HTML 5 2D rendering engine that uses webGL with canvas fallback
  • Pex: Pex is a javascript 3d library / engine allowing for seamless development between Plask and WebGL in the browser.
  • Babylon.js: a complete JavaScript framework for building 3D games with HTML 5 and WebGL
  • Filament: Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS and WASM/WebGL
  • ClayGL: A WebGL graphic library
@ricardoaguiar
ricardoaguiar / TextBlockContentFragment.js
Created May 31, 2021 05:20 — forked from debpu06/TextBlockContentFragment.js
TextBlock Gatsby-Contentful Fragment
import { graphql } from "gatsby"
export const TextQuery = graphql`
fragment TextBlock on ContentfulTextBlock {
id
bodyContent {
json
}
sys {
contentType {
@ricardoaguiar
ricardoaguiar / app.js
Created December 12, 2020 17:16
Talking to a remote mysql database using node.js
//
// Hacked together from http://utahjs.com/2010/09/22/nodejs-and-mysql-introduction/
//
var Client = require('mysql').Client;
var client = new Client();
client.host ='some.host.com';
client.user = 'user';
client.password = 'password';
console.log("connecting...");