Skip to content

Instantly share code, notes, and snippets.

View brianium's full-sized avatar
🕊️
Human

Brian Scaturro brianium

🕊️
Human
View GitHub Profile
@brianium
brianium / php
Created May 4, 2014 01:40
Busted this using namespace in hacklang
<?hh //strict
namespace HackUnit\Runner;
class Options
{
protected ?string $testPath;
public function setTestPath(string $testPath): this
{
$this->testPath = $testPath;
@brianium
brianium / async.php
Created May 28, 2014 10:51
async hack
<?hh
type SomeResult = shape('property' => int);
function doIoBoundThing(): void {
$nums = array(
100000000,
1000000000,
);
foreach ($nums as $num) {
$i = 0;
@brianium
brianium / koa-xmen-api.js
Last active October 18, 2018 23:55
Koa.js X-MEN Api
var koa = require('koa');
var app = koa();
var json = require('koa-json');
app.use(json());
app.use(function* (next) {
if (this.method != 'GET') return yield next;
if (!/x-men/.test(this.originalUrl)) return yield next;

Keybase proof

I hereby claim:

  • I am brianium on github.
  • I am scaturr (https://keybase.io/scaturr) on keybase.
  • I have a public key whose fingerprint is E2A3 8685 A6BD F6A5 2D51 33A5 B242 F6DB 4E9C F051

To claim this, I am signing this object:

@brianium
brianium / captain.js
Created December 14, 2014 20:53
multiple inheritance in js
function Entity() {
}
Entity.prototype.entityThing = function() {
console.log("entity thing");
};
function NPC(name) {
Entity.call(this);
this.name = name;
@brianium
brianium / interval.go
Created December 18, 2014 19:09
interval.go
import "time"
type Interval struct {
Start Time
End Time
}
func NewInterval(start string, end string) Interval {
startTime, err := time.Parse(time.RFC3339, start)
@brianium
brianium / interval.go
Last active August 29, 2015 14:11
interval.go
package main
import (
"time"
"fmt"
)
type Interval struct {
Start time.Time
End time.Time
<?php
it('should return the newly created resource', function() {
$this->collection->insert($this->currentJson['users'])->willReturn(true);
$response = $this->controller->create($this->request);
expect($response)->to->have->status(201);
expect($response)->json->to->have->deep->property('users->login', 'brian');
});
@brianium
brianium / PromiseObserver.js
Created March 4, 2015 20:30
Potential implementation for loading graphics?
function PromiseObserver() {
this.observables = {
root: false;
};
}
/**
* @param {object} promise a promise to reserve
* @return {object} the observed promise
*/
@brianium
brianium / span.exs
Created April 16, 2015 23:08
list span in elixir
defmodule MyList do
def span(from, to), do: _span(from, to, [])
defp _span(from, to, list) when from == to do
list ++ [to]
end
defp _span(from, to, list) do
list ++ [from | _span(from + 1, to, list) ]