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
def self.find_all_by_tag(tag, &block) | |
array = [] | |
all = self.find(:all) | |
all.each do |one| | |
next if one.supertags.blank? | |
array << one.supertag(tag) unless one.supertag(tag).blank? | |
end | |
if block_given? | |
array.map(&block) | |
else |
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
def self.all_cached | |
last_id = Rails.cache.read('last_id') | |
last_time = Rails.cache.read('last_time') || Time.now | |
last_object = self.find(:first, :params => {:updated_since => last_time}) | |
self.recache if last_id.nil? || (last_object && last_id != last_object.id) | |
Rails.cache.read(self.clean_name) | |
end | |
def self.recache | |
['last_id', 'last_time', self.clean_name].each{|str| Rails.cache.delete(str)} |
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
Given /^there are a few contacts$/ do | |
Dupe.stub 2, :people | |
Dupe.stub 2, :companies | |
end | |
Then /^I should see all pre-registered contacts$/ do | |
Dupe.find(:people).each do |person| | |
Then %{I should see "#{person.first_name} #{person.last_name}"} | |
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
2.2.1. A linguagem Ruby | |
Ruby ([RUBY01]) é uma linguagem de programação de alto nível, dinâmica, reflexiva puramente orientada a objetos. Foi concebida em 1993 pelo analista japonês Yukihiro Matsumoto mas apenas recentemente atingiu um nível de popularidade maior devido ao lançamento do largamente utilizado framework para desenvolvimento web Ruby on Rails . | |
Apesar do interpretador padrão Ruby ter sido na linguagem C, existem várias implementações diferentes deste interpretador, a qual se destaca JRuby ([JRUBY01]), que foi escrita em Java e roda na máquina virtual Java (JVM). JRuby vem mostrando resultados superiores ao interpretador padrão quanto a velocidade além de permitir uma integração nativa com a linguagem Java. | |
Ruby é considerada uma linguagem de alto nível devida a sua sintaxe amigável ao usuário e devida a suas abstrações que escondem do programador detalhes específicos do computador, como o gerenciamento de memória e de escopo, ou seja, uma linguagem com foco no programador ao invés da máquina. | |
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
Feature: Login | |
In order to be able to use the application | |
As a user | |
I want to be able to login | |
Background: | |
Given the following users exists: | |
| name | login | password | password_confirmation | | |
| Default | default | 123456 | 123456 | |
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
require File.dirname(__FILE__) + '/acceptance_helper' | |
feature "Login", %q{ | |
In order to be able to use the application | |
As a user | |
I want to be able to login | |
} do | |
background do | |
Factory(:user, :login => 'default', :name => 'Default') |
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
var http = require('http'); | |
var url = 'http://radio.pedromtavares.com:10000'; // URL to a known Icecast stream | |
var icecast = require('icecast-stack'); | |
var stream = icecast.createReadStream(url); | |
// var radio = require("radio-stream"); | |
// var stream = radio.createReadStream(url); |
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
package com.ped; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; | |
import java.net.MalformedURLException; | |
import java.net.URL; | |
import org.apache.http.HttpResponse; |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
#define TAMANHO 10 | |
long fibonacci(long); | |
main (){ | |
long i, resultado[TAMANHO]; |
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
# Configure Riak connections for the Ripple library. | |
development: | |
#http_port: 8092 | |
#pb_port: 8087 | |
nodes: | |
- host: 127.0.0.1 | |
http_port: 8091 | |
- host: 127.0.0.1 | |
http_port: 8092 | |
- host: 127.0.0.1 |