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
for(let i = 0; i < 2000; i++) { | |
const square = document.createElement('div'); | |
square.style.backgroundColor = 'rgb(' + (Math.random() * 255) + ', ' + (Math.random() * 255) + ', ' + (Math.random() * 255) + ')'; | |
square.style.position = 'absolute'; | |
square.style.left = (Math.random() * 950) + 'px'; | |
square.style.top = (Math.random() * 950) + 'px'; | |
square.style.width = '50px'; | |
square.style.height = '50px'; | |
document.body.appendChild(square) | |
} |
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
<div id="errors" style=" | |
background: #c00; | |
color: #fff; | |
display: none; | |
margin: -20px -20px 20px; | |
padding: 20px; | |
white-space: pre-wrap; | |
"></div> | |
<div id="root"></div> | |
<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
var handlerBgImage = function(){ | |
var auxImg = new Image(); | |
auxImg.id = "auxImg"; // the bg image id; | |
auxImg.src = ""; // the bg image; | |
handleLoad(auxImg); | |
document.body.appendChild(auxImg); | |
} | |
var handleLoad = function(auxImg){ | |
if(auxImg.addEventListener) { |
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
ffmpeg -i <input_video> -an -vcodec copy <output_video> |
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
// Seen at MDN map function description | |
var returnInt = function(element){ | |
return parseInt(element,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
// Simple Array Remove - By César de la Cruz (MIT Licensed) | |
Array.prototype.removeIndex = function(index){ | |
var rest = this.slice(index+1); | |
this.length = index; | |
return this.push.apply(this, rest); | |
}; |
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 | |
function getDataFromUrl($url) { | |
$ch = curl_init(); | |
// Set URL and header options | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_HEADER, 0); | |
// Start to capture the output | |
ob_start(); |
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 getRadioValue = function(radioName){ | |
var radios = document.getElementsByName(radioName); | |
for( i = 0; i < radios.length; i++ ) { | |
if( radios[i].checked ) { | |
return radios[i].value; | |
} | |
} | |
return null; | |
} |
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 | |
function getHost ($url) { | |
return preg_replace("/^(http[s]?:\/\/|ftp:\/\/)?((www\.)?[a-zA-Z0-9][a-zA-Z0-9-\.]*\.(com|org|net|mil|edu|ca|co.uk|com.au|gov|es))\/(.*)$/", "$2", $url); | |
} | |
?> |