Skip to content

Instantly share code, notes, and snippets.

View UziTech's full-sized avatar
💭
Having Fun

Tony Brix UziTech

💭
Having Fun
View GitHub Profile
@UziTech
UziTech / trimAll.js
Created August 6, 2014 19:29
Trim all strings in an object
/**
* DWTFYW License
*
* Author: Tony Brix, http://tonybrix.info
*
* This function trims all strings in an object or array
*
* This is useful when sending ajax requests
*
* var vals = {
@UziTech
UziTech / mysqlddate.js
Created August 8, 2014 04:14
Format date as mySQL date format
/**
* DWTFYW License
*
* Author: Tony Brix, http://tonybrix.info
*
* Formats date in mm/dd/yyyy format as yyyy-mm-dd
*
* Returns false on failure
*
*/
@UziTech
UziTech / searchLog.php
Last active August 29, 2015 14:05
Show logs from a file that matches a regular expression
<?php
/**
* DWTFYW License
*
* Author: Tony Brix, http://tonybrix.info
*
* Show logs from a file that matches a regular expression. Matches multiline records.
* @param string $file The file to search
* @param string $search [optional] A string or regular expression to match; default = ""
@UziTech
UziTech / sendPost.php
Last active August 29, 2015 14:06
Send POST request to a webpage from php and return the response
<?php
/**
* Author: Tony Brix, http://tonybrix.info
*
* Send POST request to a webpage from php and return the response.
* @param string $url The url of the webpage you would like to send the request to.
* @param array $data The post data to send with the request.
* @return string The response of the request
*/
function sendPost($url, $data) {
@UziTech
UziTech / jquery.erasable.js
Created March 26, 2015 16:28
Add x to input fields to erase content
/**
* DWTFYW License
* Author: Tony Brix, http://tonybrix.info
*
* Usage:
* $("input").erasable();
*/
(function ($) {
var defaults = {
//align: "right"
@UziTech
UziTech / jquery.pluginTemplate.js
Last active October 6, 2015 20:15
jQuery Plugin Template
/**
* Author: Tony Brix, Tony@Brix.ninja
* License: MIT http://www.opensource.org/licenses/mit-license.php
* Template Gist: https://gist.github.com/UziTech/f85d7756ed931c304281
* Description:
*/
;
(function ($, undefined) {
"use strict";
var pluginName = "plugintemplate";//TODO: ENTER YOUR PLUGIN NAME
@UziTech
UziTech / array.remove.js
Last active October 17, 2015 03:38
Remove items from an array. Optionally limit the number of items to remove from the beginning or end of the array.
/**
* Author: Tony Brix
* Website: tony.brix.ninja
* License: MIT
* Description: Remove items from an array. Optionally limit the number of items to remove from the beginning or end of the array.
* Examples:
* var a = [1, 2, 3, 1, 2, 3];
* a.remove(1); // [2, 3, 2, 3]
* a.remove(2, 1); // [1, 3, 1, 2, 3]
* a.remove(3, -1); // [1, 2, 3, 1, 2]
@UziTech
UziTech / jquery.overlay.js
Last active February 11, 2016 20:25
jQuery simple overlay
/*
* DWTFYW License
* Author: Tony Brix, http://tonybrix.info
*
* Simple overlay with text/html in the center and a delayed cancel button
* Requires jQuery
*
* if cancelTimeDelay is < 0 then there is no cancel button
*
*/
@UziTech
UziTech / fs-readdir-recursive.js
Created May 20, 2016 05:00
node get files from directory asynchronously and recursively with promises
/*
* License: MIT
* Author: Tony Brix, https://Tony.Brix.ninja
* Description: Get files from directory asynchronously and recursively with promises.
*/
var fs = require("fs");
var path = require("path");
module.exports = {
@UziTech
UziTech / searchDirectory.php
Last active June 17, 2016 15:45
Search files in php, recursive, regex
/*
* License: MIT
*/
/**
* Search files in a directory by string or regex
* @param string $root Directory to search
* @param string $q Search term
* @param bool $recursive [optional] Search lower directories. Default = TRUE
* @param bool $isRegex [optional] Search term is a regular expression. Default = FASLE