This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Database extends PDO { | |
protected $dbHost; | |
protected $dbName; | |
protected $dbUser; | |
protected $dbPass; | |
public function __construct() { | |
// assign */a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": "1", | |
"title": "Lorem Ipsum", | |
"short_desc": "Dolor", | |
"category": "Quarte", | |
"images": [], | |
"text": "Lorem ipsum dolor quarte" | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function mapStateToProps (state) { | |
return { | |
user: state.user | |
} | |
} | |
// or | |
function mapStateToProps ({ user }) { | |
return { | |
user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const USER_LOGGED_IN = '*/user/USER_LOGGED_IN' | |
const apiUrl = 'http://localhost:3000/api/login' | |
// If you haven't already installed redux-thunk middleware | |
// just do it LOL: https://github.com/gaearon/redux-thunk | |
// then doDis | |
function login ({ username, password }) { | |
return dispatch => { | |
fetch(`${apiUrl}`, { | |
method: 'POST', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// import react and router | |
import React, { Component } from 'react'; | |
import { Route } from 'react-router-dom'; | |
import Home from './Home' | |
export default class App extends Component { | |
render() { | |
return ( | |
<div> | |
{/* this is how you add comments inside react render function -> jsx */} |
OlderNewer