Mitchell McKenna - tagged with programming http://mitchmckenna.com/feed en-us http://blogs.law.harvard.edu/tech/rss LifePress mitchellmckenna@gmail.com Code Snippets with PhpStorm Live Templates – Christoph Rumpel http://mitchmckenna.com/post/19005/code-snippets-with-phpstorm-live-templates-phpstorm-tips-with-christoph-rumpel-episode-4

Christoph Rumpel demos PhpStorm code snippets a.k.a. live templates.

]]>
Thu, 10 Sep 2020 05:08:00 -0400 http://mitchmckenna.com/post/19005/code-snippets-with-phpstorm-live-templates-phpstorm-tips-with-christoph-rumpel-episode-4/code-snippets-with-phpstorm-live-templates-phpstorm-tips-with-christoph-rumpel-episode-4
Marmoset - Code Screenshots http://mitchmckenna.com/post/16944/marmoset-code-screenshots

Marmoset is a Chrome App which lets you create gorgeous code snapshots within seconds.

]]>
Mon, 25 Jul 2016 03:21:00 -0400 http://mitchmckenna.com/post/16944/marmoset-code-screenshots/marmoset-code-screenshots
Laravel Queued Jobs + Doctrine - Fix Objects Not Updating Between Jobs Run http://mitchmckenna.com/post/15632/laravel-queued-jobs-doctrine-fix-objects-not-updating-between-jobs-run

The issue is that doctrine is keeping the objects in local memory because the daemon is basically a php long-running process. In order to allow the objects used by the job to get updated, you need to $em->detach() the objects. But you'd also have to have cacade={"detach"} on all relationships that object has as well. So the best thing is to just call $em->clear() at the end of your job. This will detach all objects from doctrine and it will get a fresh copy of all the objects from the database for the next job run.

]]>
Wed, 10 Feb 2016 07:34:54 -0500 http://mitchmckenna.com/post/15632/laravel-queued-jobs-doctrine-fix-objects-not-updating-between-jobs-run/laravel-queued-jobs-doctrine-fix-objects-not-updating-between-jobs-run
Adonis - Nodejs MVC Framework Inspired by Laravel http://mitchmckenna.com/post/16139/adonis-nodejs-mvc-framework-inspired-by-laravel

This new NodeJS framework was inspired by Laravel, with similar folder structure and includes IOC container, very similar router, service providers, middlewares, even Views similar to blade. Utilizes ES6 classes for controllers. Even has an ORM called Lucid.

]]>
Wed, 20 Jan 2016 19:08:00 -0500 http://mitchmckenna.com/post/16139/adonis-nodejs-mvc-framework-inspired-by-laravel/adonis-nodejs-mvc-framework-inspired-by-laravel
Marco Pivetta (Ocramius) - Doctrine ORM Good Practices and Tricks http://mitchmckenna.com/post/15802/phpday-2015-marco-pivetta-doctrine-orm-good-practices-and-tricks

Interesting presentation from one of the Doctrine core team members.

In this Talk, we are going to dive into Doctrine 2 ORM’s feature set. We’re going to see the advantages and disadvantages of each functionality, with a particular focus on use-cases that each functionality attempts to solve, which features should be used with care (or avoided completely) and which ones should be used even more.

]]>
Tue, 29 Sep 2015 17:39:00 -0400 http://mitchmckenna.com/post/15802/phpday-2015-marco-pivetta-doctrine-orm-good-practices-and-tricks/phpday-2015-marco-pivetta-doctrine-orm-good-practices-and-tricks
JSON API — A specification for building APIs in JSON http://mitchmckenna.com/post/15792/json-api-a-specification-for-building-apis-in-json

Building a JSON API, you should be trying to follow the JSON API spec. Save your team the effort of arguing the best response format. It reached version 1.0 earlier this year, so it's safe to say there won't be too many big changes now.

It defines a standard for what the offsets in the json response should include: a resource is returned in "data", pagination in "links", errors in "errors", additional data in "meta", and a standard for including other objects aka "compound documents" in "relationships"/"included", so that instead of embedding other resource objects inside the main resource it flattens the graph of objects to eliminate duplicate data in the response (eg. the same user can be both the post author and a comment author).

If you're curious about some of the design decisions or how it compares to HAL, check out the FAQ.

]]>
Sun, 27 Sep 2015 16:34:00 -0400 http://mitchmckenna.com/post/15792/json-api-a-specification-for-building-apis-in-json/json-api-a-specification-for-building-apis-in-json
Vagrant Manager - Manage Multiple Vagrants From The Mac Menu Bar http://mitchmckenna.com/post/14900/vagrant-manager-manage-multiple-vagrants-from-the-mac-menu-bar

If you've played with vagrant it can be difficult to know which vagrant might be taking up a port right now, or where all your memory went (various vagrants still running). This lets you boot up and shutdown vagrants from the Mac Menu Bar, see the status on all your vagrants, etc.

]]>
Thu, 06 Nov 2014 16:29:00 -0500 http://mitchmckenna.com/post/14900/vagrant-manager-manage-multiple-vagrants-from-the-mac-menu-bar/vagrant-manager-manage-multiple-vagrants-from-the-mac-menu-bar
ChooseALicense.com - Choosing an Open Source License http://mitchmckenna.com/post/14331/choosealicensecom-choosing-an-open-source-license

Great website by Github to help developers understand the differences between the open source licenses and which one might be best for their project.

]]>
Thu, 10 Apr 2014 19:50:00 -0400 http://mitchmckenna.com/post/14331/choosealicensecom-choosing-an-open-source-license/choosealicensecom-choosing-an-open-source-license
Convert a GitHub Issue Into a Pull Request http://mitchmckenna.com/post/14011/convert-a-github-issue-into-a-pull-request

A little-known-feature of the GitHub API is the ability to attach changes to an issue, converting it into a pull request. The hub command, a wrapper around git that makes it more GitHub aware, allows you to easily do this.

]]>
Tue, 04 Feb 2014 18:01:00 -0500 http://mitchmckenna.com/post/14011/convert-a-github-issue-into-a-pull-request/convert-a-github-issue-into-a-pull-request
You Might Not Need jQuery http://mitchmckenna.com/post/13996/you-might-not-need-jquery

Neat site that shows side by side how to do something in jquery and how to do it in native javascript. It's not saying don't use jquery, but your just doing something simple, in modern browsers, maybe you don't need the whole jquery library.

]]>
Fri, 31 Jan 2014 13:45:00 -0500 http://mitchmckenna.com/post/13996/you-might-not-need-jquery/you-might-not-need-jquery
Sequelize - Mysql ORM for NodeJS http://mitchmckenna.com/post/13811/sequelize-mysql-orm-for-nodejs

The Sequelize library provides easy access to MySQL, MariaDB, SQLite or PostgreSQL databases by mapping database entries to objects and vice versa. To put it in a nutshell, it's an ORM (Object-Relational-Mapper). The library is written entirely in JavaScript and can be used in the Node.JS environment.

]]>
Mon, 16 Dec 2013 17:49:00 -0500 http://mitchmckenna.com/post/13811/sequelize-mysql-orm-for-nodejs/sequelize-mysql-orm-for-nodejs
Plates - The native PHP template system http://mitchmckenna.com/post/13660/plates-the-native-php-template-system

Plates is a minimal PHP template system that’s fast, easy to use and easy to extend. Inspired by the Twig template engine. Made for developers who prefer to use PHP templates over more compiled templates such as Twig or Smarty.

]]>
Wed, 13 Nov 2013 18:14:00 -0500 http://mitchmckenna.com/post/13660/plates-the-native-php-template-system/plates-the-native-php-template-system
Lime - Open Source Sublime Text Alternative http://mitchmckenna.com/post/13579/lime-open-source-sublime-text-alternative ]]> Sun, 27 Oct 2013 19:30:00 -0400 http://mitchmckenna.com/post/13579/lime-open-source-sublime-text-alternative/lime-open-source-sublime-text-alternative PHP Coding Standards Fixer http://mitchmckenna.com/post/13558/php-coding-standards-fixer

PHP-CS-Fixer will analyzes some PHP files and try to automatically convert the code to meet PSR coding standards. There is even plugins for VIM and Sublime Text.

]]>
Sat, 26 Oct 2013 16:37:00 -0400 http://mitchmckenna.com/post/13558/php-coding-standards-fixer/php-coding-standards-fixer
NPM Link with Vagrant - Symlinks Not Working? http://mitchmckenna.com/post/13362/npm-link-with-vagrant-symlinks-not-working

NPM Link

It can be handy to use npm link to make npm use a local copy of a node repo if you're working on that other repo at the same time (eg. I'm working on a repo that relies on a npm module I also contribute to). npm link creates a symlink in your npm global modules folder to your local repo, so that npm install/update uses your local copy and doesn't overwrite it.

Vagrant

You used to have to add settings to your config to get symlinks to work in Vagrant (see this issue) but since Vagrant 1.1, Vagrant supports symlinks by default (yay!) (see the commit).

NPM Link Not Working With Vagrant?

If the symlink points to somewhere outside your shared_folder, the symlink won't work though. You have to shared_folder where the symlink points to as well. So just like in the example:

cd ~/projects/node-redis    # go into the package directory
npm link                    # creates global link
cd ~/projects/your-project-repo   # go into some other package directory.
npm link redis              # link-install the package


You have to add to your Vagrant config:

config.vm.synced_folder "/usr/local/lib/node_modules/node-redis", "/usr/local/lib/node_modules/node-redis", :owner => "www-data", :group => "www-data"
]]>
Thu, 05 Sep 2013 14:04:09 -0400 http://mitchmckenna.com/post/13362/npm-link-with-vagrant-symlinks-not-working/npm-link-with-vagrant-symlinks-not-working
Better Testing in Laravel - Jeffrey Way http://mitchmckenna.com/post/12641/laracon-day-1-talk-2-jeffrey-way

Jeffery Way, editor at Nettuts, is somewhat of a Laravel evangelist. In his talk at Laravel Conference 2013 he goes over how you can write more testable code, and how you can improve your unit tests.

  • 5:40 - Intro to Laravel's handy generator Artisan to generate files, and a package he put together of even more handy generators, you can get it on github: Laravel-4-Generators.
  • 10:55 - Using Dependency Injection to write more testable code.
  • 13:30 - Smart type hinting with Laravel's IOC Containers.
  • 18:45 - Intro to Interfaces using an example of injecting your database layer via an Interface implementation so your controller isn't bound to an ORM.
  • 24:05 - Creating php unit tests.
  • 28:40 - Using mock objects and the Mockery framework.
  • 33:50 - Making tests more readable. I found this interesting; creating common assertions to simplify writing tests, so your more likely to write them in the future.
]]>
Fri, 22 Mar 2013 02:49:00 -0400 http://mitchmckenna.com/post/12641/laracon-day-1-talk-2-jeffrey-way/laracon-day-1-talk-2-jeffrey-way
whoops - PHP Errors For Cool Kids http://mitchmckenna.com/post/12626/whoops-php-errors-for-cool-kids

"whoops is an error handler base/framework for PHP. Out-of-the-box, it provides a pretty error interface that helps you debug your web projects, but at heart it's a simple yet powerful stacked error handling system." Another popular one is PHP-Error: https://github.com/JosephLenton/PHP-Error .

]]>
Sun, 17 Mar 2013 20:34:00 -0400 http://mitchmckenna.com/post/12626/whoops-php-errors-for-cool-kids/whoops-php-errors-for-cool-kids
PHP 5.5 replaces APC with Zend Optimizer+, now called Opcache http://mitchmckenna.com/post/12623/mitchellmckenna-php-55-replaces-apc-with-zend-optimizer-now-called-opcache-httptcokm9etmw8ao-php-programming

PHP 5.5 replaces APC with Zend Optimizer+, now called Opcache http://t.co/kM9EtMw8aO #php #programming

]]>
Sun, 17 Mar 2013 20:11:00 -0400 http://mitchmckenna.com/post/12623/mitchellmckenna-php-55-replaces-apc-with-zend-optimizer-now-called-opcache-httptcokm9etmw8ao-php-programming/mitchellmckenna-php-55-replaces-apc-with-zend-optimizer-now-called-opcache-httptcokm9etmw8ao-php-programming
Taylor Otwell - History & Philosophy of Laravel http://mitchmckenna.com/post/12612/laracon-day-1-talk-1-taylor-otwell

I learned a lot about the history of Laravel from this introductory talk by the founder Taylor Otwell at the first Laravel Conference (2013).

  • 2:48 - The Vision: aka Otwell's inspiration. I didn't realize that Otwell used to be a big CodeIgniter fan. This is probably why I was naturally attracted to Laravel when I first discovered it. It fills a lot of the gaps the CI community wanted filled.
  • 4:12 - Why create a new framework? Why not fork?
  • 8:05 - Documentation is king. Since CI was known for its' simple/clear docs, Otwell realizes how important good docs are to attracting new developers.
  • 9:15 - Important features of Laravel: Routing, Eliquent, Blade templating, and Auth.
  • 11:35 - How Laravel is leveraging the Symfony community.
  • 13:05 - Embracing Composer for dependencies.
  • 14:25 - New features in Laravel 4: Mail, password reminders, job queue.
  • 17:26 - Did he consider Zend? Not really, he mentions he was fairly new to the PHP landscape at the time and hadn't really tried it.
  • 19:30 - Building a community.
  • 33:50 - The name Laravel comes from rhyming with castle Cair Paravel in Narnia.

Want to learn more about Laravel? Check out the Laravel 4 Video Tutorials.

]]>
Thu, 14 Mar 2013 01:45:00 -0400 http://mitchmckenna.com/post/12612/laracon-day-1-talk-1-taylor-otwell/laracon-day-1-talk-1-taylor-otwell
Tiled Text – a Different Approach to Editing Text http://mitchmckenna.com/post/12946/tiled-text-a-different-approach-to-editing-text

submitted by mitchmckenna to programming [link] [22 comments]

]]>
Fri, 01 Mar 2013 15:55:00 -0500 http://mitchmckenna.com/post/12946/tiled-text-a-different-approach-to-editing-text/tiled-text-a-different-approach-to-editing-text