Skip to content

Instantly share code, notes, and snippets.

<?php
$obj = new \stdClass;
$obj->x = '';
$first = function() use ($obj) {
$obj->x .= ' 1 ';
yield ControlFlow::NEXT;
@dadamssg
dadamssg / task.json
Created December 9, 2013 01:22
Expected Polymorphic json
{
"task": {
"id": "1",
"created_at": "2013-12-09 00:57:50",
"updated_at": "2013-12-09 00:57:50",
"subject": "This is a task.",
"taskable": {
"id": "1",
"type": "person"
}
@dadamssg
dadamssg / app.js
Last active December 29, 2015 23:28
Select2 is passing an object literal into the handleCompanySelect method on the PeopleNewController.
App.PeopleNewController = Ember.ObjectController.extend({
companySelection: null,
actions: {
doneEditing: function () {
var person = this.get('model');
person.save();
@dadamssg
dadamssg / main.yml
Last active December 29, 2015 16:47
---
- name: Define release name.
set_fact: app_project_release={{ lookup('pipe', 'date +%Y%m%d%H%M%S') }}
- name: Set current release directory.
set_fact: app_current_release_dir={{app_project_root}}/releases/{{app_project_release}}
- name: Set shared directory.
set_fact: app_shared_dir={{app_project_root}}/shared
//Why are collections namespaced and single entity responses not? For example:
[
{
"name": "Hulk Hogan",
"id": "100002"
},
{
"name": "Mick Foley",
"id": "100003"
}
{
"posts": [{
"id": "1",
"title": "A blog title",
"links": {
"author": "http://example.com/people/1",
"comments": "http://example.com/comments/5,12,17,20"
}
}]
}
<?php
class Person extends BaseModel
{
protected $table = 'people';
protected $fillable = [
'firstName',
'lastName',
'email',
<?php
use Illuminate\Database\Migrations\Migration;
class CreateCompaniesTable extends Migration {
public function up()
{
Schema::create('companies', function($table)
{
@dadamssg
dadamssg / gist:7393979
Created November 10, 2013 04:52
MySQL companiesExtended view
CREATE VIEW companiesExtended AS
select *, (select group_concat(id separator ',') from people as peopleTable where companyTable.id = peopleTable.`company_id`) as people_ids from companies as companyTable
window.App = Ember.Application.create();
App.ApplicationAdapter = DS.FixtureAdapter.extend();
App.PersonController = Ember.ObjectController.extend({
isEditing: false,
actions: {
edit: function() {