This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The sign '>' in CSS means Direct Child: | |
<ul> | |
<li> | |
ul > li OK | |
<ul> | |
<div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//written by seth from StackOverFlow | |
//Thanks. | |
// sorting function for the headers | |
function th_sorter(a, b) { | |
// just compare the text | |
var cmp = $(a).text() > $(b).text(); | |
if (cmp) { | |
return 1; | |
} | |
else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
So, you want to search in your MongoDB? | |
Here's how to do so | |
'puki' is my collection, for normal people it would be articles, pages or whatever | |
$query is what I'm searching for, here I have inside puki a body and name, | |
I want to retrieve pukis that have $query in their name or body | |
$db = MangoDB::instance(); | |
$puki = $db->find('puki', array( | |
new MongoCode("function() { return (/$query/i.test(this.body) || (/$query/i.test(this.name))}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
So, you want to search in your MongoDB? | |
Here's how to do so | |
'puki' is my collection, for normal people it would be articles, pages or whatever | |
$query is what I'm searching for, here I have inside puki a body and name, | |
I want to retrieve pukis that have $query in their name or body | |
$db = MangoDB::instance(); | |
$puki = $db->find('puki', array( | |
new MongoCode("function() { return (/$query/i.test(this.body) || (/$query/i.test(this.name))}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'$where' => new MongoCode("function() { return /$query/i.test(this.body) }") | |
This works great if I want to find $query in the object's body, | |
I want to add OR if the object _id is in the array $IDS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ever wondered how the hell you connect Doctrine to MS SQL? | |
simply through this: | |
$manager = Doctrine_Manager::getInstance(); | |
$manager->openConnection('dblib://'.$db['user'].':'.$db['password'].'@'.$db['host'].'/'.$db['database']); | |
This should do it! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements hook_theme(). | |
*/ | |
function product_attribute_theme() { | |
return array( | |
'product_attribute_formatter_product_attribute' => array( | |
'arguments' => array('element' => NULL), | |
), | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Strip non Alphanumeric (_ and -) from whatever field you want on MySQL | |
CREATE FUNCTION `strip_non_alpha`(_dirty_string CHAR(127)) RETURNS char(127) CHARSET utf8 | |
BEGIN | |
DECLARE _length int; | |
DECLARE _position int; | |
DECLARE _current_char varchar(1); | |
DECLARE _clean_string varchar(40); | |
SET _clean_string = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Drop Shadow Plugin jQuery | |
* http://sarfraznawaz.wordpress.com/ | |
* Author: Sarfraz Ahmed (sarfraznawaz2005@gmail.com) | |
*/ | |
(function($){ | |
$.fn.dropshadow = function(settings){ | |
// Extend default settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select-line cut-to-clipboard caret-up caret-begin-line paste-from-clipboard |