Skip to content

Instantly share code, notes, and snippets.

@renie
renie / gist:2230445
Created March 28, 2012 20:59
All array values to UTF8 ( recursive, so it works on assiciative array )
function convertArrayToUtf8(array $array) {
$convertedArray = array();
foreach($array as $key => $value) {
if(gettype($key)=='string')
$key = utf8_encode($key);
if(is_array($value))
$value = $this->convertArrayToUtf8($value);
if(gettype($value)=='string')
@renie
renie / gist:2776282
Created May 23, 2012 16:42
Function to remove some special unicode chars of an unique string or a strings array
private function _semAcentos($string, $returnFormat = 1){
if(is_array($string)){
for($i=0; $i<count($string); $i++){
$string[$i] = preg_replace("/[áàâãª]/u","a",$string[$i]);
$string[$i] = preg_replace("/[ÁÀÂÃ]/u","A",$string[$i]);
$string[$i] = preg_replace("/[éèê]/u","e",$string[$i]);
@renie
renie / tabEngine.js
Created July 2, 2012 17:41
Just the logic, with jquery, for a tab menu( I will convert this in a plugin and improve logic )( WITHOUT STYLE! Stylish by yourself )
$(document).ready(function(){
//if exists a tab menu
if($('.tabsMenu').length > 0){
prepareTabMenu();
}
});
/**
* Prepare elements with function that will be called when clicked
* */
@renie
renie / checkCustom
Created April 30, 2013 19:30
A simple custom checkbox using a random image.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Document</title>
<style>
*{ padding: 0; margin: 0; font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; }
input[type='checkbox'] { opacity: 0; width: 18px; float: left; }
input[type='checkbox'] + label { clear: none; padding: 2px 2px 2px 19px; cursor: pointer; background: url(./img/ico-uncheck.png) left 5px no-repeat; border: 1px dotted transparent; }
input[type='checkbox']:focus + label,
@renie
renie / runtimeCounting.java
Created June 24, 2013 20:29
Runtime counting
// start method
long startFullTime = System.currentTimeMillis();
//step1 begin
long startStep1Time = System.currentTimeMillis();
// some logic of step 1 here
long endStep1Time = System.currentTimeMillis();
//step1 end
@renie
renie / gist:6143303
Last active December 20, 2015 13:59
mask for brazillian cellphone. NOT TESTED YET!
function mascara(field,callback){
v_obj=field;
v_fun=callback;
setTimeout("executeMask()",1)
}
function executeMask(){
v_obj.value=v_fun(v_obj.value);
}
@renie
renie / gist:6214708
Last active December 20, 2015 23:48
Just numbers on html input
onkeyup="this.value = isNaN(this.value.substr(this.value.length-1>0?this.value.length-1:0, this.value.length-1>1?this.value.length-1:1))?(this.value.length<2?"":this.value.substr(0,this.value.length-1)).replace(/\s+/g,""):this.value.replace(/\s+/g,"")"
onkeypress="this.value = isNaN(this.value.substr(this.value.length-1>0?this.value.length-1:0, this.value.length-1>1?this.value.length-1:1))?(this.value.length<2?"":this.value.substr(0,this.value.length-1)).replace(/\s+/g,""):this.value.replace(/\s+/g,"")"
@renie
renie / gist:287e4d00fed74ff6ceda
Last active August 29, 2015 14:20
cache ajax
/*
*
*
*
* WILL BE MOVED SOON
* USE THIS => https://github.com/renie/CacheRequest
*
*
*
*
@renie
renie / .vimrc
Last active August 17, 2016 14:05
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'bling/vim-airline'
Plugin 'tpope/vim-fugitive'
Plugin 'pangloss/vim-javascript'
#!/usr/bin/nodejs
var DEFAULT_CURRENCY_PAIR = 'USDT_DASH';
var DEFAULT_CURRENCY_PROPERTY = 'last';
/*============================================*/
/*============================================*/
/*============================================*/