Skip to content

Instantly share code, notes, and snippets.

View trungdq88's full-sized avatar

Tony Dinh trungdq88

View GitHub Profile
@trungdq88
trungdq88 / postgres-brew.md
Created February 5, 2018 01:59 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@trungdq88
trungdq88 / redis-autostart-osx.md
Created February 5, 2018 02:02 — forked from subfuzion/redis-autostart-osx.md
redis auto start OS X

Install with Homebrew

brew install redis

Set up launchctl to auto start redis

$ ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents

/usr/local/opt/redis/ is a symlink to /usr/local/Cellar/redis/x.y.z (e.g., 2.8.7)

@trungdq88
trungdq88 / routes.rake
Created February 5, 2018 02:37 — forked from oivoodoo/routes.rake
rake task for printing grape routes.
namespace :grape do
desc 'Print compiled grape routes'
task :routes => :environment do
API.routes.each do |route|
puts route
end
end
end
@trungdq88
trungdq88 / Handling Page Transitions on Single Page Web Apps.md
Last active July 18, 2018 08:57
Handling Page Transitions on Single Page Web Apps

Handling Page Transitions on Single Page Web Apps

zoom

Real world application with a lot of pages (or "screens") have to deal with problem managing the pages' DOM and memory efficiently and at the same provide a nice smooth transition effect between pages. This is not a real problem when you do it in native apps since Android or iOS already handle the hard work for you, but when come to JavaScript, HTML, and CSS, running on mobile browsers, this is the real challenge.

There are 2 common approaches to solve this problem:

  • Approach 1: Keep all the pages in the DOM tree, use CSS (for example display) to transit between pages.
@trungdq88
trungdq88 / install_jupyterlab_launch_agent.sh
Last active April 19, 2019 02:43 — forked from nathanielobrown/install_jupyterlab_launch_agent.sh
script to install a jupyter lab launch agent on MacOS
cat <<EOF > ~/Library/LaunchAgents/com.$(whoami).jupyterlab.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.$(whoami).jupyterlab</string>
<key>ProgramArguments</key>
@trungdq88
trungdq88 / debug-zindex-stacking-context.js
Last active April 29, 2020 11:44
debug z-index and stacking context
/*
Usage:
* Paste this into your dev tools console (or even better as a snippet)
* It will parse the page and find all the things that create a new stacking context
and dump some info about them to the console. It will also outline them on the page.
* This is pretty rough and probably misses heaps of bugs and edge cases.
*/
function run() {
@trungdq88
trungdq88 / clean-desktop.sh
Created April 17, 2022 04:05
clean desktop
######################################################
#
# My desktop is too messy for a long time. So I made
# a rule for it: Everything in my desktop should be
# temporary and should be deleted by the end of the
# day.
#
# This script will archive all items on your desktop
# to a directory. You will always have a clean
# desktop!
import board
import busio
from time import sleep
from displayio import (
Bitmap,
Palette,
Group,
TileGrid,
FourWire,
@trungdq88
trungdq88 / paddle-revenue.js
Last active April 6, 2023 14:07
A scriptable's script to get Paddle revenue from multiple accounts using puppeteer.
/*
RUN THE SCRIPT BY YOURSELF:
- Run `node paddle-revenue.js` on your server and let it run 24/7.
- Access the API at http://your_server_ip:8175/ (JSON)
HOSTED VERSION:
If you don't want to run the script by your own, you can use the
hosted version. The price is $5 per month per Paddle account.
Here is how:
if (document.querySelector('[data-element-id="side-bar-background"]')) {
document.querySelector('[data-element-id="side-bar-background"]').style.backgroundColor = "black";
}