Skip to content

Instantly share code, notes, and snippets.

View zot24's full-sized avatar
🦑
boom!

zot24

🦑
boom!
View GitHub Profile
@zot24
zot24 / logout.blade.php
Created October 25, 2014 10:13
Logout Laravel
{{ Form::open(['route' => ['session.destroy'], 'method' => 'delete']) }}
<button type="submit">Logout</button>
{{ Form::close() }}
@zot24
zot24 / demonize_pm2.sh
Last active August 29, 2015 14:07
Run this command to run your application as a service by typing the following
sudo env PATH=$PATH:/usr/bin pm2 startup ubuntu -u ghost
@zot24
zot24 / mongo_search_dbref.txt
Created October 10, 2014 08:57
Search with MongoDB a DBRef object (user -> space)
db.space.find({"createdBy": DBRef("user", ObjectId("54379c3bb0e6df50048b458a"))}).pretty()
@zot24
zot24 / search_issue_github
Created October 6, 2014 11:30
Github search open issue without a milestone and without the label 's:in-pull-request'
is:open is:issue no:milestone -label:s:in-pull-request
@zot24
zot24 / mongo_export.php
Last active July 5, 2016 23:59
Low level helper class to export your mongo collections or specific documents using DB Reference
class MongoExportHelper {
private $path = './';
private $database = 'default';
public function setPath($path) {
$this->path = $path;
}
public function setDatabase($database) {
$this->database = $database;
@zot24
zot24 / script.sh
Created September 24, 2014 14:37
Prepend line to file using sed on a Mac, this is only valid if the script already have some data in it
sed -i '' -e $'1i\\\n Here is my new top line' file
@zot24
zot24 / script
Created September 24, 2014 14:36
Run command in a child process with gulp
gulp.task "run", (command, cb) ->
exec = require('child_process').exec;
exec command, (err, stdout, stderr) ->
console.log(stdout);
console.log(stderr);
cb(err);
@zot24
zot24 / start.php
Created June 27, 2014 08:31
This is how I detect my environment with Laravel, if I'm running from the console outside of Vagrant I'm calling the environment console which have all the credentials to access the database from outside of the virtual machine. And if I'm using the browser and there is not ENV set up I'm using by default development environment.
$env = $app->detectEnvironment(function () use ($app)
{
return getenv('ENV') ?: ($app->runningInConsole() ? 'console' : 'development');
});
@zot24
zot24 / alias
Created June 26, 2014 17:28 — forked from JeffreyWay/.bash_profile
Personal bash/zsh alias
# laravel new-app
alias laravel="git clone -o laravel -b develop https://github.com/laravel/laravel.git"
alias artisan="php artisan"
alias migrate="php artisan migrate"
alias serve="php artisan serve"
alias dump="php artisan dump"
alias t="phpunit"
# Generators Package
@zot24
zot24 / zshrc
Created June 26, 2014 08:25
My ZSH config file
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="agnoster"
# Default user name