Skip to content

Instantly share code, notes, and snippets.

View zot24's full-sized avatar
🦑
boom!

zot24

🦑
boom!
View GitHub Profile
@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 / 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 / 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_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 / 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 / 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() }}
<?php
// credential to access github, you should choose between username/password authentication or token (for two step verification accounts)
$githubUser = 'YOURGITHUBUSER';
$githubPasswd = 'YOURGITHUBPASSWD';
// or
//$githubToken = 'YOURGITHUBTOKEN';
$githubOrganization = 'YOURGITHUBORGANIZATION';
@zot24
zot24 / post.md
Last active August 29, 2015 14:10
My personal boilerplate for write a posts using the blogging platform Ghost - blog.zot24.com

[Series]

Short explanation about the series


Introdution, explaining which is the gloal of the post and what are the motivation to face this problem, is basically a very short resume or explanation about what the user is going to read.

@zot24
zot24 / phpdox
Created November 28, 2014 11:32
PHP Dox example config file
<?xml version="1.0" encoding="utf-8" ?>
<phpdox xmlns="http://phpdox.net/config">
<project name="MyProjectName" source="MyBaseDir" workdir="phpdox">
<collector publiconly="false">
<include mask="*/source1/**/*.php" />
<include mask="*/source2/**/*.php" />
<exclude mask="*autoload.php" />
</collector>
<generator output=".">
@zot24
zot24 / clean_jenkins.sh
Last active August 29, 2015 14:10
Jenkins CI Server – Resetting a build number and cleaning a build - http://goo.gl/WLlXYV
#
# Jenkins build cleaner
# Cleans out all builds for projects that exist in the directory
# Resets the build number to 1
# Backup all projects before running this
 
function cleanbuild {
 
echo "cleaning $1"
cd $1