Skip to content

Instantly share code, notes, and snippets.

@adnan360
adnan360 / wp-ajaxify.html
Created Oct 12, 2014
Makes any wordpress theme ajax-based (jQuery required)
View wp-ajaxify.html
<script type="text/javascript">
jQuery(document).ready(function($) {
/*function bb() {
$( "a" ).unbind();
$( "a" ).bind( "click", function( ev ) {
ev.preventDefault();
$( "#main" ).load( $(this).attr('href') + " #main", bb );
//bb();
return false;
});
@adnan360
adnan360 / config.xml
Created Jan 29, 2015
Cordova config.xml sample
View config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.adnan__.yo___" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Yo__ App</name>
<description>
Simple description for tha app.
</description>
<author email="needa__@gmail.com" href="http://adnan360.com">
Adnan Shameem
</author>
<content src="index.html" />
@adnan360
adnan360 / xcointoss.lua
Created Apr 28, 2015
A script to make virtual coint tosses. You can just give how many coin tosses you want and the script will make that many coin tosses.
View xcointoss.lua
-- title
io.write('** COIN TOSS SIMULATOR **\n\n')
-- take input
io.write('Please enter how many coin toss you want:')
num = io.read()
-- tossing
tails=0
heads=0
@adnan360
adnan360 / gist:155c4b42515f173a68cc
Created Jul 19, 2015
Sample Dictionary Data (LazPlanet)
View gist:155c4b42515f173a68cc
a First letter of English alphabet
a1 Very good
abc Basics
apple A red fruit
b Second letter of English alphabet
bad Not good
bag Holder of things
bank Keeper of money
big Large in size
c Third letter of English alphabet
@adnan360
adnan360 / Pi_Spigot.pas
Created Mar 15, 2016
Get the value of Pi to the 100000th decimal place!
View Pi_Spigot.pas
//////////////////////////////////////////////////////////////
// This code was inspired by: http://www.geom.uiuc.edu/~huberty/math5337/groupe/digits.html
// The solution was from rvk in this thread: http://forum.lazarus.freepascal.org/index.php/topic,31955.0.html
// The code was based on Rosetta code: https://rosettacode.org/wiki/Pi#Pascal
//------------------------------------------------------------
// USING INSTRUCTIONS:
// To use it:
// 1. Open up Lazarus <http://lazarus-ide.org>
// 2. Project -> New Project -> Program -> OK
// 3. Select all, then paste this code
@adnan360
adnan360 / WP-plugin-settings-sample.php
Created Sep 28, 2016
Wordpress plugin with settings options sample code
View WP-plugin-settings-sample.php
<?php
// Example # 2 from
// https://codex.wordpress.org/Creating_Options_Pages
class MySettingsPage
{
/**
* Holds the values to be used in the fields callbacks
*/
private $options;
@adnan360
adnan360 / VirtualAboutForm.pas
Created Nov 12, 2016
How to create an about form without having a form
View VirtualAboutForm.pas
procedure TfrmEditor.Closeme(Sender: TObject);
begin
tform( tcontrol(sender).parent ).Close;
end;
procedure TfrmEditor.mnuAboutClick(Sender: TObject);
const
margin = 20;
var
frm: TForm;
@adnan360
adnan360 / test.php
Last active Jan 5, 2017
PHP mktime() test
View test.php
<?php
echo mktime().'<br/>';
sleep(1);
echo mktime().'<br/>';
sleep(1);
echo mktime().'<br/>';
sleep(1);
View functions.php_snip
$args = array(
'post_type' => 'booked_appointments',
'posts_per_page' => -1,
'post_status' => 'any',
'meta_query' => array(
array(
'key' => '_appointment_timestamp',
'value' => array( $start_timestamp, $end_timestamp ),
'compare' => 'BETWEEN'
)
@adnan360
adnan360 / functions.php_snip
Created Jan 5, 2017
Booked plugin - $args array
View functions.php_snip
$bookedAppointments = new WP_Query( apply_filters('booked_fe_date_content_query',$args) );