Skip to content

Instantly share code, notes, and snippets.

View imvision's full-sized avatar

Ali R imvision

View GitHub Profile
@imvision
imvision / social_sharing.html
Created October 8, 2013 14:02
Facebook, Twitter, and G+ plus sharing with query strings.
Social Sharing
1. Facebook
<a href="#" onclick="window.open('https://www.facebook.com/sharer/sharer.php?s=100&p[url]=http://processgreen.com&p[images][0]=http://processgreen.com/images/process_green_facebook.png&p[title]=Proccess Green&p[summary]=Businesses donating to charities for free through day-to-day transactions - Check out Process Green!','facebook-share-dialog', 'width=626,height=436'); return false;"><img src="images/facebook_round.png" width="32" height="32"></a>
2. Twitter
<a href="#" onclick="window.open('http://twitter.com/share?url=http://processgreen.com/&text=Businesses donating to charities for free through day-to-day transactions - Check out Process Green!','twitter-share-dialog', 'width=626,height=436'); return false;"><img src="images/twitter_round.png" width="32" height="32" alt="Twitter" /></a>
3. Google Plus
<a href="#" onclick="window.open('https://plus.google.com/share?url='+encodeURIComponent(location.href),'google-share-dialog', 'width=626,height=436'); return false;"><img src
@imvision
imvision / Sanitize_data.php
Last active December 23, 2015 06:19
Simple database abstraction for mysql queries TODO: Add support for joins
<?php
function dbSafe($data) {
if(is_array($data)) {
$new = array();
foreach($data as $k => $v) {
$new[$k] = $v;
}
} else {
$new = dbSafe($data);
@imvision
imvision / date_range.php
Created September 17, 2013 11:10
Function to find all dates between two given dates
<?php
/**
* function to calculate all dates between two dates
*
* @param date $first
* @param date $last
* @param string $step
* @param string format
*
@imvision
imvision / Dota_teams
Last active December 22, 2015 23:39
Dota2 team compositions and strats
1. Necro Push
i. Lineup
Offlane BH
Mid BM
Safe Jakiro + Sven + Wisp
ii. Lineup (against non AOE heroes)
NP Lycan BM Enigma Chen
2. Razor
@imvision
imvision / number_conversion.php
Last active December 22, 2015 16:19 — forked from almirsarajcic/steamid_conversion.php
Function to convert 64-bit numbers to 32-bit and vice verse.
<?php
function convert_id($id)
{
if (strlen($id) === 17)
{
$converted = substr($id, 3) - 61197960265728;
}
else
{
/**
* simple JSONP support
*
* JSONP.get('https://api.github.com/gists/1431613', function (data) { console.log(data); });
* JSONP.get('https://api.github.com/gists/1431613', {}, function (data) { console.log(data); });
*
* gist: https://gist.github.com/gists/1431613
*/
var JSONP = (function (document) {
var requests = 0,