Skip to content

Instantly share code, notes, and snippets.

View elioermini's full-sized avatar

Elio Ermini elioermini

View GitHub Profile
@elioermini
elioermini / TestApp.php
Last active August 22, 2016 13:36
Magento 2 Testing Playground
<?php
class TestApp extends \Magento\Framework\App\Http
{
public function launch()
{
$test = $this->_objectManager->create(\Namespace\of\Class\ClassName::class);
// all you want here
$test->foo('foo','bar');
@elioermini
elioermini / confirmleave.js
Created August 25, 2015 16:32
Script to Confirm form Submission when edited
/**
* Created by Elio on 16/07/15.
*/
jQuery(document).ready(function() {
var formmodified=0;
console.log(formmodified);
jQuery('form *').keyup(function(){
formmodified=1;
console.log(formmodified);
});
@elioermini
elioermini / php.ini
Created August 11, 2015 11:34
php.ini
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
; PHP attempts to find and load this configuration from a number of locations.
; The following is a summary of its search order:

Magento Code Snippets

Download extension manually using mage

./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@elioermini
elioermini / gist:0a5d7138db7e0d2c864c
Created October 20, 2014 12:19
Thumbs not creator maybe one day
<?php
require('config.php');
$category_info = $_GET["image"];
echo "<img src=".HTTP_IMAGE.$category_info." />";
$img = resize($category_info, 380, 300);
echo $img;
echo "<img src=".HTTP_IMAGE.$img." />";