Skip to content

Instantly share code, notes, and snippets.

@jerrylopez
jerrylopez / grabbit.js
Created April 25, 2014 15:26
This is a simple jQuery plugin that lets you grab the url parameter value and append it to any input you'd like.
// This is a simple jQuery plugin that lets you grab the url parameter value and append it to any input you'd like .
//
// Example:
// Your url is : http://myurl.com/?name=Jerry&last=Lopez&age=21
//
// Now lets say you have a form that you want prefilled when a user visit the form. You can
// can accomplish that with grabbit it will pull the name, last and age parameters then add
// them to the input fields you specify.
//
// Usage:
@jerrylopez
jerrylopez / checkallboxes.js
Created May 19, 2014 19:38
Check all checkboxes
/*
*
* Found at : http://jsfiddle.net/YxUHw/
*
* You can use this to check all check boxes just in case you have a crap load
* and there is no checkall button.
*
*/
(function () {
var checkboxes = document.querySelectorAll('input[type=checkbox]');
@jerrylopez
jerrylopez / clear_cms.sql
Created June 12, 2014 18:42
Clear the CMS Static Blocks and Pages from Magento database in one swoop!
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE `cms_block`;
TRUNCATE TABLE `cms_block_store`;
TRUNCATE TABLE `cms_page`;
TRUNCATE TABLE `cms_page_store`;
SET FOREIGN_KEY_CHECKS = 1;
@jerrylopez
jerrylopez / csv_to_array.php
Last active September 11, 2015 14:50 — forked from jaywilliams/csv_to_array.php
Convert a comma separated file into an associated array.
<?php
/**
* Convert a comma separated file into an associated array.
* The first row should contain the array keys.
*
* Example:
*
* @param string $filename Path to the CSV file
* @param string $delimiter The separator used in the file
* @return array
@jerrylopez
jerrylopez / magento-secure-img-url.php
Created December 2, 2015 15:10
Magento image URL secure or non-secure based on page being secure or not.
<?php echo $this->getSkinUrl(‘images/ sampleimage.gif’,array(‘_secure’=> Mage::app()->getStore()->isCurrentlySecure())) ?>
@jerrylopez
jerrylopez / export.sql
Created February 7, 2017 21:32 — forked from sashas777/export.sql
Export Magento Related, Crosssell, Upsell Products from Database
/* Related Products */
SELECT e.sku as sku, GROUP_CONCAT(ee.sku) as related_product FROM catalog_product_link l
INNER JOIN catalog_product_entity e on e.entity_id=l.product_id
INNER JOIN catalog_product_entity ee on ee.entity_id=l.linked_product_id
WHERE l.link_type_id=1
GROUP BY e.sku
/* Crosssell Products */
SELECT e.sku as sku, GROUP_CONCAT(ee.sku) as crossel_product FROM catalog_product_link l
INNER JOIN catalog_product_entity e on e.entity_id=l.product_id
@jerrylopez
jerrylopez / API.md
Created April 20, 2017 00:48 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@jerrylopez
jerrylopez / check_docker_container.sh
Created April 26, 2017 18:30 — forked from ekristen/check_docker_container.sh
Bash Script for Nagios to Check Status of Docker Container
#!/bin/bash
# Author: Erik Kristensen
# Email: erik@erikkristensen.com
# License: MIT
# Nagios Usage: check_nrpe!check_docker_container!_container_id_
# Usage: ./check_docker_container.sh _container_id_
#
# Depending on your docker configuration, root might be required. If your nrpe user has rights
# to talk to the docker daemon, then root is not required. This is why root privileges are not
@jerrylopez
jerrylopez / test.attr.php
Created August 17, 2017 16:27 — forked from DevertNet/test.attr.php
Magento Adding existing attribute to all attribute sets
<?php
/*
replace show_in_price_search_engine with your attr code
replace General with antoher Tab
*/
$dir = dirname(__FILE__);
chdir($dir);
@jerrylopez
jerrylopez / get_latest_release.sh
Created September 7, 2017 06:09 — forked from lukechilds/get_latest_release.sh
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4