Skip to content

Instantly share code, notes, and snippets.

View v1shwa's full-sized avatar
:octocat:
⚡️

Vishwa v1shwa

:octocat:
⚡️
View GitHub Profile
@v1shwa
v1shwa / access-modifier.md
Created June 22, 2016 08:50
Access Modifiers in Java
Access modifier  Class  Package  Subclass  Any Class
private            Y       N         N         N 
[no specifier]     Y       Y         N         N 
protected          Y       Y         Y         N 
public             Y       Y         Y         Y 
@v1shwa
v1shwa / keybase.md
Created May 23, 2016 19:31
keybase.md

Keybase proof

I hereby claim:

  • I am v1shwa on github.
  • I am v1shwa (https://keybase.io/v1shwa) on keybase.
  • I have a public key whose fingerprint is 8EB4 0D20 3DBB A582 FD59 6269 5603 1371 358A 520A

To claim this, I am signing this object:

@v1shwa
v1shwa / get-social-shares
Created April 14, 2016 06:12 — forked from ihorvorotnov/get-social-shares
Get number of shares from social platforms
Facebook*:
https://api.facebook.com/method/links.getStats?urls=%%URL%%&format=json
+ works, returns shares, likes, comments and total
Twitter:
http://urls.api.twitter.com/1/urls/count.json?url=%%URL%%&callback=twttr.receiveCount
+ v1 API but still works
Reddit:
http://buttons.reddit.com/button_info.json?url=%%URL%%
@v1shwa
v1shwa / ISO 3166-1 alpha-2 code
Last active April 13, 2016 05:52
Country Codes ISO 3166-1 alpha-2 code
[
{
"Name": "Afghanistan",
"Code": "AF"
},
{
"Name": "Åland Islands",
"Code": "AX"
},
{
@v1shwa
v1shwa / gist:f7bbdc234bdc5df0ed0c8eadb9e19d48
Created April 3, 2016 05:19 — forked from jonathanmoore/gist:2640302
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

@v1shwa
v1shwa / foo.log
Created February 12, 2016 16:15 — forked from ibeex/foo.log
Flask logging example
A warning occurred (42 apples)
An error occurred
@v1shwa
v1shwa / QB-tax-invoice.php
Created February 12, 2016 14:08
Quickbooks Invoice with Tax using Consolibyte's SDK
<?php
$InvoiceService = new QuickBooks_IPP_Service_Invoice();
$Invoice = new QuickBooks_IPP_Object_Invoice();
$Invoice->setDocNumber('st-100002'); // doc number (optional)
$Invoice->setTxnDate('2016-02-12');
$Invoice->setCustomerRef( 1 ); // customer Id
// Create a New line
@v1shwa
v1shwa / PHP - excel to array helper function.php
Last active December 5, 2015 11:54 — forked from calvinchoy/PHP - excel to array helper function.php
PHP - excel to array helper function
<?php
/*
|--------------------------------------------------------------------------
| Excel To Array
|--------------------------------------------------------------------------
| Helper function to convert excel sheet to key value array
| Input: path to excel file, set wether excel first row are headers
| Dependencies: PHPExcel.php include needed
*/
function excelToArray($filePath, $header=true){
@v1shwa
v1shwa / pecl-oauth.sh
Created December 3, 2015 04:52
Installing PHP OAuth in Ubuntu
# Steps for installing PECL oAuth package on ubuntu
apt-get update
apt-get install libpcre3 libpcre3-dev php5-dev
pecl install -Z oauth