Skip to content

Instantly share code, notes, and snippets.

Barry Simpson sirbarrence

Block or report user

Report or block sirbarrence

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 background.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="background.js"></script>
</head>
<body>
<textarea id="ta"></textarea>
</body>
</html>
View rxDecorateDirective.js.diff
diff --git a/rxDecorateDirective.js b/rxDecorateDirective.js
index 56912ca..1ecb8b5 100644
--- a/rxDecorateDirective.js
+++ b/rxDecorateDirective.js
@@ -1,4 +1,7 @@
+'use strict';
+
function rxDecorateDirective($provide, directiveName) {
+ // Duck-typing function lifted from the rx.js source.
function isObservable(obj) {
@sirbarrence
sirbarrence / rxDecorateDirective.js
Last active Sep 6, 2016
A function to decorate some stock AngularJS 1.x directives to accept RxJS Observables. Finished product of https://barrysimpson.net/posts/rx-directive-decorators and https://barrysimpson.net/posts/rx-directive-decorators-update1
View rxDecorateDirective.js
'use strict';
function rxDecorateDirective($provide, directiveName) {
// Duck-typing function lifted from the rx.js source.
function isObservable(obj) {
return obj && typeof obj.subscribe === 'function';
}
$provide.decorator(directiveName + 'Directive', ['$delegate', 'rx', function($delegate, rx) {
var directiveConfig = $delegate[0];
View keybase.md

Keybase proof

I hereby claim:

  • I am sirbarrence on github.
  • I am barrysimpson (https://keybase.io/barrysimpson) on keybase.
  • I have a public key whose fingerprint is 1681 C5AF CCB4 4ADA 88C8 9CF7 4E77 556C 52CD 2279

To claim this, I am signing this object:

@sirbarrence
sirbarrence / WhatIsThis.js
Created Mar 13, 2013
Short illustration of what `this` means in various scopes, when using a constructor function approach.
View WhatIsThis.js
var WhatIsThis = function () {
var _this = this; // `_this` or `that` or `self`, take your pick
// References to Window below assume you're running in a browser and not node.js
console.log("'this' directly in constructor body: ", this); // 'this' is WhatIsThis
function privateFunc() {
console.log("'this' in privateFunc: ", this); // 'this' is Window
console.log("'_this' in privateFunc: ", _this); // '_this' is WhatIsThis
You can’t perform that action at this time.