Skip to content

Instantly share code, notes, and snippets.

View alnutile's full-sized avatar

Alfred Nutile alnutile

View GitHub Profile
<?php
use Illuminate\Database\Capsule\Manager as Capsule;
use \User;
use BehatEditor\Models\Team;
use BehatEditor\Models\Project;
use BehatEditor\Models\Site;
use Faker\Factory as Faker;
Capsule::schema()->create('project_url', function($table)
{
$table->increments('id');
$table->string('project_id', 36)->index();
$table->foreign('project_id')->references('id')->on('projects')->onDelete('cascade');
$table->string('url_id', 36)->index();
$table->foreign('url_id')->references('id')->on('urls')->onDelete('cascade');
});
if(Config::get('database.default') != 'sqlite') {
DB::statement('SET FOREIGN_KEY_CHECKS=0;');
}
@alnutile
alnutile / alertServices.js
Created August 7, 2014 11:59
This is a noty service I add to my app
var alertServices = angular.module('alertServices', []);
alertServices.
factory('addAlert', ['$rootScope',
function($rootScope){
return function(type, message, $scope) {
$scope.alerts.push({ type: type, msg: message});
}
}]).
factory('closeAlert', ['$rootScope',
@alnutile
alnutile / behats_composer.json
Created August 6, 2014 18:47
Example using github to pull in libraries and not https://packagist.org/If it was packagist you would not need the repositoriesarray
{
"name": "alnutile/behat_editor",
"description": "yml file and FeatureContext.php needed for other modules to extend it",
"license": "GPL2.0+",
"type": "library",
"authors": [
{
"name": "Alfred Nutile",
"email": "[email protected]"
}
@alnutile
alnutile / app.js
Created August 6, 2014 14:58
adding resolve to the route gives me current user in my controllers.
app.config(['$routeProvider',
function ($routeProvider) {
$routeProvider.
when('/', {
templateUrl: 'assets/js/templates/dash/dashboard.html',
controller: 'DashboardCtrl',
resolve: {
current_user: function(getCurrentUser) {
return getCurrentUser;
}
{
"require": {
"php": ">=5.4.0",
"davedevelopment/phpmig": "1.1.*@dev",
"silex/silex": "2.0.*@dev",
"vlucas/phpdotenv": "1.0.6",
"symfony/event-dispatcher": ">=2.3",
"illuminate/database": "*",
"illuminate/container": "*"
},
{
"name": "alnutile/REPO_NAME",
"type": "library",
"description": "",
"keywords": [],
"homepage": "https://github.com/alnutile/REPO_NAME",
"license": "MIT",
"authors": [
{
"name": "Alfred Nutile",
@alnutile
alnutile / listings.php
Created July 30, 2014 01:43
Example of fields
$table->increments('id');
$table->boolean('published')->default(0);
$table->dateTime('published_at')->nullable();
$table->integer('published_by')->nullable();
$table->integer('status_state_id')->nullable();
$table->integer('off_market_reason_id')->nullable();
$table->decimal('sale_price', 10, 2)->nullable();
$table->string('cap_rate')->nullable();
$table->string('commission_split')->nullable();
$table->integer('occupancy')->default(0);
@alnutile
alnutile / MenuService.php
Created July 29, 2014 00:14
move to a method
if($id == null) {
$page = $this->pageModel->first();
$pageCtrl = new \PagesController();
return $pageCtrl->show($page);
}
//Try Page
$page = $this->pageModel->where("slug", 'LIKE', '/' . $id)->first();
if ($this->checkIfPublishedAndUserState($page)) {
($page->slug === '/home') ? $banner = TRUE : $banner = FALSE;