This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function string_to_slug(str) { | |
str = str.replace(/^\s+|\s+$/g, ''); // trim | |
str = str.toLowerCase(); | |
// remove accents, swap ñ for n, etc | |
var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;"; | |
var to = "aaaaeeeeiiiioooouuuunc------"; | |
for (var i=0, l=from.length ; i<l ; i++) { | |
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.use(function(req, res, next) { | |
if(req.url.substr(-1) == '/' && req.url.length > 1) | |
req.url.slice(0, -1); | |
next(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// based on Ben Alman's Debugging with Less https://github.com/cowboy/benalman.com-idea/commit/d99edd33a5000875776393e28afa412496260850 | |
// using Paul Irish's Bookmarklet: Inject New Css Rules http://paulirish.com/2008/bookmarklet-inject-new-css-rules/ | |
(function (){ | |
var newcss = ''; | |
var tags = [['H1','#f00'],['H2','#0a0'],['H3','#00f'],['H4','#f0f'],['H5','#0ff'],['H6','#0ff'],['P','#0aa'],['LI','#aa0'],['A','#000']]; | |
var createMarker = function(tag, bg){ | |
return tag + ':before {padding: 0 4px; margin-right: 4px; color: #fff;content: "' + tag + '";background: ' + bg + ';} '; | |
}; | |
for (var i = 0; i < tags.length; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Numerous always-ignore extensions | |
*.diff | |
*.err | |
*.orig | |
*.log | |
*.rej | |
*.swo | |
*.swp | |
*.vi | |
*~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function themename_customize_register($wp_customize){ | |
$wp_customize->add_section('themename_color_scheme', array( | |
'title' => __('Color Scheme', 'themename'), | |
'priority' => 120, | |
)); | |
// ============================= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var currentTimeZoneOffsetInHours = (new Date()).getTimezoneOffset()/60; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.whenReady = function(target, delay) { | |
var dfd = $.Deferred(); | |
var look = window.setInterval(function() { | |
var $target = $(target); | |
if($target.length) { | |
dfd.resolve($target); | |
window.clearInterval(look); | |
} | |
}, delay || 10); | |
return dfd; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* (madness?).log() | |
* | |
* Copyright (c) 2012 Kevin Attfield | |
* Licensed under the MIT license. | |
*/ | |
Object.prototype.log = function(){ | |
console.log(this.valueOf()); | |
return this; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var GetUserProfileByName = function (accountName) { | |
var soap = ''; | |
accountName = accountName || ''; //Blank accountName returns results for current user | |
soap += '<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">'; | |
soap += ' <soap12:Body>'; | |
soap += ' <GetUserProfileByName xmlns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService">'; | |
soap += ' <accountName>' + accountName + '</accountName>'; | |
soap += ' </GetUserProfileByName>'; | |
soap += ' </soap12:Body>'; | |
soap += '</soap12:Envelope>'; |