Skip to content

Instantly share code, notes, and snippets.

Ben Ng ben-ng

Block or report user

Report or block ben-ng

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View amd_commonjs_module_syntax.md

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;
@ejdyksen
ejdyksen / patch-edid.md
Last active Nov 16, 2019
A script to fix EDID problems on external monitors in Mac OS. Source: http://embdev.net/topic/284710
View patch-edid.md

patch-edid.rb

A script to fix EDID problems on external monitors in Mac OS.

  1. Connect the problem monitor.

  2. Download this script into your /System/Library/Displays/Overrides (note: this file is only writeable by root, so some commands require sudo).

View renderer.js
var Renderer = function () {
var self = this
, requestAnimationFrame = window.requestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.msRequestAnimationFrame
this.queue = {}
requestAnimationFrame(function () {
@reklis
reklis / svgtextelement.patch
Created Nov 4, 2011
SVG Text Element parsing
View svgtextelement.patch
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"
You can’t perform that action at this time.