Skip to content

Instantly share code, notes, and snippets.

View davemo's full-sized avatar
😀

David Mosher davemo

😀
View GitHub Profile
:: NOTE needs to be elevated
@set /p HTTP_PORT=Enter Port number [e.g. 10082]:
netsh http add urlacl url=http://*:%HTTP_PORT%/ user=everyone
netsh http add urlacl url=http://localhost:%HTTP_PORT%/ user=everyone
netsh http add urlacl url=http://%COMPUTERNAME%:%HTTP_PORT%/ user=everyone
netsh http add urlacl url=http://%COMPUTERNAME%.local:%HTTP_PORT%/ user=everyone
@pause
@davemo
davemo / gist:317201
Created February 28, 2010 04:29 — forked from cmelbye/gist:317193
$('form.section_edit_form').live('submit', function () {
var section_id = $(this).parent().attr('id').split("_")[1];
$.ajax({
url: "/wiki/ajax/section_edit/?section_id=" + section_id,
type: "POST",
data: $(this).serialize(),
success: function(data) {
$(this).parent().html(data);
}
@davemo
davemo / gist:317198
Created February 28, 2010 04:29 — forked from cmelbye/gist:317193
$('form.section_edit_form').live('submit', function () {
var section_id = $(this).parent().attr('id').split("_")[1];
$.ajax({
url: "/wiki/ajax/section_edit/?section_id=" + section_id,
type: "POST",
data: $(this).serialize(),
success: function(data) {
$(this).parent().html(data);
}
@davemo
davemo / gist:317199
Created February 28, 2010 04:29 — forked from cmelbye/gist:317193
$('form.section_edit_form').live('submit', function () {
var section_id = $(this).parent().attr('id').split("_")[1];
$.ajax({
url: "/wiki/ajax/section_edit/?section_id=" + section_id,
type: "POST",
data: $(this).serialize(),
success: function(data) {
$(this).parent().html(data);
}
/*
* Full example here: http://jsfiddle.net/jboesch26/3SKsL/1/
*/
$.fn.outerHTML = function(){
// IE, Chrome & Safari will comply with the non-standard outerHTML, all others (FF) will have a fall-back for cloning
return (!this.length) ? this : (this[0].outerHTML || (
function(el){
var div = document.createElement('div');
@davemo
davemo / some-source.js
Created May 19, 2011 13:08 — forked from searls/some-source.js
Add a little spy on creator that defaults to return this to support jQuery-like chaining.
buttonifyAndHide = function($obj) {
$obj.button().hide();
};
@davemo
davemo / gist:3093034
Created July 11, 2012 20:16 — forked from rmurphey/gist:3086328
What's wrong with Netmag's "Optimize your JavaScript" post

What's wrong with Netmag's "Optimize your JavaScript" post

Update: The original post on Netmag has been updated since this was written.

This is a response to an article posted on Net Magazine earlier this week that offers optimization tips for those writing JavaScript. Generally, these performance-related articles are inaccurate and harmful to new Front-End Developers trying to understand the craft -- there are many other things you should do to improve a page's performance before worrying about the purported perf hit of multiplication vs. division -- while the intention of this post may have been to inform and educate it did the opposite: it offered inaccurate advice.

A few of us have taken the time to assemble a list of corrections in the hope that Net Magazine will update the article and avoid lead

@davemo
davemo / jsconf_does_disney.md
Created October 6, 2012 17:27 — forked from jed/jsconf_does_disney.md
2012 JavaScript Roundup, Disney-style @ JSCONF EU 4ß

Objective-C (to the tune of Under the Sea)

If you're shipping iOS apps,

and dream of the bucks you'll make,

you might think of "going native",

but Xcode's a big headache.

@davemo
davemo / ios5webdebug.sh
Created November 13, 2012 23:22 — forked from sergiolopes/ios5webdebug.sh
Runs iOS 5 simulator with MobileSafari remote debug
#!/bin/bash
# Open iPhone Simulator on default location for XCode 4.3
open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app
# Open mobile safari
echo Open mobile safari on emulator and press return
read
# Plug debug to MobileSafari.app
@davemo
davemo / jquery.touch.js
Last active November 2, 2016 10:24 — forked from twalling/jquery.touch.js
Zeptos touch events, ported to work inside jQuery, including jQuery Mobiles scroll suppression.
;(function($){
var touch = {},
touchTimeout, tapTimeout, swipeTimeout,
longTapDelay = 750, longTapTimeout
function parentIfText(node) {
return 'tagName' in node ? node : node.parentNode
}
function swipeDirection(x1, x2, y1, y2) {