Skip to content

Instantly share code, notes, and snippets.

View imvision's full-sized avatar

Ali R imvision

View GitHub Profile
@imvision
imvision / index.php
Created March 4, 2014 11:22
Experimental Front Controller that can return content in multiple formats.
<?php
require "startup.php";
$action = (isset($_REQUEST['action']) && $_REQUEST['action']!="" && file_exists(__DIR__."/{$_REQUEST['action']}.php")) ? $_REQUEST['action'] : "sources";
?>
<?php if(! isset($_REQUEST['request_type']) || $_REQUEST['request_type']!="ajax"): ?>
<?php include('header.php');?>
<div id="content">
<?php
function it($m,$p){echo ($p?'✔︎':'✘')." It $m\n"; if(!$p){$GLOBALS['f']=1;}}function done(){if(@$GLOBALS['f'])die(1);}
@imvision
imvision / max_upload.php
Created February 11, 2014 12:13
Check upload size limit of server
<?php
echo "<table>";
echo "<tr><td>upload_max_filesize</td><td>" .$max_upload = (int)(ini_get('upload_max_filesize')) . "</td></tr>";
echo "<tr><td>post_max_size</td><td>" . $max_post = (int)(ini_get('post_max_size')) . "</td></tr>";
echo "<tr><td>memory_limit</td><td>" . $memory_limit = (int)(ini_get('memory_limit')) . "</td></tr>";
// echo $upload_mb = min($max_upload, $max_post, $memory_limit);
echo "</table>";
@imvision
imvision / default.css
Created January 22, 2014 13:36
Wordpress plugin - Creates facebook like preview of given url
.url-preview {
border-top: 1px solid #EAEAEA;
font-family: calibri;
}
.share_form {
width: 625px;
}
.share_form input {
width: 500px;
}
@imvision
imvision / user-certifications.php
Created January 21, 2014 13:33
Wordpress Plugin - User Certifications - Adds user certifications fields using template tags anywhere. User certifications then can be rendered anywhere using template tags.
<?php
/*
Plugin Name: User Certifications
Plugin URI:
Description: Adds User Certifications fields in user profile. User certifications can be rendered anywhere using template tags.
Version: 1.0
Author: Ali Roshan
Author Email: [email protected]
License:
@imvision
imvision / hello-world.php
Created January 21, 2014 08:11
Wordpress plugin with AJAX support
<?php
/*
Plugin Name: Hello World 4
Plugin URI: http://ocaoimh.ie/
Description: A simple hello world plugin
Version: 0.1
Author: Donncha O Caoimh
Author URI: http://ocaoimh.ie/
*/
@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 / 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!