Skip to content

Instantly share code, notes, and snippets.

View aslamdoctor's full-sized avatar
💭
Always working but happy to talk 👍

Aslam Doctor aslamdoctor

💭
Always working but happy to talk 👍
View GitHub Profile
@aslamdoctor
aslamdoctor / imageRestrict.php
Created January 19, 2012 14:03
Image Resizing based on Width & Height
<?php
function imageRestrict($image, $maxwidth, $maxheight) {
list($width,$height) = getimagesize($image);
if ($width > $maxwidth) {
$newheight = $maxwidth/$width * $height;
if($newheight > $maxheight){
@aslamdoctor
aslamdoctor / eMailHelper.php
Created January 19, 2012 14:09
All in One PHP Mail Function
<?php
function send_mail($from, $from_name, $to, $to_name, $subject, $body, $attachment="")
{
include_once("phpmailer.class.php");
$mail = new PHPMailer();
$mail->From = $from;
$mail->FromName = $from_name;
$mail->Subject = $subject;
$search = array(
@aslamdoctor
aslamdoctor / dummyHtmlContent.html
Last active September 29, 2015 17:47
Dummy HTML Content including all common elements
<p><a href="#"><img class="size-thumbnail wp-image-58 alignright" alt="" src="http://lorempixel.com/g/500/300/people/1/"></a>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Curabitur quam augue, vehicula quis, tincidunt vel, varius vitae, nulla. Sed convallis orci. Duis libero orci, pretium a, <a href="#">convallis quis</a>, pellentesque a, dolor. Curabitur vitae nisi non dolor vestibulum consequat.</p>
<blockquote>
<p>Proin vestibulum. Ut ligula. Nullam sed dolor id odio volutpat pulvinar. Integer a leo. In et eros at neque pretium sagittis. Sed sodales lorem a ipsum suscipit gravida. Ut fringilla placerat arcu. Phasellus imperdiet. Mauris ac justo et turpis pharetra vulputate.</p>
</blockquote>
<p><cite><a href="#">Quote Source</a></cite></p>
<h1>Level 1 Heading</h1>
<h2>Level 2 Heading</h2>
<h3>Level 3 Heading</h3>
<h4>Level 4 Heading</h4>
<h5>Level 5 Heading</h5>
@aslamdoctor
aslamdoctor / dummyPosts.xml
Created January 19, 2012 14:37
Wordpress Dummy Content
<?xml version="1.0" encoding="UTF-8"?>
<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your blog. -->
<!-- It contains information about your blog's posts, comments, and categories. -->
<!-- You may use this file to transfer that content from one site to another. -->
<!-- This file is not intended to serve as a complete backup of your blog. -->
<!-- To import this information into a WordPress blog follow these steps. -->
<!-- 1. Log into that blog as an administrator. -->
<!-- 2. Go to Manage: Import in the blog's admin panels. -->
<!-- 3. Choose "WordPress" from the list. -->
@aslamdoctor
aslamdoctor / CreditCardValidation.js
Created February 1, 2012 06:34
CreditCard Validation using Javascript
function isValidCreditCard(type, ccnum) {
if (type == "Visa") {
// Visa: length 16, prefix 4, dashes optional.
var re = /^4\d{3}-?\d{4}-?\d{4}-?\d{4}$/;
} else if (type == "MC") {
// Mastercard: length 16, prefix 51-55, dashes optional.
var re = /^5[1-5]\d{2}-?\d{4}-?\d{4}-?\d{4}$/;
} else if (type == "Disc") {
// Discover: length 16, prefix 6011, dashes optional.
var re = /^6011-?\d{4}-?\d{4}-?\d{4}$/;
@aslamdoctor
aslamdoctor / jqueryAjax.js
Created February 6, 2012 09:00
jQuery Ajax call
$.ajax({
type: "POST",
url: "submit_ops.php?action=submit_form",
data: $( "#frmMyForm" ).serialize(),
success: function(result){
if(result=='Success'){
$("#msgContainer").html('<div style="color:#3CA322;font-weight:bold;font-size:14px;padding:10px;">Thank you.</div>');
$("#msgContainer").fadeIn();
}
else{
@aslamdoctor
aslamdoctor / bootstrap3-mediaqueries.css
Last active November 26, 2015 11:50
Bootstrap 3 Media Queries
/*==================================================
= Bootstrap 3 Media Queries =
==================================================*/
/*========== Mobile First Method ==========*/
/* Custom, iPhone Retina */
@media only screen and (min-width : 320px) {
/*-- example usage : custom grid spacing --*/
.row{
@aslamdoctor
aslamdoctor / delete-duplicate.sql
Created September 19, 2013 07:16
Delete duplicate records from MySQL Database
DELETE FROM table1
USING table1, table1 AS vtable
WHERE (
table1.ID > vtable.ID
)
AND (
table1.field1 = vtable.field1
)
AND (
table1.field2 = vtable.field2
@aslamdoctor
aslamdoctor / force-file-download.php
Created September 19, 2013 07:24
Force file download using PHP
<?php
function download_file($file){
$file = $file; //Set File Location
if (file_exists($file)) { // Check if file exists
if(!is_dir($file)){ // Check if it is a directory or a file
// The following files will set the headers to the file download
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
@aslamdoctor
aslamdoctor / blink-text.js
Created September 19, 2013 07:17
Blink Text using jQuery