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
{hora: [ | |
0: [{ | |
tipo: {type: String, default: ''} | |
, idPublicacao: Schema.Types.ObjectId | |
}] | |
, 1: [{ | |
tipo: {type: String, default: ''} | |
, idPublicacao: Schema.Types.ObjectId | |
}] | |
, 2: [{ |
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
db.timeline.findOne() | |
{ | |
_id: "username_month_day_hour", | |
time: [ | |
'59': [ { _idEvent: ObjectId(....), text:'some description text', media:['url'], embedded: "..." } ], | |
'58': [ { _idEvent: ObjectId(....), text:'some description text', media:['url'], embedded: "..." } ], | |
'57': [ { _idEvent: ObjectId(....), text:'some description text', media:['url'], embedded: "..." } ], | |
'56': [ ], | |
'55': [ { _idEvent: ObjectId(....), text:'some description text', media:['url'], embedded: "..." } ], | |
'54': [ ], |
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'); | |
// Criando o servidor para o proxy | |
http.Server(function(req, res){ | |
res.writeHead(200, { | |
'Content-Type' : 'application/json; charset=utf-8', | |
'Transfer-Encoding' : 'chunked' | |
}); | |
setInterval(function(){ |
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
{ | |
"color_scheme": "Packages/Theme - Spacegray/base16-eighties.dark.tmTheme", | |
"font_size": 16, | |
"ignored_packages": | |
[ | |
"Vintage", | |
"BracketHighlighter", | |
"Markdown" | |
], | |
"tab_size": 2, |
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 Beer = require('./model') | |
, Cervejaria = require('./model-cervejaria') | |
; | |
Cervejaria | |
.findOne() | |
.populate('beers') | |
.exec(function (err, cervejaria) { | |
if (err) return console.log('Erro: ', err); | |
console.log('Cervejaria', cervejaria); |
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 main | |
import ( | |
"fmt" | |
"strconv" | |
) | |
func is_happy_number(number int) bool { | |
str := strconv.Itoa(number) |
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 MongoClient = require('mongodb').MongoClient | |
, url = 'mongodb://localhost:27017/geodb' | |
, lugar = { | |
name: "Zona da Creide" | |
, loc: [50, 50] | |
} | |
; | |
MongoClient.connect(url, function(err, db) { | |
if(err) return console.log(err); |
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 express = require('express') | |
, router = express.Router() | |
, Controller = require('./../controller') | |
; | |
var cbCreate = function(req, res) { | |
Controller.create(req, res); | |
} | |
, cbRetrieve = function(req, res) { | |
Controller.retrieve(req, res); |
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 mongoose = require('mongoose'); | |
mongoose.connect('mongodb://localhost/workshop-online-julho-2015'); | |
var db = mongoose.connection; | |
db.on('error', function(err){ | |
console.log('Erro de conexao.', err); | |
}); | |
db.on('open', function () { | |
console.log('Conexão aberta.'); |
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
function somar(x, y) { | |
return x + y; | |
}; | |
function subtrair(x, y) { | |
return x - y; | |
}; | |
function multiplicar(x, y) { | |
return x * y; |