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 / 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>
public class ConnectionFactory : IConnectionFactory
{
private static readonly IDictionary Strings = new Dictionary<string,string>();
static ConnectionFactory()
{
lock(Strings.SyncRoot)
{
Strings.Add("key", "value");
}
@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
])
@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 / 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 / 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
Created January 13, 2014 21:10
Swamp of POX with Silex
<?php
$app = new \Silex\Application();
$doOrder = function(\SimpleXMLElement $order) {
$orderService = new OrderService();
$orderService->setBeerId((string) $order['beer_id']);
$creditCard = CreditCardFactory::fromXml($order->CreditCard);
$orderService->setCreditCard($creditCard);
$order = $orderService->createOrder();
@brianium
brianium / authenticated.js
Last active January 2, 2016 02:39
create authenticted app in express
var _ = require('lodash')
, problem = require('../errors').problem;
/**
* Check the request for a user. If none found
* create an API-Problem style error
*/
function check(req, res, next) {
if (!req.user) return next(
problem(new Error("Resource requires authorization"), {
solve problems
software
AngularJS
passionate
teamwork
meet commitments
skill
proven history of shipping software
collaboration
creating solutions
@brianium
brianium / catalogitemmodel.js
Created May 20, 2013 20:39
angular service
/**
* Sets up a model that depends on resource pools
* and catalogs
*/
angular.module("uss.services").
factory('CatalogItemModel', ['Catalog', 'ResourcePool', function(Catalog, ResourcePool) {
return {
setModel: function($scope, /** invoked with first cat */ cfn, /** invoked with first pool */ pfn) {
$scope.catalogs = Catalog.query({'public':0}, function(cats){
cfn(cats[0].id);