Skip to content

Instantly share code, notes, and snippets.

View gaboelnuevo's full-sized avatar

Gabriel S. L gaboelnuevo

View GitHub Profile
const hash = require("object-hash");
export const generate = (req: any) => {
const company = req.payload && req.payload.user.company._id.toString();
const obj = {
method: req.method,
originalUrl: req.originalUrl,
auth: req.header("Authorization"),
device: req.header("Device-Unique-Id"),
body: req.body && hash(req.body)
@gaboelnuevo
gaboelnuevo / angular-module-info-patch.js
Created February 11, 2019 22:03
angular-module-info-patch.js
"use strict";
var _oldModuleFunction = angular && angular.module;
if (_oldModuleFunction) {
angular.module = function () {
var _module = _oldModuleFunction.apply(void 0, arguments);
if (_module && !_module.info) {
_module.info = function () {
@gaboelnuevo
gaboelnuevo / realm-query-ext.js
Created September 19, 2018 07:23
add fullOuterJoin support to realm-query
RealmQuery.prototype.fullOuterJoin = function(query) {
const initialCriteria = this.criteria.slice();
// NOTE: We don't use arrow function because if the criteria of another RealmQuery is joined
// NOTE: we want 'this' instance to be used for the call such that values are pushed on to the correct instance.
if (initialCriteria.length) {
const q1 = function() {
return `(${initialCriteria
.map(wrapper => {
if (Array.isArray(wrapper)) {
return `(${wrapper
@gaboelnuevo
gaboelnuevo / MyScreen.js
Last active May 1, 2018 03:58
React.js Observable Props
import React from 'react';
import {
servicesConnector,
addNavigationOptions,
watchObservableProps,
} from './connectors';
import { realmResultToObservable } from './Utils';
import { Observable } from 'rxjs/Observable';
export default {
Exit: 'Exit',
ExitConfirm: 'Are you sure you want to exit this app',
YES: 'YES',
OK: 'OK',
ViewMyOrders: 'View My Oders',
CANCEL: 'CANCEL',
Confirm: 'Confirm',
//Scene's Titles
@gaboelnuevo
gaboelnuevo / tesseract_files.sh
Created September 22, 2017 19:48
tesseract aws lambda bin
#source: https://github.com/skylander86/lambda-text-extractor
sudo yum install libtool
sudo yum install libjpeg-devel libpng-devel libtiff-devel zlib-devel
curl http://www.leptonica.com/source/leptonica-1.73.tar.gz | tar xzv
cd leptonica-1.73 && ./configure && make && sudo make install && cd ..
curl -L https://github.com/tesseract-ocr/tesseract/archive/3.05.tar.gz | tar xzv
cd tesseract-3.05/ && ./autogen.sh && ./configure && make && sudo make install && cd ..
@gaboelnuevo
gaboelnuevo / Readme.md
Created August 11, 2017 01:35
Fireabse set cors

gsutil cors set cors.json gs://exampleproject.appspot.com

@gaboelnuevo
gaboelnuevo / .htaccess
Created August 10, 2017 05:43
httaccess protect files
Order Allow,Deny
Deny from all
<FilesMatch "\.(jpg|gif|png|php)$">
Order Deny,Allow
Allow from all
</FilesMatch>
<Directory "Your directory path/uploads/">
Allow from all
@gaboelnuevo
gaboelnuevo / example.js
Created August 1, 2017 07:01
js-report-example
var jsreportConfig = config.getKey("jsreport", null, null);
if(!jsreportConfig){
console.log("jsreport config not found")
return res.status(500).end();
}
var jsreport = require("jsreport-client")(
jsreportConfig.url,
jsreportConfig.username,
jsreportConfig.password
);
@gaboelnuevo
gaboelnuevo / datasources.local.js
Created July 30, 2017 10:01
loopback mongo uri
'use strict';
// serve/datasources.local.js
var mongodbUri = require('mongodb-uri');
var URI = process.env.MONGODB_URI;
var uriObject = URI ? mongodbUri.parse(URI) : null;
var config = {};