Skip to content

Instantly share code, notes, and snippets.

View aaronj1335's full-sized avatar
🤠

Aaron Stacy aaronj1335

🤠
View GitHub Profile
@aaronj1335
aaronj1335 / -
Last active December 25, 2015 19:19
diff --git a/webapps/msgme3.0/scripts/msgme/ko/mapping.js b/webapps/msgme3.0/scripts/msgme/ko/mapping.js
index 9ac150e..5439cb7 100644
--- a/webapps/msgme3.0/scripts/msgme/ko/mapping.js
+++ b/webapps/msgme3.0/scripts/msgme/ko/mapping.js
@@ -116,6 +116,14 @@ function ($, _, ko, komapping, deep) {
}
}
+ function isObservableArray(oa) {
+ return oa &&
@aaronj1335
aaronj1335 / gist:7041151
Last active December 25, 2015 21:18 — forked from roidrage/gist:7040766
cache:
directories:
- ~/node_modules
- node_modules
@aaronj1335
aaronj1335 / .bashrc
Last active December 26, 2015 04:09
# if we've got the 'selecta' command (https://github.com/garybernhardt/selecta)
# then bind ctrl-b to fuzzy-find a file and insert it on the command line
if which selecta &>/dev/null; then
export SELECTA_IGNORE='(.*node_modules.*)|(.*.git.*)'
bind '"\C-b" "$(find -E . -type f -not -regex \"$SELECTA_IGNORE\" \| selecta)\n"'
fi
@aaronj1335
aaronj1335 / README.md
Last active December 26, 2015 15:09
how generators work w/ iterating over collections.

generators

2 (most?) common uses of generators:

  • async control flow
    • this is what the js community has mostly been talking about
    • that's a huge topic, and it's [better covered elsewhere][jlongster], so i'm not going to go over that stuff here
  • iteration - this is probably the most common use case for python

iteration

@aaronj1335
aaronj1335 / dashboard-view.js
Last active December 26, 2015 18:59
my proposal for implementing feature flags client-side based on hard-coding a role (we could do a group too, i just used role because it was easy to show the idea).
define([
'feature-flags'
], function(feature) {
// .. instantiate the view and all of that
feature.promise().then(function() {
path.map(url).to(function() {
if (feature.flags.dashboard)
view.show();
});
astacy∂ʇoqǝɔɐʇs ☠ ~/code/frontend/webapps/msgme3.0  04:04:58 Nov14
§ curl -H 'Cookie:SessionId=e87ba716-3bbc-487f-91ca-7172737d439f; yeti-agent=136665393287845030; astacy.4e6fa6177a475eefd68fb5ee=permanent; joes.4e6fa6177a475eefd68fb5ee=permanent; wmadmin.4e6fa6177a475eefd68fb5ee=permanent; smsonly.4e6fa6177a475eefd68fb5ee=permanent; rtongsinoon.4e6fa6177a475eefd68fb5ee=permanent; astacy.4e6fa6177a475eefd68fb5ee.3.4.0=permanent; astacy.4e6fa6177a475eefd68fb5ee.3.4.1=permanent; PETA.50a1555198a72f1b6261306e.3.4.1=permanent; jlau.4e6fa6177a475eefd68fb5ee.3.4.1=permanent; astacy.4e6fa6177a475eefd68fb5ee.3.4.2=permanent; wmadmin.4e6fa6177a475eefd68fb5ee.3.4.2=permanent; JSESSIONID=e87ba716-3bbc-487f-91ca-7172737d439f' -D - http://threebeta.waterfallmobile.com/api/v2/stream/inboxCounter
HTTP/1.1 500 Server Error
Server: nginx/1.2.7
Date: Thu, 14 Nov 2013 22:05:15 GMT
Content-Type: application/xml
Content-Length: 118
Connection: keep-alive
Access-Control-Allow-Origin: *
define([
'msgme/underscore'
'msgme/ko'
], function (_, ko) {
var kounwrap = ko.utils.unwrapObservable;
return function (path) {
path = (path || '').split('.');
return _.reduce(path.slice(1), function (item, prop) {
diff --git a/webapps/msgme3.0/tests/spec/msgme/util/feature-flags.js b/webapps/msgme3.0/tests/spec/msgme/util/feature-flags.js
index fae30fb..ff332bb 100644
--- a/webapps/msgme3.0/tests/spec/msgme/util/feature-flags.js
+++ b/webapps/msgme3.0/tests/spec/msgme/util/feature-flags.js
@@ -24,6 +24,10 @@ define([
done();
}).
fail(function (jqXHR) {
+ if (jqXHR.status !== 404) {
+ throw jqXHR;
@aaronj1335
aaronj1335 / core.clj
Created March 15, 2014 21:03
re-bind a random number generator for testing
(ns my-lib.core)
(def my-rand rand)
(defn my-fn []
(take 3 (repeatedly my-rand)))
@aaronj1335
aaronj1335 / hmm.clj
Last active August 29, 2015 13:57
debugging slow code
(defn tokens-and-labels [labeled-tokens]
"given a sequence of token/label pairs, return a set of the tokens and a set
of the labels"
;{:tokens (set (map first labeled-tokens))
; :labels (set (map second labeled-tokens))})
(reduce
(fn [{:keys [tokens labels]} [token label]]
{:tokens (conj tokens token)
:labels (conj labels label)})
{:tokens #{} :labels #{}}