Skip to content

Instantly share code, notes, and snippets.

Avatar

Axel Roche aquelito

View GitHub Profile
@aquelito
aquelito / git-command.md
Last active Feb 26, 2021
GIT - Ligne de commande principale
View git-command.md
title category
Git config
Git

Rappel

Ne pas oublier : l'aide en ligne de commande.

@aquelito
aquelito / mysql.md
Last active Jul 1, 2019
Mysql command shelll
View mysql.md

Mysql

Command

Import bdd file into bdd

mysql -u root -p DBB_NAME < /PÄTH_TO_SQL_FILE.sql
View exemple.styleguide.css
/*doc
---
title: Breadcrumb
component:
notes:
- Note 1
- Note 2
see:
- link1
@aquelito
aquelito / create_file.php
Last active Feb 9, 2019 — forked from facine/__INDEX.txt
Drupal 8 - Examples
View create_file.php
<?php
// Programmatically create files.
use Drupal\file\Entity\File;
$file = File::create([
'uid' => 1,
'filename' => 'logo.svg',
'uri' => 'public://page/logo.svg',
'status' => 1,
]);
@aquelito
aquelito / dataAttributes.php
Created Feb 20, 2014
Encodage du tableau JSON passer via data attribute
View dataAttributes.php
<?php
// UPDATE::AxelRoche
$var_modal = array(
'id' => $_product->getId(),
'title' => $_product->getName(),
'price' => $_product->getPrice(),
'image' => $_product->getImageUrl(),
'qty' => 1,
);
@aquelito
aquelito / mapbox-gl.js.md
Last active Dec 31, 2018
Mapbox GL - Helpers
View mapbox-gl.js.md
View snippet_drupal8.md

Drupal 8 Snippet

Check if current page is admin page

  if (service('router.admin_context')->isAdminRoute(\Drupal::routeMatch()->getRouteObject())) {
    ...
  }
View gist:8063540

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

View Preferences.sublime-settings.json
// Place your settings in the file "User/Preferences.sublime-settings", which
// overrides the settings in here.
//
// Settings may also be placed in file type specific options files, for
// example, in Packages/Python/Python.sublime-settings for python files.
{
// Sets the colors used within the text area
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
// Note that the font_face and font_size are overridden in the platform