Skip to content

Instantly share code, notes, and snippets.

View harddy's full-sized avatar

Hardik Thakkar harddy

  • Anand, Gujarat, India
View GitHub Profile
body {
background-color: #02aff1;
}
#center {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
<?php
function getBrowser()
{
$u_agent = $_SERVER['HTTP_USER_AGENT'];
$bname = 'Unknown';
$platform = 'Unknown';
$version= "";
//First get the platform?
if (preg_match('/linux/i', $u_agent)) {
@harddy
harddy / loop.php
Last active November 28, 2021 15:53
Wordpress Pagination
<?php
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$args = array(
'posts_per_page' => 6,
'paged' => $paged
);
$custom_query = new WP_Query( $args );
@harddy
harddy / theme_option_repeater.php
Created October 23, 2016 05:33
Theme Option Repeater
/*
* Define a custom option type
* this type will repeat some text inputs
*/
function repeat_text_option_type($option_name, $option, $values) {
$counter = 0;
$output = '<div class="of-repeat-loop">';
@harddy
harddy / slug.php
Created June 27, 2017 12:03
Create Clean Slugs
function slugify($text)
{
// replace non letter or digits by -
$text = preg_replace('~[^\pL\d]+~u', '-', $text);
// transliterate
$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
// remove unwanted characters
$text = preg_replace('~[^-\w]+~', '', $text);
<?php
/*
Template Name: dashboadrd
*/
?>
<form method="POST" action="">
<input type="submit" name="Sinkdata" value="Add data" />
</form>
<?php
if (isset($_POST['Sinkdata'])) {
@harddy
harddy / functions.php
Created February 17, 2018 15:02
functions.php
<?php
if (!defined('ABSPATH'))
exit;
// BEGIN ENQUEUE PARENT ACTION
// AUTO GENERATED - Do not modify or remove comment markers above or below:
if (!function_exists('chld_thm_cfg_parent_css')):
<?php
Array
(
[fname] => Array
(
[0] => Student 1
[1] => Student 2
)
<?php
$count = count($main_array['fname']);
for($i = 0 ; $i < $count ; $i++ ) {
echo "First Name : " . $main_array['fname'][$i] ."<br>";
echo 'Last Name : ' . $main_array['lname'][$i] ."<br>";
}
@harddy
harddy / jshipster_and_and.js
Created July 29, 2018 15:30 — forked from berzniz/jshipster_and_and.js
Some small javascript hacks for hipsters
// Boring
if (isThisAwesome) {
alert('yes'); // it's not
}
// Awesome
isThisAwesome && alert('yes');
// Also cool for guarding your code
var aCoolFunction = undefined;