Skip to content

Instantly share code, notes, and snippets.

View trinhduyhung's full-sized avatar
🏠
Working from home

Trinh Duy Hung trinhduyhung

🏠
Working from home
View GitHub Profile
@trinhduyhung
trinhduyhung / System Design.md
Created September 17, 2020 08:59 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@trinhduyhung
trinhduyhung / install.sh
Created August 18, 2020 03:45 — forked from ziadoz/install.sh
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# https://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# https://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# https://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# https://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS https://chromedriver.storage.googleapis.com/LATEST_RELEASE`
@trinhduyhung
trinhduyhung / gitconfig.ini
Created July 19, 2020 11:01 — forked from tdd/gitconfig.ini
Nice, useful global Git configuration
# Put this in your ~/.gitconfig or ~/.config/git/config
# Windows users: "~" is your profile's home directory, e.g. C:\Users\<YourName>
[user]
name = Your Full Name
email = [email protected]
[color]
# Enable colors in color-supporting terminals
ui = auto
[alias]
# List available aliases
@trinhduyhung
trinhduyhung / mac-apps.md
Created February 2, 2018 13:56 — forked from erikreagan/mac-apps.md
Mac developer must-haves

Mac web developer apps

This gist's comment stream is a collection of webdev apps for OS X. Feel free to add links to apps you like, just make sure you add some context to what it does — either from the creator's website or your own thoughts.

— Erik

@trinhduyhung
trinhduyhung / Macros.h
Created October 12, 2016 08:03 — forked from numo16/Macros.h
Some useful iOS/Objective-C Macros
#define ApplicationDelegate ((AppDelegate *)[[UIApplication sharedApplication] delegate])
#define UserDefaults [NSUserDefaults standardUserDefaults]
#define NotificationCenter [NSNotificationCenter defaultCenter]
#define SharedApplication [UIApplication sharedApplication]
#define Bundle [NSBundle mainBundle]
#define MainScreen [UIScreen mainScreen]
#define ShowNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = YES
#define HideNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = NO
#define NetworkActivityIndicatorVisible(x) [UIApplication sharedApplication].networkActivityIndicatorVisible = x
#define NavBar self.navigationController.navigationBar
/**
* Copyright 2013 Alex Curran
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@trinhduyhung
trinhduyhung / AutoSummaryListPreference
Created October 1, 2016 11:07 — forked from Sloy/AutoSummaryListPreference
Android custom ListPreference which shows its selected value as summary, as suggested in the official guidelines. No need to use OnPreferenceChangeListener in the Activity or anything like that. Only assign entries and entryValues.
package com.your.package;
import android.content.Context;
import android.preference.ListPreference;
import android.util.AttributeSet;
/**
* Created by Rafa Vázquez on 29/06/13.
*
* ListPreference item that shows its selected value as summary.
@trinhduyhung
trinhduyhung / gist:5fda680a78019aad45da4c094b660050
Last active May 23, 2016 16:41 — forked from orhanobut/gist:8665372
Up down animation for dialog fragment
// Slide up animation
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:duration="@android:integer/config_mediumAnimTime"
android:fromYDelta="100%"
android:interpolator="@android:anim/accelerate_interpolator"
android:toXDelta="0" />
@trinhduyhung
trinhduyhung / gist:c68862ee0e4416502759
Created February 25, 2016 06:31 — forked from korayguclu/gist:5508961
Convert byte to Hex to analyse Encoding problems
public String byteToHex(final byte b) {
// Returns hex String representation of byte b
char hexDigit[] = {
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
};
char[] array = { hexDigit[(b >> 4) & 0x0f], hexDigit[b & 0x0f] };
return new String(array);
}
@trinhduyhung
trinhduyhung / CharExploreMain.java
Created February 25, 2016 06:30 — forked from data-tamer-vgp/CharExploreMain.java
Playing with Java, Unicode and UTF-8
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
public class CharExploreMain {
private static final byte[] BA = new byte[1024];
private static final ByteBuffer BB = ByteBuffer.wrap(BA);