Skip to content

Instantly share code, notes, and snippets.

View bratsche's full-sized avatar

Cody Russell bratsche

View GitHub Profile
void ShowStuff ()
{
var client = new WebClient ();
var content = JsonValue.Parse (client.DownloadString ("http://api.worldbank.org/countries?format=json&per_page=50"));
int number_of_countries = content [0] ["total"];
int done = 0, error = 0;
InvokeOnMainThread (() => {
CountriesLabel.Text = string.Format ("Countries: {0} done: 0 error: 0", number_of_countries);
});
async Task ShowStuffAsync ()
{
var client = new HttpClient ();
var content = JsonValue.Parse (await client.GetStringAsync ("http://api.worldbank.org/countries?format=json"));
int number_of_countries = content [0] ["per_page"];
int done = 0, error = 0;
CountriesLabel.Text = string.Format ("Countries: {0} done: 0 error: 0", number_of_countries);
@andkerosine
andkerosine / raskell.rb
Created August 15, 2012 05:56
Haskell-like list comprehensions in Ruby
$stack, $draws = [], {}
def method_missing *args
return if args[0][/^to_/]
$stack << args.map { |a| a or $stack.pop }
$draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :<
end
class Array
def +@
#! /usr/bin/ruby
# Pre-commit hook for removing trailing whitespace, converting tabs to
# spaces and removing blank lines at the end of a file.
#
# Author: Clifton King <cliftonk@gmail.com>
# gist: https://gist.github.com/3173611
if File.exists? '.git/merge-rebase'
puts "Detected '.git/merge-rebase'! Skipping pre-commit hook..."
module Sass::Script::Functions
def user_color
color_values = options[:custom][:user].color.
scan(/^#?(..?)(..?)(..?)$/).first.
map {|num| num.ljust(2, num).to_i(16)}
Sass::Script::Color.new(color_values)
end
end