Skip to content

Instantly share code, notes, and snippets.

View RandomArray's full-sized avatar

Mike Johanning RandomArray

View GitHub Profile
@RandomArray
RandomArray / ucm-archive-tweets.js
Created July 25, 2016 19:50
A quick script to run from the JavaScript console. Archives/clears the all tweets in UCM - Ultimate Client Manager, waits 3 seconds and reloads the current page. This is to avoid clicking on each individual `Archive` button.
function clearAllTweets(){
$('.socialtwitter_message_action').each(function(i) {
$(this).click();
$(this).remove();
});
}
var xx;
xx = setInterval(function(){
if($('.socialtwitter_message_action').length<=0){
clearInterval(xx);
@RandomArray
RandomArray / criticalcss.html
Created August 31, 2016 03:50 — forked from PaulKinlan/criticalcss.html
Detect Critical CSS
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<h2>Original CSS</h2>
<style style="display: block; white-space: pre; font-family: monospace">
h2 { margin:0; }
@RandomArray
RandomArray / stringContainsOnlyZeros.inc.php
Created October 2, 2016 21:17
Function returns true if string contains only zeros. Used to check for invalid serial numbers consisting of only zeros.
<?php
function stringContainsOnlyZeros($s){
return (is_numeric($s) && (int)$s===0);
}
@RandomArray
RandomArray / testupload.php
Created October 7, 2016 21:32
Simple test for multiple file uploads.
<!DOCTYPE html>
<html>
<body>
<meta charset="utf-8">
<title>Test Multiple File Upload POST Request</title>
<meta name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1.0, user-scalable=1">
<form method="POST" enctype="multipart/form-data">
<!--<input type=file name="files[]" multiple>-->
<input type="file" name="uploads[]" multiple="multiple" accept="image/*">
<input type=submit value=Upload>
@RandomArray
RandomArray / update-url-titles.php
Created October 25, 2016 08:51
Updates / Refreshes all URL titles in YOURLS database.
<?php
// Updates all YOURLS' URL Page Titles
// 1) Change the database connection details below.
// 2) Update page titles from command line with: php -f update-url-titles.php
$db_host = 'localhost';
$db_name = 'database_name';
$db_user = 'username';
@RandomArray
RandomArray / select-state-v1.php
Last active November 9, 2016 09:55 — forked from solepixel/select-state-v1.php
PHP States Select
<?php
$selected = ' selected="selected"';
?>
<select name="state" id="state" class="form-control">
<option value=""<?php if(!isset($contact['state']) || empty($contact['state']))echo $selected; ?> disabled>State</option>
<option value="AL"<?php if($contact['state'] == 'AL')echo $selected; ?>>Alabama</option>
<option value="AK"<?php if($contact['state'] == 'AK')echo $selected; ?>>Alaska</option>
@RandomArray
RandomArray / ucm-archive-bookmarklet.js
Created November 9, 2016 18:36
Bookmarklet javascript for Ultimate Client Manager. It triggers a click event on all "Archive" buttons. Avoid clicking every button individually as there is not an "Archive All" button in UCM.
javascript:(function()%7B%24('.socialtwitter_message_action').click()%7D)()
@RandomArray
RandomArray / ucm-archive-bookmarklet.js
Created November 9, 2016 18:40
Bookmarklet javascript for Ultimate Client Manager. It triggers a click event on all "Archive" buttons. Avoid clicking every button individually as there is not an "Archive All" button in UCM.
////////////////
//
// Equivalent to running the following jQuery in the console.
//
// $('.socialtwitter_message_action').click();
//
////////////////
javascript:(function()%7B%24('.socialtwitter_message_action').click()%7D)()

Web Design Contract

Based on Contract Killer, an open-source contract for web developers.

Summary:

I’ll always do my best to fulfill your needs and meet your expectations, but it’s important to have things written down so that we both know what’s what, who should do what and when, and what will happen if something goes wrong. In this contract you won’t find any complicated legal terms or long passages of unreadable text. I have no desire to trick you into signing something that you might later regret. What I do want is what’s best for both parties, now and in the future.

So in short;

You ([CLIENT COMPANY]), located at [CLIENT ADDRESS] are hiring me ([DEVELOPER]) located at [DEVELOPER ADDRESS] to design and develop a web site for the estimated total price of [QUOTE] as outlined in our previous correspondence.

@RandomArray
RandomArray / urbackup-notes.txt
Created November 26, 2016 01:06
Installing UrBackup Client with and setting up common folders to backup
TF=`mktemp` && wget "https://hndl.urbackup.org/Client/2.0.36/UrBackup%20Client%20Linux%202.0.36.sh" -O $TF && sh $TF; rm $TF
urbackupclientctl add-backupdir -x -f -d /home
urbackupclientctl add-backupdir -x -f -d /root
urbackupclientctl add-backupdir -x -f -d /etc
urbackupclientctl add-backupdir -x -f -d /var