Skip to content

Instantly share code, notes, and snippets.

View PsKs's full-sized avatar

PSK PsKs

  • 01:27 (UTC +07:00)
View GitHub Profile

It seems that it does not matter what timezone is on the server as long as you have the time set right for the current timezone, know the timezone of the datetime columns that you store, and are aware of the issues with daylight savings time.

On the other hand if you have control of the timezones of the servers you work with then you can have everything set to UTC internally and never worry about timezones and DST.

Here are some notes I collected of how to work with timezones as a form of cheatsheet for myself and others which might influence what timezone the person will choose for his/her server and how he/she will store date and time.

MySQL Timezone Cheatsheet

@PsKs
PsKs / git-clearHistory
Last active April 29, 2020 11:18 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -S -m "Initial commit" --allow-empty
-- push to the github remote repos ensuring you overwrite history
git remote add origin [email protected]:<YOUR ACCOUNT>/<YOUR REPOS>.git
@PsKs
PsKs / MainActivity.java
Created January 25, 2019 21:31 — forked from anandwana001/MainActivity.java
Implementing Bottom Navigation Bar in your Android App with more than 3 items
public class MainActivity extends AppCompatActivity {
@BindView(R.id.navigation)
BottomNavigationView navigation;
@BindView(R.id.toolbar)
Toolbar toolbar;
private int saveState;
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
@PsKs
PsKs / nginx.conf
Created August 22, 2018 11:25 — forked from mjurincic/nginx.conf
Setup NodeJS Production with PM2, Nginx on AWS Ubuntu 16.04 server
proxy_http_version 1.1;
proxy_set_header Connection "";
https://gist.github.com/miguelmota/6912559
# The upstream module is the link between Node.js and Nginx.
# Upstream is used for proxying requests to other servers.
# All requests for / get distributed between any of the servers listed.
upstream helloworld {
# Set up multiple Node.js webservers for load balancing.
# max_fails refers to number of failed attempts
# before server is considered inactive.
@PsKs
PsKs / github_gpg_key.md
Last active January 19, 2022 23:39 — forked from Fastidious/github_gpg_key.md
[Signing commits using GPG (Ubuntu/Mac)] To use on GitHub, or any other git repository.

Signing commits using GPG (Ubuntu/Mac)

  • Do you have an Github account? If not create one.
  • Install required tool.
  • Latest Git Client.
  • gpg tools.
# Ubuntu
sudo apt-get install gpa seahorse
@PsKs
PsKs / README.md
Created May 3, 2018 00:09 — forked from BoGnY/README.md
[WINDOWS] How to enable auto-signing Git commits with GnuPG for programs that don't support it natively

[WINDOWS] How to enable auto-signing Git commits with GnuPG for programs that don't support it natively

This is a step-by-step guide on how to enable auto-signing Git commits with GPG for every applications that don't support it natively (eg. GitHub Desktop, Eclipse, Git Tower, ...)

Requirements

  • Install GPG4Win: this software is a bundle with latest version of GnuPG v2, Kleopatra v3 certificate manager, GNU Privacy Assistant (GPA) v0.9 which is a GUI that uses GTK+, GpgOL and GpgEX that are respectively an extension for MS Outlook and an extension for Windows Explorer shell
  • Install Git for Windows: so you can have a *nix based shell, this software is a bundle with latest version of Git which use MINGW environment, a Git bash shell, a Git GUI and an extension for Windows Explorer shell (Make sure your local version of Git is at least 2.0, otherwise Git don't have support for automatically sign your commits)
  • Verify
@PsKs
PsKs / AndroidManifest.xml
Created March 13, 2018 11:23 — forked from cofearabi/AndroidManifest.xml
Android sample connect to the mysql server database and get the values of field of table , and display them.
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
@PsKs
PsKs / AuthServiceProvider.php
Created February 25, 2018 12:30 — forked from gbuckingham89/AuthServiceProvider.php
Blog: Laravel Authentication Customer User Provider Demo
<?php
namespace App\Authentication;
use Auth;
use App\Authentication\UserProvider;
use Illuminate\Support\ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
@PsKs
PsKs / 1README.md
Created February 23, 2018 14:14 — forked from joseluisq/1README.md
How add a custom field to Laravel 5.4 default login. LoginController.php

How add a custom field to Laravel 5.4 default login controller.

In this php example (app/Http/Controllers/Auth/LoginController.php) my model is called Client and the custom field for login validation is status. (Client->status)

Add in your resources/lang/en/auth.php file :

    'failed_status' => 'Your account is inactive yet. Please confirm your e-mail address.',
@PsKs
PsKs / How to Implement Client Model Observer for Laravel Passport Custom IDs.txt
Created February 11, 2018 19:17
[See How to Implement.txt below] This Gist shows how to implement a Client model observer for Laravel Passport so that you don't have to be stuck with that weird autoincrementing Client ID.
This Gist provides an example of how to implement a Client Model Observer for Laravel Passport.
This Observer will allow you to intercept the creation of a `Laravel\Passport\Client` model and set a custom id for it.
However, to implement this, you will need to handle the migrations yourself. In my case, the custom ID will be a random, large integer. So the database migrations set the `id` field to a type of `bigInteger`.
Take a look at this complete Gist carefully and implement it yourself. It's very easy.