Skip to content

Instantly share code, notes, and snippets.

View oliver-montes's full-sized avatar

Oliver Montes oliver-montes

View GitHub Profile
@oliver-montes
oliver-montes / php.ini
Created March 6, 2013 12:47
PHP Warning: Unknown: Input variables exceeded 1000 y Magento para el limite formularios grandes, etc...
##
## Tener en cuenta si teneis el suhosin pach o similar.
##
suhosin.post.max_vars = 3000
suhosin.request.max_vars = 3000
max_input_vars = 3000
@oliver-montes
oliver-montes / writeisomac.sh
Created March 4, 2013 11:25
Grabar imagen ISO en USB desde Mac OS
### Find Block Device
diskutil list
### Unmount USB Stick
diskutil unmountDisk /dev/diskX
### Write ISO to USB
# https://github.com/SachaG/Telescope
########################
# it should be
sudo apt-get install git npm
curl https://install.meteor.com | /bin/sh
sudo npm install -g meteorite
<action type="dataflow/convert_parser_csv" method="parse">
<var name="delimiter"><![CDATA[,]]></var>
<var name="enclose"><![CDATA[]]></var>
<var name="fieldnames"></var>
<var name="map">
<map name="sku"><![CDATA[sku]]></map>
<map name="image"><![CDATA[image]]></map>
<map name="image_label"><![CDATA[image_label]]></map>
<map name="small_image"><![CDATA[small_image]]></map>
<map name="small_image_label"><![CDATA[small_image_label]]></map>
@oliver-montes
oliver-montes / args.php
Created January 14, 2013 12:05
PHP args shell class
<?php
// A quick and dirty command line argument parser. Written in about
// an hour, so you might want to take this with a grain of salt or two.
//
// Single letter options should be prefixed with a single
// dash and can be grouped together. Examples:
//
// cmd -a
// cmd -ab
@oliver-montes
oliver-montes / script.js
Created January 8, 2013 22:06
Compruebo si el Select no esta hidden, si lo esta oculto el DIV que utiliza el plugin jQuery.uniform
jQuery(function(){
// Start uniForm
jQuery("select, input:radio, input:checkbox").uniform();
updateSelect();
//solo compruebo si el select cambia
jQuery("select").change(function(){ updateSelect(); });
function updateSelect()
{
@oliver-montes
oliver-montes / restclient.php
Created January 7, 2013 23:05
Fichero PHP que lista todos los productos de una tienda magento y los muestra serializados en JSON
<?php
/**
* Error reporting
*/
error_reporting(E_ALL | E_STRICT);
/**
* Compilation includes configuration file
*/
<?php
/**
* Copyright Magento 2012
* Example of products list retrieve using Customer account via Magento
REST API. OAuth authorization is used
*/
$callbackUrl = "http://yourhost/oauth_customer.php";
$temporaryCredentialsRequestUrl =
"http://magentohost/oauth/initiate?oauth_callback=" .
urlencode($callbackUrl);
require 'etc'
require 'fileutils'
# Copies the most recent MAX_IMAGES photos/videos from the device image dir.
# I use Dropbox to sync my device images to my workstation disk
MAX_IMAGES=500
USER_HOME_DIR = Etc::getpwuid.dir
DEVICE_IMAGES_DIR="#{USER_HOME_DIR}/Dropbox/Camera Uploads"
SIMULATOR_IMAGES_DIR="#{USER_HOME_DIR}/Library/Application Support/iPhone Simulator/5.1/Media/DCIM/100APPLE"
@oliver-montes
oliver-montes / mage-constraints.sql
Created November 14, 2012 16:20 — forked from cgdangelo/mage-constraints.sql
Recreate foreign keys for a Magento installation, after you fire the idiot who deleted all of them.
# one-liner for generating this: mysqldump --no-data -uroot magento1600 | nawk '{if(match($0, /CREATE TABLE `(.*)`/, matchesT)) { the_table = matchesT[1]; } if(match($0, /(CONSTRAINT .*),?/, matchesK) && the_table) { the_key = gensub(/,?$/, "", matchesK[1]); the_key = gensub(/^ */, "", the_key); print "ALTER TABLE `" the_table "` ADD", the_key ";"; }}'
ALTER TABLE `admin_rule` ADD CONSTRAINT `FK_ADMIN_RULE_ROLE_ID_ADMIN_ROLE_ROLE_ID` FOREIGN KEY (`role_id`) REFERENCES `admin_role` (`role_id`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `api_rule` ADD CONSTRAINT `FK_API_RULE_ROLE_ID_API_ROLE_ROLE_ID` FOREIGN KEY (`role_id`) REFERENCES `api_role` (`role_id`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `api_session` ADD CONSTRAINT `FK_API_SESSION_USER_ID_API_USER_USER_ID` FOREIGN KEY (`user_id`) REFERENCES `api_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `catalog_category_entity_datetime` ADD CONSTRAINT `FK_CAT_CTGR_ENTT_DTIME_ATTR_ID_EAV_ATTR_ATTR_ID` FOREIGN KEY (`attribute_id