oleh Taufan Aditya
a. Sekilas tentang "native" PHP
Mari kita perhatikan sejenak kode berikut ini :
oleh Taufan Aditya
a. Sekilas tentang "native" PHP
Mari kita perhatikan sejenak kode berikut ini :
| <?php | |
| $files = glob("*.tar.gz"); | |
| foreach($files as $file) { | |
| if(is_file($file) | |
| && time() - filemtime($file) >= 7*24*60*60) { // 7 days | |
| unlink($file); | |
| } | |
| } | |
| ?> |
| /* | |
| In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp | |
| server, but for some reason omit a client connecting to it. I added an | |
| example at the bottom. | |
| Save the following server in example.js: | |
| */ | |
| var net = require('net'); |
| -- Remove the history from | |
| rm -rf .git | |
| -- recreate the repos from the current content only | |
| git init | |
| git add . | |
| git commit -m "Initial commit" | |
| -- push to the github remote repos ensuring you overwrite history | |
| git remote add origin [email protected]:<YOUR ACCOUNT>/<YOUR REPOS>.git |
| <?php | |
| /* | |
| * PHP: Recursively Backup Files & Folders to ZIP-File | |
| * MIT-License - 2012-2018 Marvin Menzerath | |
| */ | |
| // Make sure the script can handle large folders/files | |
| ini_set('max_execution_time', 600); | |
| ini_set('memory_limit', '1024M'); |
| <!DOCTYPE html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
| <title></title> | |
| <meta name="description" content=""> | |
| <meta name="viewport" content="width=device-width"> | |
| </head> | |
| <body> |
| function change(element, increment) { | |
| var $el = $(element), | |
| elValue = parseInt($el.val(), 10), | |
| incAmount = increment || 1, | |
| newValue = elValue + incAmount; | |
| if ((newValue) > -1) { | |
| $el.val(newValue); | |
| } | |
| } |
| // Reference | |
| // http://tools.ietf.org/html/rfc6455 | |
| // http://www.w3.org/TR/2011/WD-websockets-20110929/ | |
| // https://github.com/einaros/ws | |
| // https://github.com/Worlize/WebSocket-Node | |
| // http://ja.wikipedia.org/wiki/WebSocket | |
| // http://www.slideshare.net/You_Kinjoh/javascript-websocket P.68 | |
| // http://d.hatena.ne.jp/gtk2k/20120203/1328274962 | |
| var log = console.log.bind(console); |
| <?php | |
| /** | |
| * Settings | |
| */ | |
| define('API_KEY', $_GET['apikey']); // CloudFlare API key | |
| define('USERNAME', '[email protected]'); // Email address used to login into CloudFlare | |
| define('IP', getCurrentIP()); // Current IP address | |
| echo 'Setting IP address to "' . IP . '"...<br />'; |
| <?php | |
| // Usage: | |
| // $master=new WebSocket("localhost",12345); | |
| // $master->callback = function($self, $user, $msg){ | |
| // $self->send($user->socket,$msg); | |
| // }; | |
| require "CommandsAppBase.class.php"; | |
| require "WsRequest.class.php"; |