Skip to content

Instantly share code, notes, and snippets.

Elben Shira elben

Block or report user

Report or block elben

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@elben
elben / ruby-exercises.md
Last active Sep 15, 2015
Fundamental programming exercises. Happens to be in Ruby.
View ruby-exercises.md

This is a principled approach to programming. We use Ruby as the delivery language, but the things you learn here applies to all programming languages. What you learn will be important in your day-to-day Ruby programming, but my primary goal is for you to understand common, important concepts of computation.

Ruby made unfortunate mistakes in its design—mistakes that we Ruby programmers have to deal with on a daily basis. Of course, we get used to those mistakes and start to think of them as "features" or "that's just how those things work." I will often "ignore" those mistakes at first so that you will understand the fundamental idea. The mistakes are edge cases that we have to worry about, but they should not get in your way of learning. Hence why some people (mainly people with exposure to Ruby) will consider the order of things very odd.

Type the examples into IRB and complete every exercise. Merely reading will not give you true understanding.

Important vocabulary are in bold.

1. Functions

@elben
elben / polls-api-nfl.markdown
Last active Aug 29, 2015
Polls API for NFL
View polls-api-nfl.markdown

Documentation that covers the Polls API with constrained topics. The example poll below is powered a stream's constrained topics, and all keyword management will be through the streams UI.

How to create a poll powered by constrained topics (in development):

Poll API

@elben
elben / understanding-transducers.clj
Last active Apr 3, 2018
Understanding Transducers. See README below.
View understanding-transducers.clj
(ns my-transducers.core
(:require [clojure.core.async :as async]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Understanding Transducers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This is the source code for the blog post Understanding Transducers, found
;; here: http://elbenshira.com/blog/understanding-transducers
;;
@elben
elben / README.md
Last active May 8, 2016
Using core.async for Producer-consumer Systems
View README.md

Using core.async for Producer-consumer Systems

# Set up input file
repeat 10000 echo "." >> input

# Run inline
time lein run inline < input > output

# Run async
View test.rb
/ .*(?:#{shard}).* /i
@elben
elben / snake-nibbles.bas
Created Oct 5, 2012
The first program I saw my in my life. And it changed my life.
View snake-nibbles.bas
'
' Q B a s i c N i b b l e s
'
' Copyright (C) Microsoft Corporation 1990
'
' Nibbles is a game for one or two players. Navigate your snakes
' around the game board trying to eat up numbers while avoiding
' running into walls or other snakes. The more numbers you eat up,
' the more points you gain and the longer your snake becomes.
'
View gist:2705187
stub_request(:get, 'https://graph.facebook.com/search').with(:query => hash_including({"query" => "mytestquery"})).to_return(:body => "{}")
///////////////////
TypeError: can't convert RR::WildcardMatchers::HashIncluding into String
webmock (1.8.7) lib/webmock/request_pattern.rb:97:in `+'
webmock (1.8.7) lib/webmock/request_pattern.rb:97:in `add_query_params'
webmock (1.8.7) lib/webmock/request_pattern.rb:135:in `add_query_params'
View gist:1425237
import org.specs2._
class HelloWorldSpec extends Specification { def is =
"This is a specification to check the 'Hello world' string" ^
p^
"The 'Hello world' string should" ^
"contain 11 characters" ! e1^
"start with 'Hello'" ! e2^
"end with 'world'" ! e3^
View gist:1356156
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:55404,suspend=y,server=n -Dfile.encoding=UTF-8 -classpath /Applications/IntelliJ IDEA 10 CE.app/lib/idea_rt.jar:/Applications/IntelliJ IDEA 10 CE.app/plugins/junit/lib/junit-rt.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/deploy.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/dt.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/javaws.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jce.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jconsole.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/management-agent.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/plugin.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/sa-jdi.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Cla
View gist:1352769
diff --git a/src/lucandra/IndexReader.java b/src/lucandra/IndexReader.java
index e88e789..5596b87 100644
--- a/src/lucandra/IndexReader.java
+++ b/src/lucandra/IndexReader.java
@@ -34,6 +34,7 @@ import com.google.common.collect.MapMaker;
import org.apache.cassandra.db.*;
import org.apache.cassandra.thrift.ColumnParent;
import org.apache.cassandra.utils.ByteBufferUtil;
+import org.apache.cassandra.utils.FBUtilities;
import org.apache.log4j.Logger;
You can’t perform that action at this time.