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 "pdf/writer" | |
pdf = PDF::Writer.new | |
pdf.select_font "Times-Roman" | |
pdf.text "Certificado de POG", :font_size => 72, :justification => :center | |
pdf.text "Microsoft Corporation (R)", :font_size => 32, :justification => :center | |
pdf.text "O sr. Ricardo Lopes de Goes cumpriu os cursos da microsoft M$ POG001 ao M$ POG999++ e agora é um POGueiro.", :font_size => 12, :justification => :left | |
pdf.text "Grau de aproveitamento: 100% <gênial>", :font_size =>20, :justification => :left | |
pdf.save_as("certificacao.pdf") |
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
I paginate the data | |
@books = Book.paginate :page => params[:page], :conditions => ['title LIKE ?', "%#{params[:q]}%"] | |
then respond requests | |
respond_to do |format| | |
format.html # new.html.erb | |
#format.xml { render :xml => @user_book} | |
format.js |
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 <string> | |
#include <iostream> | |
#include <cstdlib> | |
using namespace std; | |
class AnalisadorLexico | |
{ | |
public: |
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 <string> | |
#include <iostream> | |
#include <cstdlib> | |
#include <cmath> | |
using namespace std; | |
class AnalisadorLexico | |
{ |
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
[2010-06-24 05:06:01] ERROR NoMethodError: private method `gsub!' called for #<Class:0x7fbf413febb8> | |
/usr/lib/ruby/1.8/webrick/htmlutils.rb:16:in `escape' | |
/usr/lib/ruby/1.8/webrick/httpresponse.rb:232:in `set_error' | |
/home/thiagofm/Documents/new_chan/vendor/rails/railties/lib/webrick_server.rb:94:in `handle_file' | |
/home/thiagofm/Documents/new_chan/vendor/rails/railties/lib/webrick_server.rb:73:in `service' | |
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service' | |
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run' | |
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread' | |
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start' | |
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread' |
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
I'm in script/console and i do the following: | |
>> @message.thread_id = 63 | |
=> 63 | |
>> @topic_update = Topic.find(:all,:conditions=>{:id=> @message.thread_id}) | |
=> [#<Topic id: 63, title: "fgfgf", created_at: "2010-06-25 12:27:20", updated_at: "2010-06-25 12:27:20">] | |
>> @topic_update.updated_at=Time.now | |
NoMethodError: undefined method `updated_at=' for #<Array:0x7f5209fd4ed8> | |
from (irb):11 |
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
#CONTROLLER | |
def refresh | |
s=Source.find(:all) | |
@updated_feeds=Array.new | |
s.each do |source| | |
@rss = SimpleRSS.parse open(source.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
/** | |
* Module dependencies. | |
*/ | |
var express = require('express'); | |
var app = module.exports = express.createServer(); | |
// Configuration |
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 mongoose = require('mongoose'); | |
var db = mongoose.connect('mongodb://localhost/mydb'); | |
var Schema = mongoose.Schema; | |
var Posts = new Schema({ | |
name : String, | |
subject: String, | |
comment : String, | |
password: String, | |
}); |
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
The algorithm has O(n*maximum_time) time complexity and O(n) space complexity and is a viable choice when Counting Sort's space complexity is a big issue and the numbers that will be sorted has many duplications and the maximum number isn't really far from the lowest(e.g. 1,1,1,2,2,2,2,3,3,4,5). | |
It works just like rain. The first raindrop that is more close to the ground(have less height) is the first to hit the ground and so on. | |
It works only with positive numbers but its possible to do it for negative, just use your head(big O complexity _is_ the same in this case). | |
It works for floating point and that's the reason why highestCommonFactor is used. | |
Pseudo-code(or pseudo-c++-code lol): |
OlderNewer