Jarret.Byrne

Politics, Sociology, Firefighting, Technology, and Original Fiction

Author: jbyrne (Page 1 of 2)

Practical RESTful API Scheme Organized By Scenario

Please note that this post is a work in progress, because there is a a lot of ground to cover. Shouldn’t take more than a week to flesh the whole thing out. Thanks for your patience.


This post outlines my playbook for designing a RESTful API service’s endpoints (method + URL) and return values (HTTP status code and body). It’s organized by scenario so if you know what your goal is, you can jump straight to it.

Read More

Events, Listeners, Queues, and Jobs in Laravel Explained Simply

Someone on StackOverflow recently asked for a very basic explanation of what the differences are between Events, Listeners, Queues, and Jobs in Laravel. Specifically, the poster requested that the answer be explained as if he or she was only 5. As Events, Listeners, Queues, and Jobs can be confusing, I thought it might be worth posting my response, in the hopes that it might be useful to anyone who might be wondering the same thing.

Read More

New EventServiceProvider Location For Lumen 5.2

This is as much a note to myself as anything, but if you have recently tried to update a project that was using Lumen 5.1 to use Lumen 5.2, you might get an error that Illuminate\Foundation\Support\Providers\EventServiceProvider can no longer be found.

The problem is explicit in the error, thankfully: the class can no longer be found. The question then is, where has that file gone?

Read More

Centrist Challenge: Argue For Marco Rubio

This article is the response to a challenge from my friend Dave: as a centrist, argue for Marco Rubio as a presidential candidate. The resulting argument does not represent my actual beliefs on Marco Rubio’s candidacy. It is an intellectual exercise (or unintellectual exercise, depending on your politics?). I neither endorse nor denounce Marco Rubio’s candidacy. If challenged to argue against Marco Rubio, I would have done the same, but that was not the challenge this time.


Challenge: Argue for Marco Rubio

Marco Rubio, the junior Senator from Florida, is both the youngest candidate for president still running into February 2015 and only one of two remaining candidates with Hispanic bona fides. As a conservative, Rubios’ ethnicity is a strength in the general election as he may appeal to voters in the coveted Hispanic demographic. Policy-wise, his ethnicity also lends itself to a centrist views on immigration reform, in comparison to his conservative counterparts. The comparison is important one, but taken together, Rubio’s current stated positions on the issues are definitively conservative. Given his heritage, his past work on immigration reform, and his firm conservative views, Rubio represents a strong candidate in the general election.

Read More

Unique Pivot Rows With Laravel’s Eloquent

This post is something I find myself needing a lot, so I thought I would put it here for my own memory and anyone else who might need it. To give credit where credit is due, the methodology shown below is taken from the answers here: https://laracasts.com/discuss/channels/requests/many-to-many-relation-with-unique-records-in-pivot?page=1


Often times, when I set up a many-to-many relationship in Laravel, I need the relationship between two nodes to be distinct. For example, when a user is given a privilege for a forum, and they can have one-and-only-one privilege type for that particular forum, even if they are related to many other forums, then we will not want duplicate pivot rows. In this case, it would get awful tedious to ensure that every time there is an update for the user’s privilege that we check to see if a relationship already exists between the user and forum and update it instead of creating it. That can be thrown into a model method easily enough for DRY’er code, but it is still mildly annoying, and if you’re working with a team there’s no ultimate failsafe error should someone circumvent that procedure, by accident or otherwise.




So the goal of this post is:

  1. to ensure that in a many-to-many relationship there can be only one row relating two nodes (many users are tied to many forums, but a particular user and a particular forum are related through no more than one row);
  2. to use built-in Eloquent methodology to perform the if-new-create-otherwise-update logic for us; and
  3. to ensure that the systems used will throw an error should an attempt be made to create a duplicate relationship.

Read More

Refugees in the United States

This article is the first in a series concerning refugees in the United States, including a history of refugees in America, the application process and acceptance of refugees, the costs and benefits of refugee acceptance, and the addressing of several common questions. Each article strives to provide useful, sourced information, in order to help understand what is a very complex issue. This series is in no way definitive or exhaustive, and you are encouraged to seek out additional information, but I hope that you find it valuable.


As a nation comprised primarily of immigrants and their descendants, the United States has long grappled with the topic of foreigners, their worthiness, and their eventual assimilation into the culture. Present day debates concerning the acceptance of refugees from the Syrian civil war represent only a new chapter in that debate. There are many definitions of a refugee, but understanding the present debate requires assessing the general and legal definitions of both a refugee and an immigrant. Once defined, it is easy to see that there have been several periods in the history of the United States where immigrants have proven to be refugees as well. The status of refugee would not exist legally in the U.S. until the 20th century, however, allowing for specific policies and programs aimed at accepting and settling refugees. The resulting programs continue a 4-century-long story of refugees that have looked to North America and the United States as a haven of protection from fear and violence.

Read More

Simple PHP Getter/Setter Snippet For Sublime Text

The following snippet is what I use in PHP when I am building out a class and need to quickly and easily flesh out the getters and setters for my protected and private variables:

To use this snippet yourself, throw it in a text file named getter-setter.sublime-snippet and put it in the folder where your user preferences are stored. For reference, on OSX the default location should be ~/Library/Application Support/Sublime Text 3/Packages/User/.

Read More

Should We Allow DocBlocks To Function As Code?

I love DocBlocks. When I meet developers who do not, or who dislike writing them, I get profoundly sad. Same thing when it comes to comments in code. I was once told that I write too many comments, and that I should not need them since my peers could read code just fine anyway. Sure, I said, and I can read Spanish just fine as well, but I would do a lot better if you threw in some English comments here and there.

Read More

Get Fully Qualified Class Name From File Contents In PHP

Ever needed to get the name of a class from a file without actually loading that file in PHP? Probably not – I’ll admit it’s kind of a super edgy edge case. Nonetheless, it’s an interesting problem, and I ran into it working on some migration scripts for a project. So, for the sake of my own memory, I thought I would put together this quick little write-up. Hopefully it helps someone else out as well.

Read More

Unity3d RTS Camera Part 3: Panning

This is the final part a multipart discussion of the camera system I have constructed for my experimental RTS game using Unity3d. In Unity3d RTS Camera Part 1: Data Component, I explained the DataComponent script that would be used to contain and provide all the data for the camera so that all the other components can share data easily. I highly suggest that you start there if you have not read it yet, as the Data Component is essential to the entire camera system. In Unity3d RTS Camera Part 2: Zoom and Rotate, I explained how we could use our Data Component to control zoom and rotation.




For this post we’ll explore the last remaining topic: panning, or scrolling, the camera. Only 1 new file need to be created for this final portion, but it contains the longest method we have seen so far, so there is a lot to go over. When we are through, we’ll have a functioning camera system that pans, zooms, and rotates, with a single script to control all of our data.

Read More

Page 1 of 2

Powered by WordPress & Theme by Anders Norén