This file contains 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/sh | |
while [ 1 ]; | |
do | |
/usr/local/bin/php /your/path/to/cron.php >> log-exec.log | |
sleep 1800 | |
done |
This file contains 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
find ./ -name "*.php" -print0 | xargs -0 grep "my query string" >> found.txt |
This file contains 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(time) { | |
function again() { | |
var procede = yourActionFunction(); | |
if(procede) | |
setTimeout(again, time); | |
} | |
again(time); | |
})(5000); |
This file contains 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
oldFunction = (function(temp) { | |
return function() { | |
if(typeof temp != 'undefined') | |
temp(); | |
// your new code here | |
... | |
} | |
})(oldFunction); |
This file contains 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
/** | |
* Carrega um script e executa callback | |
*/ | |
(function(window, document, head) { | |
if(!window.loadScript) { | |
window.loadScript = function(url, callback, scope, charset) { | |
var sc = document.createElement('script'); | |
sc.type = 'text/javascript'; | |
sc.async = true; | |
sc.charset = charset || "utf-8"; |
This file contains 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
/** | |
* Valida se o usuário está habilitado para usar a API localStorage. | |
* https://gist.github.com/gustavopaes/6024904 | |
* @type {Boolean} | |
*/ | |
var storageValidation = (function(window) { | |
'use strict'; | |
var validation; | |
try { | |
// IE <= 9 e demais navegadores devem retornar TRUE |
This file contains 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
<?php | |
/** | |
* Create a link by joining the given URL and the parameters given as the second argument. | |
* Arguments : $url - The base url. | |
* $params - An array containing all the parameters and their values. | |
* $use_existing_arguments - Use the parameters that are present in the current page | |
* Return : The new url. | |
* Example : | |
* getLink("http://www.google.com/search",array("q"=>"binny","hello"=>"world","results"=>10)); |
This file contains 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
<?php | |
/** | |
* Created on 06/Jan/2010 | |
* | |
* Classe com métodos encadeados para criar | |
* ou ler arquivos. | |
* | |
* @author Gustavo Paes (http://gustavopaes.net/) | |
* @version 1.0124.01 | |
**/ |
This file contains 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 page = require('webpage').create(), | |
system = require('system'); | |
page.viewportSize = { width: 1024, height: 768 }; | |
if(system.args.length < 2) { | |
console.log("Informe a URL para realizar o prinscreen."); | |
console.log("phantomjs http://www.uol.com.br/"); | |
phantom.exit(1); | |
} |
This file contains 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
/** | |
* Simples Lib de template para substituir apenas variáveis. Útil para montar URL | |
* de Webservices com parâmetros variáveis. | |
* | |
* @param {String} template | |
* @param {Json} obj Objetos que serão adicionados no template | |
* @returns {String} | |
*/ | |
function maker(template, obj) { | |
var attr; |
OlderNewer