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 getArgs(func) { | |
// First match everything inside the function argument parens. | |
var args = func.toString().match(/function\s.*?\(([^)]*)\)/)[1]; | |
// Split the arguments string into an array comma delimited. | |
return args.split(',').map(function(arg) { | |
// Ensure no inline comments are parsed and trim the whitespace. | |
return arg.replace(/\/\*.*\*\//, '').trim(); | |
}).filter(function(arg) { | |
// Ensure no undefined values are added. |
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
+-------------------+ | |
| users | | |
+-------------------+ | |
| | | |
| id (int) | | |
| username (string) | | |
| password (string) | | |
| | | |
+-------------------+ |
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
class Rest_Client { | |
/** | |
* | |
* Perform any get type operation on a url | |
* @param string $url | |
* @return string The resulting data from the get operation | |
*/ | |
public static function get($url) { | |
$ch = curl_init(); |
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 | |
include("Yubikey.php") | |
$id = 00000; | |
$signature = 'yoursignature'; | |
if(isset($_POST) && array_key_exists('otp', $_POST)) { | |
$token = new Yubikey($id, $signature); | |
if($token->verify($_POST['otp'])) { | |
echo 'Verified!'; | |
} |
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 http = require('http'); | |
http.createServer(function (req, res) { | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
res.end('Hello World\n'); | |
}).listen(1337, '293.122.113.1'); | |
console.log('Server running at http://293.122.113.1:1337/'); |
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 | |
$OPML = 'ENTER THE LINK TO YOUR OPML FILE'; | |
$rawOPML = file_get_contents($OPML); | |
$doc = new DOMDocument(); | |
$doc->loadXML($rawOPML); | |
$arrayOutline = OPMLToArray($doc->childNodes->item(0)); | |
$jsonOutline = json_encode($arrayOutline); |
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
//JAVASCRIPT | |
$(document).ready(function(){ | |
CLICKIT_core.init(); | |
CLICKIT_contract_form.init(); | |
}); | |
var CLICKIT_config = { | |
URLs : { | |
checkName : 'index.php/users/getnames' | |
} |
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 delete_todo($id) { | |
if(is_numeric($id) && !empty($id)) { | |
$sql = 'delete from todo where todo_id = '.$id; | |
return json(db($sql)); | |
} | |
} | |
?> |
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 update_todo($id) { | |
if(is_numeric($id) && !empty($id)) { | |
$todo_title = mysql_real_escape_string($_POST['title']); | |
$todo_text = (empty($_POST['todo_text']))?$todo_title:mysql_real_escape_string($unescaped_string); | |
$completed = bool($_POST['completed']); | |
if(!empty($todo_title)) { | |
$sql = 'update todo set todo_title = "'.$todo_title.'", todo_text = "'.$todo_text.'", completed = '.$completed.' where todo_id = '.$id; | |
return json(db($sql)); |
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 get_todo($id) { | |
if(is_numeric($id) && !empty($id)) { | |
$sql = 'select * from todo where todo_id = '.$id; | |
return json(db($sql)); | |
} | |
} | |
?> |
NewerOlder