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 / export-this
Created January 20, 2014 05:47
Artigo sobre módulos em Node.js para ser traduzido. http://bites.goodeggs.com/posts/export-this/
<div class="entry-content"><p>When you require a module in Node, what are you getting back? When you write a module, what options do you have for designing its interface?</p>
<p>When I was first learning to work in Node I found the sheer number of ways to do things to be a bit overwhelming. JavaScript is extremely flexible and the community of developers contributing to open source seem to have different styles for implementing the same thing.</p>
<p>On my journey with Node I've been keeping an eye out the Good Way to do things and adopting them for use in my own work and in our work at Good Eggs.</p>
<p>In this post I'll share my observations of the Node module system and the ways in which you can use it to encapsulate and share code. My goal is to identify and illustrate useful patterns for module interface design and to help you understand when and how to use them in your own work.</p>
<p>I discuss seven patterns below, many of which can be used in combination. They are:</p>
<ul>
<li><a href="../../posts/e
@suissa
suissa / watermark.js
Last active June 12, 2023 10:07
Add watermark with Node.js and ffmpeg
var ffmpeg = require('ffmpeg');
try {
var process = new ffmpeg('example.mp4');
process.then(function (video) {
console.log('The video is ready to be processed');
var watermarkPath = 'watermark-suissa.png',
newFilepath = './video-com-watermark.mp4',
settings = {
position : "SE" // Position: NE NC NW SE SC SW C CE CW
@suissa
suissa / breakpoints-media-query
Created August 15, 2014 04:11
Breakpoints for media query with EM
// Breakpoints
// Base: 16px
// Small: 688px - 43em
// Tablets: 768px - 48em
// Desktop: 1024px - 64em
// Large Screen 1: 1440px - 90em
// Large Screen 2: 1600px - 100em
@suissa
suissa / mongoose-connection-best-practices
Created August 26, 2014 23:38
Mongoose best practices
// Bring Mongoose into the app
var mongoose = require( 'mongoose' );
// Build the connection string
var dbURI = 'mongodb://localhost/mongoose-best-practices';
// Create the database connection
mongoose.connect(dbURI);
// CONNECTION EVENTS
@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(){
@suissa
suissa / method-override-http-verbs
Created August 28, 2014 01:40
Using _method input hidden to override HTTP verbs
var methodOverride = require('method-override')
// NOTE: when using req.body, you must fully parse the request body
// before you call methodOverride() in your middleware stack,
// otherwise req.body will not be populated.
app.use(methodOverride(function(req, res){
if (req.body && typeof req.body === 'object' && '_method' in req.body) {
// look in urlencoded POST bodies and delete it
var method = req.body._method