Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Having Fun

Tony Brix UziTech

💭
Having Fun
View GitHub Profile
@UziTech
UziTech / trimAll.js
Created Aug 6, 2014
Trim all strings in an object
View trimAll.js
/**
* 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 Aug 8, 2014
Format date as mySQL date format
View mysqlddate.js
/**
* 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 Aug 29, 2015
Show logs from a file that matches a regular expression
View searchLog.php
<?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 Aug 29, 2015
Send POST request to a webpage from php and return the response
View sendPost.php
<?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.isOver.js
Created Mar 13, 2015
jQuery plugin to check if a point on the page is within an element.
View jquery.isOver.js
/*
* DWTFYW License
*
* Author: Tony Brix, http://tonybrix.info
*
* Check if a point is within an element.
* Useful for mouseover on absolutely positioned overlapping elements.
*
* Example:
* $(document).mousemove(function(e){
@UziTech
UziTech / jquery.erasable.js
Created Mar 26, 2015
Add x to input fields to erase content
View jquery.erasable.js
/**
* DWTFYW License
* Author: Tony Brix, http://tonybrix.info
*
* Usage:
* $("input").erasable();
*/
(function ($) {
var defaults = {
//align: "right"
@UziTech
UziTech / jquery.pluginTemplate.js
Last active Oct 6, 2015
jQuery Plugin Template
View jquery.pluginTemplate.js
/**
* 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 Oct 17, 2015
Remove items from an array. Optionally limit the number of items to remove from the beginning or end of the array.
View array.remove.js
/**
* 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 Feb 11, 2016
jQuery simple overlay
View jquery.overlay.js
/*
* 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
node get files from directory asynchronously and recursively with promises
View fs-readdir-recursive.js
/*
* 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 = {