Skip to content

Instantly share code, notes, and snippets.

@kocisov
kocisov / server.js
Created March 28, 2018 14:41
express or bust
// require your modules
var express = require('express')
var bodyParser = require('body-parser')
// create instance of express
var app = express()
// let app use body-parser
// this one is parsing application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }))
@kocisov
kocisov / index.js
Created September 1, 2017 23:38
flook
function flookThis (input) {
console.log(input)
}
@kocisov
kocisov / index.js
Created August 3, 2017 20:21
tp02l
// example
// don't overthink this too much
class X extends PureComponent {
// constructor equivalent for creating initial state
state = {
something: ''
}
// function that returns another function
changeReturn = () => e => {
@kocisov
kocisov / index.less
Created June 14, 2017 20:00
Atom icon Aesthetic UI xd
.icon::before {
animation: cc 5s infinite linear;
}
@keyframes cc {
0% {
color: #fff;
}
10% {
class E extends PureComponent {
changeText = e => {
this.setState({
text: e.target.value
});
}
render() {
return (
<div onClick={this.changeText} />
class FirstComponent extends Component {
state = {
a: 2
}
changeState = val => {
this.setState({
a: val
})
}
@kocisov
kocisov / index.js
Created May 1, 2017 16:36
for smart bois
// smart boi with redux would do it like this
store = {
notification: {
status: 'error',
message: 'Error message'
} || {
status: 'success',
message: 'Success message'
}
}
export default ({ error, success }) => {
const message = error.message ? error.message : success.message
return (
<div>
{message}
</div>
)
}
// That first component lul
...
render() {
return (
...
<Notification error={this.state.error} success={this.state.success} />
...
)
}