Skip to content

Instantly share code, notes, and snippets.

View s-ben's full-sized avatar

Seth Benton s-ben

View GitHub Profile
@s-ben
s-ben / indexing_objects.sh
Created May 21, 2012 18:06
secondary index example 1
curl -v -X PUT \
-d 'data1' \
-H "x-riak-index-field1_bin: val1" \
-H "x-riak-index-field2_int: 1001" \
http://127.0.0.1:8098/riak/mybucket/mykey1
curl -v -X PUT \
-d 'data2' \
-H "x-riak-index-Field1_bin: val2" \
-H "x-riak-index-Field2_int: 1002" \
@s-ben
s-ben / gist:3915123
Created October 18, 2012 22:20 — forked from dmitrizagidulin/gist:3909785
Dmitri's blog post

Rails Rumble with Riak and Ripple - Three Developers and a Lot of Rs

This past weekend, Bryce Kerley, David Andersen, and I had the honor of participating in Rails Rumble 2012 (of which, I am proud to say, Basho was a sponsor). This event is a 48-hour competition to design, build and deploy a web application in Ruby and Rails (or one of the other Rack-based web framework). Developing at this pace is grueling, to say the least (especially since it took place immediately after we all flew home from Ricon 2012), but also really exciting. You get the whole product cycle experience, from design to feature releases to testing and QA, all in one intense weekend.

Our application is Brainload. It's a social flashcard/memorization aid tool, which lets users create, share and review

import sys
if len(sys.argv)>1:
count_to = int(sys.argv[1])
else:
count_to = int(raw_input("how many, yo?"))
for num in range(1,count_to):
import sys
if len(sys.argv)>1:
count_to = sys.argv[1]
else:
count_to = raw_input("how many, yo? ")
# Exception handling
try:
i = int(count_to)
import random
questions = {
"strong": "Do ye like yer drinks strong?",
"salty": "Do ye like it with a salty tang?",
"bitter": "Are ye a lubber who likes it bitter?",
"sweet": "Would ye like a bit of sweetness with yer poison?",
"fruity": "Are ye one for a fruity finish?"
}
models = {
'huffy': [15, 50],
'bianci': [10, 200],
'masi': [8, 500],
'schwinn': [12, 100],
'cannondale': [6, 1000],
'trek': [9, 700]}
customers = {
'stephanie': [1200, True],
'craig': [2000, True],
import bicycles
# Create bike shop with 6 bikes, 20% profit margin
print "Creating bike shop"
my_shop = bicycles.BikeShop('mikes', 6, 20)
model_list = bicycles.models.keys()
for i in range(0,my_shop.num_models):
my_shop_price = bicycles.models[model_list[i]][1] * (1+my_shop.margin)
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
engine = create_engine('postgresql://ubuntu:thinkful@localhost:5432/tbay')
Session = sessionmaker(bind=engine)
session = Session()
Base = declarative_base()
from flask import Flask
from os import environ
app = Flask(__name__)
@app.route("/")
@app.route("/hello")
def say_hi():
return "Hello World!"
@s-ben
s-ben / dcrdata Insight API.md
Last active October 3, 2018 22:30
dcrdata Insight API (DRAFT)

Insight API (EXPERIMENTAL)

The Insight API is accessible via HTTP via REST or WebSocket.

To call the REST API, use the /insight/api path prefix. To call the Websocket API, use the /insight/socket.io path prefix.

POST methods require parameters to be passed in JSON objects.

Endpoints