Skip to content

Instantly share code, notes, and snippets.

@rvanweerd
rvanweerd / breadcrumbs.php
Created April 10, 2014 23:05 — forked from Dimox/dimox_breadcrumbs.php
Breadcrumbs script for WordPress
<?php
function dimox_breadcrumbs() {
/* === OPTIONS === */
$text['home'] = 'Home'; // text for the 'Home' link
$text['category'] = 'Archive by Category "%s"'; // text for a category page
$text['search'] = 'Search Results for "%s" Query'; // text for a search results page
$text['tag'] = 'Posts Tagged "%s"'; // text for a tag page
$text['author'] = 'Articles Posted by %s'; // text for an author page
<!DOCTYPE html>
<title>Say it to me!</title>
<link rel="stylesheet" href="http://cheeaun.github.com/cacss/ca.min.css">
<style>
body{
text-align: center;
}
input, button{
font-size: 2em;
width: 70%;
@rvanweerd
rvanweerd / rvw-strip-tags
Last active August 29, 2015 14:10
Strip tags, replace, and more in WordPress database
<?php
/*
* Plugin Name: rvw Strip Tags
* Version: 0.0.2
* Description: Strip html tags from the Content, leave links and images
* Plugin URI: http://weerdpress.com
* Author: Ronald van Weerd
* Author URI: http://weerdpress.com
* Changelog: see history.txt
*/

Keybase proof

I hereby claim:

  • I am rvanweerd on github.
  • I am rvanweerd (https://keybase.io/rvanweerd) on keybase.
  • I have a public key whose fingerprint is 161D 1AA7 A7D0 A60D F4EA 857B 8D6C 0995 52B2 D5F3

To claim this, I am signing this object:

@rvanweerd
rvanweerd / functions.php
Created June 16, 2015 10:11
Exchange: add "buy now" and/or "add to cart" to store view
function buy_now_in_store() {
echo "</br>Example 1: add to cart and buy now: <br />";
it_exchange('product', 'purchase-options', array('add-to-cart-edit-quantity' => false, 'buy-now-edit-quantity' => false));
echo "<br /><hr><br />";
echo "Example 2: add to cart and buy now and edit quantities: <br />";
it_exchange('product', 'purchase-options', array('add-to-cart-edit-quantity' => true, 'buy-now-edit-quantity' => true));
echo "<br /><hr><br />";
@rvanweerd
rvanweerd / import_sat_via_Zendesk_API.js
Created April 27, 2020 16:22 — forked from sbkinney/import_sat_via_Zendesk_API.js
This is a method for pulling Zendesk data from a view via the API into a Google Docs spreadsheet
/* This function runs when the spreadsheet is opened and populates a menu option
labelled Zendesk that contains two options (7 days and 30 days) which are tied
to the listed functions
*/
function onOpen() {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var entries = [{
name : "Pull Satisfaction Data (last 7 days, rolling)",
functionName : "getSatisfactionDataLast7"
@rvanweerd
rvanweerd / wp-get-youtube-thumb.php
Created October 8, 2020 23:15 — forked from woraperth/wp-get-youtube-thumb.php
[WordPress] Get Youtube video thumbnail from URL & Set as Featured Image
// Get Youtube URL
$yturl = 'https://www.youtube.com/watch?v=HhAKNSsb4t4';
preg_match("/^(?:http(?:s)?:\/\/)?(?:www\.)?(?:m\.)?(?:youtu\.be\/|youtube\.com\/(?:(?:watch)?\?(?:.*&)?v(?:i)?=|(?:embed|v|vi|user)\/))([^\?&\"'>]+)/", $yturl, $matches);
$video_id = $matches[1];
// Get Thumbnail
$file_headers = get_headers( 'http://img.youtube.com/vi/' . $video_id . '/maxresdefault.jpg' );
$is_404 = $file_headers[0] == 'HTTP/1.0 404 Not Found' || false !== strpos( $file_headers[0], '404 Not Found' );
$video_thumbnail_url = $is_404 ? 'http://img.youtube.com/vi/' . $youtube_id . '/maxresdefault.jpg' : 'http://img.youtube.com/vi/' . $video_id . '/hqdefault.jpg';
@rvanweerd
rvanweerd / functions.php
Last active October 30, 2020 22:35
RCP - redirect to please verify page instead of error message
function my_replace_message_with_redirect() {
$user = get_current_user_id();
if( rcp_is_pending_verification( $user ) ) {
$location = 'https://www.mysite.com/please-verify-your-email-address/';
echo("<script>location.href = '" . $location . "'</script>");
@rvanweerd
rvanweerd / README.md
Created December 3, 2020 13:15 — forked from jfreels/README.md
d3js: Create a table using data from a CSV file.

d3js: Create a table using data from a CSV file.

@rvanweerd
rvanweerd / web-scraper-node-js.md
Created December 31, 2021 12:55 — forked from corinneling/web-scraper-node-js.md
Node web scraper with axios and cheerio

Node JS Web Scraper

I this is part of the first node web scraper I created with axios and cheerio. I took out all of the logic, since I only wanted to showcase how a basic setup for a nodejs web scraper would look.

const cheerio = require('cheerio'),
      axios = require('axios'),
      url = `<url goes here>`;