eugenemorgan.com Open in urlscan Pro
213.109.149.141  Public Scan

URL: https://eugenemorgan.com/
Submission: On November 22 via api from US — Scanned from US

Form analysis 1 forms found in the DOM

GET https://eugenemorgan.com/

<form method="get" class="searchform search-form" action="https://eugenemorgan.com/" role="search"><input type="text" value="Search this website…" name="s" class="s search-input" onfocus="if ('Search this website…' === this.value) {this.value = '';}"
    onblur="if ('' === this.value) {this.value = 'Search this website…';}"><input type="submit" class="searchsubmit search-submit" value="Search"></form>

Text Content

EUGENE MORGAN

Web Developer

 * Home
 * About me


ADDING A RANDOM GITHUB REPOSITORY TO YOUR PROJECT USING COMPOSER

Posted on September 28, 2012 Written by Eugene Morgan

I’m becoming a big fan of Composer. I recently had to re-create the environment
for an older project on a different development machine, a process which
unfortunately included quite a few manual steps to get the dependencies
configured.

I decided to set up the project with Composer, and now setting up the project is
fast and easy (well at least easy … waiting for the Zend Framework files to
download does take a little while).

It’s super easy to get started and follow the Composer documentation to use
dependencies that are available through Packagist. More and more packages, like
both Zend Framework 1 and Zend Framework 2, are becoming available there.

But what about packages that aren’t available through Packagist? If you control
the package, you can publish it there, or if it’s something for
private/corporate use, you can set it up as a Composer package using Satis.

But what if you don’t have control over the package? What if it’s just a random
GitHub repository?

Because Composer can work with any source code repository, it’s actually not
difficult to make it work with a third-party repository on GitHub (or Bitbucket,
whatever … as long as it uses Git, Mercurial or Subversion).

For example, for my Zend Framework 1 projects, I like to use a dependency
injection container called Yadif. With some help, I was able to get it set up in
my project like so:

"repositories": {
    "yadif": {
        "type": "package",
        "package": {
            "name": "beberlei/yadif",
            "version": "1.0.0",
            "source": {
                "url": "https://github.com/beberlei/yadif",
                "type": "git",
                "reference": "d874042a50"
            }
        }
    }
},
"require": {
    "beberlei/yadif": "1.0.0"
},
"autoload": {
    "psr-0": {
        "Yadif": "vendor/beberlei/yadif/src/"
    }
}

Because the Yadif repository doesn’t have any tags for version numbers, we have
to tell Composer very explicitly about it. Under “repositories”, we give the
package its name and specify a version number (I used 1.0.0 but you could plug
in whatever makes sense). We then tie that version to a specific commit, in this
case d8740042a50.

After basically defining the repository for Composer, we then tell Composer to
require the repository. Then — and I love this part — we tell Composer how to
autoload the classes from the package. Because Yadif basically follows the PSR-0
convention, we just tell Composer where the core class files are found, and
autoloading is all set up — no need to mess with symlinks or include paths.

Note: Check this post for more explanation and sample composer.json code.

Filed Under: PHP Development


SIMPLE VIM TRICK: SORTING ALPHABETICALLY

Posted on September 12, 2012 Written by Eugene Morgan

Some days I feel like I am only using Vim to a fraction of its capacity. Today I
discovered a simple time-saver that I hadn’t known about before — Vim’s :sort
command.

The sort function can be used to sort a whole file alphabetically or certain
lines within a file. It’s perfect for CSS code, for example, where I like to
alphabetize the properties.

So for something like this:

.some-class {
  padding: 5px;
  margin: 5px;
  width: 180px;
  /* ... */
  line-height: 1.2;
}

… I can position my cursor within the brackets and type vi{ and then :sort, and
the properties are sorted alphabetically.

Filed Under: Vim


SETTING UP “CONTACT US ABOUT THIS PROPERTY” FORMS IN AGENTPRESS

Posted on August 18, 2012 Written by Eugene Morgan

The AgentPress theme from StudioPress is a very nice theme, but it's not always
apparent how to set up your client's site to look like the demo. One example is
the form titled "Contact Us About This Property" that shows up at the bottom of
each … [Continue reading]

Filed Under: WordPress

SEARCH



CONNECT




Return to top of page

©2024 Eugene Morgan · All Rights Reserved · Powered by WordPress