Skip to content

Instantly share code, notes, and snippets.

View xus's full-sized avatar
:octocat:
Coding

Jesús López xus

:octocat:
Coding
  • NetRivals / Lengow
  • Girona / Barcelona
View GitHub Profile
@xus
xus / Google Analytics PHP Sample ReadME
Created November 19, 2020 11:26 — forked from LindaLawton/Google Analytics PHP Sample ReadME
Oauth example for PHP and the Google Analytics reporting api v4 with pagination.
For service account auth include:
require_once __DIR__ . '/ServiceAccount.php';
For Oauth2 include:
require_once __DIR__ . '/Oauth2Authentication.php';
Note: To reset the auth for oauth to just unset the sessions
@xus
xus / DirectoryStructure
Created June 11, 2020 12:18 — forked from satooshi/DirectoryStructure
Directory structure of Domain Driven Design application with Symfony2, Doctrine2.
sf2-ddd
├── app
├── bin
├── build
├── lib
├── src
│   └── __VendorPrefix
│   ├── Application
│   │   └── __DomainNameBundle
│   │   ├── Command
@xus
xus / cleanup_uft8_class.php
Created May 23, 2017 12:13 — forked from zeroasterisk/cleanup_uft8_class.php
A PHP class to cleanup strings to be UTF8
<?php
/* Standardized data cleanup helper class */
class Cleanup {
/**
* Make a string into UTF8 compliant... cleans funcky input characters
* @param mixed $str
* @return mixed $str
*/
static function makeUTF8($str) {
if (is_array($str)) {
@xus
xus / gist:7cf5d016b033dbb48dbb25aac3038e7f
Created May 23, 2017 08:52
Best way to remove whitespaces and linebreaks in PHP
// Sometimes the whitespaces contains bullshit and we need to clean this mess.
// I saw the light here --> http://heavydots.com/blog/when-the-white-space-became-a-beast
// Same with breaklines.
$ascii_whitespaces = chr(194).chr(160);
$ascii_breaklines = chr(13).chr(10);
$to_replace = array ($ascii_whitespaces, $ascii_breaklines);
$replace_to = array (' ', '');

Magento Code Snippets

Download extension manually using mage

./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name
@xus
xus / removeattribute.php
Last active August 29, 2015 14:19
Magneto - Programmatically remove Customer Attribute via file php in the root directory
<!-- PUT THIS CODE IN ONE PHP FILE IN THE ROOT DIRECTORY -->
<?php
error_reporting(E_ALL | E_STRICT);
include 'app/Mage.php';
Mage::app();
Mage::setIsDeveloperMode(true);
umask(0);
$attributeCode = "barrio"; //Put here your attribute code
@xus
xus / gist:beee57bdbfffab34a9b7
Created March 30, 2015 15:04
Objects to array ( Perfect to consume SOAP )
function obj2array($obj) {
$out = array();
foreach ($obj as $key => $val) {
switch(true) {
case is_object($val):
$out[$key] = obj2array($val);
break;
case is_array($val):
$out[$key] = obj2array($val);
break;

Chevron HTML-CSS

Chevron effect for headers or separators in page. Efecte Chevron per les capçaleres o separadors de pàgina. Efecto Chevron para los encabezados o separadores de página.

A Pen by xus on CodePen.

License.

@xus
xus / gist:4729930
Created February 7, 2013 09:50
Evitar el modo compatibilidad del IE
<meta http-equiv='X-UA-Compatible' content='IE=8'/>
@xus
xus / gist:4729926
Created February 7, 2013 09:49
Evitar que Skype modifique tu diseño con su link e imagen personalizados
<meta name='SKYPE_TOOLBAR' content='SKYPE_TOOLBAR_PARSER_COMPATIBLE' />