Skip to content

Instantly share code, notes, and snippets.

/*
@AntonyMarcano:
This is the default Appcelerator Titanium app.js file
created for you when you create a new project, including all the comments.
I think this makes the framework harder rather than easier to understand
*/
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
package uk.co.studentvoiceonline.android.activity;
import static uk.co.studentvoiceonline.android.adapter.UniversitiesAdapter.during;
import static uk.co.studentvoiceonline.android.adapter.UniversitiesAdapter.forListing;
import java.util.List;
import uk.co.studentvoiceonline.University;
import uk.co.studentvoiceonline.UniversityExpert;
import uk.co.studentvoiceonline.android.R;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
theUniversities = theUniversities();
showAListOf(theUniversities);
theUserCanFilterThemByTyping();
}
@Override
protected void onListItemClick(ListView l, View v, int inThisPosition, long id) {
@RiverGlide
RiverGlide / csharp_webrequest_example.cs
Created November 4, 2010 03:26
CSharp Web Request Example
using System;
using System.IO;
using System.Net
var request = WebRequest.Create("http://google.com") as HttpWebRequest;
using (var response = request.GetResponse() as HttpWebResponse)
{
var reader = new StreamReader(response.GetResponseStream());
Console.WriteLine(reader.ReadToEnd(););
@RiverGlide
RiverGlide / random_words.rb
Created December 21, 2010 00:57
Picks a number of pseudo-random words from a dictionary
dict = File.open('/path/to/dictionary.file')
lines = dict.readlines
if ARGV[0] != nil
number_of_words = ARGV[0]
else
number_of_words = 1
end
words = []
@RiverGlide
RiverGlide / dynamic_role_switching_spec.rb
Created March 18, 2011 11:35
Beginnings of interesting dynamic role switching example
$:.unshift(File.dirname(__FILE__), ".")
require 'rubygems'
require 'rspec'
module Butler
def self.extended base
base.get_ready
end
@Test
public void should_be_able_to_add_the_first_todo_item() {
givenThat(james).wasAbleTo(Start.withAnEmptyTodoList());
when(james).attemptsTo(AddATodoItem.called("Buy some milk"));
then(james).should(seeThat(TheItems.displayed(), hasItem("Buy some milk")));
}
Actor james = Actor.named(“James”);
@Test
public void should_be_able_to_add_the_first_todo_item()
@Given(“James starts with one item in his todo list”)
public void start_with_one_todo(){
james.attemptsTo(
Start.withAnEmptyTodoList(),
AddATodoItem.called(“Buy some milk”)
);
}