Skip to content

Instantly share code, notes, and snippets.

View acataluddi's full-sized avatar

Adriano C. acataluddi

View GitHub Profile
@acataluddi
acataluddi / collectionFilter.php
Created August 2, 2017 14:22
Filtros de collection do produto.
<?php
// Get All Products of a category
$collection = Mage::getResourceModel('catalog/product_collection')
->setStoreId($this->getStoreId())
->addCategoryFilter($category);
// In this the addCategoryFilter() function, is used to get all products of a particular category. So, if you want to get all products of a certain category use this function.
// Visibility Filter
$collection = Mage::getResourceModel('catalog/product_collection');
@acataluddi
acataluddi / Apache Tomcat 8 Start stop script init.d script
Created September 27, 2017 20:05 — 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
#!/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
@acataluddi
acataluddi / local.xml
Created February 5, 2018 17:42 — forked from raivis-vitols/local.xml
Magento local.xml layout file boilerplate
<?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-->
# 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 / Android Privacy Policy Template
Created December 8, 2018 13:28 — 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.
<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
@acataluddi
acataluddi / User.php
Created February 3, 2019 20:10 — forked from Ocramius/User.php
Doctrine 2 ManyToMany - the correct way
<?php
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity()
* @ORM\Table(name="user")
*/
class User
@acataluddi
acataluddi / mysql-drop-all-tables.sh
Created September 18, 2019 21:08 — forked from cweinberger/mysql-drop-all-tables.sh
drops all tables of a specific db
#!/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 / git-recover-branch.md
Created February 22, 2020 18:07 — forked from jbgo/git-recover-branch.md
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
acataluddi / Build NPM Package.md
Last active April 8, 2020 17:37 — forked from tmpvar/my-first-module.md
how to create your very first node.js module and publish it to the npm registry

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 / fiddle.js
Created September 11, 2020 14:42 — forked from rlmcneary2/fiddle.js
Demonstrate use of jQuery $.ajax with an array of jqXHR Deferred Promise objects passed to the $.when function.
// 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/",