Skip to content

Instantly share code, notes, and snippets.

View socheatsok78's full-sized avatar
πŸ––
ΰΌΌ ぀ β—•_β—• ༽぀ is having a baby

Socheat Sok socheatsok78

πŸ––
ΰΌΌ ぀ β—•_β—• ༽぀ is having a baby
View GitHub Profile
@socheatsok78
socheatsok78 / keybase.md
Last active June 3, 2021 04:04
I am socheatsok78 (https://keybase.io/socheatsok78) on keybase

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@socheatsok78
socheatsok78 / README.md
Created May 30, 2021 08:59
Deploy Hashicorp Waypoint Droplet on Digital Ocean

Hashicorp Waypoint Droplet on Digital Ocean:

  1. In the Digital Ocean portal, go to the project view.
  2. Click New Droplet.
  3. Click Create Droplet.
  4. Click the Marketplace tab.
  5. Click Docker.
  6. Choose a plan. Make sure your Droplet has the minimum hardware requirements for Docker.
  7. Choose any options for backups, block storage, and datacenter region.
  8. Optional: In the Select additional options section, you can check the User data box and enter a cloud-config file in the text box that appears. The cloud-config file is used to provide a script to be run on the first boot. An example is below.

Saved replies

Issue

# Issue: can't reproduce
Thanks for filing this issue! I'm having trouble reproducing, though. Is thre any other information you can provide?

# Issue: closing, no repro steps
This issue has no reproducible steps. 
@socheatsok78
socheatsok78 / HttpProgressHandler.js
Last active April 28, 2021 04:02
MLHttpRequest: progress event handler
export function HttpProgressHandler () {
let lastNow = new Date().getTime()
let lastKBytes = 0
return function onHttpProgressHandler (e) {
if (!e.lengthComputable) return
const now = new Date().getTime()
const bytes = e.loaded
const total = e.total
@socheatsok78
socheatsok78 / humanReadableFileSize.js
Created April 28, 2021 03:55
Convert Bytes to Human readable file size
export function humanReadableFileSize (bytes, binary = false) {
const base = binary ? 1024 : 1000
if (bytes < base) {
return `${bytes} B`
}
const prefix = binary ? ['Ki', 'Mi', 'Gi'] : ['k', 'M', 'G']
let unit = -1
while (Math.abs(bytes) >= base && unit < prefix.length - 1) {
bytes /= base
@socheatsok78
socheatsok78 / formatBytes.js
Created April 23, 2021 08:16 — forked from zentala/formatBytes.js
Convert size in bytes to human readable format (JavaScript)
function formatBytes(bytes,decimals) {
if(bytes == 0) return '0 Bytes';
var k = 1024,
dm = decimals || 2,
sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
}
// Usage:
@socheatsok78
socheatsok78 / README.md
Last active March 31, 2021 13:23
My personal "require.context" helper functions

My personal require.context helper functions

  • loadModules automatically load all vuex store modules
  • loadRoutes automatically load all vue routes files

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@socheatsok78
socheatsok78 / README.md
Created September 10, 2020 04:12
Check if the current device is a mobile browser