Skip to content

Instantly share code, notes, and snippets.

using FirebaseSharp.Portable;
using Newtonsoft.Json;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
static async Task Listen(string url)
{
HttpClient client = new HttpClient();
client.Timeout = TimeSpan.FromHours(1);
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("text/event-stream"));
var response = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead);
using(var content = await response.Content.ReadAsStreamAsync())
using (StreamReader sr = new StreamReader(content))
@bubbafat
bubbafat / gist:5915372
Created July 3, 2013 04:05
How do I do this with active record find method?
select count(*) as Count,
((elapsed / 1000) * 1000) + 1000 as LessThanSecond
from speedies
where elapsed is not null
group by ((elapsed / 1000) * 1000) + 1000
@bubbafat
bubbafat / gist:354125
Created April 3, 2010 04:48
Twilio and RestSharp to send SMS
private RestResponse SendSms(string sid, string token, string to, string from, string key, string msg)
{
var client = new RestClient("https://api.twilio.com")
{
Authenticator = new HttpBasicAuthenticator(sid, token),
};
var request = new RestRequest
{
Method = Method.POST,