Some JavaScript performance tests created by me using the jsperf.
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
<?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
<!doctype html> | |
<html amp lang="pt"> | |
<head> | |
<title>UOL Copa do Mundo 2018</title> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui"> | |
<link rel="shortcut icon" href="https://conteudo.imguol.com.br/favicon.ico" type="image/x-icon"> | |
<script src="https://cdn.ampproject.org/v0.js" async></script> | |
<script custom-element="amp-ad" src="https://cdn.ampproject.org/v0/amp-ad-0.1.js" async></script> |
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/bash | |
atom -v | |
echo "---------" | |
curl -q -s https://api.github.com/repos/atom/atom/tags | grep "name" | awk -F "\"" '{ print $4 }' | head -n 10 | |
echo | |
echo -n "Update to (ctrl+c to cancel): " |
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 | |
# Constantes indicando ON e OFF do relay | |
ON=1 | |
OFF=0 | |
# Hora e minuto que a irrigacao deve ocorrer | |
H_PERIOD=8 | |
M_PERIOD=0 |
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
const amqplib = require('amqplib'); | |
const connect = amqplib.connect('amqp://172.17.0.2:5672'); | |
const QUEUE_NAME = 'benchmark'; | |
const TOTAL_MESSAGES = process.argv[2] || 10; | |
let SEND_MESSAGES = 0; | |
let RECEIVED_MESSAGES = 0; | |
let sendingStartTime; |
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
window.jsonpRequestQueue = {}; | |
function handleJsonp(options) { | |
var callbackKey = options.callback || ("mithril_callback_" + | |
new Date().getTime() + "_" + | |
(Math.round(Math.random() * 1e16)).toString(36)) | |
var script = $document.createElement("script") | |
// callback já existe, faz fila | |
if(typeof global[callbackKey] === 'function') { |
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 | |
## Usage example, starts and irrigates for 30 seconds: | |
## start-irrigation.sh 30 | |
APP_PATH="/app" | |
relay-exp -i | |
force_stop() { |
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 log = /debug=true/.test(location.search) ? (function(nav) { | |
// ie | |
if(/MSIE/.test(nav) === true) return console.log; | |
return function() { | |
console.log.apply(console, arguments); | |
} | |
})(navigator.userAgent) : function() {}; |
NewerOlder