Skip to content

Instantly share code, notes, and snippets.

View crewstyle's full-sized avatar
💭
Good mood! Wanna try new tools for WordPress

Achraf Chouk crewstyle

💭
Good mood! Wanna try new tools for WordPress
View GitHub Profile
@crewstyle
crewstyle / find-parameter-clientid-from-ga.js
Created February 15, 2017 10:03
How to get a parameter's value from URL and set a client ID into GA tracker, to retrieve it later
/**
* Retrieve parameter from URL
*/
function findParameter(param) {
var result = 0, tmp = [], BreakException = {};
// Iterate on all and breaks when param is found
// @see http://stackoverflow.com/a/2641374
try {
location.search
@crewstyle
crewstyle / urls-headers-cache-fetch.gs
Last active March 30, 2017 22:58
Google Spreadsheet - How to get data from URL's headers, using CacheService and UrlFetchApp class services
/**
* This script has been especially made for a particular context.
* So use it with caution, and do not forget to customize it before any use.
*/
//globals
var sheet = SpreadsheetApp.getActiveSpreadsheet(),
sheets = sheet.getSheets();
/**
@crewstyle
crewstyle / urls-create-sheet-ota.gs
Created April 1, 2017 21:37
Google Spreadsheet - How to create sheet on the air, using SpreadsheetApp and Utilities class services
/**
* This script has been especially made for a particular context.
* So use it with caution, and do not forget to customize it before any use.
*/
//globals
var sheet = SpreadsheetApp.getActiveSpreadsheet(),
sheets = sheet.getSheets();
/**
@crewstyle
crewstyle / list.html.twig
Created January 29, 2018 16:05 — forked from garak/list.html.twig
Twig recursive macro
{% macro recursiveCategory(category) %}
{% import _self as self %}
<li>
<h4><a href="{{ path(category.route, category.routeParams) }}">{{ category }}</a></h4>
{% if category.children|length %}
<ul>
{% for child in category.children %}
{{ self.recursiveCategory(child) }}
{% endfor %}
@crewstyle
crewstyle / shortcode.js
Created May 15, 2019 08:22
WordPress ~ Add shortcode button with title, list and image contents - #frontend #shortcode
/*!
* SHORTCODE
*
* Plugin Name: Shortcode
* Version: 1.0.0
* Description: Add shortcode button with title, list and image contents.
*
* Author: Achraf Chouk
* Author URI: https://github.com/crewstyle
* License: The MIT License (MIT)
@crewstyle
crewstyle / functions.php
Last active January 10, 2020 18:29
WordPress ~ Remove unnecessary details in body_class function - #frontend #security #optimisation
<?php
/**
* Remove unnecessary details from `body_class()`
*
* @param string $classes
* @param string $class
*
* @uses get_query_var()
* @uses get_user_by()