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 / app.php
Last active January 3, 2016 04:19
Richardson maturity model: Resources with Silex
<?php
use Silex\Application;
use Symfony\Component\HttpFoundation\Request;
$app = new Application();
$app->post('/order', function(Request $request) {
$service = new OrderService();
$order = OrderFactory::fromArray($request->request->all());
$service->setOrder($order);
@brianium
brianium / app.php
Last active January 3, 2016 04:28
Richardson maturity model: Resources + verbs with Silex
<?php
use Silex\Application;
use Symfony\Component\HttpFoundation\Request;
$app = new Application();
$app->post('/order', function(Request $request) {
$service = new OrderService();
$order = OrderFactory::fromArray($request->request->all());
$service->setOrder($order);
@brianium
brianium / sample-hypermedia.json
Created January 14, 2014 18:32
sample hypermedia response
{
"_links": {
"self": {"href": "http://www.beerapi.com/orders/54cde"},
"beer": [
{"href": "http://www.beerapi.com/beers/76cde"},
{"href": "http://www.beerapi.com/beers/76cdf"}
],
"status": {"href": "http://www.beerapi.com/orders/54cde/status"}
},
"id": "54cde",
@brianium
brianium / mutliple-promise.js
Created February 18, 2014 14:48
resolving multiple promises in angular
return $q.all([
Resource.get({var: value}).$promise,
Resource.get({var: otherValue}).$promise
])
public class ConnectionFactory : IConnectionFactory
{
private static readonly IDictionary Strings = new Dictionary<string,string>();
static ConnectionFactory()
{
lock(Strings.SyncRoot)
{
Strings.Add("key", "value");
}
@brianium
brianium / main.html
Created March 22, 2014 14:57
ng-kiosk in action
<body ng-app="grdevday-slides" key-kiosk>
<kiosk src="http://kiosk.hellomean.com/api">
<kiosk-nav topics="topics" />
</kiosk>
<script type="text/javascript" src="bower_components/angular/angular.min.js"></script>
<script type="text/javascript" src="bower_components/angular-sanitize/angular-sanitize.min.js"></script>
<script type="text/javascript" src="bower_components/angular-animate/angular-animate.min.js"></script>
<script type="text/javascript" src="bower_components/ng-kiosk/dist/kiosk.min.js"></script>
<script type="text/javascript" src="application/main.js"></script>

##Issues, Problems, Impediments

  • Tool impediment. Vim is a tricky beast. Mainly problems with copy and paste and configuring indentation. Indentation fixed with smart indent, copy broke with smartindent
  • Learning curve with httpBackend, test dependencies inside of a directive’s $compile phase.
  • Overall testing structure. Is it ok to break tests for the same unit into multiple files?

##Possible Ways To Improve

  • Find better ways to copy/paste in vim? Shared buffers in tmux sessions?

##Issues, Problems, Impediments

  • Refactoring took up entire session

##Possible Ways To Improve

  • More granular refactoring
@brianium
brianium / mod10.cs
Created March 27, 2014 19:18
Mod10 algo in C#
void Main()
{
var mod = new Mod10("600649179422170350");
var digit = mod.CheckDigit; //2
var activationNumber = mod.ActivationCardNumber; //6006491794221703502
}
public class Mod10
{
private string _serialNumber;
@brianium
brianium / asynctest.php
Last active August 29, 2015 14:00
hacklang async?
<?hh //partial
class TestResult {
public function __construct(public string $message)
{
}
}
class TestCase {