Skip to content

Instantly share code, notes, and snippets.

View jessgusclark's full-sized avatar

Jesse Clark jessgusclark

View GitHub Profile
@jessgusclark
jessgusclark / anchor-php-replace-version1.xsl
Last active December 5, 2016 16:42
Template match for anchors to remove .php
<xsl:template match="a[contains(@href, '.php')]">
<a href="{replace(@href, '.php', '')}">
<xsl:value-of select="node()" />
</a>
</xsl:template>
@jessgusclark
jessgusclark / anchor-php-replace-version2.xsl
Last active December 5, 2016 16:46
Second anchor replace that loops through all attributes
<xsl:template match="a[contains(@href, '.php')]">
<xsl:element name="a">
<xsl:for-each select="@*">
<xsl:choose>
<xsl:when test="name(.) = 'href'">
<xsl:attribute name="href">
<xsl:value-of select ="replace(., '.php', '')"/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<table id="ou-snippet" class="ou-alex-example">
<thead>
<tr>
<th class="butter ou-help snippet-heading">Alex Example</th></tr>
</thead>
<tbody>
<tr>
<td>This is sample content that Jesse placed in here.</td>
</tr>
</tbody>
<!-- ========== START Snippet ========== -->
<xsl:template match="table[@class='ou-alex-example']">
<div class="panel break-below">
<xsl:choose>
<xsl:when test="$ou:action = 'pub'">
<xsl:apply-templates select="tbody/tr/td/node()"/>
</xsl:when>
<xsl:otherwise>
<p><strong>This content will be removed on publish</strong></p>
<xsl:apply-templates select="tbody/tr/td/node()"/>
<script type="text/javascript" charset="utf-8">
$(window).load(function() {
// get the total number of slides:
var numberOfSlides = $(".slides li").size();
// select a random number between 0 and numberOfSlides.
var randomStart = Math.floor( Math.random() * numberOfSlides );
$('.flexslider').flexslider({
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>FlexSlider Demo</title>
<link rel="stylesheet" href="http://flexslider.woothemes.com/css/flexslider.css" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://flexslider.woothemes.com/js/jquery.flexslider.js"></script>
</head>
<script>
$(document).ready(function () {
displayResults();
});
</script>
@jessgusclark
jessgusclark / example.html
Created February 8, 2017 18:59
Code for Google Event Tracking Gadget
<a href="http://jessclark.com" onclick="ga('send', {
hitType: 'event',
eventCategory: 'link',
eventAction: 'click',
eventLabel: 'Jesse' });">Jesse Clark</a>
@jessgusclark
jessgusclark / index.aspx.cs
Last active May 18, 2017 19:17
API Call with C#
/// <summary>
/// Execute a PULL or GET ApiCall
/// </summary>
/// <param name="url">The full URL including the querystring parameters</param>
/// <param name="type">PULL or GET</param>
/// <param name="cookies">A CookieContainer that can be used to string </param>
/// <returns>Resturns a string of the response from the API call.</returns>
protected string APICall(string url, string type, CookieContainer cookies) {
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
@jessgusclark
jessgusclark / hide-stuff.js
Last active September 20, 2017 16:13
Javascript code to hide content on 'sub pages' for Community Funded. Requires JQuery (kinda)
$(document).ready(function(){
if ( window.location.href.indexOf("cfpage=") !== -1 ){
// select the classes(or IDs) here that should be hidden
$(".images").hide();
$(".intro-text").hide();
}
});