Skip to content

Instantly share code, notes, and snippets.

View donnellyjoe's full-sized avatar

Joe Donnelly donnellyjoe

  • New York City, NY
View GitHub Profile
@danharper
danharper / gulpfile.js
Last active April 11, 2024 08:31
New ES6 project with Babel, Browserify & Gulp
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
@tvanantwerp
tvanantwerp / custom-social-media-buttons.md
Last active September 20, 2022 10:54
Custom Social Media Sharing Buttons

Custom Sharing Buttons for Social Media

These files contain a basic template for creating customized social media share buttons on a web page. The CSS styles are arbitrary, and easily changes. The HTML and JavaScript works as follows.

HTML Structure

The buttons are simply a elements with no href value. Font Awesome is used to add icons. The IDs are used by the JavaScript to modify these a elements.

JavaScript Structure

This file uses jQuery.

Three functions are defined to find share counts for Facebook, Twitter and LinkedIn. Google+ is currently excluded.

The web page address is grabbed by window.location.href and encoded. The page title is pulled from whatever HTML element has id="title". The share count functions are called, and the results appended to the inner text of the share buttons. The the href of each button is changed to the appropriate URL for sharing the webpage.