View api.js
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
var request = require("request"); | |
var options = { | |
method: 'GET', | |
url: 'https://api.meltwater.com/v1/analytics/8285607', | |
qs: { | |
start: '2019-09-10T10:00:00', | |
end: '2019-09-11T10:00:00', | |
tz: 'America/Los_Angeles', | |
source: 'twitter' |
View db-debug.php
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
\DB::listen(function($sql) { | |
if ($sql instanceof Illuminate\Database\Events\QueryExecuted) { | |
\Log::info($sql->sql); | |
\Log::info(json_encode($sql->bindings)); | |
} | |
}); | |
DB::listen( | |
function ($query) { | |
Log::info($query->sql); |
View countries.php
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 | |
namespace Acme\Utils; | |
class Countries | |
{ | |
/** | |
* List of all countries | |
* | |
* @var array |
View logstash.sh
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
#!/usr/bin/env bash | |
echo ">>> Installing Logstash" | |
# Set some variables | |
LOGSTASH_VERSION=1.5.4-1_all # Check https://www.elastic.co/downloads/logstash for latest version | |
# Install prerequisite: Java | |
# -qq implies -y --force-yes | |
sudo apt-get update |
View kibana.sh
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
#!/usr/bin/env bash | |
echo ">>> Installing Kibana" | |
# Set some variables | |
KIBANA_VERSION=4.1.1 # Check https://www.elastic.co/downloads/kibana for latest version | |
sudo mkdir -p /opt/kibana | |
wget --quiet https://download.elastic.co/kibana/kibana/kibana-$KIBANA_VERSION-linux-x64.tar.gz | |
sudo tar xvf kibana-$KIBANA_VERSION-linux-x64.tar.gz -C /opt/kibana --strip-components=1 |
View .bash_profile
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 serve() | |
{ | |
if [ -z $1 ]; then port=9999 else port=$1 fi | |
echo "----------------- Starting Server -----------------"; | |
php -S localhost:$port; | |
} |
View progress.py
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
def updateProgress(position, total = 100, length = 10): | |
progress = int((position/float(total))*100) | |
print '\r[{0}] {1}%'.format('#'*(progress/length), progress) |
View ObjectToArray.php
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 | |
/** | |
* Convert an object to and array recursively | |
* | |
* @param Object $object Object to be converted to an array | |
* | |
* @return array | |
*/ | |
private function _objectToArray($object) | |
{ |
View LAMP-Setup.sh
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
#!/usr/bin/env bash | |
sudo apt-get update | |
sudo apt-get install -y vim curl python-software-properties | |
sudo add-apt-repository -y ppa:ondrej/php5 | |
sudo apt-get update | |
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root' | |
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root' |
View install-mailcatcher.sh
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 MailCatcher (Vagrant) | |
# Install RVM (ruby) | |
sudo apt-get --purge remove ruby-rvm | |
sudo rm -rf /usr/share/ruby-rvm /etc/rvmrc /etc/profile.d/rvm.sh | |
env | grep rvm | |
\curl -L https://get.rvm.io | bash -s stable --ruby --autolibs=enable --auto-dotfiles --gems=mailcatcher | |
source /usr/local/rvm/scripts/rvm | |
# Start Mailcatcher for testing email |