grid calendar generator for php Updated

Posted by & filed under Uncategorized.

This one's simpler based on php 5.3 and more calendar functions 14 fewer lines and it's using timestamps for each grid square, so you can use the dates well for whatever other purposes.
function grid_cal($m){
   $bag = ""; 
   $m = strtotime("first day of this month",$m);
	$i = strtotime("-" . date("w",$m) . " days",$m); // starts on the previous sunday
	$bag .= "<table class=\"cal-table\"><tr class=\"cal-month\">\n<td colspan=\"7\">" .date("F",$m) ." ". date("Y",$m) . "</td>\n</tr>\n<tr class=\"cal-days\">";
	for($j=0;$j<7;$j++){
		$bag .= "\n<td>" . date("D",strtotime("+$j days",$i)) . "</td>";
	}
	$bag .="\n</tr>";
	while(!(date("m",$i)>date("m",$m) && date("w",$i)==0)){
		if(date("w",$i) == 0)
			$bag .= "\n<tr>";
		$bag .= (date("m",$i)==date("m",$m)) ? "\n<td>" . date("j",$i) . "</td>" : "<td class='emptygrid'></td>";
			
		if(date("w",$i) == 6)
			$bag .= "\n</tr>";
		
		$i = strtotime("+1 day",$i);
	}
	$bag .= "\n</table>";
	return $bag;
}
here's how you'd use it...
 print grid_cal(time());











Export Markers From Final Cut & Import Into Logic Pro

Posted by & filed under Uncategorized.

There IS a way to do this! It seems impossible to get the markers into Logic, but it's not.
  1. export xml from Final Cut (FCP)
  2. import xml to Logic Pro
  3. download markerTool
  4. open xml file in markerTool
  5. select all markers in markerTool
  6. copy all the FCP markers
  7. open the marker text box in Logic
  8. paste



Basic PHP grid calendars

Posted by & filed under Uncategorized.



Here's how to make a basic PHP grid calendar. I started with this code and stripped it down to bare bones. http://www.phpjabbers.com/how-to-make-a-php-calendar-php26.html Here's a simple function that takes a month and year and it will mark today's grid square on the calendar with the class "cal-today"
function grid_cal($m,$y){
	$tabs = "\n\t\t\t\t";
	$w_days = array("S","M","T","W","T","F","S");
	$stamp = mktime(0,0,0,$m,1,$y);
	$maxday = date("t",$stamp);
	$thismonth = getdate ($stamp);
	$startday = $thismonth['wday'];			
?>

				<table class="cal-table">
					<tr class="cal-month">
						<td colspan="7"><?php echo date("F",$stamp).' '. date("Y",$stamp); ?></td>
					</tr>
					<tr class="cal-days">
						<?php foreach($w_days as $d) { echo "$tabs\t\t<td>$d</td>"; } ?>
				
					</tr>
<?php
	$curr_month = (date("F Y")==date("F Y",$stamp))? TRUE : FALSE; // if this calendar is displaying current month
	$today = date("j"); 
	for ($i=0; $i<($maxday+$startday); $i++) {
		if(($i % 7) == 0 ) echo "$tabs\t<tr class='cal-date'>";
		$date_class = ($curr_month && $i - $startday + 1 == $today)? " class='cal-today'": "";
		if($i < $startday) echo "$tabs\t\t<td></td>";
		else echo "$tabs\t\t<td{$date_class}>". ($i - $startday + 1) . "</td>";
		if(($i % 7) == 6 ) echo "$tabs\t</tr>\n";
	}
echo "$tabs</table>";

}
usage...
<?php grid_cal(date("n"),date("Y")); ?>



TypeIt4Me URL shortener using Bitly

Posted by & filed under Uncategorized.

Here's a quick thingy for bit.ly-ing urls. Copy a url, type your snippet and TypeIt4Me makes it a bit.ly url. To make applescript work right in TypeIt4Me, you'll need to add the a/s character at the beginning of your snippet content. At the bottom of the window, go to Insert> Special> a/s (Execute As Applescript)
set the ClipURL to (the clipboard as string)
# to get your api key, go to http://bitly.com/a/your_api_key
set u to "" # your username goes in the quotes
set k to "" # your api key goes in the quotes


ignoring case
	if ((characters 1 through 4 of ClipURL as string) is not "http") then
		return "Malformed URL."
	else
		set ClipURL to deHash(ClipURL)
		set curlCMD to ¬
			"curl --stderr /dev/null \"http://api.bitly.com/v3/shorten?login=" & u & "&apiKey=" & k & "&longUrl=" & ClipURL & "&format=txt\""
		
		-- Run the script and get the result:
		set tinyURL to (do shell script curlCMD)
		
		return tinyURL
	end if
end ignoring

on deHash(uri)
	set hash to "#"
	set rehash to "%23"
	set ditd to text item delimiters of AppleScript
	set text item delimiters of AppleScript to hash
	set uri to text items of uri
	set text item delimiters of AppleScript to rehash
	set uri to "" & uri
	set text item delimiters of AppleScript to ditd
	return uri
end deHash



Balloons = Dark Lord

Posted by & filed under Uncategorized.

Darth Vader Balloon Brian Asman is an amazing balloon sculptor in San Francisco who was a main character on TLC's Unpoppables (reality show about balloon twisters). He made this amazing Darth Vader sculpture. I especially like the light saber.
"Received a call to send something to a huge Star Wars fan. I've never created anything based on Star Wars before, and who better to create than the most recognized villain of all time? I was determined to make this a stand out work of art. Viewing images that span the years of the franchise, plus the Imperial March music playing repeatedly, I present The Dark Lord!"
Brian has won a bunch of international awards, he made a life-size effigy of me and a functioning couch all outta his magic latex bubbles. Here's his website : http://balloonsequalfun.com