Skip to content

Instantly share code, notes, and snippets.

View ptgamr's full-sized avatar

Anh Trinh ptgamr

View GitHub Profile
@ptgamr
ptgamr / alacritty.yml
Created August 13, 2018 10:12
~/.config/alacritty/alacritty.yml
# Configuration for Alacritty, the GPU enhanced terminal emulator
# Any items in the `env` entry below will be added as
# environment variables. Some entries may override variables
# set by alacritty it self.
env:
# TERM env customization. Default is xterm-256color
# Note: the default TERM value `xterm-256color` does not
# specify all features alacritty supports. This does pose
@ptgamr
ptgamr / coursera-stylus.css
Created August 7, 2018 19:57
coursera-stylus.css
body {
background-color: #333;
color: #ddd;
border-color: white !important;
}
body * {
border-color: #444 !important;
}
@ptgamr
ptgamr / keybase.md
Created June 9, 2018 03:13
keybase.md

Keybase proof

I hereby claim:

  • I am ptgamr on github.
  • I am ptgamr (https://keybase.io/ptgamr) on keybase.
  • I have a public key ASC4NF7gpcHQqMZm8ep9eQlRPlRXZfx8fgMSlrUAN5SwFwo

To claim this, I am signing this object:

@ptgamr
ptgamr / Ubuntu-Compass-ruby[16.04]
Created March 24, 2018 10:36 — forked from AungMyoKyaw/Ubuntu-Compass-ruby[16.04]
Compass installation for ubuntu 16.04
[https://gist.github.com/stephou0104/233b5c99884f1d8c8b8b#file-ubuntu-compass-ruby]
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
curl -L https://get.rvm.io | bash -s stable
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
@ptgamr
ptgamr / dirty.js
Created September 15, 2017 11:03
dirty.js
const isValid = (v) => {
return v !== null && v !== undefined;
}
const isObject = (v) => {
return typeof(v) === 'object';
}
const isCallable = (v) => {
return typeof(v) === 'function';
@ptgamr
ptgamr / remove-duplicate.js
Created September 5, 2017 12:06
MONGODB: remove duplicates
var duplicates = [];
db.staff.aggregate([
{ $match: {
id: { "$exists": true } // discard selection criteria
}},
{ $group: {
_id: { id: "$id"}, // can be grouped on multiple properties
dups: { "$addToSet": "$_id" },
count: { "$sum": 1 }
@ptgamr
ptgamr / promisify.js
Created July 13, 2017 03:57
Promisify
const promisify = func => {
// this need to not using arrow function, otherwise the `this` context will be wrong
return function() {
const args = Array.from(arguments);
return new Promise((resolve, reject) => {
const callback = (err, data) => {
if (error) {
return reject(err);
}

I have successfully applied the following coupon on the subscription: sub_B11QoX8cG4AjeW

ID: scoutingtagging-chf-month
Amount off: CHF 90.00 CHF off
Duration: once
Valid: true

Now I want to switch all the subscribed plans to yearly plan, with prorate = true.

@ptgamr
ptgamr / react-native-deployments.md
Last active November 20, 2018 21:59
Environment configurations for React Native App

Intro

If you ever need a mobile application, you probably have an API endpoint to talk to. And if you're doing it right, you should have different environment for your API, usually it'll be: dev, staging, production.

The problem: How do we do the testing for our app?

We dont' want to perform test againts the production API. We need a way to teach our app to talk to different API environment. But what is the switch?

The naive way:

1 Au = 12.5 Tbsp

Plain Flour

  • 1 Au cup = 132g
  • 1 Au Tbsp = 10.56g

--> 75g = 7 Au Tbsp

Water