Skip to content

Instantly share code, notes, and snippets.

Avatar

Ferran Basora fcsonline

View GitHub Profile
@fcsonline
fcsonline / events.rb
Created Jan 24, 2019
Events / Commands / Callbacks / Observers / Webhooks
View events.rb
module ApiCore
module TeamInteractor
class Create
attr_accessor(
:team,
:team_params,
:team_metadata_params,
:author
)
@fcsonline
fcsonline / mlocate.sh
Created May 10, 2018
Disable mlocate un Ubuntu (100% CPU and 100% IO problems)
View mlocate.sh
sudo chmod -x /etc/cron.daily/mlocate
sudo dpkg -P mlocate
sudo tee /etc/apt/preferences.d/disable-mlocate << EOF
Package: mlocate
Pin: release o=Ubuntu
Pin-Priority: -1
EOF
View CartList.css
.cart {
border: 1px solid #ddd;
}
.cart li {
margin-bottom: 10px;
border: 1px solid red;
}
.cart li.selected {
@fcsonline
fcsonline / CartList.html
Created Dec 2, 2016
Cart - CartList markup
View CartList.html
<ul class="cart">
<li>
<header>Item 1</header>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing.</p>
<button>Remove from cart</button>
</li>
<li class="premium selected">
<header>Item 2</header>
<p>Fusce vel neque sit amet felis fermentum cursus vitae.</p>
<button>Remove from cart</button>
@fcsonline
fcsonline / CartList.jsx
Last active Dec 2, 2016
Cart - CartList
View CartList.jsx
class CartList extends React.Component {
onClickItem(event, index) {
this.state.setState({
selected: [
...this.state.selected,
index
]
});
}
View Cart.html
<ul>
<li>
<div>
<header>Item 1</header>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing.</p>
<button>Remove from cart</button>
</div>
</li>
<li class="selected"> <!-- More clear responsibilities (SelectList) -->
<div class="premium"> <!-- More clear responsibilities (CartItem) -->
View SelectableList.css
.selectable-list {
border: 1px solid #ddd;
}
.selectable-list li {
padding-bottom: 10px; /* margin to padding ;) */
}
.selectable-list .selected {
background-color: blue;
}
View CartItem.jsx
class CartItem extends React.Component {
onClickRemove () {
// Go to your store and remove item
}
render() {
const { item } = this.props;
const isPremium = item.premium ? 'premium' : '';
return (
View SelectableList.jsx
class SelectableList extends React.Component {
onClickItem(event, index) {
this.state.setState({
selected: [
...this.state.selected,
index
]
});
}
View dcsp.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Test</title>
<script type="text/javascript" src="http://192.168.3.2/assets/javascript/app.js"></script>
<script type="text/javascript" src="./monkeypatch.js"></script>
</head>
<body>
You can’t perform that action at this time.