Skip to content

Instantly share code, notes, and snippets.

View shubhamjain's full-sized avatar

Shubham Jain shubhamjain

View GitHub Profile
@shubhamjain
shubhamjain / Human readable time format in Javascript.
Last active August 29, 2015 13:57
This function takes milliseconds as input and converts it into human readable form. Useful in showing time elapsed or ETA.
/**
* This function takes milliseconds as input and converts it into "D H M S ms" format.
*
* @author Shubham Jain <[email protected]>
* @license MIT License
*/
function timeFormat( miliseconds )
{
formatArr = {
"d": 24 * 60 * 60 * 1000,

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@shubhamjain
shubhamjain / Binary File reader in PHP
Last active July 23, 2020 09:07
This class is a better replacement for PHP unpack(). Unlike unpack, which creates a very large associative array, this class reads data in blocks defined by a map. Additionally blocks of Dynamic size can also be used with special constants.
<?php
/**
* A simple class to read variable byte length binary data.
* This is basically is a better replacement for unpack() function
* which creates a very large associative array.
*
* @author Shubham Jain <[email protected]>
* @example https://github.com/shubhamjain/PHP-ID3
* @license MIT License