Skip to content

Instantly share code, notes, and snippets.

David Parker boldfacedesign

Block or report user

Report or block boldfacedesign

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Gulp KSS
var gulp = require('gulp'),
kss = require('gulp-kss'),
rename = require('rename');
gulp.task('kss-css', function() {
return gulp.src(['css/master.css']) //get compiled CSS
.pipe(rename('style.css')) //rename to KSS required nameing convention
.pipe(gulp.dest('guides/complete/public')); //move to KSS compile folder
});
@boldfacedesign
boldfacedesign / Google maps geocode.txt
Last active Feb 15, 2019
Google maps geocode multiple addresses and add info windows
View Google maps geocode.txt
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 / JS Sleep
Created Jan 28, 2014
JavaScript sleep (wait) function
View JS Sleep
function sleep(milliseconds) {
var startTime = new Date().getTime();
while (new Date().getTime() < startTime + milliseconds);
}
sleep(10000);
@boldfacedesign
boldfacedesign / weinre script tag
Created Jun 9, 2016
Inject weinre script tag
View weinre script tag
var weinre_script = document.createElement("script");
weinre_script.type = "text/javascript";
weinre_script.src = "http://xxx.xx.xx.xx:8855/target/target-script-min.js#anonymous";
var head = document.getElementsByTagName('head')[0];
head.appendChild(weinre_script);
// replace xxx with IP adress
@boldfacedesign
boldfacedesign / hex64
Last active May 27, 2016
Take a colour hex and return a base64 image string in gif format
View hex64
hex64: function(hex) {
function encodeHex(s) {
s = s.substring(1, 7);
if (s.length < 6) {
s = s[0] + s[0] + s[1] + s[1] + s[2] + s[2];
}
return encodeRGB(
parseInt(s[0] + s[1], 16), parseInt(s[2] + s[3], 16), parseInt(s[4] + s[5], 16));
}
View watch.rb
#!/usr/bin/env ruby
require 'tempfile'
require 'fileutils'
# Signals
trap("SIGINT") { exit }
# Setup
TARGET_FOLDER = ARGV[0]
TARGET_URL = ARGV[1]
@boldfacedesign
boldfacedesign / gist:7357899
Created Nov 7, 2013
make page editable via console in JS
View gist:7357899
document.body.contentEditable = 'true';
@boldfacedesign
boldfacedesign / gist:7339612
Last active Dec 27, 2015
Make IIS/IISExpress accept remote connections
View gist:7339612
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 Nov 4, 2013
Rebind/Refire JavaScript after partial postback
View gist:7301723
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 Nov 1, 2013
Call client-side JavaScript from code behind 'EPiServer syntax'.
View gist:7264260
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
You can’t perform that action at this time.