Skip to content

Instantly share code, notes, and snippets.

<div style="background: rgba(0,0,0,0.4); border: 2px solid #fff; padding: 20px 15px; margin: 50px 0; border-radius: 5px; ">
<h3 style="color: #fff; text-align: center; margin-bottom: 10px;"> Newsletter </h3>
<script>
jQuery(document).ready(function($) {
$("#subscribe2").click(function(){
var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
var name=$('#name2').val();
var email=$('#email2').val();
@aabir
aabir / timthumb.php
Created February 23, 2016 18:47
TimThumb Image Lib for PHP
<?php
/**
* TimThumb by Ben Gillbanks and Mark Maunder
* Based on work done by Tim McDaniels and Darren Hoyt
* http://code.google.com/p/timthumb/
*
* GNU General Public License, version 2
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Examples and documentation available on the project homepage
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@aabir
aabir / featuredImage.php
Created January 11, 2016 10:40
WordPress get featured image url
<?php
$thumb = get_post_thumbnail_id();
$img_url = wp_get_attachment_url( $thumb,'full');
@aabir
aabir / curl.php
Last active November 19, 2015 14:31
Capsule CRM XML API request using PHP
<?php
$add_person="<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n
<person>\n
<contacts>\n
<address>\n
<type>Postal</type>\n
<city>Mountain View</city>\n
<zip>94043</zip>\n
</address>\n
<email>\n
@aabir
aabir / htaccess
Created November 8, 2015 06:33
Laravel 5, to remove public folder from localhost; rename the server.php file to index.php and bring the .htaccess file to root and add following line.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
@aabir
aabir / index.php
Created November 2, 2015 10:47
HTML5 File Reader API
<!DOCTYPE html>
<html>
<head>
<title> HTML 5 File Reader API </title>
</head>
<body>
<p id="destination"></p>
@aabir
aabir / index.php
Created October 28, 2015 08:59
SecurePay XML API working with PHP
<!DOCTYPE html>
<html>
<head>
<title> Test Payment </title>
</head>
<style>
#form-success {border: 1px solid #ccc; background: #f8f8f8; display: none; padding: 10px; width: 320px; }
</style>
<body>
@aabir
aabir / index.html
Last active October 30, 2015 09:33
Google map API with multiple addresses, custom marker, custom info box window and custom map style.
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Info windows</title>
<link href="css/style.css" rel="stylesheet" />
</head>
<body>
<div id="map" style="width: 900px; height: 500px;"></div>
@aabir
aabir / js
Created June 25, 2015 08:35
Smooth scrolling in page IDs
jQuery(function($) {
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
return false;