Skip to content

Instantly share code, notes, and snippets.

View gianlucacandiotti's full-sized avatar

Gianluca Candiotti gianlucacandiotti

  • Wolt
  • Helsinki, Finland
View GitHub Profile
@gianlucacandiotti
gianlucacandiotti / Git list commits
Last active August 24, 2017 00:25
List commits with a nice format
git log --pretty=format:"%h - %an, %ar : %s" --max-count=5
@gianlucacandiotti
gianlucacandiotti / Untrack file git
Created April 6, 2015 14:29
Untrack a file from git without removing it from git cache.
git update-index --assume-unchanged [path]
@gianlucacandiotti
gianlucacandiotti / WP - get custom post
Last active November 2, 2019 12:56
Get all posts for a custom post type and query them.
<?php
$type = 'custom_post_type';
$args = array(
'post_type' => $type,
'post_status' => 'publish',
'posts_per_page' => -1,
'ignore_sticky_posts'=> true
);
$my_query = null;
$my_query = new WP_Query($args);
@gianlucacandiotti
gianlucacandiotti / WP - ACF get related posts
Last active February 24, 2020 20:44
Get all post objects of a custom post type related to the current post. Advanced Custom Fields.
@gianlucacandiotti
gianlucacandiotti / Puppet Common Modules
Created May 22, 2015 17:29
Adding Puppet common modules as submodules.
git submodule add git@github.com:GianlucaCandiotti/puppet-nodejs.git vagrant-env/puppet/modules/nodejs
git submodule add git@github.com:GianlucaCandiotti/puppetlabs-stdlib.git vagrant-env/puppet/modules/stdlib
git submodule add git@github.com:GianlucaCandiotti/puppet-wget.git vagrant-env/puppet/modules/wget
git submodule add git@github.com:GianlucaCandiotti/puppetlabs-apt.git vagrant-env/puppet/modules/apt
@gianlucacandiotti
gianlucacandiotti / Basic default.pp
Last active August 29, 2015 14:21
Basic default.pp configuration.
# Requires nodejs, stdlib, apt and wget modules.
Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] }
exec { 'apt-get update':
command => 'apt-get update',
timeout => 60,
tries => 3,
}
@gianlucacandiotti
gianlucacandiotti / Mongo ready default.pp
Created May 22, 2015 17:51
Basic default .pp configuration with Mongodb manual install.
# Requires nodejs, stdlib, apt and wget modules.
Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] }
exec { 'apt-get update':
command => 'apt-get update',
timeout => 60,
tries => 3,
}
#!/bin/bash
files=$(git diff --cached --name-only | grep '\.js$')
# Prevent ESLint help message if no files matched
if [[ $files = "" ]] ; then
exit 0
fi
echo $files | xargs eslint
// Params to filter
$params = [
'param_1',
'param_2',
'param_3'
];
// an array of objects
$objects_array = [];
$data = [];
@gianlucacandiotti
gianlucacandiotti / after.sh
Created December 9, 2015 03:42
Vagrant shell provisioning - gvm, go1.5.2 and godep
#!/bin/bash
sudo apt-get install bison -y --force-yes
sudo -u vagrant -H bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
sudo -u vagrant -H bash -c 'echo "source $HOME/.gvm/scripts/gvm" >> $HOME/.bashrc'
sudo -u vagrant -H bash -c 'source $HOME/.gvm/scripts/gvm; gvm install go1.4'
sudo -u vagrant -H bash -c 'source $HOME/.gvm/scripts/gvm; gvm use go1.4 --default'
sudo -u vagrant -H bash -c 'source $HOME/.gvm/scripts/gvm; gvm install go1.5.2'
sudo -u vagrant -H bash -c 'source $HOME/.gvm/scripts/gvm; gvm use go1.5.2 --default'
sudo -u vagrant -H bash -c 'source $HOME/.gvm/scripts/gvm; go get github.com/kr/godep'