Skip to content

Instantly share code, notes, and snippets.

View philsturgeon's full-sized avatar
🌳
Planting Trees

Phil Sturgeon philsturgeon

🌳
Planting Trees
View GitHub Profile
@philsturgeon
philsturgeon / Options.md
Last active January 3, 2016 09:38
Array Of Syntax should represent the following code https://wiki.php.net/rfc/arrayof

Option A)

Null content items break things.

foreach ($foos as $foo) {
    if (! $foo instanceof Face) {
        throw new Exception ('AAAGGGGGHHH!');
    }
}
@philsturgeon
philsturgeon / stuff.md
Last active January 2, 2016 17:59
Framework Stuff Names

Following the assumption that part of what makes something a "framework" is that it dictates architecture, the "sample application" or "application layer" is what should be called the "Framework". In which case those people would label these repos differently.

https://github.com/laravel/laravel/ - This is the "framework"

https://github.com/illuminate - This is the "component vendor", where multiple "components" or "packages" can be found.

https://github.com/laravel/framework - This is... something other than "framework". FuelPHP use foundation, or maybe "kernel", or... something.

For other projects this distinction is different.

We had a long discussion about all of this over email (should have done that sooner) and here are most of the points for anyone reading this:

If you want to add a line in a twitter bio about Laravel, DO IT. If you want to put on your LinkedIn profile that you use Laravel on your projects, DO IT. You’re not hurting PHP. You’re helping it and anyone who was around during PHP’s dark days should know this.

I never suggested you shouldn’t do it, or that you would “hurt PHP”. I said branding yourself as a “Laravel developer” first is damaging to yourself. Lots of people branded themselves as a CodeIgniter developer for a while. What good has that done them now?

People will not be confused by this. Employers will not be confused by this. As someone who has probably looked at 1000 resumes for Laravel developers I’ve never seen even one where the only reference to anything PHP or development related is Laravel.

Here’s one. http://www.linkedin.com/profile/view?id=263426041&authType=OUT_OF_NETWORK&authToken=a0_e

@philsturgeon
philsturgeon / examples.php
Created November 26, 2013 19:35
Proposed short logical assignment operator
<?php
$foo = null;
// If's - verbose and uneccassry
if (! $foo) {
$foo = 'default';
}
// Short Ternary syntax
@philsturgeon
philsturgeon / README.md
Last active December 22, 2015 09:59
MySQL Enum Quiz

Preperation

Read the SQL statements in instructions.sql.

Question

Only one of the following queries will produce 1, the other two will produce 0.

Which query will produce the number 1?

@philsturgeon
philsturgeon / Syntax Examples.md
Last active December 22, 2015 02:39
PHP Named Param History

Example A

Inside the function declaration all values are assigned to variables, so using variable syntax on the outside seems to make sense too.

$api->getFriends($screen_name = 'phpdrama', $include_user_entities = true);

Pro:

@philsturgeon
philsturgeon / gist:6378999
Last active December 21, 2015 22:59
PSR-2 Control Structures and Statements

Class/method blocks:

These things are "blocks" of code, always on their own lines because they are always by themselves.

<?php
class Foo
{
  public function doSomeShit() 
 {
@philsturgeon
philsturgeon / composer.json
Created July 11, 2013 15:16
Composer Dev Requirements
{
"require": {
"laravel/framework": "4.0.*",
},
"require-dev": {
"behat/behat": "2.4.*",
"mockery/mockery": "0.7.*",
"fzaninotto/Faker": "1.2.*",
"pdepend/pdepend" : "1.1.*",
@philsturgeon
philsturgeon / rewards.md
Last active December 19, 2015 03:09
285 mile "Braking Aids" bike ride sponsorship rewards https://bit.ly/BRAKEAIDS

$1 - That warm fuzzy feeling of being a good person
$5 - A thank you tweet praising your or your company
$10 - Any one of the following:

@philsturgeon
philsturgeon / gist:5859679
Created June 25, 2013 15:58
Kibana user error
[2013-06-25T15:50:22+00:00] INFO: Processing template[/etc/sudoers] action create (sudo::default line 41)
[2013-06-25T15:50:22+00:00] INFO: Processing execute[apt-get-update] action run (apt::default line 22)
[2013-06-25T15:50:22+00:00] INFO: Processing execute[apt-get update] action nothing (apt::default line 29)
[2013-06-25T15:50:22+00:00] INFO: Processing package[update-notifier-common] action install (apt::default line 36)
[2013-06-25T15:50:22+00:00] INFO: Processing execute[apt-get-update-periodic] action run (apt::default line 40)
[2013-06-25T15:50:22+00:00] INFO: Processing directory[/var/cache/local] action create (apt::default line 50)
[2013-06-25T15:50:22+00:00] INFO: Processing directory[/var/cache/local/preseeding] action create (apt::default line 50)
[2013-06-25T15:50:22+00:00] INFO: Processing package[git] action install (git::default line 24)
[2013-06-25T15:50:22+00:00] INFO: Processing package[build-essential] action install (build-essential::default line 48)
[2013-06-25T15:50:22+00:00] INFO: