Skip to content

Instantly share code, notes, and snippets.

View koriym's full-sized avatar

Akihito Koriyama koriym

View GitHub Profile
@wojteklu
wojteklu / clean_code.md
Last active April 24, 2024 00:28
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@koriym
koriym / v8js.md
Last active May 2, 2016 07:57
v8js for MacOS

How to install latest v8 (5.x) on MacOS

Compile latest v8

# Install depot_tools first (needed for source checkout)
# https://github.com/phpv8/v8js/blob/php7/README.MacOS.md
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=`pwd`/depot_tools:"$PATH"
@gaearon
gaearon / slim-redux.js
Last active March 25, 2024 19:12
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
@gonex45
gonex45 / RamDisk
Last active November 7, 2017 01:31
do shell script "
DISK_SIZE_G=4
if ! test -e /Volumes/RamDisk ; then
echo create ramdisk
diskutil erasevolume HFS+ RamDisk `hdiutil attach -nomount ram://$((${DISK_SIZE_G}*1024*1024*2))`
#Idea
@non
non / answer.md
Last active January 9, 2024 22:06
answer @nuttycom

What is the appeal of dynamically-typed languages?

Kris Nuttycombe asks:

I genuinely wish I understood the appeal of unityped languages better. Can someone who really knows both well-typed and unityped explain?

I think the terms well-typed and unityped are a bit of question-begging here (you might as well say good-typed versus bad-typed), so instead I will say statically-typed and dynamically-typed.

I'm going to approach this article using Scala to stand-in for static typing and Python for dynamic typing. I feel like I am credibly proficient both languages: I don't currently write a lot of Python, but I still have affection for the language, and have probably written hundreds of thousands of lines of Python code over the years.

@jashkenas
jashkenas / semantic-pedantic.md
Last active November 29, 2023 14:49
Why Semantic Versioning Isn't

Spurred by recent events (https://news.ycombinator.com/item?id=8244700), this is a quick set of jotted-down thoughts about the state of "Semantic" Versioning, and why we should be fighting the good fight against it.

For a long time in the history of software, version numbers indicated the relative progress and change in a given piece of software. A major release (1.x.x) was major, a minor release (x.1.x) was minor, and a patch release was just a small patch. You could evaluate a given piece of software by name + version, and get a feeling for how far away version 2.0.1 was from version 2.8.0.

But Semantic Versioning (henceforth, SemVer), as specified at http://semver.org/, changes this to prioritize a mechanistic understanding of a codebase over a human one. Any "breaking" change to the software must be accompanied with a new major version number. It's alright for robots, but bad for us.

SemVer tries to compress a huge amount of information — the nature of the change, the percentage of users that wil

@harikt
harikt / questions.md
Last active August 29, 2015 14:04
When and where are you using an event / signal hanlder ?

Are you making use of the event handling system like Symfony event handler, Aura.Signal, Zend event manager or any other in your core framework?

Are you using signal/events before they hit the action class ( controller action ) ?

I have a feeling it will be good to have an event handling system in core of a framework.

The basic idea is to call a signal

  • before a route is checked
  • before dispatching
@smizell
smizell / vnd.error.xml
Created July 31, 2014 20:55
ALPS doc for defining semantics and links for error messages, as taken from the vnd.error media type
<alps version="1.0">
<descriptor id="error" type="semantic">
<doc>Error Message</doc>
<descriptor id="message" type="semantic">
<doc>
For expressing a human readable message related to the current error which may be displayed to the user of the api
</doc>
</descriptor>
@dhrrgn
dhrrgn / JsonResponder.php
Last active August 29, 2015 14:01
A WIP implementation of the Responder Layer of Paul Jones' ADR Pattern: https://github.com/pmjones/mvc-refinement
<?php
namespace Core\Responder;
class JsonResponder extends Responder
{
/**
* @return \Orno\Http\Response
*/
protected function respond()