Skip to content

Instantly share code, notes, and snippets.

View relipse's full-sized avatar

James Kinsman relipse

View GitHub Profile
/**
* LCRscrollingText jquery plugin
* @description Left Center Right, with center vertical scrolling text using a ul
* @author Jim Kinsman | Paul Kulp | InterVarsity Christian Fellowship (intervarsity.org)
* @version 1.1.0
* @example
* JAVASCRIPT:
* With html already defined:
*
* $('#scrolling_text_container').LCRscrollingText();
@relipse
relipse / DAO.php
Last active January 20, 2022 13:15
Data Access Object
<?php
namespace Todo;
// Data Access Object
abstract class DAO{
protected array $row = [];
public const KEYS = [];
protected static string $table = '';
public static function SetTable(string $table){
<?php
function strip_unsafe_fnchars($input){
return str_replace(['#','|','`','+','@',':','"',"'",'!','$',' ','/','\\',
'?','*','>','<','{','}','%'],'', $input);
}
<?php
$date = $argv[1] ?? null;
$curdate = $argv[2] ?? 'now';
if (empty($date)){
die('Date: '.$date.' is invalid. Use first argument for date of birth and second argument for date to calculate from like:'.
"\nphp birthday.php \"Nov 1, 1984\" \"Mar 1, 2004\""."\n");
}
try{
<?php
$opts = getopt('bfsvd:n:h', ['break','silent','verbose','dir:','name:','files','help']);
$helpstr = <<<EOT
Find Folder will find folders named anything.
php {$argv[0]} --dir /path/to/search/for/folders -n=foobar
Options:
-d, --dir Specify directory to search (recursively).
-n, --name Search by folder name (-n=foobar).
-v, --verbose Turn Verbosity on
-s, --silent Make as silent as possible except final result.
@relipse
relipse / phpsyntaxcheckemptyifclean.sh
Created December 15, 2022 15:00
PHP Lint check empty if clean
#!/bin/bash
find -iname "*.php" -print0 | xargs -0 -n1 php -l 2>&1
<?php
$opts = getopt('s:f:h', ['file:','string:','help']);
var_dump($opts);
$helpstr = <<<EOD
Description: Sum all the values given in either the file or string.
Usage: php {$argv[0]} OPTIONS
OPTIONS
@relipse
relipse / slash.php
Last active December 16, 2022 14:09
<?php
$opts = getopt('lhc:v::', ['convert:','loop','ls', 'help']);
$helpstr = <<<EOT
Slash will convert strings/paths with / to \ and vice versa.
ie. try
C:\\Users\\relipse\\AppData\\Local\\JetBrains\\Toolbox\\apps\\PhpStorm\\ch-0\\221.5080.224\\bin\\phpstorm64.exe
or
/c/path/to/file
php {$argv[0]}
Options:
/**
* Generate an array of English requirements from the html element validation
* @param $element
* @returns {*[]}
*/
const generateRequirementsFromHtmlValidation = function($element){
var min = null;
var max = null;
var minlength = null;
var maxlength = null;
@relipse
relipse / dirlist.cpp
Last active November 15, 2023 15:32
List files and some statistics in directory for huge directories.
/**
* dirlist
* A program to list files in a directory with some information as fast as possible.
* Useful for directories with 500,000 files.
*
* @date 2023-10-23
* @author relipse
*/
#include <sys/stat.h>
#include <time.h>