Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View drewjoh's full-sized avatar

Drew Johnston drewjoh

View GitHub Profile
1f8fec61-4a6f-9bd5-7f8e-e12325c464c3
1f8fed49-4a6f-9bd5-7f8e-d665dedc0297
1f8fee17-4a6f-9bd5-7f8e-29d1ce3e9e30
1f8feef2-4a6f-9bd5-7f8e-8ce03bebdbdf
1f8fefc7-4a6f-9bd5-7f8e-c22fbedb5390
# CodeIgniter writing
RewriteCond $1 !^(index\.php|images|robots\.txt|css|user_files|subdomain1|subdomain2)
RewriteRule ^(.*)$ /index.php/$1 [L]
<?php
$file = @fopen($filename,"r");
if ($file)
{
while(!feof($file))
{
print(fread($file, 1024*4));
flush();
<style type="text/css">
.btn {
border-radius:4px;
-moz-border-radius:4px;
-webkit-border-radius:4px;
background:url("./btn_bg.png") repeat-x scroll 0 2px #efefef;
border-color:#5b5b5b;
border-style:solid;
border-width:1px;
color:#262626;
<?php
/**
* Remove any non-ASCII characters and convert known non-ASCII characters
* to their ASCII equivalents, if possible.
*
* @param string $string
* @return string $string
* @author Jay Williams <myd3.com>
* @license MIT License
* @link http://gist.github.com/119517
@drewjoh
drewjoh / ticks_to_timestamp.php
Created September 26, 2010 00:53
Ticks to Timestamp Function
<?php
/*
* Ticks To Unix Timestamp
*
* Function to get a usable timestamp from ticks
* Returns a unix timestamp or MySQL datetime
*
* $ticks - the tick (timestamp) that we're converting to a unix timestamp
* $offset - the time offset in hours to adjust the result to
@drewjoh
drewjoh / timezones.min.php
Created October 11, 2011 03:59
List of all timezones compatible with the PHP DateTimeZone object.
$timezones = array('UTC','Africa/Abidjan','Africa/Accra','Africa/Addis_Ababa','Africa/Algiers','Africa/Asmara','Africa/Asmera','Africa/Bamako','Africa/Bangui','Africa/Banjul','Africa/Bissau','Africa/Blantyre','Africa/Brazzaville','Africa/Bujumbura','Africa/Cairo','Africa/Casablanca','Africa/Ceuta','Africa/Conakry','Africa/Dakar','Africa/Dar_es_Salaam','Africa/Djibouti','Africa/Douala','Africa/El_Aaiun','Africa/Freetown','Africa/Gaborone','Africa/Harare','Africa/Johannesburg','Africa/Juba','Africa/Kampala','Africa/Khartoum','Africa/Kigali','Africa/Kinshasa','Africa/Lagos','Africa/Libreville','Africa/Lome','Africa/Luanda','Africa/Lubumbashi','Africa/Lusaka','Africa/Malabo','Africa/Maputo','Africa/Maseru','Africa/Mbabane','Africa/Mogadishu','Africa/Monrovia','Africa/Nairobi','Africa/Ndjamena','Africa/Niamey','Africa/Nouakchott','Africa/Ouagadougou','Africa/Porto-Novo','Africa/Sao_Tome','Africa/Timbuktu','Africa/Tripoli','Africa/Tunis','Africa/Windhoek','America/Adak','America/Anchorage','America/Anguilla','Ameri
@drewjoh
drewjoh / example.php
Last active January 11, 2021 18:06 — forked from mloberg/example.php
A Simple Postmark PHP Class with Attachments
<?php
require("postmark.php");
$postmark = new Postmark("your-api-key","from-email","optional-reply-to-address");
$result = $postmark->to("reciver@example.com")
->subject("Email Subject")
->plain_message("This is a plain text message.")
->attachment('File.pdf', base64_encode(file_get_contents('sample.pdf')), 'application/pdf')
@drewjoh
drewjoh / custom.js
Created January 27, 2012 13:55
Dynamic (AJAX) loaded Bootstrap Modal (Bootstrap 2.1)
$(document).ready(function() {
// Support for AJAX loaded modal window.
// Focuses on first input textbox after it loads the window.
$('[data-toggle="modal"]').click(function(e) {
e.preventDefault();
var url = $(this).attr('href');
if (url.indexOf('#') == 0) {
$(url).modal('open');
} else {
@drewjoh
drewjoh / bootstrap.custom.css
Created September 15, 2012 20:10
CSS to make Laravel 3.2's built in pagination links work with Bootstrap 2.1.
.pagination a, .current, .previous_page, .next_page
{
float: left;
padding: 0 14px;
line-height: 34px;
text-decoration: none;
border: 1px solid #ddd;
border-left-width: 0;
}