Skip to content

Instantly share code, notes, and snippets.

/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
@gabriel-felipe
gabriel-felipe / equalheights.js
Last active October 12, 2017 16:17
Small javascript plugin to make objects have the same height
/*
Usage example:
$(".list > .col-md-4").equalheights();
*/
(function ( $ ) {
$.fn.equalheights = function() {
var maxHeight = 0;
this.each(function(i){
if(parseInt($(this).outerHeight()) > maxHeight){
maxHeight = parseInt($(this).outerHeight());
@gabriel-felipe
gabriel-felipe / bcmath_regex.text
Last active July 3, 2018 22:25
Regex Replace PHP Operations by BCMath functions
YOU SHOULD NOT BLINDLY REPLACE USING THESE REGEX, FALSE POSITIVES ARE POSSIBLE.
These were written to make the job easier, but it still needs checking.
Adding var regex, replaces $var1 + $var2 by bcadd($Var1, $var2, 2)
Regex: (\$[\$\'\'\"\"\[\]\_A-z0-9]+?)[\s]*\+[\s]*([\$\'\'\"\"\[\]\_A-z0-9]+)
Replace: bcadd($1,$2)
Replaces $var1 += $var2 by $var1 = bcadd($var1,$var2)
Regex: (\$[\$\'\'\"\"\[\]\_A-z0-9]+?)[\s]*\+\=[\s]*(\$[\$\'\'\"\"\[\]\_A-z0-9]+)
@gabriel-felipe
gabriel-felipe / side-button-scroll.sh
Last active August 8, 2023 21:09
Scroll with auxiliary mouse buttons on wayland
#!/bin/bash
# This file need to be executed with root privilegies
# Dependencies:
# - evemu
# - xinput
MOUSE_ID=6 #Get the correct id with xinput list