Skip to content

Instantly share code, notes, and snippets.

View imvision's full-sized avatar

Ali R imvision

View GitHub Profile
@imvision
imvision / javascript_resources.md
Created January 20, 2014 19:20 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@imvision
imvision / page-api.php
Created January 3, 2016 07:09 — forked from petenelson/page-api.php
WordPress: Create a REST API endpoint
<?php
/*
* Sample code for using WordPress as a REST API endpoint (vs AJAX Admin)
* Author: Pete Nelson @GunGeekATX
*
* 1) Create a page called API in WordPres
* 2) Create a file called page-api.php in your theme directory
* 3) Add code as-needed
*
*/
@imvision
imvision / sublime_pref.txt
Last active January 3, 2016 03:58
Sublime Text Settings
{
"word_wrap": true,
"font_face": "Inconsolata",
"font_size": 14,
"highlight_line": true,
"trim_trailing_white_space_on_save": true,
"auto_complete_commit_on_tab": true,
"draw_white_space": "all",
"translate_tabs_to_spaces": true,
"tab_size": 2,
xdebug.collect_assignments = 1
xdebug.collect_includes = 1
xdebug.collect_params = 4
xdebug.collect_return = 1
xdebug.trace_format = 0
xdebug.trace_output_dir = "C:\Program Files\Ampps\www\p\xdebug_traces"
xdebug.var_display_max_data = 1024
xdebug.var_display_max_depth = 15
xdebug.trace_output_name = trace.%t
@imvision
imvision / aweber_add.php
Last active December 25, 2015 06:39
Add a lead to aweber list using PHP & curl
<?php
// Encode them for URL
$email = urlencode( utf8_encode( $email ) );
$fullname = urlencode( utf8_encode( $fullname ) );
//
// 3. Define Aweber Variables
//
$listname = 'users-premium'; // IMPORTANT: change to your list name!
@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 / 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,