Skip to content

Instantly share code, notes, and snippets.

View rtablada's full-sized avatar

Ryan Tablada rtablada

View GitHub Profile
Queue::push('UserCreator', $data);
class UserCreator
{
public function fire($job, $data)
{
$user = $this->user->create($data);
$job->pass('UserConfirmationEmailSender');
@rtablada
rtablada / example.html
Created March 22, 2014 23:38
Allow awesome uploaders in Gumby
<div class="append field fancy-uploader">
<input type="text" class="input xwide" placeholder="File">
<input type="file" name="picture">
<div class="primary btn medium">
<button>Upload</button>
</div>
</div>
@rtablada
rtablada / controllers.md
Last active August 29, 2015 14:00
My thoughts on a CMF

Admin Controller

The admin controller will extend the Laravel base controller and be crazy smart about things. If you return a string or view object, then it will be injected in the content of the BlockCMF admin layout. This allows you to program like a usual Laravel controller with your own internal layouts, sub-views, view composers, and everything and not having to be bothered about remembering to follow some weird API to make sure you inject your view into the layout. Just extend the AdminBaseController and go to town!

API Controllers (Advanced mutations to be implemented later)

@rtablada
rtablada / gist:11186145
Created April 22, 2014 16:43
Easier building formdata
prepareFormData = function (data) {
formData = new FormData();
$.each(data, function (key, val) {
formData.append(key, val);
});
return formData;
};
@rtablada
rtablada / routes.php
Created April 25, 2014 00:10
Sample files for a block module for Block CMF
// $routeNamespace, $baseNamespace
BlockModule::start('page', 'Rtablada\\Pages');
// $accessArea (string) - sets before filter, route name prefix, namespace for controllers
BlockModule::access('admin', function () {
// Will be available at 'admin/pages'
// Uses Rtablada\\Blog\\Admin\\PagesController@index
// Route name 'pages.admin.index - based on controller method if no 'as' is provided
BlockRoute::get('/', 'PagesController@index');
BlockRoute::get('{id}/new', 'PagesController@create');
@rtablada
rtablada / why.php
Created May 7, 2014 20:37
When to use repos
<?php
// Why not use the raw model?
class GlorifiedProxyUserRepo
{
public function __construct(User $user)
{
$this->user = $user;
}

The proxy repo example has little to no value.

ActiveRecord (Eloquent in this case) in a way is an implementation of an existing interface. Adding a repository does not add readability, testability, or code organization.

Instead you are adding more and files to check when trying to debug. This is just complicating your dependencies. When you are using simple base level ActiveRecord functions, you are just adding code everywhere when you need to add another function.

Good Use of Repos

==> default: GPG error: http://ppa.launchpad.net trusty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 4F4EA0AAE5267A6C
==> default: Reading package lists...
==> default: Building dependency tree...
==> default: Reading state information...
==> default: Some packages could not be installed. This may mean that you have
==> default: requested an impossible situation or if you are using the unstable
==> default: distribution that some required packages have not yet been created
==> default: or been moved out of Incoming.
==> default: The following information may help to resolve the situation:
==> default: The following packages have unmet dependencies:
@rtablada
rtablada / Todo.md
Last active August 29, 2015 14:02
TODO aggregator

TODO comments are nasty, hard to find, and just get forgotten about.

Instead, take those TODOs and put them to work in a place you will always know to look!

This plugin would essentially do the following:

  • Search all of the files in your current project for TODO
  • Copy the rest of the line after TODO
  • Put these in Github MD style todo items
  • Save this as a TODO.md

Currently Ember Simple Auth's OAuth2 authenticator submits a post request with form data. And sends username, password and grant_type. And when authorizing a request the Authentication header is set to: Bearer {token}.

The end point I am attempting to connect to currently uses json data in a POST request with email and password. And then the Authentication header is only: {token}. Other than that the functionality is almost spot on with the spec followed by the OAuth2 authenticator.

Since Ember Easy Auth OAuth2 auto registers itself with Ember CLI, is there an easy way to stop this autoregistration, extend OAuth and inject my custom authenticator?