Skip to content

Instantly share code, notes, and snippets.

Tony Dinh trungdq88

Block or report user

Report or block trungdq88

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@trungdq88
trungdq88 / install_jupyterlab_launch_agent.sh
Last active Apr 19, 2019 — forked from nathanielobrown/install_jupyterlab_launch_agent.sh
script to install a jupyter lab launch agent on MacOS
View install_jupyterlab_launch_agent.sh
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 / routes.rake
Created Feb 5, 2018 — forked from oivoodoo/routes.rake
rake task for printing grape routes.
View routes.rake
namespace :grape do
desc 'Print compiled grape routes'
task :routes => :environment do
API.routes.each do |route|
puts route
end
end
end
View redis-autostart-osx.md

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 / postgres-brew.md
Created Feb 5, 2018 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)
View postgres-brew.md

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 / debug-zindex-stacking-context.js
Last active Nov 20, 2017
debug z-index and stacking context
View debug-zindex-stacking-context.js
/*
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() {
View debug-react-component.js
(() => {
const getSelector = target => {
const tag = target.tagName.toLowerCase();
const classSelector = Array.from(target.classList)
.map(_ => '.' + _)
.join('')
const idSelector = target.id ? ('#' + target.id) : '';
@trungdq88
trungdq88 / install-comodo-ssl-cert-for-nginx.rst
Created Feb 21, 2017 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.
View install-comodo-ssl-cert-for-nginx.rst

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@trungdq88
trungdq88 / Handling Page Transitions on Single Page Web Apps.md
Last active Jul 18, 2018
Handling Page Transitions on Single Page Web Apps
View Handling Page Transitions on Single Page Web Apps.md

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.
View gist:c41f6932435f0876f3ae9bef10b5f208
(function () {
String.prototype.padRight = function(l,c) {return this+Array(l-this.length+1).join(c||" ")};
// intersection
const intersect = xs => ys => {
const zs = createSet(ys);
return filter(x => zs.has(x)
? true
: false
) (xs);
You can’t perform that action at this time.