Skip to content

Instantly share code, notes, and snippets.

@kocisov
kocisov / _database.php
Created July 17, 2016 15:55
Database class
<?php
class Database extends PDO {
protected $dbHost;
protected $dbName;
protected $dbUser;
protected $dbPass;
public function __construct() {
// assign */a
@kocisov
kocisov / index.html
Last active August 4, 2016 19:58
How to properly create HTML document
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="css files here">
<script src="js files here"></script>
</head>
<body>
Body content here...
@kocisov
kocisov / posts.json
Created December 18, 2016 16:34
Blog posts JSON
[
{
"id": "1",
"title": "Lorem Ipsum",
"short_desc": "Dolor",
"category": "Quarte",
"images": [],
"text": "Lorem ipsum dolor quarte"
},
{
@kocisov
kocisov / user.js
Created March 15, 2017 20:52
User reducer
const CHANGE = '.../user/CHANGE'
export default function user (state = {
name: 'Koci',
avatar: '//placecage.com/200/200',
rank_group: 5,
points: 1341
}, action) {
switch (action.type) {
case CHANGE:
@kocisov
kocisov / index.js
Created March 15, 2017 21:03
Entry file
import React from 'react'
import { render } from 'react-dom'
import { Provider } from 'react-redux'
import { syncHistoryWithStore } from 'react-router-redux'
import store from './store'
import {
Router,
Route,
IndexRoute,
@kocisov
kocisov / next_nginx.md
Last active April 10, 2024 14:27
How to setup next.js app on nginx with letsencrypt
@kocisov
kocisov / index.css
Last active October 19, 2017 20:22
atom cc animation
@keyframes cc {
0% {
color: #fff;
}
10% {
color: #c92a2a;
}
20% {
@kocisov
kocisov / index.js
Created April 22, 2017 09:23
emoteParserLUL
import parse from 'twitch-emoji';
import bttv from './bttv.json'; // https://api.betterttv.net/emotes
// it's a mess, just... don't... please... save us
function emoteParser (msg) {
let _msg = msg;
msg.split(/\s+/).map(t => {
bttv.emotes.filter(emote => t === emote.regex).map(e => {
if (e.url && e.url.length > 0) {
@kocisov
kocisov / index.js
Last active April 30, 2017 16:45
redux215
// Component.js
import React from 'react'
// get props from redux store
export default ({ user, login }) =>
<div>
{!user.isAuthenticated ?
<div>
<button onClick={login}>
Login with StreamLabs
function mapStateToProps (state) {
return {
user: state.user
}
}
// or
function mapStateToProps ({ user }) {
return {
user