Skip to content

Instantly share code, notes, and snippets.

@carlosasin
carlosasin / validate_spanish_id.js
Last active April 5, 2017 17:30 — forked from skarcha/validate_spanish_id.js
Magento validation dni/nif/nie
/**
* ValidateSpanishID. Returns the type of document and checks its validity.
*
* Usage:
* ValidateSpanishID( str );
*
* > ValidateSpanishID( '12345678Z' );
* // { type: 'dni', valid: true }
*
* > ValidateSpanishID( 'B83375575' );
@carlosasin
carlosasin / magento-nginx.conf
Created October 13, 2015 12:35 — forked from gwillem/magento-nginx.conf
Battle-tested Nginx configuration for Magento (source: www.hypernode.com)
# This is an annotated subset of the Nginx configuration from our Magento production platform @ www.hypernode.com
# See https://www.byte.nl/blog/magento-cacheleak-issue
user app;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
}
@carlosasin
carlosasin / .gitignore
Created August 14, 2015 10:25
Git ignore Magento
# Ignore PHPStorm
/.idea/
/.phpstorm.meta.php
#Ignore vagrant
/.vagrant/
# Ignore code coverage reports
/build/
<?php
require_once('app/Mage.php');
Mage::app();
$stores = array_map(function($store) {
return $store->getId();
}, Mage::app()->getStores(true));
foreach ($stores as $store_id) {
// Setup app emulation
@carlosasin
carlosasin / console.js
Last active August 29, 2015 14:15 — forked from jonmunson/console.js
console.log('%c Oh I see, you wanna check out my code! ', 'background: #bada55; color: #222');
local 192.168.2.0 # SWAP THIS NUMBER WITH YOUR RASPBERRY PI IP ADDRESS
dev tun
proto udp #Some people prefer to use tcp. Don't change it if you don't know.
port 1194
ca /etc/openvpn/easy-rsa/keys/ca.crt
cert /etc/openvpn/easy-rsa/keys/Server.crt # SWAP WITH YOUR CRT NAME
key /etc/openvpn/easy-rsa/keys/Server.key # SWAP WITH YOUR KEY NAME
dh /etc/openvpn/easy-rsa/keys/dh1024.pem # If you changed to 2048, change that here!
server 10.8.0.0 255.255.255.0
# server and remote endpoints
@carlosasin
carlosasin / foundation5-accordion-animate.html
Last active August 29, 2015 14:15 — forked from jonmunson/foundation5-accordion-animate.html
JS - Foundation nimate accordion
<script src="/bower_components/foundation/js/foundation/foundation.accordion.js"></script>
<script>
//reflow after page load
$(document).foundation('accordion', 'reflow');
//animate open/close
$(".accordion dd").on("click", "a:eq(0)", function (event) {
var dd_parent = $(this).parent();
@carlosasin
carlosasin / removeorders.sql
Created October 28, 2014 00:09
Magento - Remove orders
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE `sales_flat_creditmemo`;
TRUNCATE `sales_flat_creditmemo_comment`;
TRUNCATE `sales_flat_creditmemo_grid`;
TRUNCATE `sales_flat_creditmemo_item`;
TRUNCATE `sales_flat_invoice`;
TRUNCATE `sales_flat_invoice_comment`;
TRUNCATE `sales_flat_invoice_grid`;
TRUNCATE `sales_flat_invoice_item`;
TRUNCATE `sales_flat_order`;
@carlosasin
carlosasin / permission.sh
Created October 2, 2014 08:26
Magento - Repair permissions
#!/bin/sh
sudo find . -type f -exec chmod 644 {} \;
sudo find . -type d -exec chmod 755 {} \;
sudo chmod o+w var app/etc
sudo chmod 550 mage
sudo chmod -R o+w media
@carlosasin
carlosasin / iOS-7-web-app.html
Last active August 27, 2022 00:25 — forked from tfausak/ios-8-web-app.html
HTML - headers web app ios
<!doctype html>
<html>
<head>
<!-- Run in full-screen mode. -->
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- Make the status bar black with white text. -->
<meta name="apple-mobile-web-app-status-bar-style" content="black">