Skip to content

Instantly share code, notes, and snippets.

kfiil / js-pad-date-zero.js
Created Mar 17, 2019
Javascript add leading zeroes to date
View js-pad-date-zero.js
// Source:
function pad(n){return n<10 ? '0'+n : n}
/* use a function for the exact format desired... */
function ISODateString(d){
function pad(n){return n<10 ? '0'+n : n}
return d.getUTCFullYear()+'-'
+ pad(d.getUTCMonth()+1)+'-'
+ pad(d.getUTCDate())+'T'
kfiil / value-is-null-or-undefined.js
Created Dec 18, 2018
Check for null, undefined, or blank variables in JavaScript
View value-is-null-or-undefined.js
Test for "value is null or undefined" is
if ( some_variable == null ){
// some_variable is either null or undefined
// So these two lines are equivalent:
if ( typeof(some_variable) !== "undefined" && some_variable !== null ) {}
if ( some_variable != null ) {}
kfiil /
Last active Feb 8, 2018
Gartner Identifies the Top 10 Strategic Technology Trends for 2018
kfiil / hide-html-table-row-and-column.css
Created Nov 5, 2015
Hide HTML table row and column
View hide-html-table-row-and-column.css
/*You can use the nth-child CSS selector to hide a whole column:*/
#myTable tr > *:nth-child(2) {
display: none;
/*This works under assumption that a cell of column N (be it a th or td) is always the Nth child element of its row.*/
kfiil / MainView.js
Last active Jun 10, 2016
Play iOS system sound(Uno and Native JavaScript Modules) in button click event handler
View MainView.js
var play = require("SoundPlayer").Play;
function buttonPlayClicked(){
module.exports = {
buttonPlayClicked: buttonPlayClicked
kfiil / guid.js
Created Oct 1, 2015
Create GUID / UUID in JavaScript
View guid.js
//For an rfc4122 version 4 compliant solution, this one-liner(ish) solution is the most compact I could come up with
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16);
function S4() {
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
kfiil /
Last active Aug 29, 2015 — forked from justingarrick/
Expose IIS or IISExpress running in a Parallels Windows 7/8 VM to your OS X host

###Expose IIS or IISExpress running in a Parallels Windows 7/8 VM to your OS X host

####Rename your virtual machine In your Windows 7/8 VM, go to Control Panel > System > Advanced system settings > Computer Name and click Change. Name this whatever you like, e.g. windows. Restart your VM.

####Add an ACL rule Open CMD or Powershell as administrator. Add a URL ACL entry for your new name on the port of your choice, e.g.
netsh http add urlacl url=http://windows:8080/ user=everyone

####Add a firewall rule