Skip to content

Instantly share code, notes, and snippets.

<?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">
<?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>
<?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.
<?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.
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
@eqdw
eqdw / ProperOO.rb
Created October 28, 2010 18:48
In case you miss Java...
module ProperOO
self.instance_variables.each do |i|
class_eval <<CODE
def get_#{i}
i
end
def set_#{i} newVal
@#{i} = newVal
end
CODE
<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 code borrowed from the internet
class Array
# Returns the "power set" for this Array. This means that an array with all
# subsets of the array's elements will be returned.
def power
# the power set line is stolen from http://johncarrino.net/blog/2006/08/11/powerset-in-ruby/
inject([[]]) do |c,y|
r=[]
c.each do |i|
r<<i
require 'mathn'
@min = 227000
@primes = [2,3,5,7,11]
@fibs = [1,1,2,3,5,8,13]
#fills @fibs until @fibs[-1] contains the first pribe fib greater than @min
def gen_fibs
@max_size = 0
def is_palindrome(str)
# puts " checking string #{str}"
rtn = true
i = 0
j = str.size-1
while(rtn && i<str.length && j >= 0)
puts " i,j: #{i},#{j}"