Skip to content

Instantly share code, notes, and snippets.

<!--http://updates.html5rocks.com/2012/08/Stick-your-landings-position-sticky-lands-in-WebKit->
<style>
body {
margin: 0;
text-align: center;
font-family: sans-serif;
}
.fixed {
position: fixed;
top: 0;
http://stackoverflow.com/questions/19971428/recursively-search-all-directories-for-an-array-of-strings-in-php?lq=1
$contents_list = array("xyz","abc","hello");
$path = "/tmp/";
$pattern = implode('\|', $contents_list) ;
$command = "grep -r '$pattern' $path";
$output = array();
exec($command, $output);
foreach ($output as $match) {
echo $match . '\n';
@billcreswell
billcreswell / application.php
Last active August 29, 2015 13:56
Drop in form for job application
<?php
/**
* @brief: job application for websites
* @created: 2010/07
* @todo: classify
*/
// config
$email = "[email protected]"; // recipient
$site = "unknown";
<!doctype html>
<head>
<style>
body {font-size:1em; font-family:Droid Sans,Verdana,Helvetica,sans-serif;}
.iwrap { float:left;padding:2px}
.iwrap label {display:block;font-weight:bold;}
.iwrap.border { border:1px #eee solid;padding:2px;margin:4px}
.iwrap.border label {text-align:center}
@billcreswell
billcreswell / TimeCardValidRange.php
Created February 8, 2014 12:15
For a time range, like a time card entry, check that input range of time is valid, and check against a table with times entered to avoid overlap; Allow times to "touch" in a minute range.
/**
* @brief Check for Valid Time In and Out
*
* @params arr(in_time, out_time, technichian_id);
* @return json (success,message);
*/
private function isValidRange($params)
{
// validate input
if ($params["in_time"] == "1969-12-31 19:00") die("{'success': false, 'message': 'Incorrect Time In.'}");
@billcreswell
billcreswell / BloggerFBLikeButton
Last active December 17, 2015 08:38
Add FB Like Button to Each Blogger Post
Put the FB Javascript code in the template
This code was retrieved from https://developers.facebook.com/docs/reference/plugins/like/
at the time of this writing.
# Add to the Template:
1 Template/Edit HTML
2 Underneath the <body> tag:
@billcreswell
billcreswell / PHPProjectDocumentationHints
Created March 1, 2013 17:04
Setting up Documentation for PHP Projects With Doxygen
Separate subdirectory called "doxygen" for docs
use a dir list script in index.php for projects:
....
foreach($dirlist as $file) {
if ($file["type"] == "dir") {
} else {
@billcreswell
billcreswell / jQToC.html
Last active December 14, 2015 03:08
Dynamically generate a table of contents of all #jQueryMobile data-role=pages's?
<!DOCTYPE html>
<head>
<title>Automatically generate table of contents using jQuery </title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#toc").append('<p>In this article:</p>')
$("h1[data-role='page']").each(function(i) {
var current = $(this);