This file contains 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
$ssss = $wpdb->get_results("select name, id from wp_cities"); | |
foreach($ssss as $s){ | |
$z = file_get_contents("http://maps.googleapis.com/maps/api/geocode/json?address={$s->name}&sensor=false"); | |
$a = json_decode($z, true); | |
$lat = $a['results'][0]['geometry']['location']['lat']; | |
$lng = $a['results'][0]['geometry']['location']['lng']; | |
$wpdb->update( | |
'wp_cities', | |
array( 'lat' => $lat, 'lng' => $lng ), | |
array( 'id' => $s->id), |
This file contains 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
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 54422A4B98AB5139 |
This file contains 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
SET FOREIGN_KEY_CHECKS = 0; | |
SET @tables = NULL; | |
SELECT GROUP_CONCAT(table_schema, '.', table_name) INTO @tables | |
FROM information_schema.tables | |
WHERE table_schema = 'database_name'; -- specify DB name here. | |
SET @tables = CONCAT('DROP TABLE ', @tables); | |
PREPARE stmt FROM @tables; | |
EXECUTE stmt; | |
DEALLOCATE PREPARE stmt; |
This file contains 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
echo 300 | sudo tee /sys/class/backlight/intel_backlight/brightness |
This file contains 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
#!/bin/bash | |
INK=/Applications/Inkscape.app/Contents/Resources/bin/inkscape | |
if [[ -z "$1" ]] | |
then | |
echo "SVG file needed." | |
exit; | |
fi |
This file contains 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
############################################################################## | |
# INSTALL isolated PHP 5.6 ZTS (Thread-safe) with pthreads on Ubuntu 14.04 ### | |
############################################################################## | |
1) Install necessary bison version | |
wget http://launchpadlibrarian.net/140087283/libbison-dev_2.7.1.dfsg-1_amd64.deb | |
wget http://launchpadlibrarian.net/140087282/bison_2.7.1.dfsg-1_amd64.deb | |
dpkg -i libbison-dev_2.7.1.dfsg-1_amd64.deb | |
dpkg -i bison_2.7.1.dfsg-1_amd64.deb |
This file contains 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
sudo apt-get install bridge-utils | |
pkill docker | |
iptables -t nat -F | |
ifconfig docker0 down | |
brctl delbr docker0 | |
sudo service docker start |
This file contains 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
// to capture ALL events use: | |
Ext.util.Observable.prototype.fireEvent = | |
Ext.util.Observable.prototype.fireEvent.createInterceptor(function() { | |
console.log(this.name); | |
console.log(arguments); | |
return true; | |
}); | |
// to capture events for a particular component: | |
Ext.util.Observable.capture( |
This file contains 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
# Obtain the latest source for NGINX from http://nginx.org/en/download.html | |
$ wget http://nginx.org/download/nginx-1.9.5.tar.gz | |
$ tar -xzvf nginx-1.9.5.tar.gz | |
# Obtain the development sources for nginScript | |
$ hg clone http://hg.nginx.org/njs | |
# Build and install NGINX | |
$ cd nginx-1.9.5 | |
$ ./configure \ |
This file contains 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
function simulateClick() { | |
var evt = document.createEvent("MouseEvents"); | |
evt.initMouseEvent("click", true, true, window, | |
0, 0, 0, 0, 0, false, false, false, false, 0, null); | |
var cb = document.getElementById("checkbox"); | |
var canceled = !cb.dispatchEvent(evt); | |
if(canceled) { | |
// A handler called preventDefault | |
alert("canceled"); | |
} else { |
OlderNewer