This file contains hidden or 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 | |
| use Slim\Http\Request; | |
| use Slim\Http\Response; | |
| use Slim\Http\Stream; | |
| $app->get('/stream', function (Request $request, Response $response, array $args) { | |
| // a 100mb file | |
| $path = '../public/files/document.pdf'; |
This file contains hidden or 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
| git clone git@github.com:docker-library/php.git docker-library-php | |
| ## Go to the specific version you're interested in | |
| cd docker-library-php/7.1/fpm/alpine | |
| ## Edit the .Dockerfile. | |
| ## Change | |
| ## ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data | |
| ## to | |
| ## ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --enable-debug | |
| ## Comment out or delete: |
This file contains hidden or 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 | |
| header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); | |
| header("Cache-Control: post-check=0, pre-check=0", false); | |
| header("Pragma: no-cache"); | |
| ob_end_flush(); | |
| $pid = getmypid(); | |
| $secs = 10; | |
| $cmd = "kill -3 $pid"; |
This file contains hidden or 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
| export XDEBUG_CONFIG="idekey=PHPSTORM" | |
| export PHP_IDE_CONFIG="serverName=cli" | |
| ;in php.ini | |
| zend_extension=xdebug.so | |
| xdebug.remote_enable=1 | |
| xdebug.remote_host=HOST_IP | |
| xdebug.remote_port=9000 |
This file contains hidden or 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
| /** | |
| * Selects an option in a Chosen Selector based on its label | |
| * | |
| * @return void | |
| */ | |
| public function selectOptionInSelectize($label, $option) | |
| { | |
| $I = $this; | |
| $I->waitForJS("return jQuery(\"label:contains('$label')\");"); | |
| $selectID = $I->executeJS("return jQuery(\"label:contains('$label')\").attr(\"for\");"); |
This file contains hidden or 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
| # | |
| # The MySQL database server configuration file. | |
| # | |
| # You can copy this to one of: | |
| # - "/etc/mysql/my.cnf" to set global options, | |
| # - "~/.my.cnf" to set user-specific options. | |
| # | |
| # One can use all long options that the program supports. | |
| # Run program with --help to get a list of available options and with | |
| # --print-defaults to see which it would actually understand and use. |
This file contains hidden or 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
| <? | |
| //send http post request and return http headers in array form | |
| function http_post_request($url,$pdata,$getHeaders=false) | |
| { | |
| $pdata = is_array($pdata) ? http_build_query($pdata) : $pdata; | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_URL, $url ); | |
| curl_setopt($ch, CURLOPT_POSTFIELDS, $pdata); |
This file contains hidden or 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
| import numpy as np | |
| def GENP(A, b): | |
| ''' | |
| Gaussian elimination with no pivoting. | |
| % input: A is an n x n nonsingular matrix | |
| % b is an n x 1 vector | |
| % output: x is the solution of Ax=b. | |
| % post-condition: A and b have been modified. | |
| ''' |
This file contains hidden or 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 | |
| file_put_contents( 'progress.txt', '' ); | |
| $targetFile = fopen( 'testfile.iso', 'w' ); | |
| $ch = curl_init( 'http://ftp.free.org/mirrors/releases.ubuntu-fr.org/11.04/ubuntu-11.04-desktop-i386-fr.iso' ); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
| curl_setopt( $ch, CURLOPT_NOPROGRESS, false ); | |
| curl_setopt( $ch, CURLOPT_PROGRESSFUNCTION, 'progressCallback' ); | |
| curl_setopt( $ch, CURLOPT_FILE, $targetFile ); |