Skip to content

Instantly share code, notes, and snippets.

Avatar

Augusto Pissarra abernardobr

View GitHub Profile
View But PDFMaker
const Path = require('path');
var fonts = {
Roboto: {
normal: Path.join(__dirname, 'fonts/Roboto-Regular.ttf'),
bold: Path.join(__dirname, 'fonts/Roboto-Medium.ttf'),
italics: Path.join(__dirname, 'fonts/Roboto-Italic.ttf'),
bolditalics: Path.join(__dirname, 'fonts/Roboto-MediumItalic.ttf')
}
};
View redis
var _ = require('lodash');
var HD = require('hd').utils;
var Domains = require('hd').domains;
var Redis = require("redis");
var internals = { };
internals = {
client: null,
connected: false
@abernardobr
abernardobr / coverletterdet.js
Created Apr 27, 2016
emprego.net - front-end - code examples
View coverletterdet.js
// CRUD for the CoverLetter
// Author: Augusto Pissarra
var _modelName = "cartasdet";
var _renderOrder = ["login", "menu", _modelName];
var _pageTitle = HS.get("Professional Central");
var _pageName = HS.get("Cover Letter");
var _pageTitleCls = 'icon-user';
var _breadcrumbs = [
@abernardobr
abernardobr / activities.js
Created Apr 27, 2016
emprego.net - example code - back-end
View activities.js
var _ = require('lodash');
var Mongoose = require('mongoose');
var Mongoosastic = require('mongoosastic')
var Behaviours = require("hd-behaviours");
var Decorators = require("hd-decorators");
var Async = require('async');
var HD = require('hd').utils;
var Domains = require('hd').domains;
var SanitizerPlugin = require('mongoose-sanitizer');
var HStatus = require('hd-status');
@abernardobr
abernardobr / crypto_xml_a3.txt
Last active Apr 15, 2020
Example XML Crypto, using A3
View crypto_xml_a3.txt
var SignedXml = require('xml-crypto').SignedXml;
var FileKeyInfo = require('xml-crypto').FileKeyInfo;
LocalSchema.statics.sign = function(options, cb) {
var user = options.user;
if(user.orgId !== options.payload.orgId) {
return cb(HD.errors.unauthorizedAction, {});
}
@abernardobr
abernardobr / getfipe.js
Last active Dec 22, 2015
Importar tabela FIPE mongodb
View getfipe.js
var Args = require('commander');
Args
.version('0.0.1')
.option('-s, --servertype [type]', 'Type of the server location: dev, test, accept or prod')
.option('-r, --routes [routes]', 'A comma separeated routes: admin,server')
.option('-e, --environment [environment]', 'If we are running on windows, mac or linux. Default is mac.')
.parse(process.argv);
process.env["servertype"] = Args.servertype ? Args.servertype : "dev";
process.env["environment"] = Args.environment ? Args.environment : "mac";
@abernardobr
abernardobr / Install Graphics Magick on CentOS 7
Last active Sep 20, 2020
Install Graphics Magick on CentOS 7
View Install Graphics Magick on CentOS 7
# Get Graphics Magick
> cd /
> mkdir /dowload
> cd /download
> wget ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/GraphicsMagick-LATEST.tar.gz
> tar -xzvf GraphicsMagick-LATEST.tar.gz
> cd GraphicsMagick-1.3.21 (or the lastest graphics magick)
# Install Graphics Magick
## Get libs
@abernardobr
abernardobr / Client Code
Created Aug 14, 2015
How to upload images to S3 using Graphics Magick and Knox S3 npm module
View Client Code
/ At the client, just use a normal post. I use jQuery and do an AJAX post
// In your HTML
<form id="uploadForm" autocomplete="off" action="" method="post" enctype="multipart/form-data"></form>
<input id='fileId' type="file" accept="image/*">
// In you JS
var $form = $('#uploadForm');
var $file = $('#fileId');
@abernardobr
abernardobr / Installing Graphics Magic
Created Aug 14, 2015
How to install Graphics Magick
View Installing Graphics Magic
## On Windows:
``http://www.graphicsmagick.org/INSTALL-windows.html``
## On the Mac:
``brew install graphicsmagick``
## On the Joyent box:
```
View hd_urlclientcrawler.js
// Client file
//***** hdCrawl ******//
// dependencies
// * lodash or underscore
// * jQuery
// Providers
hdCrawlProviders = {
You can’t perform that action at this time.