Skip to content

Instantly share code, notes, and snippets.

Enrico Deleo enricodeleo

Block or report user

Report or block enricodeleo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@enricodeleo
enricodeleo / ng-scroller.js
Last active Aug 29, 2015
ng-scroller: Performant infinite scrolling AngularJS directive with UITableView-like element reusal (http://ngscroller.herokuapp.com/)
View ng-scroller.js
/* jshint ignore:start */
(function(){'use strict';var h,n=this;
function aa(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";else if("function"==
b&&"undefined"==typeof a.call)return"object";return b}function p(a){return"array"==aa(a)}function r(a){return a[ba]||(a[ba]=++ca)}var ba="closure_uid_"+(1E9*Math.random()>>>0),ca=0;function da(a,b,c){return a.call.apply(a.bind,arguments)}
function ea(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arg
View hhvm_magento_setup.md

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
@enricodeleo
enricodeleo / s3-single-directory-policy
Last active Aug 29, 2015
Deny access to a subdirectory on S3
View s3-single-directory-policy
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "DenyPublicRead",
"Effect": "Deny",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
@enricodeleo
enricodeleo / s3-single-user-policy
Created Apr 9, 2015
Give just objects-related permissions to an user on S3
View s3-single-user-policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "POLICYID",
"Effect": "Allow",
"Action": [
"s3:AbortMultipartUpload",
"s3:DeleteObject",
"s3:DeleteObjectVersion",
@enricodeleo
enricodeleo / smart-log.js
Last active Aug 29, 2015
A hopefully smart solution for console.logging messages during development without affecting production apps
View smart-log.js
DEVELOPMENT = true; //global variable, I use this to adapt my js app behavior accordingly
// I want console.log just during development
if ( DEVELOPMENT ) {
smLog = function(log, type) {
var args = [ 'log', 'info', 'debug', 'warn', 'error' ]; // valid methods for `console`
var type = type || 'log'; // the second argument is optional, defaults to log
var type = ( args.indexOf( type ) ) > -1 ? type : 'log'; // defaults to log if the second argument is not valid (eg a typo)
console[type](log);
};
@enricodeleo
enricodeleo / sdxc-reload.sh
Created Jun 22, 2015
Reload SD Card reader on OS X
View sdxc-reload.sh
sudo kextunload /System/Library/Extensions/AppleStorageDrivers.kext/Contents/PlugIns/AppleUSBCardReader.kext;
sudo kextload /System/Library/Extensions/AppleStorageDrivers.kext/Contents/PlugIns/AppleUSBCardReader.kext
@enricodeleo
enricodeleo / arrayAppend.js
Created Nov 30, 2015
Extend an Array appending elements of another Array in Javascript
View arrayAppend.js
// Shorthand function
Array.prototype.append = function(array) {
this.push.apply(this, array)
}
// Example
var a = [1,2];
var b = [3,4];
a.append(b); // 'a' bacames [ 1, 2, 3, 4 ]
@enricodeleo
enricodeleo / .bash_profile
Last active Dec 4, 2015
Bash Profile OS X
View .bash_profile
# Brew bash complation (brew install bash-completion)
# you must install brew http://brew.sh/
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
# Brew's NVM (brew install nvm)
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
View gist:4756208

Magento Snippets

Download extension manually using pear/mage

Pear for 1.4, mage for 1.5. File downloaded into /downloader/.cache/community/

./pear download magento-community/Shipping_Agent
./mage download community Shipping_Agent

Clear cache/reindex

You can’t perform that action at this time.