I hereby claim:
- I am longnz on github.
- I am gialac (https://keybase.io/gialac) on keybase.
- I have a public key ASASAS5tjNcEc4HX5ZhVzm-FdAjz1_ZdNbVTrBKFaLn1swo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
<?php | |
// force download of CSV | |
// simulate file handle w/ php://output, direct to output (from http://www.php.net/manual/en/function.fputcsv.php#72428) | |
// (could alternately write to memory handle & read from stream, this seems more direct) | |
// headers from http://us3.php.net/manual/en/function.readfile.php | |
header('Content-Description: File Transfer'); | |
header('Content-Type: application/csv'); | |
header("Content-Disposition: attachment; filename=FILENAME.csv"); | |
header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
# Apache configuration file | |
# httpd.apache.org/docs/2.2/mod/quickreference.html | |
# Note .htaccess files are an overhead, this logic should be in your Apache | |
# config if possible: httpd.apache.org/docs/2.2/howto/htaccess.html | |
# Techniques in here adapted from all over, including: | |
# Kroc Camen: camendesign.com/.htaccess | |
# perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/ | |
# Sample .htaccess file of CMS MODx: modxcms.com |
Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...
// see: https://github.com/chadoe/docker-cleanup-volumes
$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
None of the string methods modify this
– they always return fresh strings.
charAt(pos: number): string
ES1
Returns the character at index pos
, as a string (JavaScript does not have a datatype for characters). str[i]
is equivalent to str.charAt(i)
and more concise (caveat: may not work on old engines).
#!/usr/bin/python | |
def poorMansConvert(di, inPath, outType, outPath): | |
from apiclient.http import MediaFileUpload | |
valid_output = [ | |
'text/html','text/plain','application/rtf','application/vnd.oasis.opendocument.text',\ | |
'application/pdf','application/vnd.openxmlformats-officedocument.wordprocessingml.document',\ | |
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet','application/x-vnd.oasis.opendocument.spreadsheet',\ | |
'image/jpeg','image/png','image/svg+xml','application/vnd.openxmlformats-officedocument.presentationml.presentation' |
<?php | |
$zip = new ZipArchive; | |
$bkfile = '../export/backup/backup-source-' . date('dd-mm-yy') . '.zip'; | |
$zip->open($bkfile, ZipArchive::CREATE); | |
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator("../../")); | |
// iterate over the directory | |
// add each file found to the archive | |
foreach ($iterator as $key => $value) { | |
if (in_array(substr($key, strrpos($key, '/') + 1), array('.', '..'))) |
<?php | |
if(!is_numeric($_GET['id']))die('Please specify a category ID'); | |
$catId = $_GET['id']; | |
$xml = simplexml_load_file('app/etc/local.xml'); | |
$host = $xml->global->resources->default_setup->connection->host; | |
$username = $xml->global->resources->default_setup->connection->username; | |
$password = $xml->global->resources->default_setup->connection->password; |
set :application, "mydomain.vn" | |
# the path to your new deployment directory on the server | |
set :deploy_to, "/home/longnguyen/www" | |
# the git-clone url for your repository | |
set :repository, "git@bitbucket.org:gialachoanglong/repo.git" | |
# the branch you want to clone (default is master) | |
set :branch, "master" |