Skip to content

Instantly share code, notes, and snippets.

View Mahjouba91's full-sized avatar
🏠
Working from home

Florian TIAR Mahjouba91

🏠
Working from home
  • London / Paris
View GitHub Profile
@alexkingorg
alexkingorg / wp-editor-char-count.php
Created January 16, 2012 18:43
Character counter for WordPress editor
<?php
// handy if you write status posts and send them to Twitter
function akv3_editor_char_count() {
?>
<script type="text/javascript">
(function($) {
wpCharCount = function(txt) {
$('.char-count').html("" + txt.length);
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

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

@palimadra
palimadra / check_base64_encoding
Created October 14, 2012 06:17
A PHP file to check your website for base64 encoding on your website
<html><head><title>Find String</title></head><body>
<?php
// upload the file to the root and access the file via a browser.
//It may take time to run so be patient as it will check all the files in the root and the directories in the root
// Most hosting services will have a time limit on how long a php script can run, typically 30 seconds.
// On large sites with a lot of files this script may not be able to find and check all files within the time limit.
// If you get a time out error you can try over riding the default time limits by removing the // in the front of these two lines.
@d3noob
d3noob / .block
Last active January 21, 2020 23:56
Map using leaflet.js and d3,js overlaid
license: mit
@dzolnai
dzolnai / OAuthClient.java
Last active August 18, 2021 07:23
Retrofit OAuth2 refreshing tokens without modifying all requests.
package com.example.yourapp;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.example.yourapp.AuthenticationModel;
import retrofit.client.Header;
import retrofit.client.OkClient;
@edouard-lopez
edouard-lopez / main.js
Last active December 25, 2017 14:40
D3js draw line with latitude/longitude from a CSV file
(function (window, document, L, undefined) {
'use strict';
/* create leaflet map */
var map = L.map('map', {
center: [44.8997, -0.8157],
zoom: 9
});
/**
@bordoni
bordoni / mailpoet-insert_new_user.php
Last active March 18, 2018 23:27
Insert a new user to MailPoet and handle custom fields
<?php
// The ID of the lists you want to add a user to
$list_ids = array( 1 );
// User Data without the custom fields
$data_subscriber = array(
'user' => array(
'email' => 'johndoe@email.com',
'firstname' => 'John',
'lastname' => 'Doe',
@westonruter
westonruter / site-title-smilies.php
Last active April 5, 2024 07:24
Selective refresh example plugin
<?php
/**
* Plugin name: Site Title (and Tagline) Smilies
* Description: Demonstration of selective refresh in the Customizer. Selectors are targeting elements in Twenty Fifteen.
* Author: Weston Ruter, XWP
* Plugin URL: https://gist.github.com/westonruter/a15b99bdd07e6f4aae7a
*
* @package SiteTitleSmilies
*/
@ciases
ciases / git-zip-changed-files.md
Last active March 23, 2024 16:37
Git: zip changed files + diff

GIT: zip changed files + diff

Create zip archive with changed files

git archive -o update.zip HEAD $(git diff --name-only <starting SHA> HEAD)

or

@mayukojpn
mayukojpn / shortcake-ui-demo.php
Last active March 28, 2017 21:47
ShortCake UI Demo Plugin
<?php
/**
* Plugin Name: Shortcake UI Pullquote Demo
* Plugin URI:
* Description: Try Shortcake with pull-quite shortcode
* Version: 1.0.0
* Author: Mte90
* License: GPL2
*/