Skip to content

Instantly share code, notes, and snippets.

@adnan360
adnan360 / wp-ajaxify.html
Created October 12, 2014 06:28
Makes any wordpress theme ajax-based (jQuery required)
<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 January 29, 2015 19:39
Cordova config.xml sample
<?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="[email protected]" href="http://adnan360.com">
Adnan Shameem
</author>
<content src="index.html" />
@adnan360
adnan360 / xcointoss.lua
Created April 28, 2015 09:17
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.
-- 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 July 19, 2015 10:28
Sample Dictionary Data (LazPlanet)
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 March 15, 2016 14:19
Get the value of Pi to the 100000th decimal place!
//////////////////////////////////////////////////////////////
// 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 September 28, 2016 07:04
Wordpress plugin with settings options sample code
<?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 November 12, 2016 14:33
How to create an about form without having a form
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 January 5, 2017 01:31
PHP mktime() test
<?php
echo mktime().'<br/>';
sleep(1);
echo mktime().'<br/>';
sleep(1);
echo mktime().'<br/>';
sleep(1);
@adnan360
adnan360 / functions.php_snip
Created January 5, 2017 01:36
Booked plugin 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 January 5, 2017 01:38
Booked plugin - $args array
$bookedAppointments = new WP_Query( apply_filters('booked_fe_date_content_query',$args) );