Skip to content

Instantly share code, notes, and snippets.

View fjcero's full-sized avatar

Francisco Caballero fjcero

View GitHub Profile
/Users/fjcero/project/node_modules/sequelize/node_modules/bluebird/js/main/captured_trace.js:478 Unhandled rejection Error: TypeError: Illegal invocation
at Object.ensureErrorObject (/Users/fjcero/project/node_modules/sequelize/node_modules/bluebird/js/main/util.js:228:20)
at Promise._rejectCallback (/Users/fjcero/project/node_modules/sequelize/node_modules/bluebird/js/main/promise.js:416:22)
at Promise._settlePromiseFromHandler (/Users/fjcero/project/node_modules/sequelize/node_modules/bluebird/js/main/promise.js:460:17)
at Promise._settlePromiseAt (/Users/fjcero/project/node_modules/sequelize/node_modules/bluebird/js/main/promise.js:530:18)
at Promise._settlePromises (/Users/fjcero/project/node_modules/sequelize/node_modules/bluebird/js/main/promise.js:646:14)
at Async._drainQueue (/Users/fjcero/project/node_modules/sequelize/node_modules/bluebird/js/main/async.js:177:16)
at Async._drainQueues (/Users/fjcero/project/node_modules/sequelize/node_modules/bluebird/js/main/async.js:187:10)
at Imm
# tcpdump -A -nn -s 0 'tcp dst port 9200 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' -i lo
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on lo, link-type EN10MB (Ethernet), capture size 65535 bytes
14:32:33.525122 IP 127.0.0.1.49777 > 127.0.0.1.9200: Flags [P.], seq 313752908:313753888, ack 2465010394, win 257, options [nop,nop,TS val 2684167067 ecr 2684167066], length 980
E...^.@[email protected]#...}L...............
..#...#.GET /index/_search HTTP/1.1
Host: 127.0.0.1:9200
Accept: */*
Content-Length: 845
Content-Type: application/x-www-form-urlencoded
@fjcero
fjcero / megaNumber.js
Last active August 29, 2015 14:24 — forked from timgit/megaNumber.js
angular.module('utilsModule').filter("megaNumber", () => {
return (number, fractionSize) => {
if(number === null) return null;
if(number === 0) return "0";
if(!fractionSize || fractionSize < 0)
fractionSize = 1;
var abs = Math.abs(number);
@fjcero
fjcero / Gruntfile.js
Last active September 10, 2015 15:57 — forked from nnarhinen/Gruntfile.js
Support html5 pushState (or angular.js html5mode) in a yeoman (grunt-contrib-connect) application.
module.exports = function (grunt) {
// show elapsed time at the end
require('time-grunt')(grunt);
// load all grunt tasks
require('load-grunt-tasks')(grunt);
//MODIFIED: add require for connect-modewrite
var modRewrite = require('connect-modrewrite');
grunt.initConfig({
@fjcero
fjcero / gist:4844c65fde536302a154
Created September 25, 2015 13:40 — forked from alexcrown/gist:089971889fda0ca4e7b1
Jasig CAS auth in angular webapp
$scope.login = function () {
$http({ // getting TGT (Ticket Granting Ticket)
method: 'POST',
url: 'http://localhost/cas/v1/tickets',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
data: $.param({username: $scope.loginform.username, password: $scope.loginform.password})
}).success(function(data, status, headers) {
// CAS returns location where we can request service ticket
var location = headers('Location');
$http({ //requesting service ticket, rest/app/heartbeat is part of our app
@fjcero
fjcero / what-forces-layout.md
Created September 28, 2015 20:14 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@fjcero
fjcero / ingress-crawl-portal-level.js
Created November 6, 2015 20:05 — forked from teckl/ingress-crawl-portal-level.js
Ingress portal level crawler with PhantomJS.
/**
* @file Ingress portal level crawler with PhantomJS
* @author teckl (https://github.com/teckl)
* @version 0.0.1
* @license MIT
* @see {@link https://github.com/nibogd/tg-ingress-scorebot|GitHub }
* @see {@link https://github.com/jonatkins/ingress-intel-total-conversion|GitHub }
*/
"use strict";
@fjcero
fjcero / gist:581550fc55402e96de4e
Created February 4, 2016 12:14
fliename_clean.php
<?php
$fname='Filenam$e 123;'.'"'.'la\l[a]*(/.jpg';
$replace="_";
$pattern="/([[:alnum:]_\.-]*)/";
$filename =str_replace(str_split(preg_replace($pattern,$replace,$fname)),$replace,$fname);
echo $filename; // Output: Filenam_e_123__la_l_a____.jpg
?>
@fjcero
fjcero / handler.js
Created March 16, 2016 22:45 — forked from ThisIsMissEm/handler.js
The better way to execute Go on Amazon Lambda (see: http://blog.0x82.com/2014/11/24/aws-lambda-functions-in-go/)
var child_process = require('child_process');
exports.handler = function(event, context) {
var proc = spawn('./test', [ JSON.stringify(event) ], { stdio: 'inherit' });
proc.on('close', function(code){
if(code !== 0) {
return context.done(new Error("Process exited with non-zero status code"));
}
@fjcero
fjcero / README.md
Created June 8, 2016 22:54 — forked from hilios/README.md
ngPageTitle - AngularJS page title service

$pageTitle

Allows to control the page title from the AngularJS route system, controllers or any other component through an injectable service.

ngPageTitle - Page title service (run tests)

To get started add the module to your app and configure the page title provider: