Skip to content

Instantly share code, notes, and snippets.

{
"$schema": "vscode://schemas/color-theme",
"type": "dark",
"colors": {
"activityBar.activeBackground": "#0f0f0f",
"activityBar.activeBorder": "#0f0f0f",
"activityBar.background": "#0f0f0f",
"activityBar.border": "#000000",
"activityBar.foreground": "#dddddd",
"activityBar.inactiveForeground": "#888888",
@HybridFox
HybridFox / component.js
Last active September 5, 2018 10:54
Stateless react component
// @flow
import React from 'react';
import classNames from 'classnames';
import { Modal } from '../modal/Modal';
type Props = {
className?: string,
};
<?php
header('Content-Type: application/json');
include "../includes/raw.inc.php";
$code = array(
"success" => false,
"error" => ""
);
if (!empty($_POST["body"]) && !empty($_POST["post_id"])) {
<?php
/**
* Created by PhpStorm.
* User: felik
* Date: 4/25/2017
* Time: 3:12 PM
*/
class Interaction
{
private $post;
$("#comment").bind("submit", function(e) {
$.post('ajax/createComment.php', $(this).serialize(), function(data) {
if (data.success) {
$(".comment-list").prepend('<div class="row comment">' +
'<div class="col-md-2">' +
'<img class="comment-avatar" src="uploads/avatars/' + data.avatar + '" alt="">' +
'</div>' +
'<div class="col-md-10">' +
'<div class="comment-body">' +
'<h3>' + data.fullname + '</h3>' +
<?php
public function getLikes()
{
$pdo = Db::getInstance();
$stmt = $pdo->prepare("SELECT count(*) as likes FROM user_likes WHERE post = :postid");
$stmt->bindValue(":postid", $this->post);
$stmt->execute();
return $stmt->fetch(PDO::FETCH_ASSOC)['likes'];
}