Skip to content

Instantly share code, notes, and snippets.

View enricodeleo's full-sized avatar

Enrico Deleo enricodeleo

View GitHub Profile
@enricodeleo
enricodeleo / .bash_profile
Last active December 4, 2015 11:17
Bash Profile OS X
# 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
@enricodeleo
enricodeleo / s3-single-user-policy
Created April 9, 2015 13:26
Give just objects-related permissions to an user on S3
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "POLICYID",
"Effect": "Allow",
"Action": [
"s3:AbortMultipartUpload",
"s3:DeleteObject",
"s3:DeleteObjectVersion",
@enricodeleo
enricodeleo / s3-single-directory-policy
Last active August 29, 2015 14:18
Deny access to a subdirectory on S3
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "DenyPublicRead",
"Effect": "Deny",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",

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 / ng-scroller.js
Last active August 29, 2015 14:05
ng-scroller: Performant infinite scrolling AngularJS directive with UITableView-like element reusal (http://ngscroller.herokuapp.com/)
/* 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
@enricodeleo
enricodeleo / my.cnf
Created March 1, 2014 14:15
MySQL optimized my.cnf for Magento store on 1GB ram VPS
[mysqld]
# GENERAL #
user = mysql
default-storage-engine = InnoDB
socket = /var/lib/mysql/mysql.sock
pid-file = /var/lib/mysql/mysql.pid
# MyISAM #
key-buffer-size = 32M
SET FOREIGN_KEY_CHECKS=0;
-- Here's where we reset the orders
TRUNCATE `sales_flat_order`;
TRUNCATE `sales_flat_order_address`;
TRUNCATE `sales_flat_order_grid`;
TRUNCATE `sales_flat_order_item`;
TRUNCATE `sales_flat_order_status_history`;
TRUNCATE `sales_flat_quote`;
TRUNCATE `sales_flat_quote_address`;
@enricodeleo
enricodeleo / taxonomies.php
Last active December 1, 2022 16:21
Get and list all the taxonomies attached to a custom post type in Wordpress
<?php
$taxonomy_objects = get_object_taxonomies( 'cpt', 'objects' ); // <--- change cpt with the custom post type
$out = array();
foreach ( $taxonomy_objects as $taxonomy_slug => $taxonomy ){
$terms = get_terms( $taxonomy_slug, 'hide_empty=0' );
if ( !empty( $terms ) ) {
$out[] = "<strong>" . $taxonomy->label . "</strong>\n<ul>";
foreach ( $terms as $term ) {
$out[] =
" <li>"
<?php
require_once(dirname(__FILE__) . '/csscrush/CssCrush.php');
$options = array(
'debug' => true,
'cache' => false,
'versioning' => false
);
$compiled_file = csscrush_file( dirname(__FILE__) .'/css/style.css', $options );
?>
<link rel="stylesheet" type="text/css" href="<?php echo $compiled_file; ?>" media="all" />