loading
Please wait while loading...

Read more Responsive image map

Source: https://github.com/stowball/jQuery-rwdImageMaps

Demo: http://mattstow.com/experiment/responsive-image-maps/rwd-image-maps.html#bubbles

One line code to make your image map responsive, $('img[usemap]').rwdImageMaps();

Read more Extract tar.gz by cmd (prevent wrong decoding)

1. Use cd command to navigate to your file's path (replace {path} by your file's path)

cd C:\{path}

2. Use following command to extract

tar -xvf Phpfiles-org.tar --wildcards

The above will extract the full folder and files

To extract specific file(s), you can add the part or full path of the file(s) to the end of the command
For example, if you want to extract all .jpg file:

tar -xvf Phpfiles-org.tar --wildcards *.jpg

For example, if you want to extract all files under the folder "abc":

tar -xvf Phpfiles-org.tar --wildcards /files/abc/*

The above example assume "fiels" is the highest level and "abc" is under the folder "files".
You can put * anywhere to match the path. For example:
/files/a*bc/ will extract any folder match the name like abc, axbc, axxbc, axxxbc...

...........

Read more Aspen, Colorado, USA

Aspen, Colorado, USA

...........

Read more A nice way to output csv with temporary file

In php programming, we always need to output data with csv format, fputcsv is good function to do that. However, it require a file handler which means you must do fopen to open a file write the content to it. But usually we just need to generate the output file for download and don't need to save in server. Today I find a better way to write csv with php memory as shown below.

// output up to 5MB is kept in memory, if it becomes bigger
// it will automatically be written to a temporary file
$csv = fopen('php://temp/maxmemory:'. (5*1024*1024), 'r+');

fputcsv($csv, array('blah','blah'));

rewind($csv);

// put it all in a variable
$output = stream_get_contents($csv);

Read more Allow multiple line of code for a string variable in Javascript

When we set a html string to a variable, we cannot come to next line with only press enter like in php, example below show the case:

$htm = '';

You will get a warning like this:
SyntaxError: unterminated string literal

Usually, we will use "+" to link up multiple line of code to solve this problem. Today I found a way to allow this which just easily add a "\" at the end of a line.

$htm = '';
1 2 3 4 5 6 7 8 9 10