Skip to content

Instantly share code, notes, and snippets.

View jpederson's full-sized avatar
💭
Website Developer/Programmer in Madison, WI.

James Pederson jpederson

💭
Website Developer/Programmer in Madison, WI.
View GitHub Profile
@jpederson
jpederson / wp-update-url.sql
Last active November 9, 2020 20:53
This sql file will update the URLs in all relevant WordPress tables when you move a site form one domain to another. Simply change the variables at the top to your URLs and execute it.
SET @wp_url_old = 'http://oldurl.com', @wp_url_new = 'http://newurl.com';
UPDATE wp_options SET option_value = replace( option_value, @wp_url_old, @wp_url_new )
WHERE option_value LIKE CONCAT( '%', @wp_url_old, '%' );
UPDATE wp_posts SET guid = replace( guid, @wp_url_old, @wp_url_new );
UPDATE wp_posts SET post_content = replace( post_content, @wp_url_old, @wp_url_new );
-- if you have plugins that include serialized arrays of data in custom fields (such as some
@jpederson
jpederson / gmaps.smooth.js
Last active October 17, 2019 21:09
Google maps smooth scroll to anchor outside map when clicking on anchor link inside the map marker info window. Not tested...
// This line is different
// it attaches a google maps listener that fires when an info window is opened and populated.
google.maps.event.addListener(referenceToInfoWindow, 'domready', function(){
// scroll handler
var scrollToAnchor = function( id ) {
// grab the element to scroll to based on the name
var elem = $("a[name='"+ id +"']");
@jpederson
jpederson / creep.html
Last active January 8, 2018 10:42
A basic example to get started with Creep.js.
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="jquery.creep.min.js"></script>
<script>
$(document).ready(function(){
$("a").creep();
});
</script>
@jpederson
jpederson / squirrel.basic.html
Created April 14, 2014 15:12
A basic example of the use of Squirrel.js.
<form action="/blah" method="post" class="squirrel">
<!-- any form fields you like :) -->
</form>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="jquery.squirrel.min.js"></script>
@jpederson
jpederson / accrue.form.compare.term.html
Last active August 29, 2015 13:57
Accrue.js form field - term_compare
<input type="text" class="term_compare" value="36m">
<select class="term_compare">
<option value="36m">36 months</option>
<option value="4y">4 years</option>
</select>
<input type="text" name="term_compare" value="36m">
@jpederson
jpederson / accrue.demo.amort.js
Created March 12, 2014 00:08
Accrue.js demo - amortization
$(".calculator-amortization").accrue({
mode: "amortization"
});
@jpederson
jpederson / accrue.demo.compare.js
Created March 12, 2014 00:07
Accrue.js demo - comparison
$(".calculator-compare").accrue({
mode: "compare"
});
@jpederson
jpederson / accrue.demo.basic.js
Created March 12, 2014 00:06
Accrue.js demo - basic
$(".calculator-loan").accrue();
@jpederson
jpederson / accrue.calculation.response.json
Created March 11, 2014 23:37
Accrue.js basic calculation-only JSON response
{
num_payments: 36,
original_amount: "7500",
payment_amount: 231.5782264902889,
payment_amount_formatted: "231.58",
total_interest: 836.8161536504012,
total_interest_formatted: "836.82",
total_payments: 8336.816153650401,
total_payments_formatted: "8336.82"
}
@jpederson
jpederson / accrue.calculation.js
Created March 11, 2014 23:34
Accrue.js basic calculation-only example
var loan_info = $.loanInfo({
amount: "$7,500",
rate: "7%",
term: "36m"
});
// log the calculation data for test purposes
console.log( loan_info );