Skip to content

Instantly share code, notes, and snippets.

@zhannes
zhannes / jquery.demo-plugin.js
Created July 29, 2011 20:18
A cleaner approach to jquery plugins. Model one instance of an object to be applied to each element returned in the wrapped set for your plugin. Separate the code for the plugin's functionality from the assignment into the jQuery namespace. Taken from var
(function( $ ){
/*
A cleaner approach to jquery plugins. Separate the code for the plugin's functionality from
the assignment into the jQuery namespace.
Taken from various articles/presos by Alex Sexton and Paul Irish, and #jquery IRC chats.
With enthusiasm for Object.create() toned down after http://news.ycombinator.com/item?id=2594521
*/
@parhamr
parhamr / 0: Magento 1.12 Enterprise multi-store cluster configuration.md
Last active October 13, 2023 14:20
A highly available, fault tolerant, distributed, and load balanced LEMP cluster.
@SchumacherFM
SchumacherFM / Magento-HHVM.md
Last active May 17, 2018 18:26
Running Magento Enterprise Edition with Facebook HipHop HHVM

Running Magento Enterprise Edition with Facebook HipHop HHVM

Prerequisites

Hardware

MacBook Air (MBA) Mid 2012

delimiter ;;
drop procedure if exists build_catalog;;
create procedure build_catalog(IN categories INT, IN products INT)
begin
SET @category_count = 1;
SET @CATNAMEPREFIX = "Category ";
SET @CATURLKEYPREFIX = "cat-";
SET @CATURLPATHPREFIX = "catpath-";
SET @ROOTCATEGORY = 2;
SET @INCLUDEINMENU = 1;
@tegansnyder
tegansnyder / hhvm_magento_setup.md
Last active July 14, 2023 22:30
HHVM Magento Server Setup

I've had the opertunity to try a variety of different server configurations but never really got around to trying HHVM with Magento until recently. I thought I would share a detailed walkthrough of configuring a single instance Magento server running Nginx + Fast CGI + HHVM / PHP-FPM + Redis + Percona. For the purpose of this blog post I'm assuming you are using Fedora, CentOS, or in my case RHEL 6.5.

Please note: I'm 100% open to suggestions. If you see something I did that needs to be done a different way, please let me know. I haven't included my Perconca my.conf file yet. I will shortly. Also I plan on trying this same test with HHVM 3.3 and PHP 7.

Install the EPEL, Webtatic, and REMI repos

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
@aleron75
aleron75 / shell_delete_unused_images
Last active August 22, 2024 16:57
Delete no more used Product Images on Magento 1
<?php
require_once 'abstract.php';
class Mage_Shell_CheckImages extends Mage_Shell_Abstract
{
const CATALOG_PRODUCT = '/catalog/product';
const CACHE = '/cache/';
protected function _glob_recursive($pattern, $flags = 0)
@JPaulDuncan
JPaulDuncan / validation-vin.js
Last active March 2, 2023 21:37
VIN Validation (Vehicle Identification Number)
function validateVin(vin) {
if (vin == "11111111111111111") { return false; }
if (!vin.match("^([0-9a-hj-npr-zA-HJ-NPR-Z]{10,17})+$")) { return false;}
var letters = [{ k: "A", v: 1 }, { k: "B", v: 2 }, { k: "C", v: 3 },
{ k: "D", v: 4 }, { k: "E", v: 5 }, { k: "F", v: 6 }, { k: "G", v: 7 },
{ k: "H", v: 8 }, { k: "J", v: 1 }, { k: "K", v: 2 }, { k: "L", v: 3 },
{ k: "M", v: 4 }, { k: "N", v: 5 }, { k: "P", v: 7 }, { k: "R", v: 9 },
{ k: "S", v: 2 }, { k: "T", v: 3 }, { k: "U", v: 4 }, { k: "V", v: 5 },
{ k: "W", v: 6 }, { k: "X", v: 7 }, { k: "Y", v: 8 }, { k: "Z", v: 9 }];
var weights = [8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2];
@gaulinmp
gaulinmp / similarity_example.ipynb
Last active April 4, 2024 04:33
N-Gram Similarity Comparison
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
'use strict';
let request = require('request');
module.exports = function(config) {
if (!config) {
config = {};
}
if (!config.rasa_uri) {
@ProcessEight
ProcessEight / Magento 1 stack configs.md
Last active April 21, 2018 04:24
Sample config files for the Magento 1 LEMP stack

Magento 1 stack configs

Nginx

nginx.conf

user www-data;
worker_processes 4;
pid /run/nginx.pid;