Skip to content

Instantly share code, notes, and snippets.

Avatar
🦑
🦖

SeanJA SeanJA

🦑
🦖
View GitHub Profile
View DB_active_rec.php
class CI_DB_active_record extends CI_DB_driver {
/**
* Select
*
* Generates the SELECT portion of the query
*
* @access public
* @param string
* @return CI_DB_active_record
*/
View Date.php
<?php
class date {
/**
* Display the time from now in a readable way
* @param int $targetTime
* @param int $now
* @return string
*/
View JSONEncodeTest.php
<?php
ini_set("include_path", "..".PATH_SEPARATOR."../../..".PATH_SEPARATOR.ini_get("include_path"));
require_once 'PHPUnit/Framework.php';
//include your json encoding classes, if you are using them
// /includes
View explode.js
//A version of http://twitter.com/gavinblair/statuses/24515252902 that will work everywhere as it does not rely on jQuery
var i=10,
elems = document.getElementsByTagName('a'),
exploder = setInterval(function(){
for(var e in elems){
(function(elem) {
if(elem.style){
elem.style.fontSize = i + 'px';
}
View confirmation.rb
module ActiveModel
# == Active Model Confirmation Validator
module Validations
class ConfirmationValidator < EachValidator
def validate_each(record, attribute, value)
if (confirmed = record.send("#{attribute}_confirmation")) && (value != confirmed)
record.errors.add(attribute, :confirmation, options)
end
end
View wtf.txt
line 1 column 60 - Error: invalid formal public identifier "-//w3c//dtd html 4.0 transitional//en": invalid public text class
line 19 column 213 - Error: "NOSAVE" is not a member of a group specified for any attribute
line 21 column 18 - Error: an attribute value must be a literal unless it contains only name characters
line 27 column 22 - Error: an attribute value must be a literal unless it contains only name characters
line 31 column 22 - Error: an attribute value must be a literal unless it contains only name characters
line 35 column 22 - Error: an attribute value must be a literal unless it contains only name characters
line 39 column 22 - Error: an attribute value must be a literal unless it contains only name characters
line 43 column 22 - Error: an attribute value must be a literal unless it contains only name characters
line 47 column 35 - Error: an attribute value must be a literal unless it contains only name characters
line 57 column 26 - Error: an attribute value must be a literal unless it cont
View ie.css
hr {margin:-8px auto 11px;}
View php52.php
<?php
include 'classes/markdown.php';
$parser = new Markdown();
//Transform text using parser.
echo $parser->transform($text);
View functions.php
<?php
//to have multiple sidebars in wordpress:
function mytheme_widgets_init() {
register_sidebar(array(
'name' => __( 'sidebar1', 'mytheme' ),
'id' => 'sidebar1-area',
'description' => __( 'The first sidebar area', 'mytheme' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h2>',
@SeanJA
SeanJA / php_shorttags.sh
Created Oct 28, 2010
grep php short tags
View php_shorttags.sh
grep -r "<?[^php]" *.php