Skip to content

Instantly share code, notes, and snippets.

View mtnbarreto's full-sized avatar
🎯
When a measure becomes a target, it ceases to be a good measure

Martin Barreto mtnbarreto

🎯
When a measure becomes a target, it ceases to be a good measure
View GitHub Profile
type SwarmStepResult<TOOLS extends Record<string, CoreTool>> = StepResult<TOOLS> & { agent: Agent };
type SwarmChunk = Extract<
TextStreamPart<any>,
{
type: "text-delta" | "reasoning" | "tool-call" | "tool-call-streaming-start" | "tool-call-delta" | "tool-result";
}
> & { agent: Agent };
export function streamSwarm<CONTEXT = any>({
#[allow(dead_code)]
#[derive(Named)]
struct RandomStrategy {
random_move: RandomMove,
}
impl Strategy for RandomStrategy {
fn play_for_favoured_move(&mut self, _favoured_move: Move) -> Move {
return self.random_move.get();
}
@mtnbarreto
mtnbarreto / ArgoAdapterForOpera.swift
Created April 12, 2016 17:12
Adapter to make Argo JSON parsing library works with Opera
extension Argo.Decodable where Self.DecodedType == Self, Self: OperaDecodable {
static func decode(json: AnyObject) throws -> Self {
let decoded = decode(JSON.parse(json))
switch decoded {
case .Success(let value):
return value
case .Failure(let error):
throw error
}
@mtnbarreto
mtnbarreto / MCSwipeTableViewCell
Last active December 25, 2015 12:19
MCSwipeTableViewCell
Pod::Spec.new do |s|
s.name = 'MCSwipeTableViewCell'
s.version = '1.1.1'
s.author = { 'Ali Karagoz' => '[email protected]' }
s.homepage = 'https://github.com/alikaragoz/MCSwipeTableViewCell'
s.summary = 'Mailbox app style UITableViewCell.'
s.license = 'MIT'
s.source = { :git => 'https://github.com/mtnbarreto/MCSwipeTableViewCell.git', :branch => 'preventGesture' }
s.source_files = 'MCSwipeTableViewCell'
s.platform = :ios