Skip to content

Instantly share code, notes, and snippets.

View albertosouza's full-sized avatar
👨‍🔬
Creating things

Alberto Souza albertosouza

👨‍🔬
Creating things
View GitHub Profile
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",
@albertosouza
albertosouza / wejs.local.js
Created September 17, 2014 12:52
Exemplo de local.js do we.js
/**
* file: config/local.js
*
* Local environment settings
*
* While you're DEVELOPING your app, this config file should include
* any settings specifically for your development computer (db passwords, etc.)
*
* When you're ready to deploy your app in PRODUCTION, you can always use this file
* for configuration options specific to the server where the app will be deployed.
@albertosouza
albertosouza / sails.config.getter.md
Last active August 29, 2015 14:05
Sails.js config getter funcion

If i try to get one sub depth attribute in sails.config and a sub attribute dont exists it will return a error but if i have a getter it can return a undefined even if a sub attribute dont exists

This is a good feature to core or is best to write a npm module (sails.utils.extra?) and plug this helpers with hook or bootstrap function?

May be something like:

/**
 * Get one sails.js config getter
 * 
@albertosouza
albertosouza / sails-acl-npm-module-proposal.md
Last active February 10, 2016 13:14
A Sails.js ACL with Roles / permissions configs proposal ... based in sails police

A ⛵ Sails.js ACL proposal ... based in polices

Please help build that feature with ideas 💭 here ... or code and tests here: https://github.com/wejs/sails-acl

How it will work? ...

What dependecies we need in our project?
  • User model - TODO add example link
@albertosouza
albertosouza / local.js
Created July 31, 2014 20:40
We.js clientside local.js config
module.exports = {
appName: 'We.js',
fileUploadPath: 'uploads/files',
imageUploadPath: 'uploads/images',
/**
@albertosouza
albertosouza / models-locale.js
Last active February 8, 2018 04:22
Sails.js simple example of localization with database
module.exports = {
adapter:'exampleDB',
//tableName:'locale',
attributes: {
text: {
type: 'string'
},
// locale config
@albertosouza
albertosouza / ex-forum-2-estacio-ED.hh
Last active August 29, 2015 14:02
Exercicio do fórum 2 da estacio de estrutura de dados 2014/1
#include <iostriam>
using namespace std;
// struct livro
struct livro {
// nome do livro
char nome[100];
// codigo do tipo de livro
int codigo;
};
var extend = require('util')._extend;
var async = require('async');
var Waterline = require('../node_modules/sails/node_modules/waterline');
var couchdb = require('sails-couchdb-orm');
var config = require('../config/adapters').adapters.couchdb;
couchdb.config = extend(couchdb.defaults, config);
module.exports = bootstrap;
@albertosouza
albertosouza / error-deploy-sails-node-jitsu
Created May 13, 2014 16:41
Error on sails deploy on node jitsu "jitsu deploy --debug"
pc:~/projetos/we-up(master)$ jitsu deploy --debug
info: Welcome to Nodejitsu albertosouza
info: jitsu v0.13.15, node v0.10.26
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Analyzing application dependencies in node app.js
debug: { method: 'GET',
debug: uri: 'https://api.nodejitsu.com/apps/albertosouza/we',
debug: headers:
debug: { Authorization: '*************************************************************************',
@albertosouza
albertosouza / Cakefile
Created January 11, 2014 21:19
Cakefile for run sails.js testes with mocha config and suport to --grep <string> option
# Cakefile
{exec} = require "child_process"
option '', '--grep [string]', 'only run tests matching <pattern>'
REPORTER = "spec"
task "test", "run all tests", (options)->
grep