Skip to content

Instantly share code, notes, and snippets.

View ReneeVandervelde's full-sized avatar
🌻
Keeping software in full bloom

Renee Vandervelde ReneeVandervelde

🌻
Keeping software in full bloom
View GitHub Profile
@ReneeVandervelde
ReneeVandervelde / getDirectoryList
Created March 22, 2011 18:21
Returns an array of filenames for a given directory
<?php
/**
* Returns an array of filenames for a given directory
*
* @param string $directory The directory of files to list
* @return array the array of files
*/
function getDirectoryList($directory){
$files= array();
$h = opendir($directory);
@ReneeVandervelde
ReneeVandervelde / stripHTML
Created March 26, 2011 06:31
Strips HTML from inside PRE tags only
function stripHTML($str) {
preg_match_all('#</?pre(>|\s[^>]*>)(.*?)</pre(>|\s[^>]*>)#is',$str,$matches);
foreach($matches[2] as $match){
$str = str_replace($match, htmlspecialchars($match),$str);
}
$str = preg_replace("/<\?/","&lt;?",$str);
$str = preg_replace("/\?>/","?&gt;",$str);
return $str;
}
@ReneeVandervelde
ReneeVandervelde / horsepowerIncrease
Created April 26, 2011 06:08
Increase in horsepower Calculation based on 0-60 times
#include <stdlib.h>
#include<iostream>
using namespace std;
/**
* Estimates the increase in horsepower of a car based on weight and a change in 0 to 60 times.
*
* @author Jimmy Goodsell
*/
@ReneeVandervelde
ReneeVandervelde / GCal_UIFix.js
Created July 1, 2011 15:22
Google Calender UI Text Fix
// Copyright (c) 2011, Max Vandervelde
// Released under the MIT license
//
// --------------------------------------------------------------------
//
// This is a Greasemonkey user script. To install it, you need
// Greasemonkey 0.3 or later: http://greasemonkey.mozdev.org/
// Then restart Firefox and revisit this script.
// Under Tools, there will be a new menu item to "Install User Script".
// Copyright (c) 2011, Max Vandervelde
// Released under the MIT license
//
// --------------------------------------------------------------------
//
// This is a Greasemonkey user script. To install it, you need
// Greasemonkey 0.3 or later: http://greasemonkey.mozdev.org/
// Then restart Firefox and revisit this script.
// Under Tools, there will be a new menu item to "Install User Script".
// Accept the default configuration and install.
@ReneeVandervelde
ReneeVandervelde / User.php
Created November 11, 2011 23:40
Xplane/User class
<?php
class User extends SQLObject {
static function structure(){
self::field("name","varchar(32)");
self::field("email","varchar(127)");
self::field("verified","varchar(64)");
}
links = document.getElementById("box");
for(x=0;x<links.length;++x){
if(links[x].innerHTML == "blah1"){
links[x].style.display="none";
}
//or
if(links[x].getAttribute("href")=="blah1.html"){
links[x].style.display="none";
}
}
<?
function markDown($str){
//Tag like markdown, ordered by precedence.
//This is the only thing you really need to configure.
//It's a regular expression (without delimiters) as the key and the desired output as the value.
$markdownSet = array(
"\_\*(.*)\*_" => " <b><i>$2</i></b> ",
@ReneeVandervelde
ReneeVandervelde / googleui.user.js
Created April 11, 2012 19:08
Google+ UI tweaks
// Copyright (c) 2011, Max Vandervelde
// Released under the MIT license
//
// --------------------------------------------------------------------
//
// This is a Greasemonkey user script. To install it, you need
// Greasemonkey 0.3 or later: http://greasemonkey.mozdev.org/
// Then restart Firefox and revisit this script.
// Under Tools, there will be a new menu item to "Install User Script".
// Accept the default configuration and install.
@ReneeVandervelde
ReneeVandervelde / example.php
Created April 17, 2012 02:01
PHP Readable Timestamps
<?
include "time.php";
$ugly = "2012-03-16 00:12:29";
$pretty = Time\readable($ugly);
echo $pretty;
?>