Skip to content

Instantly share code, notes, and snippets.

View kad3nce's full-sized avatar

Jedidiah Hurt kad3nce

View GitHub Profile
@kad3nce
kad3nce / baseplate-post.md
Last active August 29, 2015 14:14
DIY Builds: Baseplate With Built-In Shoulder Pad

Finished Baseplate

This is a guest post by Jake Schumacher & Jed Hurt

We're working on an ambitious doc called App: The Human Story. With a crowdfunded budget, we have to find ways to stretch every dollar.

The new breed of baseplates-that-double-as-shoulder-rigs is incredibly versatile, comfortable to use, and not very easy on your wallet. Don’t fret though. With a little DIY spirit, you can make your own for a fraction of the price.

Let’s start by defining the three features we're after:

@kad3nce
kad3nce / poetry.js
Created April 8, 2014 17:59
function poetry(packet) {
function poetry(packet) {
_.pipeline(_.accessor('seed'), doit)(JSON.parse(packet));
}
var t = 0;
var n = 0;
var paths = 0;
var above='brow,mist,shape,layer,the crag,stone,forest,height'.split(',');
var below='flow,basin,shape,vein,rippling,stone,cove,rock'.split(',');
@kad3nce
kad3nce / README.md
Created March 31, 2014 14:34
#Restangular

#Restangular

Build Status PayPayl donate button Donate on Gittip

Restangular is an AngularJS service that simplifies common GET, DELETE, and UPDATE requests with a minimum of client code.

@kad3nce
kad3nce / ch5.md
Created March 21, 2014 14:36
# You Don't Know JS: Scope & Closures

You Don't Know JS: Scope & Closures

Chapter 5: Scope Closure

We arrive at this point with hopefully a very healthy, solid understanding of how scope works.

We turn our attention to an incredibly important, but persistently elusive, almost mythological, part of the language: closure. If you have followed our discussion of lexical scope thus far, the payoff is that closure is going to be, largely, anti-climatic, almost self-obvious. There's a man behind the wizard's curtain, and we're about to see him. No, his name is not Crockford!

If however you have nagging questions about lexical scope, now would be a good time to go back and review Chapter 2 before proceeding.

Enlightenment

@kad3nce
kad3nce / ch6.md
Created March 21, 2014 13:58
# You Don't Know JS: *this* & Object Prototypes

You Don't Know JS: this & Object Prototypes

Chapter 6: Behavior Delegation

In Chapters 4 and 5, we addressed the [[Prototype]] mechanism in detail, and why it's confusing and inappropriate (despite countless attempts for nearly two decades) to label it "class" or "inheritance". We trudged through not only the fairly verbose syntax (.prototype littering the code), but the various gotchas (like surprising .constructor resolution or ugly pseudo-polymorphic syntax). We explored variations of the "mixin" approach, which many people use to attempt to smoothe over such rough areas.

It's a common reaction at this point to wonder why it has to be so complex to do something seemingly so simple. Now that we've pulled back the curtain and seen just how dirty it all gets, it's not a surprise that most JS developers never dive this deep, and instead relegate such mess to a "class" library to handle it for them.

I hope if you're reading these "You Don't Know JS" books, you're not content to just gloss ov

@kad3nce
kad3nce / ch5.md
Created March 21, 2014 13:35
# You Don't Know JS: *this* & Object Prototypes

You Don't Know JS: this & Object Prototypes

Chapter 5: Prototypes

In the Chapters 3 and 4, we mentioned the [[Prototype]] chain several times, but haven't said what exactly it is. We will now examine prototypes in detail.

**Note: All of the attempts to emulate class-copy behavior, as described previously in Chapter 4, labeled as variations of "mixins", completely circument the [[Prototype]] chain mechanism we examine here in this chapter.

Links

Objects in JavaScript have an internal property, denoted in the specification as [[Prototype]], which is simply a reference to another object. Almost all objects are given a non-null value for this property, at the time of their creation.

@kad3nce
kad3nce / ch5.md
Created March 20, 2014 21:41
# You Don't Know JS: *this* & Object Prototypes

You Don't Know JS: this & Object Prototypes

Chapter 5: Prototypes

In the Chapters 3 and 4, we mentioned the [[Prototype]] chain several times, but haven't said what exactly it is. We will now examine prototypes in detail.

**Note: All of the attempts to emulate class-copy behavior, as described previously in Chapter 4, labeled as variations of "mixins", completely circument the [[Prototype]] chain mechanism we examine here in this chapter.

Links

Objects in JavaScript have an internal property, denoted in the specification as [[Prototype]], which is simply a reference to another object. Almost all objects are given a non-null value for this property, at the time of their creation.

@kad3nce
kad3nce / ch6.md
Created March 20, 2014 21:35
# You Don't Know JS: *this* & Object Prototypes

You Don't Know JS: this & Object Prototypes

Chapter 6: Behavior Delegation

In Chapters 4 and 5, we addressed the [[Prototype]] mechanism in detail, and why it's confusing and inappropriate (despite countless attempts for nearly two decades) to label it "class" or "inheritance". We trudged through not only the fairly verbose syntax (.prototype littering the code), but the various gotchas (like surprising .constructor resolution or ugly pseudo-polymorphic syntax). We explored variations of the "mixin" approach, which many people use to attempt to smoothe over such rough areas.

It's a common reaction at this point to wonder why it has to be so complex to do something seemingly so simple. Now that we've pulled back the curtain and seen just how dirty it all gets, it's not a surprise that most JS developers never dive this deep, and instead relegate such mess to a "class" library to handle it for them.

I hope if you're reading these "You Don't Know JS" books, you're not content to just gloss ov

@kad3nce
kad3nce / ch2.md
Created March 20, 2014 21:07
# You Don't Know JS: *this* & Object Prototypes

You Don't Know JS: this & Object Prototypes

Chapter 2: this All Makes Sense Now!

In Chapter 1, we discarded various misconceptions about this and learned instead that this is a binding made for each function invocation, based entirely on its call-site (how the function is called).

Call-site

To understand this binding, we have to understand the call-site: the location in code where a function is called (not where it's declared). We must inspect the call-site to answer the question: what's this this a reference to?

Finding the call-site is generally: "go locate where a function is called from", but it's not always that easy, as certain coding patterns can obscure the true call-site.