Skip to content

Instantly share code, notes, and snippets.

@laras126
laras126 / gist:889794
Created March 28, 2011 00:17
var detail
<?php
$bodyfonts_array = array("one","two","three","four","five");
$options[] = array( ...
"options" => $bodyfonts_array );
@laras126
laras126 / gist:911716
Created April 9, 2011 19:56
load webfont
<?php
// Load WebFont
function gfonts_api($gf1) {
$addfont = <<<ADDFONTS
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js'></script>
<script type='text/javascript'>WebFont.load({ google: {families: [ '$gf1' ]}})</script>
<style type='text/css'>#blog-title {font-family: '$gf1', serif;}</style>
@laras126
laras126 / gist:911743
Created April 9, 2011 20:37
font array and such
<?php
$options[] = array( "name" => "Header Font",
"desc" => "Choose a font from the <a href='http://google.com/webfonts'>Google WebFont Directory</a> and type its name in the text field.",
"id" => $shortname."_google_hdr_font",
"std" => "",
"type" => "text");
@laras126
laras126 / gist:911744
Created April 9, 2011 20:37
load font
<script type='text/javascript'>WebFont.load({ google: {families: [ '$gf1' ]}})</script>
@laras126
laras126 / gist:911746
Created April 9, 2011 20:38
get loader
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js'></script>
@laras126
laras126 / gist:911748
Created April 9, 2011 20:39
call font
<?php
$hdr_dfont = get_option($shortname . '_default_hdr_font' );
gfonts_api($hdr_gfont);
@laras126
laras126 / gist:921676
Created April 15, 2011 13:26
post formats
<?php
// Post formats conditional in functions.php
// echo format and post classes for testing
function wpfolio_post_formats() {
global $post;
$post_id = $post->ID;
$format = get_post_format( $post_id );
@laras126
laras126 / gist:945458
Created April 27, 2011 23:23
MP3 Trigger
#include <MP3Trigger.h>
MP3Trigger trigger;
const int piezoPin = A0; // piezo connected to analog pin 0
const int threshold = 100;
int valueP = 0;
int buttonState = 0;
void setup()
@laras126
laras126 / gist:946331
Created April 28, 2011 13:20
void loop
if (valueP > threshold)
{
for (int i=1;i<=41;i++)
{
Serial.print("button");
trigger.trigger(i);
}
}
@laras126
laras126 / gist:955247
Created May 4, 2011 13:51
check PHP version
<?php
// Testing if we are dealing with version 5.3.0 or higher - prevent site crash if server uses older PHP version
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
// PHP5 function here
} else {
$error = "<strong>Invalid PHP version, unable to load WPFolio RSS feed. Check your server's PHP preferences and update to the latest PHP version.</strong>";
echo $error;
}