Skip to content

Instantly share code, notes, and snippets.

@mackstar
mackstar / User Controller
Created February 17, 2014 22:54
User Controller
'use strict';
app.config(['$routeProvider', function($routeProvider) {
$routeProvider
.when('/add', {
templateUrl: '/js/templates/users/edit.html',
controller: 'UserAddCtrl'
});
}]);
<img src="/img/spinner.gif" width="64" height="64" ng-show="!ready()" id="spinner" />
<div ng-show="ready()" class="row">
<ul class="nav nav-tabs">
<li class="active link" ng-click="submit()"><span class="glyphicon glyphicon-ok"></span></li>
<li class="cancel link" ng-click="close()"><span class="glyphicon glyphicon-remove"></span></li>
</ul>
<form name="userForm" novalidate>
@mackstar
mackstar / gist:9060957
Last active August 29, 2015 13:56
Angular Setup
'use strict';
var app = angular.module('spout', ['ngRoute', 'restangular', 'ngAnimate', 'ui.bootstrap']);
/* Utility service to apply form errors to a form */
app.service('parseFormErrors', function() {
return function (data, form) {
for(property in data.errors) {
form[property].$dirty = true;
form[property].$invalid = true;
@mackstar
mackstar / gist:9060972
Created February 17, 2014 23:00
User PHP REST
<?php
namespace Mackstar\Spout\Admin\Resource\App\Users;
use BEAR\Resource\ResourceObject;
use BEAR\Package\Module\Database\Dbal\Setter\DbSetterTrait;
use BEAR\Sunday\Annotation\Db;
use Mackstar\Spout\Interfaces\SecurityInterface;
use Mackstar\Spout\Admin\Annotation\Form;
use Ray\Di\Di\Inject;
@mackstar
mackstar / gist:29e44f9b42fbb75e7cfe
Created October 26, 2014 17:03
ShouldIT? Example
# Personal Scheduler
This is so atendees can worry less about boring stuff and more about socialising.
## Choosing a Talk
### Tracks
+ IT has specified numbered tracks
def after_test_step(test_step, result)
blink1 = Blink1.new
blink1.open
if result.passed?
`say -v Kathy "You're Awesome"`
blink1.set_rgb(34, 27, 230)
elsif result.failed?
`echo 'Test Failed' | terminal-notifier -sound default`
`say "You suck"`
blink1.set_rgb(222, 38, 35)
#!/bin/bash
REMOTEUSER=username
REMOTEPASS=password
REMOTECOMPUTER=remotecomputer.com
REMOTEMYSQLUSER=mysqllogin
REMOTEMYSQLPASS=mysqlpass
DB=database
FILENAME=dbschema.sql
LOCALMYSQLUSER=localuser
LOCALMYSQLPASS=localpassword
Environment::is(function($request) {
$isLocal = $request->env('HTTP_HOST') == 'lithium.local';
if(preg_match('/^\/test/', $request->env('REQUEST_URI')) && $isLocal) {
return 'test';
}
if($isLocal) {
return 'development';
}
});
public function testUpdateWithSubObjects() {
$model = $this->_model;
$exists = true;
$model::config(array('key' => '_id'));
$model::schema(array(
'array' => array('type' => 'string', 'array' => true),
'dictionary' => array('type' => 'string', 'array' => true),
'forceArray' => array('type' => 'string', 'array' => true)
));
@mackstar
mackstar / gist:1545478
Created December 31, 2011 22:04
Error for iphone Titanium build
================================================================================
Appcelerator Titanium Diagnostics Build Log
The contents of this file are useful to send to Appcelerator Support if
reporting an issue to help us understand your environment, build settings
and aid in debugging. Please attach this log to any issue that you report.
================================================================================
Starting build at 12/31/11 21:32
Build details: