Skip to content

Instantly share code, notes, and snippets.

View marcosbrasil's full-sized avatar
🌵
Always start small, never play small

Marcos Brasil marcosbrasil

🌵
Always start small, never play small
View GitHub Profile
@marcosbrasil
marcosbrasil / Erro.class.php
Created November 22, 2011 21:05
Controlando erros e logs do PHP
<?php
// desativando todos os erros, para que o usuário não os veja.
error_reporting(0);
//mudando a função que irá gerenciar os erros a partir de agora.
$old_error_handler = set_error_handler("erros");
/**
* @return void
* @param int $errno numero do erro
@marcosbrasil
marcosbrasil / image_map.html
Created November 29, 2011 19:15
Mapeamento de Imagens em HTML
<html>
<head>
<script type="text/javascript">
function coordenadas(event)
{
var x=event.clientX;
var y=event.clientY;
var coord = x + "," + y;
return coord;
}
@marcosbrasil
marcosbrasil / comparaPasta.sh
Created December 14, 2011 17:26
Comaprando arquivos de 2 diretórios ( linux )
#!/bin/bash
# TITULO: Programa em bash para comparar pastas
# DATA: 28/Jan/2009
#
# Programa em bash para comparar recursivamente duas pastas
# - informa quais arquivos tem em uma e que nao tem em outra
# - quais subpastas tem em uma que nao tem em outra
# - se houverem arquivos com mesmo nome em uma pasta e na outra,
# informa se eles sao iguais ou diferentes
@marcosbrasil
marcosbrasil / reset.css
Created January 23, 2012 18:18
CSS Reset code (include html5 tags)
/*
RESET CSS
Marcos Brasil (markus.prologic@gmail.com)
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
@marcosbrasil
marcosbrasil / gist:1913981
Created February 26, 2012 05:48 — forked from ttribeiro/gist:1903583
Easy Slider 1.7 Left And Right Function
/*
* Easy Slider 1.7 - jQuery plugin
* written by Alen Grakalic
* http://cssglobe.com/post/4004/easy-slider-15-the-easiest-jquery-plugin-for-sliding
*
* Copyright (c) 2009 Alen Grakalic (http://cssglobe.com)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* Built for jQuery library
@marcosbrasil
marcosbrasil / Mine-Field.cpp
Created April 27, 2012 05:39
Jogo campo minado - Trabalho UNA
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <string>
#include <windows.h>
#define ARRAY_SIZE 6
using namespace std;
//Declarando global screen vars
@marcosbrasil
marcosbrasil / lamp-install.sh
Last active October 5, 2015 06:17
Instalação dos Principais elementos do LAMP
#!/bin/bash
echo "###############################################################\n"
echo "Instalacao dos componentes: Apache2 / php5 / mysql / phpmyadmin\n"
echo "###############################################################\n"
apt-get update
apt-get -yV install apache2
apt-get -yV install php5 php5-mysql php5-curl php5-gd php5-mcrypt
apt-get -yV install mysql-server mysql-client
@marcosbrasil
marcosbrasil / mind_logo.js
Created May 31, 2012 14:59
Logo da Mind em canvas
function mindToCanvas(){
var c = document.getElementById('logo-mind');
c.height = 72;
c.width = 185;
var cx = c.getContext('2d');
cx.fillStyle="rgba(249,255,244,1)";
cx.fillRect(0,0,1,1);
cx.fillStyle="rgba(252,255,253,1)";
cx.fillRect(1,0,1,1);
cx.fillStyle="rgba(252,255,255,1)";
@marcosbrasil
marcosbrasil / text_cut.php
Created June 21, 2012 13:54
FUnção PHP para limitar texto sem cortar palavras
<?php
function limitarTexto($texto, $limite){
$texto = substr($texto, 0, strrpos(substr($texto, 0, $limite), ' ')) . '...';
return $texto;
}
// String a ser limitada
$string = 'Como limitar caracteres sem cortar as palavras com PHP';
// Mostrando a string limitada em 25 caracteres.
@marcosbrasil
marcosbrasil / preloadImages.js
Created July 17, 2012 14:47
Simple extend jquery plugin for load images into DOM
var cache = [];
// Arguments are image absolute paths to the current page
$.preLoadImages = function(arrImg,funcCallback) {
var imgLen = arrImg.length;
for (var i = imgLen; i>=0 ;i--) {
if(typeof arrImg[i] !== 'undefined'){
var cacheImage = document.createElement('img');
cacheImage.src = arrImg[i];
cache.push(cacheImage);