Skip to content

Instantly share code, notes, and snippets.

View koriym's full-sized avatar

Akihito Koriyama koriym

View GitHub Profile
@jpinnix
jpinnix / DCI.md
Created February 13, 2014 14:23
Notes from presentation by Trygve Reenskaug - Object Orientation Revisited. Simplicity and power with DCI.

“Object Orientation Revisited. Simplicity and power with DCI.” by Trygve Reenskaug

Great presentation by Trygve Reenskaug, the creator of MVC, on an extension of OO principles, called DCI (Data, Context, Interaction). If you are a programmer, watch this on Vimeo!

A DCI Class says everything about the inside of an object and nothing about its neighbors.

A DCI Context says everything about a network of communicating objects and nothing about their insides.

The DCI paradigm

@tmaiaroto
tmaiaroto / collection+json.md
Last active May 23, 2022 12:29
JSON Based Hypermedia Structures - Notes & Comparisons

Collection+JSON format

http://amundsen.com/media-types/collection/examples/

This format takes into consideration collections (much like Siren). It also takes into consideration versioning. However, I'm not certain version matters in the data set if it pertains to an API version. That is best left being in the API URL. It could pertain to collection version, but I'm not sure the point. Documentation says each collection should have a version - but says nothing more about meaning or why.

Items are clearly distinct in this format and are organizationally positioned separate from links.
This is by far the most collision free structure.

However, the data format itself is a bit strange...Every field being an array. Data is always an array of objects. I understand the flexibility this presents and am not 100% against it. I just believe it's perhaps not needed as things could change based on the client application.

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

@branneman
branneman / better-nodejs-require-paths.md
Last active April 27, 2024 04:16
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

<?php
// iterator impl:
class MapIterator extends IteratorIterator {
private $f;
public function __construct($f, $inner) {
parent::__construct($inner);
$this->f = $f;
@jbenet
jbenet / simple-git-branching-model.md
Last active April 9, 2024 03:31
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

@okapies
okapies / promises-are-functional.md
Last active August 14, 2023 11:44
翻訳: ”命令型のコールバック、関数型のプロミス: Node が逸した最大の機会” by James Coglan

命令型のコールバック、関数型のプロミス: Node が逸した最大の機会

Original: "Callbacks are imperative, promises are functional: Node's biggest missed opportunity" by James Coglan

Translated by Yuta Okamoto (@okapies)

Note

  • 訳者は JavaScript や Node.js に関する専門知識がほとんどありません。識者のツッコミをお待ちしております。「◯◯が分からない」等も歓迎です。
  • 元記事から構成を一部変更しています。また、関数型プログラミングに関する記述のうち、議論の骨子に絡まないものは省略しています。
@rsky
rsky / Interceptor.php
Last active December 14, 2015 10:09
ミックスインでAOPもどき(オレオレ改造PHPを使用)。 AOPサポートを追加すればInterceptor::invoke()の定義が不要になる。
<?php
trait Interceptor
{
public function before()
{
echo "(before)\n";
}
public function after()
@estahn
estahn / gist:5002290
Created February 21, 2013 05:13
Our current framework is heavily using a "Factory" to instantiate classes on the fly. It used ReflectionClass::newInstanceArgs() for classes with arguments. Since Reflection is quite slow it decreased our performance. The gist shows a solution that is less beautiful but more performant.
<?php
class Factory
{
// ...
/**
* Helper to instantiate objects with dynamic constructors.
*