Skip to content

Instantly share code, notes, and snippets.

View lenivene's full-sized avatar
🖖
Full-stack dev

Lenivene Bezerra lenivene

🖖
Full-stack dev
View GitHub Profile
@lenivene
lenivene / jquery.removeClassPrefix.js
Created November 1, 2017 16:51
jQuery function Remove Class by Prefix
$.fn.removeClassPrefix = function( prefix ){
var element = jQuery(this);
return this.each(function(){
var c = this.classList;
jQuery.each(c, function(i, className) {
if( className.indexOf( prefix + "-" ) > -1 ){
element.removeClass( className );
}
});
})
@lenivene
lenivene / hash-tag.php
Created October 21, 2017 23:08
Get hash tag with php
<?php
/*
* First array return "tags" with hash, example: #Example
* Second "tag" return without hash, Example: Example
*
* @string $tweet The text
* @function preg_match_all | Pattern | @string $tweet (The text) | @array $tags (output array the tags)
* @return array $tags
*/
$twet = "But I must #explain to u how all this #mistaken idea of #denouncing pleasure and praising pain was born and I'll #give you a complete accout";
{
"bin" : "10101101"
}
@lenivene
lenivene / skipper.js
Last active October 27, 2017 00:23
Skip and bypass the wait
// Inject start document code
Object.defineProperty(window, 'ysmm', {
set: function(val) {
var T3 = val,
I = '',
X = '',
key;
for (var m = 0; m < T3.length; m++) {
if (m % 2 == 0) {
@lenivene
lenivene / functions.php
Created August 2, 2017 19:58
Using an array as needles in mb_strpos
<?php
if( ! function_exists( 'mb_strpos' ) ){
function mb_strpos( $haystack, $needles, $offset=0 ){
return strpos( $haystack, $needle, $offset );
}
}
function mb_strposa( $haystack, $needles = array(), $offset=0 ) {
$chr = array();
foreach( $needles as $needle ){
@lenivene
lenivene / functions.php
Created February 5, 2017 11:38
Encode 256 bytes and 10 bytes
<?php
function b256_to_b10_encode( $string, $encoding = "UTF-8" ) {
bcscale( 0 );
$result = "0";
for ($i = mb_strlen( $string, $encoding )-1; $i >= 0; $i--) {
$result = bcadd( $result, bcmul( ord( $string[$i] ), bcpow( 256, $i ) ) );
}
@lenivene
lenivene / functions.php
Created February 5, 2017 10:59
First character uppercase
<?php
if( ! function_exists( 'mb_ucfirst' ) ){
function mb_ucfirst( $string = '', $encoding = "UTF-8" ){
if( empty( $string ) )
return false;
$strlen = mb_strlen( $string, $encoding );
$firstChar = mb_substr( $string, 0, 1, $encoding );
$end_Char = mb_substr( $string, 1, $strlen - 1, $encoding );
@lenivene
lenivene / jquery.fleetmenu.js
Last active December 19, 2016 19:41
Push Menu jQuery
/*!
* jQuery FleetMenu Plugin v1.0.0
* https://www.soufleet.com
*
* Copyright 2016, Lenivene Bezerra
* Released under the MIT license
*/
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD (Register as an anonymous module)
@lenivene
lenivene / .htaccess
Created August 18, 2016 00:39
All Files "aspx" redirecting to file "html".
RewriteCond %{THE_REQUEST} \ /(.+)\.aspx
RewriteRule ^ /%1.html [L,R=301]
@lenivene
lenivene / functions.php
Last active August 14, 2016 16:30
List all user by date WordPress
<?php
/**
* Add user date register in column
*
* @author Lenivene Bezerra
* @return columns and filter orderby date user registered
*/
add_filter( 'manage_users_columns', 'column_user_registered' );
function column_user_registered( $columns ) {
$columns[ 'user_registered' ] = __( 'Date' );