This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14:18 ~/src/beaglelabs/beagle $ grep react node_modules/react*/package.json | |
node_modules/react-async/package.json: "name": "react-async", | |
node_modules/react-async/package.json: "react": "~0.11.0" | |
node_modules/react-async/package.json: "react": "~0.11.0", | |
node_modules/react-async/package.json: "url": "git://github.com/andreypopp/react-async" | |
node_modules/react-async/package.json: "react-component", | |
node_modules/react-async/package.json: "react" | |
node_modules/react-async/package.json: "url": "https://github.com/andreypopp/react-async/issues" | |
node_modules/react-async/package.json: "homepage": "https://github.com/andreypopp/react-async", | |
node_modules/react-async/package.json: "_id": "react-async@1.0.2", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var iterator = 10; | |
iLoop: for (var i = 0; i < iterator; i++) { | |
yLoop: for (var y = 0; y < iterator; y++ ) { | |
console.log('i and y:', i, y) | |
testing: if (y==5) { | |
console.log('This will break the outside loop!'); | |
break iLoop; | |
console.log('This will never appear.'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parse_git_stash() { | |
[[ $(git stash list 2> /dev/null | tail -n1) != "" ]] && echo ' \[\e[0;31m\]☣' | |
} | |
set_bash_prompt(){ | |
PS1="\A \w$(parse_git_stash) \[\e[0m\]$ " | |
} | |
PROMPT_COMMAND=set_bash_prompt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Works: https://github.com/substack/static-module/blob/master/test/brfs/attribute_vars.js | |
var x = 5, f = require('fs').readFileSync, y = 2; | |
var src = f(__dirname + '/x.txt', 'utf8'); | |
console.log(src); | |
// Broken: | |
var x = 5, fs = require('fs'), y = 2; | |
var src = fs.readFileSync(__dirname + '/x.txt', 'utf8'); | |
console.log(src); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Initiation of browserify object | |
var b = browserify({ | |
// Required watchify args | |
'cache': {}, | |
'packageCache': {}, | |
'fullPaths': true, | |
// Browserify options | |
'entries': [paths.jsPath + 'main.js'], | |
'noParse': ['react.js', 'jquery.js', 'pdf.combined.js'], | |
'transform': [reactify] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.get(documentId).then(function (value) { | |
// if (err && err.name !== 'not_found') { | |
// return console.log('Failed to get ' + documentId + 'from db', err) | |
// } | |
/* Instantiate the object if it doesn't exist yet */ | |
value = value || {} | |
value._id = documentId | |
/* Add in the selection to the selections array */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 2015 April 16th | |
What am I trying to do? | |
I have a Chrome extension and I want to implement OAuth in it so that users can be authenticated and have accounts. | |
So, first, I need users. The user objects shouldn’t be too hard to implement. Juan sent me a way to do it. | |
Then, I need to figure out how to use Google OAuth. Actually, this doesn’t require me hitting the API for the Google Contacts I need, I believe - I should be able to just use Google OAuth before I hit the API, as that is actually a separate concern. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd .. | |
printf 'cd to' && pwd | |
echo 'Cloning BeagleLab/beagle-style' | |
git clone git@github.com:BeagleLab/beagle-style.git | |
cd beagle-style | |
echo 'Installing modules...' | |
npm install | |
cd .. | |
echo 'Cloning BeagleLab/beagle-pdf' | |
git clone git@github.com:BeagleLab/beagle-pdf.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
componentWillMount: function () { | |
let dummyImage = 'http://upload.wikimedia.org/wikipedia/en/4/42/Richard_Feynman_Nobel.jpg' | |
let userPromises = [] | |
let clone = _.each(this.state.conversations.slice(), function (conversation) { | |
conversation.avatars = [] | |
_.each(_.keys(conversation.participants), function (key) { | |
if (conversation.participants.hasOwnProperty(key)) { | |
// Suggestion: Only show avatars for participants who have actively contributed to conversation | |
let getAvatar = db.getUser(key).then(function (err, res) { | |
if (res.avatar) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports.getConversationsForUser = function (user, cb) { | |
db.query(function (doc) { | |
if (doc.author === user.userId) { | |
emit(doc) | |
} | |
}.bind(this), {include_docs: true}).then(function (response) { | |
console.log('response', response) | |
cb(null, response) | |
}).catch(function (err) { | |
cb(err) |