Skip to content

Instantly share code, notes, and snippets.

View SeanJA's full-sized avatar
🦑
🦖

SeanJA SeanJA

🦑
🦖
View GitHub Profile
<?php
/**
* Looks for unquoted keys in a json string and fixes them ie: {a:"b"} => {"a":"b"}
* @param string $string A json string that is suspect
* @return string A valid json string
*/
function fix_json($string){
// (no qupte) (word) (no quote) (semicolon)
$regex = '/(?<!")([a-zA-Z0-9_]+)(?!")(?=:)/i';
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
*/
<?php
class date {
/**
* Display the time from now in a readable way
* @param int $targetTime
* @param int $now
* @return string
*/
<?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
/**
* Here an example using servlet 3.0 to upload file with file-uploader
*/
package com.silyan.simplex.view.site.content;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
//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';
}
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
@SeanJA
SeanJA / wtf.txt
Created September 16, 2010 20:54
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
@SeanJA
SeanJA / ie.css
Created September 27, 2010 23:41
hr {margin:-8px auto 11px;}
<?php
include 'classes/markdown.php';
$parser = new Markdown();
//Transform text using parser.
echo $parser->transform($text);