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
#import a single json file | |
$ mongoimport -h 127.0.0.1 -c subprovider -db techtravel --file subprovider.json | |
#import csv file | |
$ mongoimport -d mydb -c things --type csv --file locations.csv --headerline | |
#export a single collection | |
$ mongoexport --db techtravel --collection subprovider --out /var/www/techtravel/storage/database/2013-04-03/subprovider.json | |
#export a single collection but specific data from that collection |
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
$environments = array( | |
'development' => array('http://localhost*', '*.dev'), | |
'production' => array('http://mywebsite.com*', '*.mywebsite.com'), | |
); |
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 pecl install mongo | |
downloading mongo-1.3.3.tgz ... | |
Starting to download mongo-1.3.3.tgz (122,098 bytes) | |
...........................done: 122,098 bytes | |
49 source files, building | |
running: phpize | |
Configuring for: | |
PHP Api Version: 20090626 | |
Zend Module Api No: 20090626 | |
Zend Extension Api No: 220090626 |
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
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm | |
yum remove php-common # Need to remove this, otherwise it conflicts | |
yum install php56w | |
yum install php56w-mysql | |
yum install php56w-common | |
yum install php56w-pdo | |
yum install php56w-opcache | |
php --version | |
sudo ssh-keygen -t rsa -b 4096 -C eishii1 |
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
Problem: | |
$ vagrant up | |
[default] VM already created. Booting if its not already running... | |
[default] Running any VM customizations... | |
[default] Clearing any previously set forwarded ports... | |
[default] Forwarding ports... | |
[default] -- ssh: 22 => 2222 (adapter 1) | |
[default] -- db2: 30003 => 30003 (adapter 1) | |
[default] Cleaning previously set shared folders... |
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
## based on http://www.developerzen.com/2011/01/10/show-the-current-git-branch-in-your-command-prompt/ | |
function parse_git_branch () { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
} | |
BLUE="[\033[0;34m\]" | |
DARK_BLUE="[\033[1;34m\]" | |
RED="\[\033[0;31m\]" | |
YELLOW="\[\033[0;33m\]" |
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
#vc dentro de Iframeid | |
parent.document.getElementById("IframeId"); | |
#vc fora dos iframes tentando chamar uma funcão javascript que está dentro de um iframe | |
document.getElementById("IframeId").contentWindow.HelloWorld(); | |
#pegar conteúdo do iframe | |
var iframe = parent.document.getElementById( "iframeReport"); | |
var innerDoc = iframe.contentDocument || iframe.contentWindow.document; |
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
<?php | |
// Mais informações | |
// http://www.delicious.com/help/feeds | |
// Count | |
function delicious_count($url) { | |
$count = 0; |
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
/* | |
* Calcula distancias | |
*/ | |
function distance($lat1, $lon1, $lat2, $lon2, $unit) { | |
$theta = $lon1 - $lon2; | |
$dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta)); | |
$dist = acos($dist); | |
$dist = rad2deg($dist); | |
$miles = $dist * 60 * 1.1515; |
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
<?php | |
/* | |
* usage: echo tweetCount('http://google.com'); | |
* ref: http://www.phpsnippets.info/get-how-many-times-a-page-have-been-retweeted-using-php | |
*/ | |
function tweetCount($url) { | |
$content = file_get_contents("http://api.tweetmeme.com/url_info?url=".$url); | |
$element = new SimpleXmlElement($content); | |
$retweets = $element->story->url_count; | |
if($retweets){ |