Skip to content

Instantly share code, notes, and snippets.

View suissa's full-sized avatar
🏠
Working from home

Jean Carlo Nascimento suissa

🏠
Working from home
  • Oncorithms Institute
  • Brasil
View GitHub Profile
@suissa
suissa / api.js
Created September 8, 2013 00:33 — forked from fwielstra/api.js
/* The API controller
Exports 3 methods:
* post - Creates a new thread
* list - Returns a list of threads
* show - Displays a thread and its posts
*/
var Thread = require('../models/thread.js');
var Post = require('../models/post.js');

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

Setup Mac OS X

I'm in a hospital in Spain and my MacBook was stolen.

Hospital Commit

Now I bought a new one and need to configure it. I have an external hard drive that backup everything using Time Machine, but I don't want all the crap I had in the old one.

1. Run Software Update

Teste para projetos responsivos

Problema

Testar/verificar a disposição dos elementos de uma determinada página em determinadas resoluções de tela.

Solução

Executar captura de telas de acordo com os viewports definidos em um script, com a ajuda do PhantomJS.

Necessário ter o NodeJS instalado.

@suissa
suissa / app.js
Last active August 29, 2015 14:05 — forked from alanhoff/app.js
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(){
module.exports = function(app) {
var Schema = require('mongoose').Schema;
var People = Schema({
Name: String,
Address: {
type: Schema.Types.ObjectId,
ref: 'Address'
},
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': [ ],
package main
import (
"fmt"
"strconv"
)
func is_happy_number(number int) bool {
str := strconv.Itoa(number)
const express = require('express');
const router = express.Router();
const mongoose = require('mongoose'); // mongo connection
const bodyParser = require('body-parser'); // parses information from POST
const methodOverride = require('method-override'); // used to manipulate POST
router.get('/', function(req, res, next) {
const isCuisine = (req) => (req.query.cuisine && req.query.cuisine !="All");
@suissa
suissa / pub-sub.js
Created September 11, 2016 01:25 — forked from reu/pub-sub.js
node.js redis pub-sub example
var redis = require("redis")
, subscriber = redis.createClient()
, publisher = redis.createClient();
subscriber.on("message", function(channel, message) {
console.log("Message '" + message + "' on channel '" + channel + "' arrived!")
});
subscriber.subscribe("test");