Skip to content

Instantly share code, notes, and snippets.

View sequelize-users-repository.js
class SequelizeUsersRepository {
constructor({ userModel }) {
this.userModel = userModel;
}
add(user) {
const { valid, errors } = user.validate();
if(!valid) {
const error = new Error('ValidationError');
@leolana
leolana / actions-todoItem.js
Last active Aug 21, 2018
demo-todolist-redux
View actions-todoItem.js
import * as types from "./../constants/ActionTypes";
export const addItem = (todoItem, index) => {
const item = {
index,
value: todoItem.newItemValue,
done: false
};
return {
View demo-estados.jsx
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import Espelho from './Espelho';
class App extends Component {
constructor(props) {
super(props);
this.state = {
@leolana
leolana / phpunit.sh
Created Jul 16, 2017
PHPUnit script sheel run docker
View phpunit.sh
#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
echo "Current working directory: '"$(pwd)"'"
sudo docker run --rm -v $(pwd):/app -v ~/.ssh:/root/.ssh leonardolana/phpdocker:latest /usr/local/bin/phpunit.phar $@
@leolana
leolana / phpcs.sh
Created Jul 16, 2017
PHP_Code_Sniffer run docker
View phpcs.sh
#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
echo "Current working directory: '"$(pwd)"'"
sudo docker run --rm -v $(pwd):/app -v ~/.ssh:/root/.ssh leonardolana/phpdocker:latest /usr/local/bin/phpcs.phar $@
@leolana
leolana / php.sh
Created Jul 16, 2017
Php scipt run docker
View php.sh
#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
echo "Current working directory: '"$(pwd)"'"
echo "Expose port 5000"
sudo docker run --rm -it -p 5000:5000 -v $(pwd):/app -v ~/.ssh:/root/.ssh leonardolana/phpdocker:latest /usr/local/bin/php $@
@leolana
leolana / composer.sh
Created Jul 16, 2017
Composer script run docker
View composer.sh
#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
echo "Current working directory: '"$(pwd)"'"
tty=tty -s && tty=--tty
sudo docker run \
$tty \
--interactive \
--rm \
--user $(id -u):$(id -g) \
--volume /etc/passwd:/etc/passwd:ro \
@leolana
leolana / fiddle.html
Created Nov 28, 2016 — forked from njouanin/fiddle.html
angularJS zero padding filter
View fiddle.html
<div ng-app="MyApp">
<h1>Zero padding filter</h1>
<div>
<input type="text" ng-model="ztext" placeholder="Type some text ..." />
</div>
<div>
<h2>Result:</h2>
<p>{{ztext | zpad:4}}</p>
</div
</div>
@leolana
leolana / docs style (bootstrap) - notes
Last active Jun 27, 2016 — forked from matthiasg/docs style (bootstrap)
the callouts from the bootstrap documentation
View docs style (bootstrap) - notes
.note {
-ms-border-radius: 3px;
border: 1px solid #eee;
border-left-width: 5px;
border-radius: 3px;
margin: 20px 0;
padding: 20px;
}
.note:first-child {