Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View dathi's full-sized avatar

Thi Duong dathi

  • TMA
  • Viet Nam
View GitHub Profile
beforeEach(function() {
this.addMatchers({
toBeInstanceOf: function(expectedInstance) {
var actual = this.actual;
var notText = this.isNot ? " not" : "";
this.message = function() {
return "Expected " + actual.constructor.name + notText + " is instance of " + expectedInstance.name;
};
return actual instanceof expectedInstance;
}
@dathi
dathi / terminal-git-branch-name.md
Created March 31, 2020 19:03 — forked from joseluisq/terminal-git-branch-name.md
Add Git Branch Name to Terminal Prompt (Mac)

Add Git Branch Name to Terminal Prompt (Mac)

image

Open ~/.bash_profile in your favorite editor and add the following content to the bottom.

# Git branch in prompt.

parse_git_branch() {
@dathi
dathi / timezones_array.php
Created February 14, 2020 02:16 — forked from pavellauko/timezones_array.php
Time zones as arrays (PHP)
<?php
$timezones = array(
'America/Adak' => '(GMT-10:00) America/Adak (Hawaii-Aleutian Standard Time)',
'America/Atka' => '(GMT-10:00) America/Atka (Hawaii-Aleutian Standard Time)',
'America/Anchorage' => '(GMT-9:00) America/Anchorage (Alaska Standard Time)',
'America/Juneau' => '(GMT-9:00) America/Juneau (Alaska Standard Time)',
'America/Nome' => '(GMT-9:00) America/Nome (Alaska Standard Time)',
'America/Yakutat' => '(GMT-9:00) America/Yakutat (Alaska Standard Time)',
'America/Dawson' => '(GMT-8:00) America/Dawson (Pacific Standard Time)',
Follow this link:
https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install-mac.html?shortFooter=true
- Install docker (https://docs.docker.com/docker-for-mac/install/)
+ Setup docker file sharing (https://docs.docker.com/docker-for-mac/#file-sharing)
- Install the AWS SAM CLI Using Homebrew:
+ Install homebrew (https://docs.brew.sh/Homebrew-on-Linux)
+ `brew tap aws/tap`
+ `brew postinstall python`
+ `brew install aws-sam-cli`
@dathi
dathi / .rubocop.yml
Created January 5, 2016 07:25 — forked from jhass/.rubocop.yml
My preferred Rubocop config
AllCops:
RunRailsCops: true
# Commonly used screens these days easily fit more than 80 characters.
Metrics/LineLength:
Max: 120
# Too short methods lead to extraction of single-use methods, which can make
# the code easier to read (by naming things), but can also clutter the class
Metrics/MethodLength:
@dathi
dathi / install.sh
Created November 18, 2015 17:33 — forked from wdullaer/install.sh
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"