Skip to content

Instantly share code, notes, and snippets.

<?php //code to get a joomla user from the database
$query = 'SELECT * FROM #__user WHERE name == "' . $this->article->params->get('user_to_find') . '"';
$db = $mainframe->getDBObject;
$db->setQuery($query,0,0);
$rows = $db->getObjectList();
<?php
/**
* @version $Id: user.php 14401 2010-01-26 14:10:00Z louis $
* @package Joomla
* @subpackage User
* @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
def foo(bar, baz)
blah
blah
blah
end
compare with c equivalent:
function AddLink(item)
{
if(item.linkageExportForAS)
{
fl.outputPanel.trace(item.name + "-> currently linked");
return;
}
// split the string at the . to remove .png
function AddLink(item)
{
if(item.linkageExportForAS)
{
fl.outputPanel.trace(item.name + "-> currently linked");
return;
}
// split the string at the . to remove .png
def to_xml
rtn = "<task>"
instance_variables.each do |i|
rtn += "<#{i[1..-1]}>#{instance_variable_get(i)}</#{i[1..-1]}>"
end
rtn += "</task>"
rtn
#"<task><id>#{@id}</id><name>#{@name}</name><desc>#{@desc}</desc><priority>#{@priority}</priority></task>"
end
@in_item = false #are we in channel or item?
@link = [] #current link. becuase links and texts go together
line = gets
while(line)
if line =~ /<item>/
puts "<h2><a href=#{@link[0]}>#{escape(@link[1])}<\/a><\/h2>"
@in_item = true
elsif line =~ /<\/item>/
#!/usr/bin/ruby
require 'rubygems'
require 'yaml'
require 'chronic'
require 'date'
require 'time'
FILENAME = File.expand_path "~/.growls"
require 'securerandom'
require 'thread'
mutex = Mutex.new
pause = false
pauser = Thread.new do
while (true) do
s = gets
mutex.synchronize do
require 'securerandom'
require 'thread'
mutex = Mutex.new
pause = false
pauser = Thread.new do
while (true) do
s = gets
mutex.synchronize do