This file contains hidden or 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
<div class="outer"> | |
<div class="inner"> | |
</div> | |
</div> | |
var html_to_inject = "<div class=\"middle\"></div>" | |
$(".outer").inject(html_to_inject).html(); //gives us: |
This file contains hidden or 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
module ProperOO | |
self.instance_variables.each do |i| | |
class_eval <<CODE | |
def get_#{i} | |
i | |
end | |
def set_#{i} newVal | |
@#{i} = newVal | |
end | |
CODE |
This file contains hidden or 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
if params[:title] | |
@posts = Post.where("UPPER(posts.title) LIKE UPPER(%?%)", parmas[:title]).paginate(:page => 1, :order => "created_at DESC", :per_page => 20) | |
else | |
@posts = Post.paginate(:page => 1, :orde r= "created_at DESC", :per_page => 20) | |
end |
This file contains hidden or 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
<?php | |
/** | |
* @version $Id: mod_latestnews.php 14401 2010-01-26 14:10:00Z louis $ | |
* @package Joomla | |
* @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved. | |
* @license GNU/GPL, see LICENSE.php | |
* Joomla! is free software. This version may have been modified pursuant | |
* to the GNU General Public License, and as distributed it includes or | |
* is derivative of works licensed under the GNU General Public License or | |
* other free or open source software licenses. |
This file contains hidden or 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
<?php | |
/** | |
* @version $Id: helper.php 14401 2010-01-26 14:10:00Z louis $ | |
* @package Joomla | |
* @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved. | |
* @license GNU/GPL, see LICENSE.php | |
* Joomla! is free software. This version may have been modified pursuant | |
* to the GNU General Public License, and as distributed it includes or | |
* is derivative of works licensed under the GNU General Public License or | |
* other free or open source software licenses. |
This file contains hidden or 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
<?php // no direct access | |
defined('_JEXEC') or die('Restricted access'); ?> | |
<ul class="blogmenuouter<?php echo $params->get('moduleclass_sfx'); ?>"> | |
<?php foreach ($list as $item) : ?> | |
<li class="blogmenuouter<?php echo $params->get('moduleclass_sfx'); ?>"> | |
<a href="<?php echo $item->link; ?>" class="latestnews<?php echo $params->get('moduleclass_sfx'); ?>"> | |
<?php echo $item->text; ?></a> | |
</li> | |
<?php endforeach; ?> | |
</ul> |
This file contains hidden or 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
<?php // @version $Id: blog_item.php 11917 2009-05-29 19:37:05Z ian $ | |
defined('_JEXEC') or die('Restricted access'); | |
?> | |
<?php if ($this->user->authorize('com_content', 'edit', 'content', 'all') || $this->user->authorize('com_content', 'edit', 'content', 'own')) : ?> | |
<div class="contentpaneopen_edit<?php echo $this->escape($this->item->params->get('pageclass_sfx')); ?>"> | |
<?php echo JHTML::_('icon.edit', $this->item, $this->item->params, $this->access); ?> | |
</div> | |
<?php endif; ?> | |
<div class="blogpostheader"> |
This file contains hidden or 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
string = [<<ONE, <<TWO, <<THREE] | |
the first thing | |
ONE | |
the second thing | |
TWO | |
and the third thing | |
THREE | |
# evaluates to: | |
# ["the first thing", "the second thing", "and the third thing"] |
This file contains hidden or 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
##in view: | |
link_to "TEST", blog_path(:year => 2010, :month => 09) | |
##when routes looks like: | |
match 'blog', => 'blog#index' | |
match 'blog(/:year/:month)' => 'blog#index' |
This file contains hidden or 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
class Post < ActiveRecord::Base | |
scope :date_counts, lambda { | |
group('DATE_FORMAT(created_at, "%Y/%m")').count | |
} | |
##Post.date_counts GENERATES ERROR: ArgumentError: Unknown key(s): 2009/01, 2009/02, 2009/03, 2009/04, 2009/06 ... etc | |
def self.date_counts | |
self.group('DATE_FORMAT(created_at, "%Y/%m")').count | |
end |