Skip to content

Instantly share code, notes, and snippets.

View tgmarinho's full-sized avatar
💻
read my blog: tgmarinho.com

Thiago Marinho tgmarinho

💻
read my blog: tgmarinho.com
View GitHub Profile
@tgmarinho
tgmarinho / AddTaskContainer.js
Last active March 31, 2018 13:09
High Order Function -> Form of forms!
import { graphql } from 'react-apollo';
import gql from 'graphql-tag';
import { withForm } from './withForm';
import { AddTask } from '../ui/AddTask';
export const addTaskMutation = graphql(
gql`
mutation addTask($task: AddTaskInput!) {
addTask(task: $task) {
@tgmarinho
tgmarinho / App.js
Created April 2, 2018 18:24
Post no Medium sobre Composição básica de componentes
import React, { Componente } from 'react';
import LikeButton from './likeButton';
import DeslikeButton from './deslikeButton';
class App extends Component {
 
 render () {
  return (
<div>
<LikeButton />
import React from 'react';
const Button = ({children, handleClick}) => (
<button onClick={handleClick}>
{children}
</button>
);
export default Button;
import React from 'react';
import Button from './button';
const LikeButton = () => (
<Button handleClick={() => alert(‘You Like It’)}>Curtir</Button>
);
export default LikeButton;
import React from 'react';
import Button from './button'
const DeslikeButton = () => (
<Button handleClick={() => alert(‘You Deslike It’)}>Descurtir</Button>
);
export default DeslikeButton;
import React, { Component } from 'react';
import LikeButton from './likeButton';
import DeslikeButton from './deslikeButton';
class App extends Component {
 
 render () {
return (
<div>
<LikeButton />
@tgmarinho
tgmarinho / remover-branch.git
Last active April 3, 2018 15:15
remover a branch local e remota
Para apagar o branch localmente:
git branch -D <nome do branch>
Para apagar o branch remotamente:
git push <nome do origin> <nome do branch> --delete
@tgmarinho
tgmarinho / main.js
Created April 20, 2018 17:43
Add new todos from main.js Meteor
// Add new todos
import { Meteor } from 'meteor/meteor';
import { TasksCollection } from 'my/path/to/collections/TasksCollection';
Meteor.startup(function() {
const data = JSON.parse(Assets.getText('csvjson.json')); // esta na pasta private do Meteor
console.log(data.length);
@tgmarinho
tgmarinho / TasksCollection.js
Created April 20, 2018 17:44
how to create a Collection Mongo in the Meteor
import { Mongo } from 'meteor/mongo';
const tasksCollection = new Mongo.Collection('tasks');
Object.assign(tasksCollection, {
add(task) {
this.insert({ ...task }));
});
var copyTextareaBtn = document.querySelector('.js-textareacopybtn');
copyTextareaBtn.addEventListener('click', function(event) {
var copyTextarea = document.querySelector('.js-copytextarea');
copyTextarea.focus();
copyTextarea.select();
try {
var successful = document.execCommand('copy');
var msg = successful ? 'successful' : 'unsuccessful';