Skip to content

Instantly share code, notes, and snippets.

View jonnu's full-sized avatar

Jon jonnu

  • London, UK
  • 23:18 (UTC)
View GitHub Profile

Keybase proof

I hereby claim:

  • I am jonnu on github.
  • I am jonnu (https://keybase.io/jonnu) on keybase.
  • I have a public key ASAvQfpnGL8pD6eagMLJUTbFGDGMTjnrsidXNHwgu_3CxAo

To claim this, I am signing this object:

@jonnu
jonnu / gist:3434840
Created August 23, 2012 09:47
Courtney CSS
blockquote {
padding: 3px 5px;
margin-left: 0;
margin-right: 0;
border-left: 2px solid #f9839d;
background: url(http://colourlovers.com.s3.amazonaws.com/images/patterns/2401/2401056.png?1334346265);
}
a:hover {
color: #ffffff;
I can’t even say what’s wrong with PHP, because – okay. Imagine you have uh, a toolbox. A set of tools. Looks okay, standard stuff in there.
You pull out a screwdriver, and you see it’s one of those weird tri-headed things. Okay, well, that’s not very useful to you, but you guess it comes in handy sometimes.
You pull out the hammer, but to your dismay, it has the claw part on both sides. Still serviceable though, I mean, you can hit nails with the middle of the head holding it sideways.
You pull out the pliers, but they don’t have those serrated surfaces; it’s flat and smooth. That’s less useful, but it still turns bolts well enough, so whatever.
And on you go. Everything in the box is kind of weird and quirky, but maybe not enough to make it completely worthless. And there’s no clear problem with the set as a whole; it still has all the tools.
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index 3536241..3a9249f 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -460,6 +460,11 @@ class CI_Form_validation {
$this->_field_data[$field]['postdata'] = $validation_array[$field];
}
+ if (empty($row['rules']))
+ {
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index 3536241..fe0dc93 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -460,7 +460,7 @@ class CI_Form_validation {
$this->_field_data[$field]['postdata'] = $validation_array[$field];
}
- $this->_execute($row, explode('|', $row['rules']), $this->_field_data[$field]['postdata']);
+ $this->_execute($row, preg_split('/\|/', $row['rules'], -1, PREG_SPLIT_NO_EMPTY), $this->_field_data[$field]['postdata']);
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index 3536241..46a8c41 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -630,6 +630,11 @@ class CI_Form_validation {
// Cycle through each rule and run it
foreach ($rules as $rule)
{
+ if (empty($rule))
+ {
@jonnu
jonnu / pngstrip.sh
Created January 25, 2012 13:36
pngstrip (using pngcrush)
#!/bin/bash
echo " "
shopt -s nullglob
for file in ./*.png; do
echo "Working on $file"
pngcrush -q -rem gAMA -rem cHRM -rem iCCP -rem sRGB $file "$file.tmp"
mv $file "$file.old"
mv "$file.tmp" $file
done