Skip to content

Instantly share code, notes, and snippets.

View jefrydco's full-sized avatar
🎯
Focusing

Jefry Dewangga jefrydco

🎯
Focusing
View GitHub Profile
@jefrydco
jefrydco / machine.js
Created March 30, 2021 10:06
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@jefrydco
jefrydco / core-web-vitals-compliance-rates-indonesia.sql
Created January 23, 2021 03:30
Calculate the percent of origins that comply with each Core Web Vital's "good" threshold for 75% or more of experiences for Indonesia country.
#standardSQL
# This query processes 735.9 MB.
# Calculate the percent of origins that comply with each Core Web Vital's "good" threshold for 75% or more of experiences.
CREATE TEMP FUNCTION IS_GOOD (good FLOAT64, needs_improvement FLOAT64, poor FLOAT64) RETURNS BOOL AS (
good / (good + needs_improvement + poor) >= 0.75
);
CREATE TEMP FUNCTION IS_NON_ZERO (good FLOAT64, needs_improvement FLOAT64, poor FLOAT64) RETURNS BOOL AS (
good + needs_improvement + poor > 0
@jefrydco
jefrydco / mypostgres.sh
Created January 21, 2019 02:03
Run PostgreSQL and pgAdmin4 on Docker with single command
#!/bin/bash
# Create postgres directory with pgvolume and pga4volume as child directory.
mkdir -p postgres/{pgvolume,pga4volume}
# Navigate to postgres directory
cd postgres
# Create pg.env that holds environment variable for postgres docker container.
cat << EOF > pg.env
@jefrydco
jefrydco / .htaccess
Last active April 7, 2017 07:14
I think this htaccess configuration is the best one.
# Serve all resources labeled as `text/html` or `text/plain`
# with the media type `charset` parameter set to `UTF-8`.
AddDefaultCharset utf-8
# Disable the pattern matching based on filenames.
Options -MultiViews