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 quinn-joyce/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 / 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"
<!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 / 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