Skip to content

Instantly share code, notes, and snippets.

Avatar

Adriano C. acataluddi

  • Rome - Italy
View GitHub Profile
@acataluddi
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: https://gist.github.com/1873879
// 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
acataluddi / Build NPM Package.md
Last active Apr 8, 2020 — forked from tmpvar/my-first-module.md
how to create your very first node.js module and publish it to the npm registry
View Build NPM Package.md

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
acataluddi / git-recover-branch.md
Created Feb 22, 2020 — forked from jbgo/git-recover-branch.md
How to recover a git branch you accidentally deleted
View git-recover-branch.md

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
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
acataluddi / mysql-drop-all-tables.sh
Created Sep 18, 2019 — forked from cweinberger/mysql-drop-all-tables.sh
drops all tables of a specific db
View mysql-drop-all-tables.sh
#!/bin/bash
#usage: mysql-drop-all-tables -d database -u dbuser -p dbpass
TEMP_FILE_PATH='./drop_all_tables.sql'
while getopts d:u:p: option
do
case "${option}"
in
@acataluddi
acataluddi / User.php
Created Feb 3, 2019 — forked from Ocramius/User.php
Doctrine 2 ManyToMany - the correct way
View User.php
<?php
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity()
* @ORM\Table(name="user")
*/
class User
@acataluddi
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
<html>
<body>
<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
View homebrew-install-gnu.sh
# see https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/
# core
brew install coreutils
# key commands
brew install binutils
brew install diffutils
brew install ed --default-names
brew install findutils --with-default-names
@acataluddi
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"?>
<layout>
<default>
<!--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-->
@acataluddi
acataluddi / Apache Tomcat 8 Start stop script init.d script
Created Sep 27, 2017 — forked from miglen/Apache Tomcat 8 Start stop script init.d script
Apache Tomcat init script (or startup/controll script). Works fine for version 7/8. Read the comments for release history. Feel free to modify, copy and give suggestions. (c) GNU General Public License
View Apache Tomcat 8 Start stop script init.d script
#!/bin/bash
#
# description: Apache Tomcat init script
# processname: tomcat
# chkconfig: 234 20 80
#
#
# Copyright (C) 2014 Miglen Evlogiev
#
# This program is free software: you can redistribute it and/or modify it under
You can’t perform that action at this time.