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.isOver.js
Created March 13, 2015 22:03
jQuery plugin to check if a point on the page is within an element.
/*
* 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 / glob_recursive.php
Last active May 25, 2023 18:32
Recursive glob search in php
/*
* License: DWTFYW
*/
/**
* Search recusively for files in a base directory matching a glob pattern.
* The `GLOB_NOCHECK` flag has no effect.
*
* @param string $base Directory to search
* @param string $pattern Glob pattern to match files
@UziTech
UziTech / jquery.tooltiponoverflow.js
Created August 13, 2014 18:52
jquery plugin for showing tooltip on overflow
/**
* DWTFYW License
* Author: Tony Brix, http://tonybrix.info
*
* jquery plugin for showing tooltip on overflow
*
* USAGE:
*
* $("input, select").tooltipOnOverflow();
*
@UziTech
UziTech / .gitconfig
Last active March 16, 2021 15:42
git aliases
[alias]
# rebase current branch with remote branch
# git up [remote=upstream] [branch=master]
up = !"f() {\
if [ $# -lt 1 ];\
then remote=upstream;\
else remote=$1;\
fi;\
if [ $# -lt 2 ];\
then repo=master;\
@UziTech
UziTech / swapImage.js
Created March 13, 2015 21:57
jQuery plugin to swap new image after it loads. Useful if you want to load low res image first then swap with high res after it loads.
/*
* DWTFYW License
*
* Author: Tony Brix, http://tonybrix.info
*
* Swap an image after it loads. Useful if you want to load low res image first then swap with high res after it loads.
*/
(function ($) {
$.fn.swapImage = function (img) {
var $this = this;
@UziTech
UziTech / getSearchTerms.js
Last active August 3, 2018 16:18
Get search terms
/**
* DWTFYW License
*
* Author: Tony Brix, http://tonybrix.info
*
* Example:
* positive terms -----------V-----------V---------V-------V-----------------------V
* console.log(getSearchTerms("this -is 'a string' '-with' positive -'and negative' terms"));
* negative terms ----------------^-------------------------------------^
* Result:
@UziTech
UziTech / keybase.md
Last active November 25, 2017 06:51

Keybase proof

I hereby claim:

  • I am uzitech on github.
  • I am tonybrix (https://keybase.io/tonybrix) on keybase.
  • I have a public key ASDne4lL1j7wiU5Lin8T5awJmGfQumiXmJnNv7ALdvqZKwo

To claim this, I am signing this object:

@UziTech
UziTech / blockstack.txt
Created November 9, 2017 19:22
blockstack id
Verifying my Blockstack ID is secured with the address 1H8NMosfNwzvXzUuUtroXbp5vHaWNZBqLZ https://explorer.blockstack.org/address/1H8NMosfNwzvXzUuUtroXbp5vHaWNZBqLZ
@UziTech
UziTech / rimraf.js
Created December 9, 2016 05:14
Remove a file or directory recursively
const fs = require("fs");
const path = require("path");
function rimraf(dir) {
return new Promise(function (resolve, reject) {
fs.lstat(dir, function (err, stats) {
if (err) return reject(err);
if (stats.isDirectory()) {
fs.readdir(dir, function (err, files) {
if (err) return reject(err);
@UziTech
UziTech / csv_to_array.php
Last active July 8, 2016 21:21
Convert a csv file to an array
/**
* Convert a comma separated file into an array.
*
* @param string $filename Path to the CSV file
* @param string[]|bool $header An array used for the keys for an associative array. If set to TRUE then the first row of the file is used as the header. If set to FALSE then a numbered array is used instead.
* @param string $delimiter The separator used in the file
* @return string[][]
* @link http://gist.github.com/385876
* @author Jay Williams <http://myd3.com/>
* @copyright Copyright (c) 2010, Jay Williams