Skip to content

Instantly share code, notes, and snippets.

View chris001177's full-sized avatar

Chris chris001177

  • india
View GitHub Profile
package main
import (
"net/http"
sarama "gopkg.in/Shopify/sarama.v1"
)
// KafkaController allows us to attach a producer
// to our handlers
package main
import (
"log"
sarama "gopkg.in/Shopify/sarama.v1"
)
// Process response grabs results and errors from a producer
// asynchronously
package main
import (
"fmt"
"github.com/Shopify/sarama"
)
func main() {
config := sarama.NewConfig()
package main
import (
"fmt"
"os"
"os/signal"
"github.com/Shopify/sarama"
)
package main
import (
"fmt"
"github.com/Shopify/sarama"
)
func main() {
// 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);
// 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! :)`)
});
<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() {
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
# cookbook/ingredients/schema.py
import graphene
from graphene_django.types import DjangoObjectType
from ingredients.models import Category, Ingredient
class CategoryType(DjangoObjectType):
class Meta: