Skip to content

Instantly share code, notes, and snippets.

View boldfacedesign's full-sized avatar

David Parker boldfacedesign

View GitHub Profile
@boldfacedesign
boldfacedesign / C# 2 digit number
Created March 17, 2014 14:48
C# make sure number has minimum of 2 didgits
n.ToString("D2")
http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx
@boldfacedesign
boldfacedesign / Sublime wrap multiple lines.txt
Last active August 29, 2015 13:57
wrap multiple lines in tag Sublime text
Use "Selection/Split into Lines" (Ctrl+Shift+L on Windows and Linux, Cmd+Shift+L on OS X)
(Shift+Alt+W) wrap lines in tag
@boldfacedesign
boldfacedesign / JS Sleep
Created January 28, 2014 17:05
JavaScript sleep (wait) function
function sleep(milliseconds) {
var startTime = new Date().getTime();
while (new Date().getTime() < startTime + milliseconds);
}
sleep(10000);
#!/usr/bin/env ruby
require 'tempfile'
require 'fileutils'
# Signals
trap("SIGINT") { exit }
# Setup
TARGET_FOLDER = ARGV[0]
TARGET_URL = ARGV[1]
@boldfacedesign
boldfacedesign / Google maps geocode.txt
Last active November 19, 2020 07:33
Google maps geocode multiple addresses and add info windows
var locations = [
['Bondi Beach', '850 Bay st 04 Toronto, Ont'],
['Coogee Beach', '932 Bay Street, Toronto, ON M5S 1B1'],
['Cronulla Beach', '61 Town Centre Court, Toronto, ON M1P'],
['Manly Beach', '832 Bay Street, Toronto, ON M5S 1B1'],
['Maroubra Beach', '606 New Toronto Street, Toronto, ON M8V 2E8']
];
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 10,
@boldfacedesign
boldfacedesign / gist:7357899
Created November 7, 2013 16:55
make page editable via console in JS
document.body.contentEditable = 'true';
@boldfacedesign
boldfacedesign / gist:7339612
Last active December 27, 2015 14:19
Make IIS/IISExpress accept remote connections
Open Command Line prompt in administrator mode:
Type:
netsh http add urlacl url=http://machine_name:port_number/ user=everyone
where 'machine_name' is you machine(hostname) - to find this open command propmt and type 'hostname'
and 'port_number' is your project port binding.
@boldfacedesign
boldfacedesign / gist:7301723
Created November 4, 2013 12:21
Rebind/Refire JavaScript after partial postback
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(onBeginRequest);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(onEndRequest);
function onBeginRequest() {
//initiate on start of postback
}
function onEndRequest() {
//initiate at end of postback
}
@boldfacedesign
boldfacedesign / gist:7264260
Created November 1, 2013 11:39
Call client-side JavaScript from code behind 'EPiServer syntax'.
System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "name_of_function", "function()", true);
Note: Client side JS function must be defined in the global name space