Skip to content

Instantly share code, notes, and snippets.


Matt Payne mattapayne

View GitHub Profile
View jambase4net.cs
using System;
using System.Collections.Generic;
using Jambase4Net;
public class App
public static void Main(String[] args)
//You can use the default configuration, which reads from app.config or web.config
//To do this, just start using the API object
View jambase4r_use.rb
#Using JamBase4R in Rails is simple. Just include it in the controller you want to use
class MyJamBaseController < ApplicationController
include JamBase4R
def search
@results =[:search])
#You could also NOT include JamBase4R and just call it like so:
# @results =[:search])
View jambase4r_config.rb
#For Rails:
#in an initializer
JamBase4R.configure do |c|
c.api_key = "your JamBase API key" #this is mandatory
c.logger = RAILS_DEFAULT_LOGGER #or any class that implements the same interface (optional)
#For Sinatra
#within the main application file
configure do
View gist_example.html
#This is a Gist. This is also how you embed the Gist
<script src=""></script>
View redefensio.rb
#To announce an article:
"article-author" => "Me",
"article-author-email" => "",
"article-title" => @post.title,
"article-content" => @post.body,
"permalink" => @post.slug
#To audit a comment:
View rdefensio_config.rb
configure do
RDefensio::API.configure do |conf|
conf.api_key = App::Config.defensio_api_key
conf.owner_url = App::Config.defensio_owner_url
View barchart.rb
def create_bar_chart(opts, data)
g =[:size])
g.title = opts[:title]
g.minimum_value = opts[:minimum]
g.maximum_value = opts[:maximum]
g.labels = { |e| e.category }[:legend], { |e| e.count } )
g.x_axis_label = opts[:x_axis_label]
g.y_axis_label = opts[:y_axis_label]
return g.to_blob
JSONArray objects = new JSONArray(response);
1. private String get(String url, Map params)
2. {
3. String result = null;
4. try
5. {
6. String queryString = getEncodedQueryString(params);
7. String fullUrl = url + "?" + queryString;
8. DefaultHttpClient client = new DefaultHttpClient();
9. HttpGet method = new HttpGet(new URI(fullUrl));
10. HttpResponse response = client.execute(method);
1. private List parseComplaints(String results)
2. {
3. List complaints = new ArrayList();
4. try
5. {
6. JSONArray objects = new JSONArray(results);
7. for(int i=0; i<objects.length(); i++)
8. {
9. JSONObject o = (JSONObject)objects.get(i);
10. Complaint c = new Complaint();
You can’t perform that action at this time.