Skip to content

Instantly share code, notes, and snippets.

View boldfacedesign's full-sized avatar

David Parker boldfacedesign

View GitHub Profile
@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
@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: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:7357899
Created November 7, 2013 16:55
make page editable via console in JS
document.body.contentEditable = 'true';
@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,
#!/usr/bin/env ruby
require 'tempfile'
require 'fileutils'
# Signals
trap("SIGINT") { exit }
# Setup
TARGET_FOLDER = ARGV[0]
TARGET_URL = ARGV[1]
@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);
@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 / 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 / shopify collection loop
Created March 23, 2014 18:29
shopify collection loop
{% if c.handle contains collection.handle and c.handle != collection.handle %}
<li class="{{ forloop.index }}">
<a href="{{ c.url }}" title="{{ c.title }}">
<span class="product-border"></span>
<div class="img-wrap">
<span class="img-wrap__inner">
<img src="{{ c.image.src | collection_img_url: 'medium' }}">
</span>
</div>