Skip to content

Instantly share code, notes, and snippets.

<ul>
<?go for index, item := range items { ?>
<li><?go fmt.Println(item) ?></li>
<?go } ?>
</ul>
@fsouza
fsouza / migration.js
Created October 4, 2012 19:37 — forked from flavianmissi/migration.js
mongodb "migration" script
// changes the data in db.collection[from] to
// db.collection[to] and deletes db.collection[from]
// how can I force the execution of the variables from and to?
function changeFieldKey(collection) {
var docs = db[collection].find({"from-key": {$exists: true}});
for (var i = 0; i < docs.length(); i++) {
print(docs[i])
docs[i]["to-key"] = docs[i]["from-key"];
delete docs[i]["from-key"];
print(docs[i])
type Person struct {
Name string
Age int
}
p := Person{Name: "andrews", Age: 1000}
Update(p, {"age": 27})
#include <stdio.h>
int produto (int a, int b) {
int vet1[20], vet2[20];
int soma, i, j;
vet2[0]=b;
vet1[0]=a;
i=1;
#include <stdio.h>
#include <stdlib.h>
struct Pessoa //registro que representa uma pessoa
{
char nome[100];
char raca[30];
int idade;
char opcao_sexual[30];
float altura;
#include <stdio.h>
#include <stdlib.h>
int parImpar(int numero)
{
if (numero%2==0)
return 1;
else
return 0;
}