Skip to content

Instantly share code, notes, and snippets.

View MiteshShah's full-sized avatar
💻
Let's Automate it!

Mitesh Shah MiteshShah

💻
Let's Automate it!
View GitHub Profile
@MiteshShah
MiteshShah / shitanal.js
Created July 2, 2012 14:37 — forked from ralt/shitanal.js
A little script that will screw up people using campaigns on Google Analytics
/**
* A little script that will screw up people using campaigns on Google
* Analytics.
*
* Do. Not. Use.
*
* I am not responsible for any action that people may employ using this
* little script. It was done purely out of curiosity.
*
* Usage:
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@MiteshShah
MiteshShah / 0_reuse_code.js
Created May 6, 2014 10:42
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@MiteshShah
MiteshShah / ee.sh
Last active August 29, 2015 14:02
EasyEngine Installer
wget --no-check-certificate -qO /tmp/ee https://raw.githubusercontent.com/rtCamp/easyengine/refactor/bin/install.sh && sudo bash /tmp/ee $1
@MiteshShah
MiteshShah / EE Changelog
Created May 14, 2015 13:46
github_changelog_generator -t token
# Change Log
## [Unreleased](https://github.com/rtCamp/easyengine/tree/HEAD)
[Full Changelog](https://github.com/rtCamp/easyengine/compare/v3.1.4...HEAD)
**Fixed bugs:**
- EasyEngine v3.1.4 | Can't install stack [\#538](https://github.com/rtCamp/easyengine/issues/538)
@MiteshShah
MiteshShah / Gemfile
Created May 18, 2015 11:48
Mitesh Shah Blog Setup
source 'https://rubygems.org'
gem 'jekyll'
gem 'jekyll-sitemap'
gem 'octopress', '~> 3.0.0.rc.12'
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = '{{ site.owner.disqus-shortname }}'; // required: replace example with your forum shortname
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();

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

#!/bin/bash
# You should need to create a crontab entry for this script
# So this script runs every 10 minutes automatically.
# Checking for any authentication failure entry founded on
# /var/log/auth.log file and update twitter status.
# Checking command-line twitter client t is installed or not