This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function ($) { | |
//o metodo static webMetodo retorna um objeto jqXHR (enfim o retorno do $.ajax) | |
$.webMetodo = function (param) { | |
return $.ajax({ | |
type: "POST", | |
contentType: "application/json", | |
//aqui eh o 'payLoad' deve ser uma string no formato JSON | |
//para o servidor poder entender | |
data: JSON.stringify(param.parametros), | |
dataType: "json", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var carregadorRecursos = function() { | |
var _todosRecursos = {}; | |
return { | |
formatoAudioSuportado: (function() { | |
var suporta = {}; | |
var audio = document.createElement("audio"); | |
var formatos = { | |
ogg: 'audio/ogg; codecs="vorbis"', | |
wav: 'audio/wav; codecs="1"', | |
webma: 'audio/webm; codecs="vorbis"', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function(window, document) { | |
var teclado = { | |
teclas: { | |
ESQUERDA: 37, | |
CIMA: 38, | |
DIREITA: 39, | |
BAIXO: 40, | |
ESPACO: 32 | |
}, | |
teclasPressionadas: {}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($){ | |
//========================================================================================= | |
$.ajaxUpload = function(config) { | |
var formData = new FormData(); | |
var data = config.data; | |
for(var i in data){ | |
formData.append(i, data[i]); | |
} | |
return $.ajax({ | |
type: "POST", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Paginacao = (function($) { | |
"use strict"; | |
var Paginacao = function() { | |
this.qtdRegistroPorPagina = 10; | |
this.qtdDePaginacao = 7; | |
this.template = ["<ul data-pg=\"container\" class=\"pagination\" > ", | |
"<li data-pg=\"anterior\" ><a href=\"javascript:;\">«</a></li>", | |
"<li data-pg=\"numeros\" > <a href=\"javascript:;\"> {@numero} </a> </li>", | |
"<li data-pg=\"proximo\" ><a href=\"javascript:;\">»</a></li> ", | |
"</ul>" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#id do usuario | |
USUARIO="victorvhpg" | |
# pega json que contem todos os repositorios e extrai as URLs | |
LISTA_URL_CLONES=`curl --silent https://api.github.com/users/${USUARIO}/repos -q | grep "\"clone_url\"" | awk -F': "' '{print $2}' | sed -e 's/",//g'` | |
#para cada url faz um 'git clone' | |
for URL in $LISTA_URL_CLONES; do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ajaxPromise(config) { | |
return new Promise( | |
function(resolve, reject) { | |
var xhr = new XMLHttpRequest(); | |
var p = []; | |
var parametros = null; | |
config.parametros = config.parametros || {}; | |
for (var parametro in config.parametros) { | |
p.push(parametro + "=" + config.parametros[parametro]); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//callbacks dentro de callbacks | |
algumaCoisa1(function(resposta1) { | |
//... | |
algumaCoisa2(function(resposta2) { | |
//... | |
algumaCoisa3(function(resposta3) { | |
//... | |
acaoFinal(resposta3); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(window) { | |
"use strict"; | |
//criamos uma funcao auto executavel que recebe uma function "fnCriaPlugin" | |
//que eh a implementacao do nosso plugin | |
(function(fnCriaPlugin) { | |
//agora eh so verificar se possui AMD ou nao | |
if (typeof define === "function" && define.amd) { | |
// COM suporte AMD | |
//entao registra o plugin com a depedencia jquery |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install apache2 apache2-utils |
OlderNewer