Skip to content

Instantly share code, notes, and snippets.

@anderson-mota
anderson-mota / gist:3936007
Created October 23, 2012 00:58
Marca d´água Ibau
<?php
if($_POST){
watterMarkUmMais1();
}
function watterMarkUmMais1(){
if(isset($_POST['upload'])){
$permitido= array('image/jpg','image/jpeg', 'image/pjpeg');
@anderson-mota
anderson-mota / gist:3950067
Created October 25, 2012 02:09
vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "phpdevbox"
<?php
function Gerar(){
mkdir('site');
mkdir('site/css');
mkdir('site/include');
mkdir('site/images');
mkdir('site/js');
$head = fopen("site/index.php", "a");
$escreve_head = fwrite($head, '
@anderson-mota
anderson-mota / gist:4066051
Created November 13, 2012 14:36
Exibir números impar de 1 a 10.
#include <stdio.h>
int main(){
int soma;
int i=1;
int total;
while(i<=10){
if(i % 2 == 1){
total = i + total;
printf("%d \t",i);
}
@anderson-mota
anderson-mota / gist:4119311
Created November 20, 2012 17:08
Configuração Fuel index
<?php
//Original:
/**
* Path to the application directory.
*/
define('APPPATH', realpath(__DIR__.'/../fuel/app/').DIRECTORY_SEPARATOR);
/**
* Path to the default packages directory.
@anderson-mota
anderson-mota / editHere.js
Last active October 13, 2015 04:08
Edit Here Plugin
/**
* Created with JetBrains PhpStorm.
* User: anderson.mota
* Date: 11/23/12
* Time: 4:48 PM
* To change this template use File | Settings | File Templates.
*/
$.fn.editHere = function(action, callback, options){
<?php
//error_reporting(E_ERROR);
$original = imagecreatefrompng("assets/picture.png");
$mask = imagecreatefrompng("assets/mask.png");
$masked = applyAlphaMask( $original, $mask );
function applyAlphaMask($image, $mask) {
var noneDig = false;
$('.mobile').mask("(99) 9999-9999").keydown(function(){
var phone, $element;
$element = $(this);
phone = $element.val().replace(/\D/g, '');
if(phone == "11" && phone.length == 2 && !noneDig){
$element.mask("(11) 99999-999?9");
noneDig = true;
}else if(phone == "11" && phone.length == 2 && noneDig){
<?php
class Pager
{
public $path;
public $page = 1;
public $perPage = 15;
public $offset;
public $totalPages;
@anderson-mota
anderson-mota / gist:4588035
Created January 21, 2013 18:12
Padrão JS
var site = function(){
function privateFunction(){
}
return {
Init: function(){