Skip to content

Instantly share code, notes, and snippets.

View caioerick's full-sized avatar

Caio Erick caioerick

View GitHub Profile
@caioerick
caioerick / BarcodeQR.class.php
Created May 18, 2013 03:32
Generate QR Code with PHP Class.
<?php
/**
* BarcodeQR - Code QR Barcode Image Generator (PNG)
*
* @package BarcodeQR
* @category BarcodeQR
* @name BarcodeQR
* @version 1.0
* @author Shay Anderson 05.11
* @link http://www.shayanderson.com/php/php-qr-code-generator-class.htm
package br.com.aplicativo.app;
package view;
import android.app.Activity;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
@caioerick
caioerick / mail.php
Last active December 18, 2015 05:49
Source code for submit mail with PHP
<?php
// Variables
$to = $_REQUEST['to'];
$message = $_REQUEST['message'];
$subject = $_REQUEST['subjet'];
$from = $_REQUEST['from'];
// Headers
$headers = "From: ".$from."\r\n";
$headers .= "Content-type: text/plain; charset=utf-8\r\n";
<?php
function no($var) {
$array = Array("'", "\\", "-", "SELECT", "select", "INSERT", "UPDATE", "*", "DELETE", "&", ",", ".", "/", ":", "]", "[", "%", "$", "!", "@", "#", "¹", "²", "³", "£", "¢", "¬", "{", "[", "]", "}", "-", "§");
$var = str_replace($array, "", $var);
$var = preg_replace("/[^0-9]/","", $var);
return $var;
}
function number($var) {
// Só passa números e nada mais
$array = Array("'", "\\", "-", "SELECT", "select", "INSERT", "UPDATE", "*", "DELETE", "&", ",", ".", "/", ":", "]", "[", "%", "$", "!", "@", "#", "¹", "²", "³", "£", "¢", "¬", "{", "[", "]", "}", "-", "§");
@caioerick
caioerick / MainActivity.java
Created June 8, 2013 22:29
Problema com mudança de tela Android
package br.com.aplicacao.app;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
public class MainActivity extends Activity {
<html>
<head>
<style type="text/css">
p.neat {
display: none;
clear: both;
margin: 1em 0;
padding: 1em 15px;
width:100px;
background: #0F67A1;
@caioerick
caioerick / gist:5777653
Last active December 18, 2015 11:39
Sobe a página lentaente
<script language="javascript">
$('html, body').animate({scrollTop:0}, 'slow');
$('html, body').animate({ scrollTop: $("#text").offset().top }, 1300);
</script>
@caioerick
caioerick / Primos.c
Last active December 21, 2015 19:29
QUESTÃO: Faça um programa em linguagem C que receba um valor inteiro N e mostre os N números primos, iniciando de 2.
#include<stdio.h>
#include<stdlib.h>
int main(int narg, char *argv[]) {
int n, i;
scanf("%d", &n);
for(i=2;i<=n;i++) {
if(i%2 == 1) {
<?php
$url = (isset($_GET['url'])) ? $_GET['url'] : "home";
$file = $url.".php";
if(file_exists($file)) {
include($file);
}
else {
echo "Desculpe... Esta página não existe.";
}
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1