Skip to content

Instantly share code, notes, and snippets.

View imvision's full-sized avatar

Ali R imvision

View GitHub Profile
@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 / 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 / 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 / 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>";
<?php
function it($m,$p){echo ($p?'✔︎':'✘')." It $m\n"; if(!$p){$GLOBALS['f']=1;}}function done(){if(@$GLOBALS['f'])die(1);}
@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">
[
{"group":"US (Common)",
"zones":[
{"value":"America/Puerto_Rico","name":"Puerto Rico (Atlantic)"},
{"value":"America/New_York","name":"New York (Eastern)"},
{"value":"America/Chicago","name":"Chicago (Central)"},
{"value":"America/Denver","name":"Denver (Mountain)"},
{"value":"America/Phoenix","name":"Phoenix (MST)"},
{"value":"America/Los_Angeles","name":"Los Angeles (Pacific)"},
{"value":"America/Anchorage","name":"Anchorage (Alaska)"},
@imvision
imvision / archive_custom_post_types.php
Created May 12, 2014 13:00
Show custom post types on Tag, Archive, Author pages
<?php
// Add custom post types on Tag, Category, Author archive pages
add_filter('pre_get_posts', 'query_post_type');
function query_post_type($query) {
if(is_category() || is_tag() || $query->is_author) {
$post_type = get_query_var('post_type');
if($post_type)
$post_type = $post_type;
else
@imvision
imvision / wp-upload-fix.txt
Created May 20, 2014 08:52
Wordpress upload error fix: "Unable to create directory in uploads folder"
sudo chown -R apache:apache /var/www/html/site_name/
That was it!!! I've spent many hours on this problem. Thank you!!
For those of you where changing the directories to 777 does not work, then this may be your problem. I just replaced the path with my own and then: service httpd restart.
@imvision
imvision / MarketViewRow.cs
Created May 20, 2014 17:50
Main application code, market row view, and place bet code
using System;
using System.Windows.Forms;
using Market = CSharpAPI6.betfair.api.exchange.Market;
using Runner = CSharpAPI6.betfair.api.exchange.Runner;
namespace CSharpAPI6
{
/// <summary>
/// Summary description for MarketViewRow.
/// </summary>