Skip to content

Instantly share code, notes, and snippets.

View rbnpercy's full-sized avatar

Robin Percy rbnpercy

View GitHub Profile
proc addTwoIntegers(a, b: int): int {.importc.}
when isMainModule:
echo addTwoIntegers(3, 7)
<html>
<body>
<script type="text/javascript">
function addTwoIntegers(a, b)
{
return a + b;
}
</script>
<script type="text/javascript" src="calculator.js"></script>
{.compile: "logic.c".}
proc addTwoIntegers(a, b: cint): cint {.importc.}
when isMainModule:
echo addTwoIntegers(3, 7)
int addTwoIntegers(int a, int b)
{
return a + b;
}
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
for i := 0; i < 10; i++ {
(ns async-example.core
(:require [clojure.core.async :refer :all])
(:gen-class))
(defn -main [& args]
(doseq [i (range 10)]
(go
(Thread/sleep (rand-int 1000))
(println i)))
require "rubygems"
require "bunny"
require "json"
# Returns a connection instance
conn = Bunny.new ENV['CLOUDAMQP_URL']
# The connection will be established when start is called
conn.start
# Create a channel in the TCP connection
require "rubygems"
require "bunny"
require "json"
# Returns a connection instance
conn = Bunny.new ENV['CLOUDAMQP_URL']
# The connection will be established when start is called
conn.start
# create a channel in the TCP connection
require "kafka"
logger = Logger.new($stderr)
brokers = ENV.fetch("KAFKA_BROKERS")
# Make sure to create this topic in your Kafka cluster or configure the
# cluster to auto-create topics.
topic = "text"
kafka = Kafka.new(
require "kafka"
# We don't want log output to clutter the console. Replace `StringIO.new`
# with e.g. `$stderr` if you want to see what's happening under the hood.
logger = Logger.new(StringIO.new)
brokers = ENV.fetch("KAFKA_BROKERS").split(",")
# Make sure to create this topic in your Kafka cluster or configure the
# cluster to auto-create topics.