Skip to content

Instantly share code, notes, and snippets.

Rich Christiansen rinogo

Block or report user

Report or block rinogo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rinogo
rinogo / plugin.php
Created Jan 3, 2019
YOURLS plugin: keep query string
View plugin.php
<?php
/*
Plugin Name: Keep Query String
Description: Adds short URL query string, if any, to the long URL
Version: 0.1
Author: Ozh
*/
yourls_add_filter('redirect_location', 'ozh_kqs');
@rinogo
rinogo / UsHolidays.php
Created Nov 26, 2018
Simple unit-tested class to calculate federal holiday dates for the United States. Methods are included for determining if a date (timestamp) is considered a date and for accessing holidays by name and by timestamp.
View UsHolidays.php
<?php
//Adapted by rich at byu.net from https://www.damia.no/calculating-u-s-federal-holidays-with-php/
class UsHolidays {
private $year;
private $list;
const ONE_DAY = 86400; //Number of seconds in one day
@rinogo
rinogo / script.js
Last active Apr 10, 2018
Improved script.js for Contact Form 7 reCAPTCHA Wordpress plugin. It shows an error message if the user fails to check the reCAPTCHA ("I am not a robot") box.
View script.js
function contact_form_7_recaptcha_callback() {
jQuery(function($){
$('.g-recaptcha-explicit-id').each(function(){
$(this).data('grecaptcha_id', grecaptcha.render($('#' + this.value)[0], {
'sitekey' : contact_form_7_recaptcha_data.sitekey
}));
});
});
};
View people-names-indexed-by-gender.js
//Source data from http://answers.google.com/answers/threadview/id/107201.html
var male = ["abdul","abe","abel","abraham","abram","adalberto","adan","adolfo","adolph","agustin","ahmad","ahmed","al","alan","alberto","alden","aldo","alec","alejandro","alfonso","alfonzo","alfred","alfredo","allan","alonso","alonzo","alphonse","alphonso","alton","alvaro","alvin","amado","ambrose","amos","anderson","andreas","andres","andy","anibal","antione","antoine","anton","antone","antony","antwan","archie","arden","arlen","arlie","armand","armando","arnold","arnoldo","arnulfo","aron","arron","art","arturo","asa","august","augustus","aurelio","barney","barrett","barry","bart","barton","basil","beau","ben","benedict","benito","benjamin","bennett","benny","benton","bernard","bernardo","bert","bertram","bill","blaine","bo","bob","booker","boris","boyce","boyd","brad","bradford","bradley","bradly","brady","brain","branden","brant","brendan","brendon","brent","brenton","bret","brice","brock","broderick","brooks","bruce","bruno","b
View people-names-with-gender.csv
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 1 column, instead of 2. in line 3.
#Original Source: http://answers.google.com/answers/threadview/id/107201.html
#
#This data is all available in raw form from the United States Census
#Site, which is about as authoritative a source as you will get on the
#subject. I have used the following files:
#
#US Male Names: http://www.census.gov/genealogy/names/dist.male.first
#US Female Names: http://www.census.gov/genealogy/names/dist.female.first
#US Last Names: http://www.census.gov/genealogy/names/dist.all.last
#
@rinogo
rinogo / ring-bill.sh
Created Oct 5, 2017
Ring the bell in terminal/bash
View ring-bill.sh
#!/bin/sh
tput bel
@rinogo
rinogo / tiny_mce.js
Created May 10, 2017
Fix for Wordpress 3.7's Tiny MCE Chrome 58 bug
View tiny_mce.js
(function(e){var a=/^\s*|\s*$/g,b,d="B".replace(/A(.)|B/,"$1")==="$1";var c={majorVersion:"3",minorVersion:"5.9",releaseDate:"2013-10-18",_init:function(){var s=this,q=document,o=navigator,g=o.userAgent,m,f,l,k,j,r;s.isIE11=g.indexOf("Trident/")!=-1&&(g.indexOf("rv:")!=-1||o.appName.indexOf("Netscape")!=-1);s.isOpera=e.opera&&opera.buildNumber;s.isWebKit=/WebKit/.test(g);s.isIE=!s.isWebKit&&!s.isOpera&&(/MSIE/gi).test(g)&&(/Explorer/gi).test(o.appName)||s.isIE11;s.isIE6=s.isIE&&/MSIE [56]/.test(g);s.isIE7=s.isIE&&/MSIE [7]/.test(g);s.isIE8=s.isIE&&/MSIE [8]/.test(g);s.isIE9=s.isIE&&/MSIE [9]/.test(g);s.isGecko=!s.isWebKit&&!s.isIE11&&/Gecko/.test(g);s.isMac=g.indexOf("Mac")!=-1;s.isAir=/adobeair/i.test(g);s.isIDevice=/(iPad|iPhone)/.test(g);s.isIOS5=s.isIDevice&&g.match(/AppleWebKit\/(\d*)/)[1]>=534;if(e.tinyMCEPreInit){s.suffix=tinyMCEPreInit.suffix;s.baseURL=tinyMCEPreInit.base;s.query=tinyMCEPreInit.query;return}s.suffix="";f=q.getElementsByTagName("base");for(m=0;m<f.length;m++){r=f[m].href;if(r){if(/^htt
@rinogo
rinogo / nightmare-catch-example.js
Created Apr 13, 2017
An example of how to use the `.catch()` mechanism in NightmareJS
View nightmare-catch-example.js
var Nightmare = require("nightmare");
var nightmare = new Nightmare();
nightmare
.goto("https://non-existent-website-nifgeoawniogea.com")
.catch(handleError);
//Note: You can manually raise an exception from within a `.then()` command with a normal `throw new Error()`:
//throw new Error("Description of the error.");
@rinogo
rinogo / back-button-override-service.ts
Created Dec 21, 2016
Ionic 1 (Angular 1.x) back button override - Typescript version
View back-button-override-service.ts
//Adapted from http://stackoverflow.com/a/36733061/114558
export class BackButtonOverrideService {
static $inject = ["$rootScope", "$ionicPlatform"];
constructor(private $rootScope: ng.IRootScopeService, private $ionicPlatform: ionic.platform.IonicPlatformService) {
}
setup($scope: ng.IScope, customBackFunction: Function) {
var that = this;
@rinogo
rinogo / 0_reuse_code.js
Created Oct 1, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
You can’t perform that action at this time.