Skip to content

Instantly share code, notes, and snippets.


Adriano C. acataluddi

View GitHub Profile
acataluddi / opt1_template.j2
Created May 6, 2021 — forked from halberom/opt1_template.j2
ansible - example of template if else
View opt1_template.j2
{# style 1 - long form #}
{% if filepath == '/var/opt/tomcat_1' %}
{% set tomcat_value = tomcat_1_value %}
{% else %}
{% set tomcat_value = tomcat_2_value %}
{% endif %}
{# style 2 - short form #}
{% set tomcat_value = tomcat_1_value if (filepath == '/var/opt/tomcat_1') else tomcat_2_value %}
acataluddi / fiddle.js
Created Sep 11, 2020 — forked from rlmcneary2/fiddle.js
Demonstrate use of jQuery $.ajax with an array of jqXHR Deferred Promise objects passed to the $.when function.
View fiddle.js
// Seeing this through jsfiddle?
// Get the source from github gist:
// Create an array with two jqXHR objects from two separate $.ajax calls.
var arrJqx = [];
// This call has no delay and the response will come back from the server
// almost immediately.
arrJqx.push($.ajax ({
url: "/echo/json/",
acataluddi / Build NPM
Last active Apr 8, 2020 — forked from tmpvar/
how to create your very first node.js module and publish it to the npm registry
View Build NPM

Building an NPM package

This is pretty simple, lets dive in!

Choose a name

Find a name that isn't taken and clearly describes what your module is doing

$ npm view your-first-node-module
acataluddi /
Created Feb 22, 2020 — forked from jbgo/
How to recover a git branch you accidentally deleted

UPDATE: A better way! (August 2015)

As pointed out by @johntyree in the comments, using git reflog is easier and more reliable. Thanks for the suggestion!

 $ git reflog
1ed7510 HEAD@{1}: checkout: moving from develop to 1ed7510
3970d09 HEAD@{2}: checkout: moving from b-fix-build to develop
1ed7510 HEAD@{3}: commit: got everything working the way I want
70b3696 HEAD@{4}: commit: upgrade rails, do some refactoring
acataluddi / change_ini_file_preserving_symlinks.yml
Created Oct 11, 2019
Modify a symlinked INI file avoiding the Ansible's bug replacing the symlink with a copy of the target file
View change_ini_file_preserving_symlinks.yml
acataluddi /
Created Sep 18, 2019 — forked from cweinberger/
drops all tables of a specific db
#usage: mysql-drop-all-tables -d database -u dbuser -p dbpass
while getopts d:u:p: option
case "${option}"
acataluddi / User.php
Created Feb 3, 2019 — forked from Ocramius/User.php
Doctrine 2 ManyToMany - the correct way
View User.php
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
* @ORM\Entity()
* @ORM\Table(name="user")
class User
acataluddi / Android Privacy Policy Template
Created Dec 8, 2018 — forked from alphamu/Android Privacy Policy Template
A template for creating your own privacy policy for Android apps. Look for "[" and "<!--" to see where you need to edit this app in order to create your own privacy olicy.
View Android Privacy Policy Template
<h2>Privacy Policy</h2>
<p>[Individual or Company Name] built the [App Name] app as a [open source | free | freemium | ad-supported | commercial] app. This SERVICE is provided by [Individual or company name] [at no cost] and is intended
for use as is.</p>
<p>This page is used to inform website visitors regarding [my|our] policies with the collection, use, and
disclosure of Personal Information if anyone decided to use [my|our] Service.</p>
<p>If you choose to use [my|our] Service, then you agree to the collection and use of information in
relation with this policy. The Personal Information that [I|we] collect are used for providing and
improving the Service. [I|We] will not use or share your information with anyone except as described
# see
# core
brew install coreutils
# key commands
brew install binutils
brew install diffutils
brew install ed --default-names
brew install findutils --with-default-names
acataluddi / local.xml
Created Feb 5, 2018 — forked from raivis-vitols/local.xml
Magento local.xml layout file boilerplate
View local.xml
<?xml version="1.0"?>
<!--Head Block Modifications For All Pages-->
<reference name="head">
<!-- Add CSS and JS, Files From Skin Folder -->
<action method="addItem"><type>skin_css</type><name>css/styles.css</name></action>
<action method="addItem"><type>skin_js</type><name>js/script.js</name></action>
<!--Remove CSS and JS, Files From Skin Folder-->