Skip to content

Instantly share code, notes, and snippets.

Today I had a brief debate on twitter about AMD vs CommonJS, https://twitter.com/TechWraith/status/441387541778808832. It's a debate worth having for sure. But I had to bail out of this one. The thing that annoyed me is that the first argument that people bring up to disquality AMD is "the syntax is too complex". I disagree with this. There are lots of reasons to prefer CommonJS over AMD, but the module authoring syntax is not a very good one. There was also a related statement that AMD authoring introduces more "cognitive overhead". This is absolutely true. But I don't consider this to be synonymous with "complexity" by any means.

So I thought I'd explore some comparable examples. Here's a simple one that was offered up by someone else in the thread. This was on twitter so I can forgive erring on the side of brevity.

AMD

define('myThing', ['some', 'deps'], function (some, deps) {
  //my code
  
 return myThing;
@reklis
reklis / svgtextelement.patch
Created November 4, 2011 14:29
SVG Text Element parsing
diff --git a/Core/SVGParser.m b/Core/SVGParser.m
index a2a3106..7726901 100644
--- a/Core/SVGParser.m
+++ b/Core/SVGParser.m
@@ -23,6 +23,7 @@
#import "SVGPolylineElement.h"
#import "SVGRectElement.h"
#import "SVGTitleElement.h"
+#import "SVGTextElement.h"
var Renderer = function () {
var self = this
, requestAnimationFrame = window.requestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.msRequestAnimationFrame
this.queue = {}
requestAnimationFrame(function () {
@trevorbernard
trevorbernard / Security.java
Created June 30, 2017 12:50
JeroMQ Curve Security
import org.zeromq.ZContext;
import org.zeromq.ZMQ;
import org.zeromq.ZMQ.Socket;
import zmq.io.mechanism.curve.Curve;
public class Security {
public static void main(String[] args) throws Exception {
Curve curve = new Curve();
String[] serverKeys = curve.keypairZ85();
@ejdyksen
ejdyksen / patch-edid.md
Last active April 6, 2024 15:59
A script to fix EDID problems on external monitors in macOS

patch-edid.rb

A script to fix EDID problems on external monitors in macOS.

Instructions

  1. Connect only the problem display.

  2. Create this directory structure (if it doesn't already exist):