Skip to content

Instantly share code, notes, and snippets.

View rveitch's full-sized avatar

Ryan Veitch rveitch

View GitHub Profile
@rveitch
rveitch / nvm-auto-run.md
Created April 6, 2023 19:01 — forked from tcrammond/nvm-auto-run.md
Automatically nvm use when entering directory

Calling nvm use automatically in a directory with a .nvmrc file

Put this into your $HOME/.zshrc to call nvm use automatically whenever you enter a directory that contains an .nvmrc file with a string telling nvm which node to use:

place this after nvm initialization!

@rveitch
rveitch / twinkle-loop.sh
Last active November 23, 2020 21:20 — forked from cpmpercussion/loop_pi_video.sh
omxplayer command to loop a video forever for use in video art exhibitions
#!/bin/bash
omxplayer --loop --vol -1300 -o asla /home/pi/twinkle-long.mp3
# omxplayer --loop --vol -1300 -o asla /home/pi/twinkle-long.mp3 &
@rveitch
rveitch / logging.js
Created February 1, 2017 02:05 — forked from adam8810/logging.js
A simple node module that makes console.log/error/warn/debug statements log through winston (simply include at the beginning of your app)
'use strict';
var util = require('util'),
winston = require('winston'),
logger = new winston.Logger(),
production = (process.env.NODE_ENV || '').toLowerCase() === 'production';
module.exports = {
middleware: function(req, res, next){
console.info(req.method, req.url, res.statusCode);
@rveitch
rveitch / gist:b48a99e3bc603777d6bccdf4c2c3ade4
Created January 24, 2017 18:42 — forked from mhawksey/gist:1442370
Google Apps Script to read JSON and write to sheet
function getJSON(aUrl,sheetname) {
//var sheetname = "test";
//var aUrl = "http://pipes.yahoo.com/pipes/pipe.run?_id=286bbb1d8d30f65b54173b3b752fa4d9&_render=json";
var response = UrlFetchApp.fetch(aUrl); // get feed
var dataAll = JSON.parse(response.getContentText()); //
var data = dataAll.value.items;
for (i in data){
data[i].pubDate = new Date(data[i].pubDate);
data[i].start = data[i].pubDate;
}
@rveitch
rveitch / Google Spreadsheet Data Puller-Inner
Created April 25, 2016 16:39 — forked from cjwinchester/Google Spreadsheet Data Puller-Inner
Pull in a live-updating data feed with Google Spreadsheets, dump content from specified cells to a web page.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Live election parser using Google Spreadsheets</title>
<!-- Adapted from a Michelle Minkoff joint: http://michelleminkoff.com/2010/11/22/using-google-spreadsheets-as-your-database/ -->
<link rel="stylesheet" type="text/css" href="http://dataomaha.com/media/base.css" />
<link rel="stylesheet" type="text/css" href="http://dataomaha.com/media/super-styles.css">
@rveitch
rveitch / google-form-to-github-issue.md
Created February 28, 2016 02:15 — forked from bmcbride/google-form-to-github-issue.md
Create a new GitHub Issue from a Google Form submission

Wiring up a Google Form to GitHub is not that difficult with a little bit of Apps Script automation. All you need is a Google account, a GitHub account, and a web browser...

Set up your GitHub Personal Access Token

Personal access tokens provide an easy way to interact with the GitHub API without having to mess with OAuth. If you don't already have a personal access token with repo or public_repo access, visit your GitHub settings page and generate a new token.

Be sure to copy your token some place safe and keep it secure. Once generated, you will not be able to view or copy the token again.

Set up the Form & Spreadsheet

  1. Create a Google Form.
@rveitch
rveitch / gist:5cc102a8d4c6c2ed7f6a
Created February 15, 2016 23:10
Debug WordPress 404 issues (permalinks, rewrite rules, etc.)
/* Produces a dump on the state of WordPress when a not found error occurs */
/* useful when debugging permalink issues, rewrite rule trouble, place inside functions.php */
ini_set( 'error_reporting', -1 );
ini_set( 'display_errors', 'On' );
echo '<pre>';
add_action( 'parse_request', 'debug_404_rewrite_dump' );
function debug_404_rewrite_dump( &$wp ) {
@rveitch
rveitch / add_feed.php
Created February 15, 2016 22:53 — forked from roborourke/add_feed.php
add_feed() example for WordPress
<?php
class custom_feed {
public $feed = 'custom-xml';
public function __construct() {
add_action( 'init', array( $this, 'init' ) );
@rveitch
rveitch / 0_reuse_code.js
Created December 21, 2015 20:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console