Skip to content

Instantly share code, notes, and snippets.

View RandomArray's full-sized avatar

Mike Johanning RandomArray

View GitHub Profile
@RandomArray
RandomArray / getMissingNameElements.js
Last active February 1, 2016 00:37
Finds missing Name element pairs for input ID elements starting with a defined prefix. Just a shortcut to find missing pairs for when working with a large form.
var ids=[], names=[], notfound=[];
$("input[id^='myPrefix_'], textarea[id^='myPrefix_'], select[id^='myPrefix_']").each(function(){
ids.push(this.id);
// console.log(this.id);
});
$("input[name^='myPrefix_'], textarea[name^='myPrefix_'], select[name^='myPrefix_']").each(function(){
names.push(this.name);
// console.log(this.name);
<?php
// Sample PHP function that Returns True if the Current Time is between the Start and End hours..
$ban_start = 19; // Clients not allow to login starting this hour
$ban_end = 7; // Clients allowed to log back in starting this hour
$currentHour = date('H');
@RandomArray
RandomArray / array-to-sql.php
Created October 4, 2015 20:25
PHP Array to MySQL PDO Statement (Not a function/Saved From Project)
<?php
/*
/* Takes an array of checklist elements from a form and converts it all to a PDO SQL Insert Statemet.
* This was saved from a project where the following code was no longer being used.
* It won't do anything without proper input. I put this here as a reference on how to build PDO SQL statements from PHP Arrays.
*/
if (isset($_REQUEST['vehicleChecklistForm']) && !empty($_REQUEST['vehicleChecklistForm'])) { //Checks if action value exists
# Remove desktop.ini & thumbs.db from all sub-directories.
del /s /q /f /a "z:\your_dir\desktop.ini"
del /s /q /f /a "z:\your_dir\thumbs.db"
@RandomArray
RandomArray / install_iorpi.sh
Last active February 12, 2018 15:56
A BASH script for easy installation of io.js on a Raspberry Pi
#!/bin/bash
# ---------------------------------------------------------------------------------------
# install_iorpi.sh - A BASH shell script for Easy installation of io.js on a Rasberry Pi
# ---------------------------------------------------------------------------------------
PROGNAME=${0##*/}
VERSION="0.1.1"
clean_up() { # Perform pre-exit housekeeping
return
@RandomArray
RandomArray / RandomArray.php
Last active August 29, 2015 14:27
A Random Array of Random
<?php
// A Random Array of Random
FUNCTION R(){$N=0;FOR($I=1;$I<=64;$I++){$N.=rand(0,1);}
RETURN $N;}FOR($I=1;$I<=RAND(0,16);$I++){$A[R()]=R();}
print_r($A);
// http://sandbox.onlinephpfunctions.com/code/271c6c02aa703dca78ae00d8a00da4aae7181baa
?>
Replace with your own usename and email:
------------------------------------------------
git config --global user.name "Username"
git config --global user.email "[email protected]"
These next two commands tell Git to use your Windows credentials to store your origin password.
------------------------------------------------
git config --global credential.helper wincred
git config --global credential.helper store