Skip to content

Instantly share code, notes, and snippets.

View kidsil's full-sized avatar

Asaf Zamir kidsil

View GitHub Profile
@kidsil
kidsil / the > sign on css
Created June 24, 2010 06:28
what does the '>' on CSS means
The sign '>' in CSS means Direct Child:
<ul>
<li>
ul > li OK
<ul>
<div>
@kidsil
kidsil / sortTableColumns.js
Created June 27, 2010 13:44
Sorting Table by column
//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 {
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))}")
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))}")
'$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
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!
/**
* Implements hook_theme().
*/
function product_attribute_theme() {
return array(
'product_attribute_formatter_product_attribute' => array(
'arguments' => array('element' => NULL),
),
);
}
# 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 = '';
@kidsil
kidsil / dropshadow.jquery.plugin.js
Created March 1, 2011 11:43
small changes adding topoffset, leftoffset and opacity
/**
* Drop Shadow Plugin jQuery
* http://sarfraznawaz.wordpress.com/
* Author: Sarfraz Ahmed (sarfraznawaz2005@gmail.com)
*/
(function($){
$.fn.dropshadow = function(settings){
// Extend default settings
@kidsil
kidsil / netbeans toggle line
Created March 1, 2011 22:14
toggle line macro netbeans
select-line cut-to-clipboard caret-up caret-begin-line paste-from-clipboard