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 / jquery.selectMultiple.js
Created November 21, 2014 07:25
HTML Select multiple without ctrl key
/**
* DWTFYW License
* Author: Tony Brix, http://tonybrix.info
*
* Set all multiple select elements to allow selecting multiple without using the ctrl key
*
*/
(function($){
$.fn.selectMultiple = function(){
return this.mousedown(function(e){
@UziTech
UziTech / array_multisort_by_key.php
Created June 17, 2016 20:41
array_multisort_by_key
/*
* License: MIT
*/
/**
* Sort an array of associative arrays by a key. Like array_multisort but you just provide the key instead of the whole column.
* @param array[] $data The array of associative arrays to sort
* @param mixed ...$args Any number of variables. [key, SORT_ASC|SORT_DESC, Sort Flags]
* https://secure.php.net/manual/en/function.array-multisort.php
* @return array[] The sorted $data
@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
@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 / 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 / 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.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 / 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 / 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 / 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 = ""