Skip to content

Instantly share code, notes, and snippets.

View imvision's full-sized avatar

Ali R imvision

View GitHub Profile
@imvision
imvision / web_service_client.js
Created June 28, 2014 07:28
Simple web service API client to run tests on all methods of web service
var client = {
endpoint : 'http://localhost/schlumberjer/xpris/service/api.php',
container : $('#tests table'),
request_payload : {},
auth_token : '',
@imvision
imvision / imv-url-share.php
Created June 5, 2014 11:36
Url preview and sharing plugin for wordpress
<?php
/*
Plugin Name: URL Preview
Plugin URI:
Description: This plugin will create facebook like preview of urls.
Version: 1.1.1
Author: Ali Roshan
Author Email: aliroshan@live.com
License:
@imvision
imvision / imv-restrict.php
Created June 4, 2014 08:18
Restrict certain pages to logged in users only
<?php
/*
Plugin Name: BP Restrict
Plugin URI:
Description: Restrict wordpress pages to logged in users
Version: 1.2.0
Author: Ali Roshan
Author Email: aliroshan@live.com
License:
@imvision
imvision / tmpl.php
Created June 4, 2014 07:14
PHP Micro Templating
<?php
/**
* PHP Micro Templating
*/
namespace imvision;
class Template {
public static function Render($tmpl, $data = array()) {
extract($data);
@imvision
imvision / wp-test.php
Created June 2, 2014 05:25
Wordpress plug-in test pattern
<?php
function wpcw_gg_RunTests() {
global $wpdb;
echo "<h3>Running Tests...</h3>";
$course_id = wpcw_gg_getFirstCourseId();
gg_OK($course_id, "First Course Id: {$course_id}");
@imvision
imvision / wp_cheat_sheet.php
Created May 27, 2014 09:52
Wordpess cheat sheet
<?php
/**
* Plugins
* /
### Create a hidden plugin page
# Add a sub menu page
function jobman_admin_setup() {
add_submenu_page( 'jobman-conf', __( 'Project Manager', 'jobman' ), __( 'Tickets', 'jobman' ), 'publish_posts', 'pm_project_tickets', 'pm_project_tickets' );
@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>
@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 / 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
[
{"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)"},