Skip to content

Instantly share code, notes, and snippets.

@rvanweerd
rvanweerd / gist:646afd70dc3bfda7513026c3b5cf0e74
Created February 16, 2023 10:20 — forked from TurekBot/gist:6da5acd27f92c86dc68d3f6588eeb499
Iterates through all subfolders and files of the given folder and changes the owner from you to someone you specify.
/*
Script to iterate through Files/Folders in Google Drive and change Ownership.
Will only attempt change after getting the current Owner and checking for match
from 'Welcome' sheet.
See blog post for full details and original spreadsheet: https://www.pbainbridge.co.uk/2020/04/bulk-change-ownership-of-google-drive.html
Note:
> Current Owner will become an Editor - include option to remove them?
> New Owner will get an email for each item.
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@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>`;
 
@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 / 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 / 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 / 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 / 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 />";

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 / 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
*/