Skip to content

Instantly share code, notes, and snippets.

View navarroaxel's full-sized avatar

Axel Navarro navarroaxel

View GitHub Profile
_.reduce(req.body.labels,
(promise, requestLabel) => promise.then(
() => {
var label = new model.Label(requestLabel);
label.branch = DISTRIBUTION_BRANCH_ID;
return labelsService.createLabel(label);
}
),
Promise.resolve()
).then(
<div ng-repeat="alert in $ctrl.alerts">
<div>{{alert.message}}</div>
</div>
router.post('/:id/picture',
global.app.data.buckets({
bucket: 'pip-recreational-centers',
nameSuffix: req => '_' + req.params.id + '.png'
}),
(req, res, next) => model.RecreationalCenter.findById(req.params.id).then(
recreationCenter => {
recreationCenter.picture = req.resource.Location;
return playlist.save();
}
<div ng-hide="$ctrl.showUploadPicture" class="row form-group">
<div class="col-xs-12">
<div ng-show="$ctrl.currentPicture">
<img ng-src="{{$ctrl.currentPicture}}" alt="{{$ctrl.course.name}}"/>
</div>
<br/>
<br/>
<a ng-hide="$ctrl.showUploadPicture" ng-click="$ctrl.showUploadPicture = true">
<span class="fa fa-cloud-upload"></span>
<span>Subir imagen</span>
/*@ngInject*/
export default function pingService($http, endpoint) {
return {
ping: () => $http.get(`${endpoint}ping`).then(response => response.data)
};
}
#!/bin/sh
#husky 0.13.1
command_exists () {
command -v "$1" >/dev/null 2>&1
}
load_nvm () {
export $1=$2
[ -s "$1/nvm.sh" ] && . $1/nvm.sh
const {reduce} = require('async');
this.sumColumn = function (rowsNumber, columnPosition,callback) {
var total = 0, value;
reduce(rowsNumber, 0, (acum, i) => {
browser.getText(ELEMENTS.ROW.locator + ':nth-child(' + i + ') td:nth-child(' + columnPosition + ')',
result => {
value = parseInt(JSON.stringify(result.value).replace(/\D/g, ''));
callback(null, acum + (value || 0));
console.log('counting... '+acum);
<div ng-switch="$ctrl.resolve.chapterZero.homeOpenDoor">
<p ng-switch-when="1">La vivienda esta deshabitada</p>
<p ng-switch-when="16">El hogar abrió la puera, recibio material</p>
<p ng-switch-default>{{::$ctrl.resolve.chapterZero.homeOpenDoor}}</p>
</div>
@navarroaxel
navarroaxel / index.js
Created March 19, 2018 14:43
redux-saga - takeLast
export default function* root() {
yield [
fork(fetchByParams)
]
export default class MegaValidator extends Validator {
constructor(validationLogic) {
super();
if (!isFunction(validationLogic)) {
throw new Error('Validator must have a method for validating.');
}
this.validationLogic = validationLogic;
}
forThis(entity) {