Skip to content

Instantly share code, notes, and snippets.

View alex-wilmer's full-sized avatar

Alex Wilmer alex-wilmer

View GitHub Profile
.bubble
{
position: relative;
width: 250px;
height: 280px;
padding: 0px;
background: #FFFFFF;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
{
"name": "go",
"description": "a mean stack deployment of the ancient board game 'go'",
"keywords": [
"express",
"mongoose",
"mongodb",
"passport",
"demo"
],
window.angular.module('go.controllers.index', [])
.controller('IndexController', ['$scope', 'Global',
function ($scope, Global) {
$scope.global = Global;
rows = 6;
cols = 6;
$scope.board = matrix(rows, cols);
$scope.player = "black";
$scope.move = function (cell, col, row) {
if (cell.color == "empty") {
<section ng-controller="IndexController">
<h1>Welcome {{global.currentUser().name}}</h1>
<h2>It's {{player}}'s turn</h2>
<div class="board"> GAME
<div ng-repeat="row in board">
<div ng-repeat="cell in row" class="space {{cell.color}}" ng-click="move(cell, $parent.$index, $index)">
<!--{{cell.color}} [{{$index}},{{$parent.$index}}]-->
<div class="grid">{{cell.id}}</div>
</div>
window.angular.module('go.services.global', [])
.factory('Global', function() {
var current_user = window.user;
return {
currentUser: function() {
return current_user;
},
isSignedIn: function() {
return !!current_user;
}
.navbar .nav> li > a.brand {
padding-left: 20px;
margin-left: 0;
}
.content {
margin-top: 50px;
width: 100%;
}
function isCorner (col, row, size) {
if ((col==0 && row==0) ||
(col==size-1 && row==size-1) ||
(col==0 && row==size-1) ||
(col==size-1 && row==0)) {
return true;
}
}
function isEdge (col, row, size) {
@alex-wilmer
alex-wilmer / mixins.styl
Last active August 29, 2015 14:10
Assorted CSS Mixins
// Clearfix
clearfix()
content ''
display block
clear both
// Layouts
basicLayout(padding, max-width)
reset()
*
box-sizing border-box
html, body
height 100%
a
cursor pointer
@alex-wilmer
alex-wilmer / filters.js
Last active January 15, 2016 12:36
Angular Filters
function dateRange () {
return function(items, from, to) {
if (items != null) {
var inRange = [];
angular.forEach(items, function(item) {
if (from < item.created && item.created < to) {
inRange.push(item);
}
});
return inRange;