Skip to content

Instantly share code, notes, and snippets.

View arcanis's full-sized avatar

Maël Nison arcanis

View GitHub Profile

The Indentation Nightmare

If there is something that I have never fully understood during the last years of learning programming languages, it's the chaos around indentation. Some says that you should use spaces, some others says that you should use tabs. And even if you're willing to use spaces, there will be multiple schools, some people saying that you should use two spaces, instead of four for some other developers.

Why is it such a mess ? I don't even see why it is such a debatable topic : indentation is made by tabs. Alignment is made by spaces. Nothing more, nothing less. Want to know why ?

Spaces have a fixed length

Spaces are usefull because they have a fixed length. It means that it should be used when you have to align code. What's aligning ? Take this piece of code :

PonyOS
http://www.ponyos.org/
Blizzard - Starcraft : Warhound is back
https://us.battle.net/sc2/en/blog/9369235
Atlassian - JIRA Jr
http://www.atlassian.com/jirajr/
Lambda The Ultimate - Migration to Facebook
MyEventManager.prototype.bootstrap = function ( ) {
var self = this;
this.listen( 'myEvent', function ( ) {
self.myEventListener( );
} );
};
// ---
var array = [ 1, 2, 3 ];
@arcanis
arcanis / gist:5780938
Created June 14, 2013 10:41
Résultat d'un `tree` sur Castel
.
└── castel
├── ast
│ ├── expr
│ │ ├── Binary.hh
│ │ ├── Conditional.hh
│ │ ├── External.hh
│ │ ├── literal
│ │ │ ├── Boolean.hh
│ │ │ ├── Class.hh
diff --git a/src/library.js b/src/library.js
index 84071b6..ae61697 100644
--- a/src/library.js
+++ b/src/library.js
@@ -5794,7 +5794,7 @@ LibraryManager.library = {
dlopen: function(filename, flag) {
// void *dlopen(const char *file, int mode);
// http://pubs.opengroup.org/onlinepubs/009695399/functions/dlopen.html
- filename = (ENV['LD_LIBRARY_PATH'] || '/') + Pointer_stringify(filename);
+ filename = filename ? (ENV['LD_LIBRARY_PATH'] || '/') + Pointer_stringify(filename) : '';
define( 'ace/mode/pegjs', [
'ace/lib/oop',
'ace/mode/text_highlight_rules',
'ace/mode/javascript_highlight_rules'
], function ( oop, textHighlightRules, javascriptHighlightRules ) {
'use strict';

Javascript

@arcanis
arcanis / README.md
Last active January 2, 2016 14:09
Custom git command for Pivotal / Github

Git Pivotal

git pivotal --start <branch_01234567>|<01234567>
  Creates a new branch, sets its upstream to the correct remote branch then
  sets the task state to 'started'. If the branch name is omitted, the script
  will use the name of the current branch. If the branch name only contain an
  issue ID, the script will try to make use of the _git_pivotal completion.

git pivotal --clean
for (let type in types)
doSomething(type); // should be indented
for (let type of types)
doSomething(type); // should be indented