Skip to content

Instantly share code, notes, and snippets.

Dani de la Cruz d4nidev

  • Barcelona
Block or report user

Report or block d4nidev

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
@d4nidev
d4nidev / remove-container.sh
Last active Oct 13, 2016
Command to remove a docker container given its name
View remove-container.sh
docker rm $(docker ps -aq --filter name=myContainerName)
@d4nidev
d4nidev / index.js
Created Oct 7, 2016
Convert an array to object
View index.js
const array = [ 'John', 'Mary', 'Luke']
const result = array.reduce((prev, acc, index) => {
return {...prev, [index]: acc}
}, {})
console.log(result) // { 1: 'John', 2: 'Mary', 3: 'Luke' },
@d4nidev
d4nidev / webpack.config.js
Created Aug 27, 2016
This webpack configuration resolves the warning of having two different instances of React when working with npm linked modules which has React themselves as a dependency
View webpack.config.js
{
resolve: {
alias: {
react: path.resolve('./node_modules/react')
}
}
}
@d4nidev
d4nidev / copyssh.sh
Created Aug 8, 2016
Copy your SSH key in your clipboard
View copyssh.sh
cat ~/.ssh/id_rsa.pub | pbcopy
View validator
import compose from 'validator'
const isRequired = () => {
return !!this.value
}
const maxLength = (maximum) => {
return this.value.length > maximum
}
@d4nidev
d4nidev / recursive-git-sh
Created Apr 14, 2016
Bash script for updating recursively your git repositories given a root path
View recursive-git-sh
for dir in $(find . -name ".git"); do cd ${dir%/*}; git pull ; cd -; done
@d4nidev
d4nidev / .babelrc
Created Feb 22, 2016
Minimal ExpressJS ES2015 server
View .babelrc
{
presets: [ "es2015" ]
}
View sumMultiplesOfFive.js
import expect from 'expect';
import {isMultipleOfFive, getMultiplesOfFive, getSumOfMultiples, sum} from '../src'
describe('Given a number', function(){
it('return true if it is a multiple of 5', function(){
expect(isMultipleOfFive(5)).toBe(true);
expect(isMultipleOfFive(10)).toBe(true);
expect(isMultipleOfFive(1)).toBe(false);
expect(isMultipleOfFive(9)).toBe(false);
});
You can’t perform that action at this time.