WordPress development environment on Mac with Brew, Nginx, PHP 7, PHP-FPM, MariaDB, phpMyAdmin and more
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php| --- | |
| METHOD 1 | |
| This should roughly sort the items on distance in MySQL, and should work in SQLite. | |
| If you need to sort them preciser, you could try using the Pythagorean theorem (a^2 + b^2 = c^2) to get the exact distance. | |
| --- | |
| SELECT * | |
| FROM table | |
| ORDER BY ((lat-$user_lat)*(lat-$user_lat)) + ((lng - $user_lng)*(lng - $user_lng)) ASC |
| CREATE TABLE IF NOT EXISTS `country` ( | |
| `id` int(11) NOT NULL AUTO_INCREMENT, | |
| `iso` char(2) NOT NULL, | |
| `name` varchar(80) NOT NULL, | |
| `nicename` varchar(80) NOT NULL, | |
| `iso3` char(3) DEFAULT NULL, | |
| `numcode` smallint(6) DEFAULT NULL, | |
| `phonecode` int(5) NOT NULL, | |
| PRIMARY KEY (`id`) | |
| ) ENGINE=MyISAM DEFAULT CHARSET=latin1; |
| $ kill -l | |
| 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL | |
| 5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE | |
| 9) SIGKILL 10) SIGUSR1 11) SIGSEGV 12) SIGUSR2 | |
| 13) SIGPIPE 14) SIGALRM 15) SIGTERM 16) SIGSTKFLT | |
| 17) SIGCHLD 18) SIGCONT 19) SIGSTOP 20) SIGTSTP | |
| 21) SIGTTIN 22) SIGTTOU 23) SIGURG 24) SIGXCPU | |
| 25) SIGXFSZ 26) SIGVTALRM 27) SIGPROF 28) SIGWINCH | |
| 29) SIGIO 30) SIGPWR 31) SIGSYS 34) SIGRTMIN | |
| 35) SIGRTMIN+1 36) SIGRTMIN+2 37) SIGRTMIN+3 38) SIGRTMIN+4 |
| <!-- country codes (ISO 3166) and Dial codes. --> | |
| <select name="countryCode" id=""> | |
| <option data-countryCode="GB" value="44" Selected>UK (+44)</option> | |
| <option data-countryCode="US" value="1">USA (+1)</option> | |
| <optgroup label="Other countries"> | |
| <option data-countryCode="DZ" value="213">Algeria (+213)</option> | |
| <option data-countryCode="AD" value="376">Andorra (+376)</option> | |
| <option data-countryCode="AO" value="244">Angola (+244)</option> | |
| <option data-countryCode="AI" value="1264">Anguilla (+1264)</option> | |
| <option data-countryCode="AG" value="1268">Antigua & Barbuda (+1268)</option> |
| # ======================================== | |
| # Testing n-gram analysis in ElasticSearch | |
| # ======================================== | |
| curl -X DELETE localhost:9200/ngram_test | |
| curl -X PUT localhost:9200/ngram_test -d ' | |
| { | |
| "settings" : { | |
| "index" : { | |
| "analysis" : { |
| cd ~ | |
| sudo apt-get update | |
| sudo apt-get install openjdk-7-jre-headless -y | |
| ### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below | |
| # NEW WAY / EASY WAY | |
| wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.0.1.deb | |
| sudo dpkg -i elasticsearch-1.0.1.deb |
| # Misc | |
| DATABASE_PASSWORD=password | |
| ADMIN_PASSWORD=password | |
| SERVICE_PASSWORD=password | |
| SERVICE_TOKEN=password | |
| RABBIT_PASSWORD=password | |
| # Reclone each time | |
| RECLONE=yes |