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
package main | |
import ( | |
"net/http" | |
sarama "gopkg.in/Shopify/sarama.v1" | |
) | |
// KafkaController allows us to attach a producer | |
// to our handlers |
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
package main | |
import ( | |
"log" | |
sarama "gopkg.in/Shopify/sarama.v1" | |
) | |
// Process response grabs results and errors from a producer | |
// asynchronously |
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
package main | |
import ( | |
"fmt" | |
"github.com/Shopify/sarama" | |
) | |
func main() { | |
config := sarama.NewConfig() |
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
package main | |
import ( | |
"fmt" | |
"os" | |
"os/signal" | |
"github.com/Shopify/sarama" | |
) |
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
package main | |
import ( | |
"fmt" | |
"github.com/Shopify/sarama" | |
) | |
func main() { |
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 the EventBus we just created. | |
import { EventBus } from './event-bus.js'; | |
// The event handler function. | |
const clickHandler = function(clickCount) { | |
console.log(`Oh, that's nice. It's gotten ${clickCount} clicks! :)`) | |
} | |
// Listen to the event. | |
EventBus.$on('i-got-clicked', clickHandler); |
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 the EventBus. | |
import { EventBus } from './event-bus.js'; | |
// Listen for the i-got-clicked event and its payload. | |
EventBus.$on('i-got-clicked', clickCount => { | |
console.log(`Oh, that's nice. It's gotten ${clickCount} clicks! :)`) | |
}); |
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
<template> | |
<div class="pleeease-click-me" @click="emitGlobalClickEvent()"></div> | |
</template> | |
<script> | |
// Import the EventBus we just created. | |
import { EventBus } from './event-bus.js'; | |
export default { | |
data() { |
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 graphene | |
import ingredients.schema | |
class Query(ingredients.schema.Query, graphene.ObjectType): | |
# This class will inherit from multiple Queries | |
# as we begin to add more apps to our project | |
pass |
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
# cookbook/ingredients/schema.py | |
import graphene | |
from graphene_django.types import DjangoObjectType | |
from ingredients.models import Category, Ingredient | |
class CategoryType(DjangoObjectType): | |
class Meta: |