Skip to content

Instantly share code, notes, and snippets.


Patrick Roza patroza

View GitHub Profile
patroza / fetch.ts
Last active April 5, 2020 20:50 — forked from JacksonGariety/fetch.ts
View fetch.ts
import * as TE from "fp-ts/lib/TaskEither"
import { pipe } from "fp-ts/lib/pipeable"
import { Do } from "fp-ts-contrib/lib/Do"
type Error1 = { errors: object[]; type: "1" }
type Error2 = { errors: object[]; response: Response; type: "2" }
type Error3 = { errors: object[]; result: unknown; type: "3" }
type Errors = Error1 | Error2 | Error3
export const post = (url: string, body: object) =>
patroza / twoSum.scala
Last active November 4, 2019 21:10 — forked from stzr1123/twoSum.scala
Interview type problems
View twoSum.scala
import scala.annotation.tailrec
object ShittySolution {
// Given an array of integers, return indices of the two numbers such that they add up to a specific target.
// You may assume that each input would have exactly one solution, and you may not use the same element twice.
// NB: More efficient solution would iterate once over the array and keep a Map of values and indicies
def twoSum(nums: Array[Int], target: Int): Array[Int] = {
patroza / BaseHub.cs
Last active September 4, 2015 07:08 — forked from lethek/AirtimeHub.cs
Using Mef to inject dependencies into SignalR hubs and manage dependency lifetimes. Currently makes assumptions based on using the request scoped container implementation from
View BaseHub.cs
public abstract class BaseHub : Hub
public EventHandler Disposing;
bool _disposed;
protected override void Dispose(bool disposing) {
if (_disposed)
_disposed = true;
View gist:1950145
// this script checks if there arent too many magazines or respawns according to available slots
_count = count (configFile >> "CfgVehicles");
_prefix = "t1o_";
_vehicleName = "";
_singleError = false;
// Remove this
_msg = format["_count: %1", _count];
diag_log [diag_frameNo, diag_tickTime, time, _msg];
patroza / plugin_to_gem.rb
Created February 15, 2012 19:55 — forked from edavis10/plugin_to_gem.rb
Script to convert a Rails/Redmine plugin to a RubyGem
View plugin_to_gem.rb
#!/usr/bin/env ruby
# Usage:
# ruby plugin_to_gem.rb my_plugin_directory
require 'fileutils'
@plugin_dir = ARGV[0]
@plugin_name = File.basename ARGV[0]
def rakefile_content
description = 'TODO'