Skip to content

Instantly share code, notes, and snippets.

View underhilllabs's full-sized avatar

Bart Lantz underhilllabs

View GitHub Profile
@underhilllabs
underhilllabs / RavelryClientSignin.java
Created February 28, 2012 17:46 — forked from knitfaced/RavelryClientSignin.java
snippet to connect to the Ravelry API
private String createShopSearchQuery() throws NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException {
String jsonAction = "http://api.ravelry.com/shops/search.json?";
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss.SSSZ");
Calendar now = Calendar.getInstance();
String timestamp = df.format(now.getTime());
String searchTerm = "yarn";
int shop_type_id = 1;
String query = jsonAction;
query += "access_key=" + urlEncode(ACCESS_KEY);
@underhilllabs
underhilllabs / category.rb
Created May 14, 2012 06:51 — forked from josegonzalez/category.rb
Category plugin for Jekyll
module Jekyll
class CategoryIndex < Page
def initialize(site, base, dir, category)
@site = site
@base = base
@dir = dir
@name = 'index.html'
self.process(@name)
self.read_yaml(File.join(base, '_layouts'), 'category_index.html')
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
App.AccountEditRoute = Ember.Route.extend({
setupController: function(controller) {
controller.set('content', this.get('currentUser'));
}
});

A Backbone.js demo app (Sinatra Backend)

Oct 16 2010

Updates

  • 04/10/2011 - Updated application.js and application.rb thanks to @rebo's comments

In this article, I will walk through some simple steps to get a [demo app][2] up and running with [Backbone.js][3] and [Sinatra][4] on [Heroku][5].

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.Response.ErrorListener;
import com.android.volley.Response.Listener;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bash Command Visualization</title>
<style type="text/css">
* { margin: 0; padding: 0; }
#chart {
@underhilllabs
underhilllabs / example_controller.php
Last active December 27, 2015 00:19
Example CodeIgniter Controller that gets parameters back from a stored procedure.
<?php
class Example_controller extends CI_Controller {
// …
// Others attributes and methods omitted for brevity
/*
* Unfortunatelly, CodeIgniter does not work well with Stored Procedure with returning parameters,
* so, if you want to use any kind of Stored Procedure with parameters, it's better do it mannualy.