Skip to content

Instantly share code, notes, and snippets.

@salipro4ever
salipro4ever / PHP Clean String of UTF8 Chars – Convert to similar ASCII char
Created November 6, 2014 03:44
PHP Clean String of UTF8 Chars – Convert to similar ASCII char
/**
* Returns an string clean of UTF8 characters. It will convert them to a similar ASCII character
* www.unexpectedit.com
*/
function cleanString($text) {
// 1) convert á ô => a o
$text = preg_replace("/[áàâãªä]/u","a",$text);
$text = preg_replace("/[ÁÀÂÃÄ]/u","A",$text);
$text = preg_replace("/[ÍÌÎÏ]/u","I",$text);
$text = preg_replace("/[íìîï]/u","i",$text);
"use strict";
/**
* jQuery.browser.mobile (http://detectmobilebrowser.com/)
**/
var $ = jQuery;
(function(a) {
($.browser = $.browser || {}).mobile = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp
@salipro4ever
salipro4ever / sudo-gitlab-runner-command-not-found.md
Last active July 6, 2023 07:49
sudo: gitlab-runner: command not found
@salipro4ever
salipro4ever / rc4.js
Last active May 31, 2023 18:48 — forked from farhadi/rc4.js
/*
* RC4 symmetric cipher encryption/decryption
*
* @license Public Domain
* @param string key - secret key for encryption/decryption
* @param string str - string to be encrypted/decrypted
* @return string
*/
function rc4(key, str) {
var s = [], j = 0, x, res = '';
@salipro4ever
salipro4ever / gitlab-ci-error-reinitialized.md
Last active March 31, 2023 10:14
[ERROR] fatal: git fetch-pack: expected shallow list

CAUSE:

Start by checking installed version of git on your CentOS 7 server. This version dont support "git fetch-pack"

$ git --version
git version 1.8.3.1

FIXED:

sudo yum -y install https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm

public static function convert_Number_To_Words($number) {
$hyphen = '-';
$conjunction = ' and ';
$separator = ', ';
$negative = 'negative ';
$decimal = ' point ';
$dictionary = array(
0 => 'zero',
1 => 'one',
@salipro4ever
salipro4ever / meta-tags.md
Created June 11, 2018 04:31 — forked from lancejpollard/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
/* Hide WP version strings from scripts and styles
* @return {string} $src
* @filter script_loader_src
* @filter style_loader_src
*/
function remove_wp_version_strings( $src ) {
global $wp_version;
parse_str(parse_url($src, PHP_URL_QUERY), $query);
if ( !empty($query['ver']) && $query['ver'] === $wp_version ) {
$src = remove_query_arg('ver', $src);
@salipro4ever
salipro4ever / hide-admin-wp.md
Last active November 25, 2021 02:39
WP Script
// Remove Administrator role from roles list
add_action( 'editable_roles' , 'hide_adminstrator_editable_roles' );
function hide_adminstrator_editable_roles( $roles ){
    if ( isset( $roles['administrator'] ) && !current_user_can('level_10') ){
        unset( $roles['administrator'] );
    }
    return $roles;
}
@salipro4ever
salipro4ever / subdomain-laravel.md
Created May 6, 2019 07:02
subdomain map to subdirectory route in existing Laravel

I serve multiple subdomains with Laravel with this code here:

RouteServiceProvider.php

  protected function mapSubdomainRoutes()
  {
    Route::group([
      'namespace' => $this->namespace,
      'domain' => '{subdomain}.affekt.de',
 ], function () {