Skip to content

Instantly share code, notes, and snippets.

View bryanl's full-sized avatar
🚩
Out in the streets

Bryan Liles bryanl

🚩
Out in the streets
View GitHub Profile
@bryanl
bryanl / oauth.m
Last active August 29, 2015 14:03
AFOAuthCredential* credential = [AFOAuthCredential credentialWithOAuthToken:accessToken tokenType:kAFOAuthCodeGrantType];
[credential setRefreshToken:refreshToken expiration:expirationDate];
AFOAuth2Client* oAuth2Client = [AFOAuth2Client clientWithBaseURL:[NSURL URLWithString:baseUrl]
clientID:clientID
secret:secret];
[oAuth2Client setAuthorizationHeaderWithToken:accessToken];
// This line is for environment where you don't have valid certificate.
// For example for development environment
[oAuth2Client setAllowsInvalidSSLCertificate:YES];
- (void)viewController:(GTMOAuth2ViewControllerTouch *)viewController
finishedWithAuth:(GTMOAuth2Authentication *)auth
error:(NSError *)error {
if (error != nil) {
// Authentication failed
} else {
// Authentication succeeded
}
}
@bryanl
bryanl / log.rb
Created September 17, 2014 15:03
x = 1
xs = [x]
10.times { x = Math::exp(Math::log(x) + 0.5); xs << x }
puts xs.inspect

docs

To start godoc at log in time (so it always there on port 6060 when you need it):

  1. copy smarticus.godoc.plist to in ~/Library/LaunchAgents
  2. launchctl load ~/Library/LaunchAgents/smarticus.godoc.plist
  3. visit http://localhost:6060
module Smarticus
class Prs
PLAYS = %w[p r s]
def play(previous=[])
PLAYS[rand(3).to_i]
end
def name
using System;
using System.IO;
using System.Runtime.Serialization.Json;
using BarCloudDL;
public class Program
{
public static void Main (string[] args)
{
make your changes now
require 'rubygems'
require "test/unit"
require "shoulda"
def score(roll)
accum = 0
raise ArgumentError unless roll.is_a? Array
raise RuntimeError unless roll.any?{|r| r.is_a? Fixnum }
raise RuntimeError if roll.any?{|r| r < 1}