Skip to content

Instantly share code, notes, and snippets.

View rodrigo-x's full-sized avatar
👻

Rodrigo_ rodrigo-x

👻
View GitHub Profile
@rodrigo-x
rodrigo-x / gist:4246606
Last active October 13, 2015 19:48
Image with GD...
<?php
class Image {
private $img;
private $text;
private $fontsize;
public function __construct( $img, $text, $fontsize ) {
$this->img = $img;
$this->text = $text;
$this->fontsize = $fontsize;
@rodrigo-x
rodrigo-x / gist:3891393
Last active October 11, 2015 17:07
snippet - teste de navegador...
// Teste de Navegador...
var $Navegador = $Navegador || {};
$Navegador.Class = (function() {
"use strict";
var Detecta = {
FireFox: (function() {
if ( /Firefox[\/\s](\d+\.\d+)/.test( navigator.userAgent ) ) {
var ffversion = new Number(RegExp.$1);
switch( ffversion ) {
case ffversion >= 4:
@rodrigo-x
rodrigo-x / gist:3891200
Created October 15, 2012 07:27
snippet - canvas...
// Rascunho...
var canvas = null,
context = null,
bufferCanvas = null,
bufferCanvasCtx = null,
flakeArray = [],
flakeTimer = null,
maxFlakes = 200;
var Flake = (function() {
@rodrigo-x
rodrigo-x / gist:3891189
Created October 15, 2012 07:24
snippet - ajax...
var loadXMLDoc = (function () {
var xmlhttp;
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
}
else { // code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
@rodrigo-x
rodrigo-x / gist:3891174
Created October 15, 2012 07:16
snippet - full screen..
var FullScreen = FullScreen || {};
FullScreen.Class = (function(){
var docElm = document.documentElement;
var imgUm = document.getElementById('img-um');
var botaoSair = document.getElementById('btn-sair');
var imgDois = document.getElementById('img-dois');
var oFs = {
@rodrigo-x
rodrigo-x / gist:3891164
Created October 15, 2012 07:13
snippet - triângulo canvas..
// Triângulo com Canvas
var NS = NS || {};
NS.Class = (function() {
var Canvas = (function() {
this.canvas = document.getElementById( "canvas" );
this.ctx = canvas.getContext( "2d" );
});
@rodrigo-x
rodrigo-x / gist:3890295
Created October 15, 2012 00:38
snippet - loic..
var LOIC = LOIC || {};
LOIC.Class = (function () {
// Global Variables
var fireInterval;
var isFiring = false;
var requestedCtrNode = document.getElementById("requestedCtr");
var succeededCtrNode = document.getElementById("succeededCtr");
var failedCtrNode = document.getElementById("failedCtr");
var targetURLNode = document.getElementById("targetURL");
@rodrigo-x
rodrigo-x / gist:3890287
Created October 15, 2012 00:34
snippet - split url..
var get = location.search.split("?"),
value = get[1].split("=");
@rodrigo-x
rodrigo-x / gist:3890280
Created October 15, 2012 00:32
snippet - ping..
$.ping = (function() {
var time_stamp = new Date;
$.ajax({ type: "POST",
url: "server.php",
data: {....},
success: (function( output ) {
ping = new Date - time_stamp;
})
});
});
@rodrigo-x
rodrigo-x / gist:3890273
Created October 15, 2012 00:28
snippet - conceito..
// Bruxarias...
var teste1 = null;
var teste2 = [1, 2, 3, 4, 5, 6];
var teste3 = new Number(10);
var teste4 = 10;
var teste5 = new Array(1, 2, 3, 4, 5);
console.log(typeof teste1); //Como é? O null é um objeto? O.o
console.log(typeof teste2); //Como é? O certo seria retornar um array.. o.O
console.log(typeof teste3); //OK é um número...
console.log(typeof teste4); //Correto sem bruxaria...