Convert Text to Slug URL in PHP

Convert Text to slug URL, example: Brown & Cony’s Secret Date! will become: brown-conys-secret-date Will be nice url. [php] function slug_url($text) { // replace non letter or digits by – $text = preg_replace(‘~[^\\pL\d]+~u’, ‘-‘, $text); // trim $text = trim($text, ‘-‘); // transliterate $text = iconv(‘utf-8’, ‘us-ascii//TRANSLIT’, $text); // lowercase $text = strtolower($text); // remove Continue reading “Convert Text to Slug URL in PHP”

Country Code in Array with PHP Value

Just copy and paste into your code to use the country code. [php] <?php $countries = array ( ‘AF’ => ‘Afghanistan’, ‘AX’ => ‘Aland Islands’, ‘AL’ => ‘Albania’, ‘DZ’ => ‘Algeria’, ‘AS’ => ‘American Samoa’, ‘AD’ => ‘Andorra’, ‘AO’ => ‘Angola’, ‘AI’ => ‘Anguilla’, ‘AQ’ => ‘Antarctica’, ‘AG’ => ‘Antigua And Barbuda’, ‘AR’ => ‘Argentina’, Continue reading “Country Code in Array with PHP Value”

Hacker’s Secret 100 Secret Techniques Revealed

One of the nice book that suitable for Hacker, but too bad it is in Japanese version. Wish someone will translate to English version in future. You can find the author from here Satoru Takabayashi, Fumitoshi Ukai, Yusuke Sato, Shinichiro Hamaji, Kazuyuki Shudo Chapter 1. Introduction 1. Introduction to Binary Hacks 2. Terminology of Binary Hacks 3. Using “file” to Continue reading “Hacker’s Secret 100 Secret Techniques Revealed”

Connect to Jetpack using behind varnish and nginx

Normally if you use varnish or other reverse proxy, you may use other port in wordpress. So you are not able to connect to Jetpack, because to connect Jetpack, you must have port 80 to authorize. It may display the error like this from your Jetpack debugger [code] SELF: Array ( [headers] => Array ( Continue reading “Connect to Jetpack using behind varnish and nginx”

How to convert pvr.czz file to PNG ?

Download TexturePacker Install and it does support command line tools. To convert single pvr.czz file to PNG in console, here is the way. [code lang=”bash”] TexturePacker filename.pvr.ccz –sheet filename.png –data dummy.plist –algorithm Basic –allow-free-size –no-trim [/code] To convert mass pvr.czz file to PNG in console, here is the way. [code lang=”bash”] find -name \*.pvr.czz | Continue reading “How to convert pvr.czz file to PNG ?”

Remove ^M with VIM in linux

How I do to replace this with a ‘normal’ line break? Replace ^M to normal line break in many config files. [code lang=”bash”] :%s/<ctrl -V></ctrl><ctrl -M>//g </ctrl> [/code]