Skip to content

Instantly share code, notes, and snippets.

View michaltakac's full-sized avatar
👨‍🏫
https://keybase.io/michaltakac

Michal Takac michaltakac

👨‍🏫
https://keybase.io/michaltakac
View GitHub Profile
@michaltakac
michaltakac / createSidebarMenu.js
Created November 20, 2015 20:49
Meteorbox - function for creating sidebar menu
// With this function you can build sidebar menus
// dynamically just from your API.
// You just construct your menu object like this:
// {
// name: 'Main menu', // This is just a name to identify your menu (useful if you got more than one)
// menuItems: [ // main menu items
// {
// title: 'Dashboard',
// link: null,
@michaltakac
michaltakac / Sidebar.jsx
Created November 17, 2015 22:15
Meteorboard - Sidebar component
import Component from 'react-pure-render/component';
import React, {PropTypes} from 'react';
export default class Sidebar extends Component {
static propTypes = {
// ...
}
render() {
@michaltakac
michaltakac / Header.jsx
Last active November 17, 2015 22:12
Meteorboard - Header component
import Component from 'react-pure-render/component';
import React, {PropTypes} from 'react';
export default class Header extends Component {
static propTypes = {
// ...
}
render() {
@michaltakac
michaltakac / App.jsx
Last active November 17, 2015 22:12
Meteorboard Main layout
import './theme.less';
import Component from 'react-pure-render/component';
import {Grid, Row, Col} from 'react-bootstrap';
import Header from './Header.react';
import Sidebar from './components/Sidebar.react';
import React, {PropTypes} from 'react';
import RouterHandler from '../../common/components/RouterHandler.react';
import mapDispatchToProps from '../../common/app/mapDispatchToProps';
import mapStateToProps from '../../common/app/mapStateToProps';
import {connect} from 'react-redux';
@michaltakac
michaltakac / dashboard.js
Created October 17, 2015 00:26
Braintree demo - dashboard.js (v4)
Template.dashboard.onCreated(function() {
var instance = this;
instance.autorun(function() {
instance.subscribe('items');
});
});
Template.dashboard.onRendered(function() {
Meteor.call('getClientToken', function(error, clientToken) {
if (error) {
@michaltakac
michaltakac / billing.js
Created October 17, 2015 00:21
Braintree demo - billing.js (v2)
// Define gateway variable
var gateway;
Meteor.startup(function () {
var env;
// Pick Braintree environment based on environment defined in Meteor settings.
if (Meteor.settings.public.env === 'Production') {
env = Braintree.Environment.Production;
} else {
env = Braintree.Environment.Sandbox;
@michaltakac
michaltakac / dashboard.js
Created October 17, 2015 00:09
Braintree demo - dashboard.js (v3)
Template.dashboard.onCreated(function() {
var instance = this;
instance.autorun(function() {
instance.subscribe('items');
});
});
Template.dashboard.onRendered(function() {
Meteor.call('getClientToken', function(error, clientToken) {
if (error) {
@michaltakac
michaltakac / dashboard.html
Created October 16, 2015 23:36
Braintree demo - dashboard.html (v2)
<template name="dashboard">
<div class="template-dashboard">
<div class="page-header">
<h1>Dashboard</h1>
</div>
{{#if showForm}}
<h3>Buy access to our list of items!</h3>
<form role="form">
@michaltakac
michaltakac / dashboard.js
Created October 16, 2015 23:34
Braintree demo - dashboard.js (v2)
Template.dashboard.onCreated(function() {
var instance = this;
instance.autorun(function() {
instance.subscribe('items');
});
});
Template.dashboard.helpers({
items: function(){
return Items.find();
@michaltakac
michaltakac / dashboard.html
Created October 16, 2015 23:28
Braintree demo - dashboard.html (v1)
<template name="dashboard">
<div class="template-dashboard">
<div class="page-header">
<h1>Dashboard</h1>
</div>
<ul class="list-group">
{{#each items}}
<li class="list-group-item">{{ name }} <span class="label label-default">{{ rating }}</span></li>
{{/each}}