Skip to content

Instantly share code, notes, and snippets.

@kfiil
kfiil / js-pad-date-zero.js
Created Mar 17, 2019
Javascript add leading zeroes to date
View js-pad-date-zero.js
// Source: https://stackoverflow.com/a/12550320
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
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
kfiil / Gartner-Top-10-Strategic-Technology-Trends-for-2018.md
Last active Feb 8, 2018
Gartner Identifies the Top 10 Strategic Technology Trends for 2018
View Gartner-Top-10-Strategic-Technology-Trends-for-2018.md
@kfiil
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
/*
COLUMN
Souce: http://stackoverflow.com/a/13512460*/
/*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.*/
/*ROW*/
@kfiil
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(){
play();
}
//RELOAD
module.exports = {
buttonPlayClicked: buttonPlayClicked
};
@kfiil
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
//http://stackoverflow.com/a/2117523
'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);
});
//http://guid.us/GUID/JavaScript
function S4() {
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
@kfiil
kfiil / IIS_Parallels_Win8_Mac.md
Last active Aug 29, 2015 — forked from justingarrick/IIS_Parallels_Win8_Mac.md
Expose IIS or IISExpress running in a Parallels Windows 7/8 VM to your OS X host
View IIS_Parallels_Win8_Mac.md

###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