Skip to content

Instantly share code, notes, and snippets.

View techjewel's full-sized avatar
🎯
Focusing

Shahjahan Jewel techjewel

🎯
Focusing
View GitHub Profile

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

<?php
$names = $_POST['name'];
$emails = $_POST['email'];
$user_array = array();
foreach($names as $key => $name)
{
$user_array[$key]['name'] = $name;
@techjewel
techjewel / simple_email_template.html
Created March 14, 2015 09:19
Very Simple email Template
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body {
margin: 0;
mso-line-height-rule: exactly;
padding: 0;
min-width: 100%;
}
@techjewel
techjewel / tmpl.js
Last active April 26, 2024 08:45
Simple JS Templating
// Simple JavaScript Templating
// John Resig - http://ejohn.org/ - MIT Licensed
// source http://ejohn.org/blog/javascript-micro-templating/
(function(){
var cache = {};
this.tmpl = function tmpl(str, data){
// Figure out if we're getting a template, or if we need to
// load the template - and be sure to cache the result.
var fn = !/\W/.test(str) ?
@techjewel
techjewel / custom_posts.php
Created November 4, 2015 08:59
Creating Custom Post Type with Custom Taxanomy
<?php
// Register Custom Post Type named FAQ
function wagon_faqs_post_type() {
$labels = array(
'name' => _x( 'CPAP FAQs', 'Post Type General Name', 'cpap' ),
'singular_name' => _x( 'CPAP FAQ', 'Post Type Singular Name', 'cpap' ),
'menu_name' => __( 'CPAP FAQs', 'cpap' ),
@techjewel
techjewel / ionicons_php_array.php
Last active November 20, 2015 13:26
PHP Array of ionicons icon pack
<?php
$ionicons_icons = array(
'ion-alert',
'ion-alert-circled',
'ion-android-add',
'ion-android-add-circle',
'ion-android-alarm-clock',
'ion-android-alert',
'ion-android-apps',
@techjewel
techjewel / sream_function.php
Created June 25, 2016 22:15
Stream a mp3 file using php when you need to protect the file
<?php
function zcast_stream($file, $content_type = 'application/octet-stream') {
@error_reporting(0);
// Make sure the files exists, otherwise we are wasting our time
if (!file_exists($file)) {
header("HTTP/1.1 404 Not Found");
exit;
}
@techjewel
techjewel / grt_youtube_id_by_url.php
Created June 27, 2016 23:17
Get Youtube ID from Youtube Full URL
<?php
/***
*** @Get youtube video ID from url
***/
function get_youtube_id_from_url($url) {
$pattern =
'%^# Match any youtube URL
(?:https?://)? # Optional scheme. Either http or https
(?:www\.)? # Optional www subdomain
(?: # Group host alternatives
@techjewel
techjewel / equalChildHeights.js
Created December 3, 2016 14:06
Make Children divs as equal height with js
var doEqualHeights = function (parentNodeSelector, childNodeSelector) {
var $nodes = $(parentNodeSelector);
$.each($nodes, function (index,node) {
var children = $(node).find(childNodeSelector);
var childHeight = 0;
$.each(children, function (index, child) {
var currentHeight = $(child).height();
if(currentHeight > childHeight) {
childHeight = currentHeight;
<?php
function distance($lat1, $lng1, $lat2, $lng2)
{
// convert latitude/longitude degrees for both coordinates
// to radians: radian = degree * π / 180
$lat1 = deg2rad($lat1);
$lng1 = deg2rad($lng1);
$lat2 = deg2rad($lat2);
$lng2 = deg2rad($lng2);