Skip to content

Instantly share code, notes, and snippets.

Daniel Rodríguez Rivero danielo515

  • Madrid Spain
Block or report user

Report or block danielo515

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@danielo515
danielo515 / README.md
Last active Aug 31, 2018
Demonstrate how lab code coverage can get into a promise chain
View README.md

This is just an example to demonstrate how lab code coverage can get in the way

@danielo515
danielo515 / .travis.yml
Last active Jul 5, 2018 — forked from willprice/.travis.yml
How to set up TravisCI for projects that push back to github
View .travis.yml
language: node_js
cache: yarn
node_js:
- "8.9.0"
branches:
only:
- master
script: # this are lerna-setup related
- npm run npm-setup
- npm run publish -- --yes --skip-git # lerna does not pick the correct repo url, so skip git
@danielo515
danielo515 / travis-ci-git-commit.bash
Created May 26, 2018 — forked from ddgenome/travis-ci-git-commit.bash
Make a commit on a branch in a Travis CI build, dealing with detached HEAD state safely
View travis-ci-git-commit.bash
#!/bin/bash
# function to make a commit on a branch in a Travis CI build
# be sure to avoid creating a Travis CI fork bomb
# see https://github.com/travis-ci/travis-ci/issues/1701
function travis-branch-commit() {
local head_ref branch_ref
head_ref=$(git rev-parse HEAD)
if [[ $? -ne 0 || ! $head_ref ]]; then
err "failed to get HEAD reference"
return 1
@danielo515
danielo515 / .hyper.js
Created Sep 13, 2017
Issue with npmRegistry
View .hyper.js
module.exports = {
config: {
hyperCommandGifs: {
disabledCommands: [ 'push' ]
},
npmRegistry: 'https://registry.npmjs.org/',
// default font size in pixels for all tabs
fontSize: 12,
@danielo515
danielo515 / create-gh-labels.js
Created Jul 12, 2017
Creates one label on github per package on a lerna repository
View create-gh-labels.js
#!/usr/bin/env node
'use strict';
/**
* This script creates labels at github.
* It depends on github-api and yargs packages, so make sure you have them installed
* on the environment you are going to run this.
* It accepts a github token or a combination of username and password for auth.
* The token can also be provided as an environment variable.
* To display help just run it with the -h or --help flag.
*
@danielo515
danielo515 / list_packages.js
Created Jul 12, 2017
List all packages under a lerna repository
View list_packages.js
'use strict';
const Fs = require('fs');
const ReadDir = Fs.readdirSync;
const Stat = Fs.statSync;
module.exports = (basePath) => {
const getAllPackages = () => ReadDir(basePath)
.map((d) => `${basePath}/${d}`)
View felicityFail.js
'use strict';
const Urls = ['www.google.es','www.google.com','www.google.it','www.google.de','www.google.no'];
const extension = (joi) => ({
base: joi.string(),
name: 'url',
language: {
metrics: 'needs to be one of {{urls}}'
},
@danielo515
danielo515 / clearEmpties.js
Last active Jun 9, 2017
A function that deletes empty object properties (null or undefined) and also deletes empty objects recursively. It is a small modification from https://stackoverflow.com/a/42736367/1734815
View clearEmpties.js
function valid(x){
return !( x == null || Number.isNaN(x));
}
function clearEmpties(o) {
for (const k in o) {
if (!valid(o[k])) {
delete o[k];
continue;
}
if (typeof o[k] !== 'object') {
@danielo515
danielo515 / clearEmpties
Created Jun 8, 2017
A function that deletes empty object properties (null or undefined) and also deletes empty objects recursively.
View clearEmpties
function clearEmpties(o) {
for (const k in o) {
if (o[k] == null) {
delete o[k];
continue;
}
if (typeof o[k] !== 'object') {
continue;
}
@danielo515
danielo515 / axios-set-base-path.js
Last active Apr 29, 2017 — forked from srph/set-base-path.js
axios: Configure the base path with interceptors
View axios-set-base-path.js
var axios = require('axios');
var join = require('url-join');
// https://github.com/sindresorhus/is-absolute-url/blob/master/index.js#L7
var isAbsoluteURLRegex = /^(?:\w+:)\/\//;
axios.interceptors.request.use(function(config) {
// Concatenate base path if not an absolute URL
if ( !isAbsoluteURLRegex.test(config.url) ) {
config.url = join('http://my-api.com', config.url);
You can’t perform that action at this time.