This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @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.'}"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @brief: job application for websites | |
* @created: 2010/07 | |
* @todo: classify | |
*/ | |
// config | |
$email = "something@example.com"; // recipient | |
$site = "unknown"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Use whatever method you like to grab your HTML string. We'll use a site I mentioned in this post | |
* as an example. | |
*/ | |
$remote_site_data = file_get_contents('http://www.10stripe.com/articles/automatically-generate-table-of-contents-php.php'); | |
$dom_document = new DomDocument(); | |
@$dom_document->loadHTML($remote_site_data); | |
$headers = $dom_document->getElementsByTagName('h2'); | |
foreach ($headers as $header) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$url="http://thehilolowdown.blogspot.com/feeds/posts/default?max-results=1"; | |
$_c = curl_init(); | |
curl_setopt($_c, CURLOPT_URL, $url); | |
curl_setopt($_c, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($_c, CURLOPT_TIMEOUT, 3); | |
//curl_setopt($_c, CURLOPT_USERPWD, "$_user:$_pass"); | |
//curl_setopt($_c, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); | |
$_data = curl_exec($_c); | |
$response= curl_getinfo($_c); |
OlderNewer