Skip to content

Instantly share code, notes, and snippets.

@cemerson
cemerson / longclick.js
Created March 16, 2014 10:12
jQuery: longclick
(function ($) {
$.fn.longClick = function (callback, timeout) {
// bind to element's mousedown event to track the longclick's beginning
$(this).mousedown(function (event) {
// save the initial event object
var initialEvent = event;
// set the delay after which the callback will be called
var timer = window.setTimeout(function () { callback(initialEvent); }, timeout);
// bind to global mouseup event for clearance
$(document).mouseup(function () {
@cemerson
cemerson / autocomplete-refresh.js
Created March 16, 2014 14:59
jQuery: autocomplete refresh data
var colors;
$(document).ready(function(){
loadColors();
$('#empf').autocomplete(colors);
}
function loadColors(){
colors = new Array(getNumColor());
//in a loop save the colors to array using colors[i] = ...
@cemerson
cemerson / cordvoa.txt
Last active August 29, 2015 13:57
Cordova: Useful CLI commands
cordova platform update ios
sudo npm update -g cordova
sudo npm update -g plugman
sudo npm install -g cordova
sudo npm install -g cordova
sudo npm install -g plugman
sudo npm install -g ios-deploy
sudo npm install -g ios-sim
@cemerson
cemerson / json.js
Created March 19, 2014 11:35
Javascript: JSON object
var status = document.getElementsByName("status")[0]; // or whatever
var jsonArr = [];
for (var i = 0; i < status.options.length; i++) {
jsonArr.push({
id: status.options[i].text,
optionValue: status.options[i].value
});
}
@cemerson
cemerson / page.html
Created March 19, 2014 16:39
HTML: Plain Page Shell (no scripts/styles)
<!DOCTYPE HTML>
<head id="" data-template-set="html5-reset">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="viewport" content="width=device-width, maximum-scale=1.0" />
</head>
<body>
</body>
</html>
@cemerson
cemerson / iis7_export_import.md
Created March 21, 2014 11:07
IIS: Export/Import Websites (IIS7)

Here's what you'd do to export a site:

    %windir%\system32\inetsrv\appcmd list site “MyWebsite” /config /xml > c:\mywebsite.xml 

#And to import it:

%windir%\system32\inetsrv\appcmd add site /in < c:\mywebsite.xml

Export site from IIS7 and Import to another IIS7 server

Here's what you'd do to export a site:

    %windir%\system32\inetsrv\appcmd list site “MyWebsite” /config /xml > c:\mywebsite.xml 

And to import it:

    %windir%\system32\inetsrv\appcmd add site /in < c:\mywebsite.xml
@cemerson
cemerson / add-column.sql
Created March 21, 2014 19:29
SQL: Add Column
ALTER TABLE {TABLENAME}
ADD {COLUMNNAME} {TYPE} {NULL|NOT NULL}
CONSTRAINT {CONSTRAINT_NAME} DEFAULT {DEFAULT_VALUE}
@cemerson
cemerson / Log.md
Created March 21, 2014 21:41
AppDev: Daily Log Template

20140000 notes

App:

SQL:

Server:

@cemerson
cemerson / cordova-plugins-cli.txt
Last active August 29, 2015 13:57
Cordova: Plugins CLI commands
cordova plugins add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
cordova plugins add https://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information.git
cordova plugins add https://git-wip-us.apache.org/repos/asf/cordova-plugin-battery-status.git
cordova plugins add https://git-wip-us.apache.org/repos/asf/cordova-plugin-media.git
cordova plugins add https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git