Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

alex http://webcracy.org

« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS 

Calcular o dígito de controle do Bilhete de Identidade

Este método Ruby ajuda a calcular o dígito de controle do Bilhete de Identidade português.

Substituir os X na variável "var" pelos números do BI.

Se o BI tiver menos de 8 dígitos, é necessário adicionar quantos zeros forem precisos à frente do número até obter um total de 8 dígitos (exemplo: 123456, o número torna-se 00123456)

var = (9*X) + (8*X) + (7*X) + (6*X) + (5*X) + (4*X) + (3*X) + (2*X)
digicon = (var.remainder(11) - 11).abs


A partir de informação em http://www.atractor.pt/mat/alg_controlo/bi/BI_texto.htm

RSS output of a Prologue post

// This is how Prologue outputs a post

<item>
		<title></title>
		<link>http://localhost/wordpress/?p=3</link>
		<comments>http://localhost/wordpress/?p=3#comments</comments>
		<pubDate>Tue, 29 Jan 2008 23:54:15 +0000</pubDate>

		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[welcome]]></category>

		<guid isPermaLink="false">http://localhost/wordpress/?p=3</guid>
		<description><![CDATA[Pretty cool, here&#8217;s the Twitta!]]></description>
			
                <content:encoded><![CDATA[<p>Pretty cool, here&#8217;s the Twitta!</p>]]></content:encoded>
			<wfw:commentRss>http://localhost/wordpress/?feed=rss2&p=3</wfw:commentRss>

</item>

« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS