Skip to content

Instantly share code, notes, and snippets.

View italoveloso's full-sized avatar

Italo Veloso italoveloso

  • Brasil
View GitHub Profile
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/multiple-select/1.2.0/multiple-select.min.css">
<script type="text/javascript" src='https://cdnjs.cloudflare.com/ajax/libs/multiple-select/1.2.0/multiple-select.min.js'></script>
<style type="text/css">
.ms-drop ul>li.multiple {
width: 45% !important;
@italoveloso
italoveloso / card_id.php
Created March 20, 2017 11:45
Pagar.me card_id
<?php
require ("pagarme-php/Pagarme.php");
$apikey = "";
$encryption_key = "";
Pagarme::setApiKey($apikey);
$info_card_array = [
<?php
class resources_Encoding {
const ICONV_TRANSLIT = "TRANSLIT";
const ICONV_IGNORE = "IGNORE";
const WITHOUT_ICONV = "";
protected static $win1252ToUtf8 = array(
128 => "\xe2\x82\xac",
130 => "\xe2\x80\x9a",

Desenvolvedor Back-end

Requisitos

  • Conhecimento em banco de dados
  • Conhecimentos em Padrões de projeto
  • Conhecimentos em pelo menos uma linguagem server side (PHP, Python, Ruby, etc)
  • Conhecimento no framework Laravel
  • Conhecimento básico HTML5 e CSS3
@italoveloso
italoveloso / gist:0519377c9766f15b45f6
Created July 10, 2015 11:01
Conexão banco de dados Zend Framework 1 direto no Bootstrap.php
$db = new Zend_Db_Adapter_Pdo_Mysql(array(
'host' => '127.0.0.1',
'username' => 'root',
'password' => '',
'dbname' => 'database_name'
));
// $db = Zend_Db::factory($config->db->adapter, $config->db->config->toArray());
Zend_Db_Table_Abstract::setDefaultAdapter($db);
$db->setFetchMode(Zend_Db::FETCH_OBJ);

#Extract Image URLs and WGet Them to a New Server#

This was a fun problem. I needed to move all the images referenced in a CSS file to another server. I didn't want to just grab all the image files as there were a bunch I didn't need. Here is how I went about it. I am sure you could do it in one step but doing it this way gives you a chance to check for errors.

First you may want to use wget http://otherserver/the_css.css to pull the CSS file on to the target server if it is still on the old server as it was in my case.

  1. User grep to extract the URLs from the css file into another file. (You may need to adjust the regular expression if you have funny characters in your file names) Note the use of the -o flag that tells grep to only print out that part of the line that matches the expression rather than the entire line.

     grep -o '\/path\/to\/files\/[a-zA-Z0-9/.:_-]*' the_css.css > images.txt
    
#!/bin/bash
TIMESTAMP=$(date +"%F")
BACKUP_DIR="/backups/$TIMESTAMP"
MYSQL_USER="user_DB"
MYSQL=/usr/bin/mysql
MYSQL_PASSWORD="password_DB"
MYSQLDUMP=/usr/bin/mysqldump
mkdir -p "$BACKUP_DIR/mysql"
databases=`$MYSQL --user=$MYSQL_USER -p$MYSQL_PASSWORD -e "SHOW DATABASES;" | grep -Ev "(Database|information_schema)"`
for db in $databases; do
jQuery.validator.addMethod("cnpj", function (cnpj, element) {
cnpj = jQuery.trim(cnpj);
// DEIXA APENAS OS NÚMEROS
cnpj = cnpj.replace('/', '');
cnpj = cnpj.replace('.', '');
cnpj = cnpj.replace('.', '');
cnpj = cnpj.replace('-', '');
var numeros, digitos, soma, i, resultado, pos, tamanho, digitos_iguais;

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@italoveloso
italoveloso / gist:9892383
Created March 31, 2014 13:36
Using Rsync to copy files/folders from local to remove server
rsync -avz -e ssh /me/copie/ login@server:/para/onde