Skip to content

Instantly share code, notes, and snippets.

View banago's full-sized avatar

Baki Goxhaj banago

View GitHub Profile
@banago
banago / inView.js
Created August 24, 2012 14:13
Keep Elements in View When Scrolling
//keep element in view
(function($)
{
$(document).ready( function()
{
var elementPosTop = $('#sidebar-ads').position().top;
$(window).scroll(function()
{
var wintop = $(window).scrollTop(), docheight = $(document).height(), winheight = $(window).height();
//if top of element is in view
@banago
banago / gist:3260741
Created August 5, 2012 00:10 — forked from JeffreyWay/gist:3185773
PHP Installation Options
./configure \
--prefix=/usr \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--sysconfdir=/private/etc \
--with-apxs2=/usr/sbin/apxs \
--enable-cli \
--with-config-file-path=/etc \
--with-libxml-dir=/usr \
--with-openssl=/usr \
@banago
banago / the_includes.html
Created June 9, 2012 17:38 — forked from linssen/the_includes.html
Extending the jQuery Sortable With Ajax & MYSQL
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<link rel='stylesheet' href='styles.css' type='text/css' media='all' />
@banago
banago / terminal.php
Created April 11, 2012 19:09
PHP: Execute a command in the terminal
<?php
/**
@author: http://www.binarytides.com/blog/40-techniques-to-enhance-your-php-code-part-3/
Method to execute a command in the terminal
Uses :
1. system
2. passthru
3. exec
@banago
banago / presentationPrep.js
Created April 6, 2012 22:28 — forked from JeffreyWay/presentationPrep.js
I wish it could be that simple. Something for me to build.
presentation
.title('My Great Presentation')
.slide({
title: 'Learn About Borders',
bullets: [
'Thing 1',
'Thing 2',
],
code: ['path/to/file.css', [2,4]] // path to file, lines to grab
@banago
banago / is_ajax.php
Created March 28, 2012 16:41
Tests if the current request is an AJAX request
<?php
/**
* Tests if the current request is an AJAX request by checking the X-Requested-With HTTP
* request header that most popular JS frameworks now set for AJAX calls.
*
* @return boolean
*/
function is_ajax()
{
return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest');
@banago
banago / average.php
Created March 4, 2012 08:56
Calculates average of values taken from custom fields out of a WordPress loop. Built of Jason ;)
<?php
/**
* Function: Average
* Calculates average of values taken from custom fields out of a WordPress loop. Built of Jason ;)
* Author: Baki Goxhaj
*/
function average( $post_no );
$no = 0;
$query = new WP_Query('posts_per_page=' . $post_no ); while( $query->have_posts() ) : $query->the_posts();
@banago
banago / gist:1790188
Created February 10, 2012 15:13 — forked from technosailor/gist:1771566
Oboject Oriented WordPress Ajax API usage
<?php
/*
Plugin Name: Test
*/
class My_Like_Button {
function __construct()
{
$this->hooks();
}
@banago
banago / gist:1292885
Created October 17, 2011 15:35 — forked from billerickson/gist:1243289
Get images marked "Include in Rotator"
<?php
// Get all images attached to post that have "Include in Rotator" marked as "Yes"
$args = array(
'post_type' => 'attachment',
'post_mime_type' => 'image',
'post_status' => 'inherit',
'posts_per_page' => '-1',
'order' => 'ASC',
@banago
banago / gist:1292884
Created October 17, 2011 15:35 — forked from billerickson/gist:1243276
Include In Rotator option in Media Uploader
<?php
/**
* Add "Include in Rotator" option to media uploader
*
* @param $form_fields array, fields to include in attachment form
* @param $post object, attachment record in database
* @return $form_fields, modified form fields
*/