Skip to content

Instantly share code, notes, and snippets.

View juanmav's full-sized avatar
🎯
Focusing

Juan Manuel Vicente juanmav

🎯
Focusing
  • Bacelona, Spain
  • 20:06 (UTC +01:00)
View GitHub Profile
library(testthat)
calculateConnections <- function(layers) {
l <- length(layers)
total <- 0
for(i in 1:(l-1)) {
total <- total + layers[i] * layers[i+1]
}
return(total)
}
function userUpdate(userId, user, fetch = getFetch()) {
// /api/v1/users/username/eroskisuperclaves/
// dev.auth.olympiaviajes.es
const url = `http://${process.env.OAUTH_APP_URL}/api/v1/users/${userId}`;
console.initTime('', 'OAuthUserUpdate');
return fetch(url, {
method: 'PUT',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
function userUpdate(userId, user, fetch = getFetch()) {
// /api/v1/users/username/eroskisuperclaves/
// dev.auth.olympiaviajes.es
const url = `http://${process.env.OAUTH_APP_URL}/api/v1/users/${userId}`;
console.initTime('', 'OAuthUserUpdate');
return fetch(url, {
method: 'PUT',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
@juanmav
juanmav / example.md
Created December 4, 2017 15:24
example.md

TSJ CORE 111

En este documento se describen los servicios expuestos por el modulo core de la plataforma.

Group Login y autenticacion.

El login nos dara un JWT (Json web token) para se utilizado en las subsiguientes llamadas.

Creacion de credencial [/auth/token/]

@juanmav
juanmav / twitter-clon.md
Created September 14, 2017 22:25
Documentacion de la API

TwitterClon Backend

Endpoints:

Usuarios [/users/]

  • Crear una cuenta [/users/][POST]

Resquest

@juanmav
juanmav / nofailfastpromise.js
Created January 13, 2017 18:44
No fail fast promise solution
let p1 = new Promise((resolve, reject) => {
setTimeout(resolve, 1000, "Everything OK in Promise 1");
});
let p2 = new Promise((resolve, reject) => {
setTimeout(resolve, 2000, "Everything OK in Promise 2");
});
let p3 = new Promise((resolve, reject) => {
setTimeout(reject, 2500, new Error("Something went wrong in Promise 3!"));
});
@juanmav
juanmav / schema.json
Created May 13, 2016 20:31
schema json example
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"colorCielo": {
"type": "string"
},
"route": {
@juanmav
juanmav / gist:0caba41b5e9f6c9762c3
Created May 13, 2015 17:14
Profile ISO 19139 to Jsonix
var cswConfig = [
[
OWS_1_0_0,
DC_1_1,
DCT,
XLink_1_0,
SMIL_2_0,
SMIL_2_0_Language,
GML_3_1_1,
GML_3_2_0,
@juanmav
juanmav / gist:4f8d79e884fab5343586
Created April 15, 2015 15:15
Decorate a Directive
var app = angular.module('suriWebClientApp');
// http://angular-tips.com/blog/2013/09/experiment-decorating-directives/
app.config(function($provide){
$provide.decorator('mdTabsDirective', function($delegate) {
var directive = $delegate[0];
directive.template = '<section ng-hide="true" class="md-header" ng-class="{\'md-paginating\': pagination.active}"><button class="md-paginator md-prev" ng-if="pagination.active && pagination.hasPrev" ng-click="pagination.clickPrevious()" aria-hidden="true"><md-icon md-svg-icon="tabs-arrow"></md-icon></button><div class="md-header-items-container" md-tabs-pagination><div class="md-header-items"><md-tabs-ink-bar></md-tabs-ink-bar></div></div><button class="md-paginator md-next" ng-if="pagination.active && pagination.hasNext" ng-click="pagination.clickNext()" aria-hidden="true"><md-icon md-svg-icon="tabs-arrow"></md-icon></button></section><section class="md-tabs-content"></section>'
return $delegate;
});
});
@juanmav
juanmav / gist:789cc85f1d09d3f9f2b9
Created December 12, 2014 17:19
Boostrap Angular on device Ready
document.addEventListener("deviceready",
function() {
angular.element(document).ready(
function () {
// retrieve the DOM element that had the ng-app attribute
var domElement = document.getElementById('appElement');
angular.bootstrap(domElement, ["angularAppName"]);
});
}, false);