oleh Taufan Aditya
a. Sekilas tentang "native" PHP
Mari kita perhatikan sejenak kode berikut ini :
<?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'); |
-- 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 |
/* | |
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'); |
<?php | |
$files = glob("*.tar.gz"); | |
foreach($files as $file) { | |
if(is_file($file) | |
&& time() - filemtime($file) >= 7*24*60*60) { // 7 days | |
unlink($file); | |
} | |
} | |
?> |
oleh Taufan Aditya
a. Sekilas tentang "native" PHP
Mari kita perhatikan sejenak kode berikut ini :
First, clone the repository of the project :
mkdir /tmp/project-name
git clone ...
Create a packages.json file in the root, containing the following :
# WinAVR Sample makefile written by Eric B. Weddington, Jörg Wunsch, et al. | |
# Modified (bringing often-changed options to the top) by Elliot Williams | |
# make all = Make software and program | |
# make clean = Clean out built project files. | |
# make program = Download the hex file to the device, using avrdude. Please | |
# customize the avrdude settings below first! | |
# Microcontroller Type | |
MCU = attiny13 |
RegExp.quote = function(str) { | |
return (str+'').replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1"); | |
} | |
function getSearchParameters() { | |
var prmstr = window.location.search.substr(1); | |
return prmstr != null && prmstr != "" ? transformToAssocArray(prmstr) : {}; | |
} | |
function transformToAssocArray( prmstr ) { |
Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.
In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.
Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j
<?php | |
// https://gist.github.com/magnetikonline/650e30e485c0f91f2f40 | |
class DumpHTTPRequestToFile { | |
public function execute($targetFile) { | |
$data = sprintf( | |
"%s %s %s\n\nHTTP headers:\n", | |
$_SERVER['REQUEST_METHOD'], | |
$_SERVER['REQUEST_URI'], | |
$_SERVER['SERVER_PROTOCOL'] |