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
// Handler for all checkboxes | |
function checkboxHandler(action, checked) { | |
switch (action) { | |
case "test1": | |
console.log("1", action, checked); | |
break; | |
case "test2": | |
console.log("2", action, checked); | |
break; | |
case "test3": |
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
<!-- This is a Node+WebSocket powered demo to sync videos | |
across different browsers. This file is the client, | |
the other one is the Node server. Powered by Node and | |
http://github.com/miksago/node-websocket-server --> | |
<style> | |
.inactive { display: none; } | |
.active { display: block; } | |
</style> | |
<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
function getRandomInt(min, max) { | |
return Math.floor(Math.random() * (max - min + 1)) + min; | |
} | |
// Build Canvas | |
var canvas = document.createElement('canvas'), | |
ctx = canvas.getContext('2d'), | |
w = canvas.width, | |
h = canvas.height, |
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
curl -F "upload_filename=@/full/path/to/local/file.txt" -F "myotherqueryvar=queryvalue" -L http://198.101.215.168/upload.php > html_out.htm |
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
/** | |
* This class allows you to assign an eventListener to be utilzed only once, before | |
* it removes itself. | |
* | |
* # Usage Example: | |
* var elem = document.createElement('div'); | |
* var onetimer = new SingleEvent(elem, "click", function(){alert("Well, I'll never do THAT again...");}); | |
* document.body.appendChild(elem); | |
*/ | |
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
/** | |
* Returns an object of elements, from a given list of ids (ev) | |
* @return {object} Object containing any matching element ids, assigning | |
* the id as the key | |
*/ | |
var getElementsByIds = function() { "use strict"; | |
var r = {}, | |
a = [].slice.call(arguments), | |
e,id,i; | |
for (i=0; i<a.length; i++) { |
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 dir2iso() { | |
echo "Generating ISO: ${1} -> ${1}.iso" | |
hdiutil makehybrid -iso -joliet -o ${1}.iso ${1} | |
} | |
alias dir2iso=dir2iso |
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 | |
# Bash script to determine if current branch(default HEAD) | |
# need rebase the changes from the integration | |
# branch(default master) | |
# Author: Justin Zhang <[email protected]> | |
# Created: 2013-12-04 | |
# | |
# Usage: | |
# check_rebase.sh [current branch] [integration branch] | |
# |
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
// Quick and easy HTTP Error Messages | |
// @ https://gist.github.com/aidilfbk/1363383 | |
var get_http_error_message = function (code) { | |
var http_errors = { | |
100: "Continue", | |
101: "Switching Protocols", | |
102: "Processing", | |
103: "Checkpoint", | |
122: "Request-URI too long", | |
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
<? | |
$path = '/var/www/myWebsite/myLog.log'; | |
$data = 'myData'; | |
file_put_contents ($path , PHP_EOL . time() .' - ' . $data, FILE_APPEND | LOCK_EX ); | |
?> |
OlderNewer