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
<html> | |
<head> | |
<title>DEMONSTRAÇÃO: Marcar todas as Check Boxes de uma lista</title> | |
</head> | |
<body> | |
<script> | |
function checkAll(o){ | |
console.log(o); | |
var boxes = document.getElementsByTagName("input"); | |
for (var x=0;x<boxes.length;x++){ |
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 str_pad (input, pad_length, pad_string, pad_type) { | |
// Returns input string padded on the left or right to specified length with pad_string | |
// | |
// version: 1009.2513 | |
// discuss at: http://phpjs.org/functions/str_pad | |
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) | |
// + namespaced by: Michael White (http://getsprink.com) | |
// + input by: Marco van Oort | |
// + bugfixed by: Brett Zamir (http://brett-zamir.me) | |
// * example 1: str_pad('Kevin van Zonneveld', 30, '-=', 'STR_PAD_LEFT'); |
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
<?php | |
header('Content-Type: text/html; charset=utf-8'); | |
//conexão com o servidor | |
$conect = mysql_connect("host", "user", "password"); | |
// Caso a conexão seja reprovada, exibe na tela uma mensagem de erro | |
if (!$conect) die ("<h1>Falha na coneco com o Banco de Dados!</h1>"); | |
// Caso a conexão seja aprovada, então conecta o Banco de Dados. |
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
<?php | |
/* | |
This function saved my life. | |
found on: http://www.sitepoint.com/forums//showthread.php?t=438748 | |
by: crvandyke | |
It takes an object, and when all else if/else/recursive functions fail to convert the object into an associative array, this one goes for the kill. Who would'a thunk it?! | |
*/ | |
$array = json_decode(json_encode($object), true); |
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 Binet = function( X ) { | |
var sqrt5 = Math.sqrt( 5 ); | |
return ( 1 / sqrt5 ) * ( Math.pow( ( 1 + sqrt5 ) / 2 , X ) - Math.pow( ( 1 - sqrt5 ) / 2 , X ) ); | |
} |
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
return Math.floor(Math.random() * (max - min + 1)) + min; |
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 sleep(milliseconds) { | |
var start = new Date().getTime(); | |
for (var i = 0; i < 1e7; i++) { | |
if ((new Date().getTime() - start) > milliseconds) { | |
break; | |
} | |
} | |
} |
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
<nav class="navbar navbar" role="navigation"> | |
<div class="container-fluid"> | |
<div class="btn-toolbar" role="toolbar"> | |
<div class="btn-group"> | |
<a href="#" class="btn btn-danger">NEW</a> | |
</div> | |
<div class="btn-group"> | |
<a href="#" class="btn btn-default">All</a> | |
<a href="#" class="btn btn-default">Friends</a> | |
<a href="#" class="btn btn-default">Family</a> |
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 event = new CustomEvent('build', { | |
'detail': 'wescley' | |
}); | |
document.addEventListener('build', function(e){ | |
alert(e.detail); | |
var nome = e.detail + ' matos'; | |
var ajaxEvent = new CustomEvent('ajax-return', { | |
'detail': nome | |
}); |