Skip to content

Instantly share code, notes, and snippets.

@steida
steida / gist:8704527
Created January 30, 2014 08:19
How to define exact Closure Library version dependency in bower.json.
{
"name": "some-app",
"version": "0.0.1",
"private": true,
"dependencies": {
"animate-css": "git://github.com/daneden/animate.css.git",
"closure-compiler-externs": "https://github.com/dcodeIO/node.js-closure-compiler-externs.git",
"closure-library": "git://github.com/steida/google-closure-library.git#74667f60a487ea7a596789e2d9f48f26ff29569c",
"este-library": "git://github.com/steida/este-library.git",
"normalize-css": "~2.1.3"
@steida
steida / gist:8747391
Created February 1, 2014 03:08
React component wrapped for DI container using domain model instead of props.
/** @jsx React.DOM */
goog.provide('app.foo.react.FooSubscribe');
goog.require('este.thirdParty.react');
/**
* Injected via DI container.
* @param {app.visitor.Model} visitor
* @constructor
name: "Alprazolam"
drug_class: "benzodiazepine"
controlled_substance: "CIV"
available_as_generic: "yes (all formulations)"
available_as_brand: "yes"
brand_names: [
"Xanax (tablet, XR tablet)"
"Niravam (orally disintegrating tablet)"
]
medical_food_products: [
container.configure
resolve: app.Scroller
with:
drugHeader: document.querySelector '.drug > header'
somethingElse: document.querySelector '.something > .else'
@steida
steida / gist:9337512
Created March 4, 2014 00:12
React.js with dependency injection based on types. Snippet from Este.js (not released yet).
/** @jsx React.DOM */
goog.provide('app.drugs.react.DrugAutoComplete');
goog.require('este.thirdParty.react');
goog.require('goog.ui.ac.AutoComplete');
/**
* @param {app.Routes} routes
* @constructor
// ==ClosureCompiler==
// @compilation_level ADVANCED_OPTIMIZATIONS
// @warning_level VERBOSE
// @output_file_name default.js
// ==/ClosureCompiler==
// ADD YOUR CODE HERE
var app = {
helllllo: function (name) {
alert('Hello, ' + name);
var getAllTextNodes = function(node) {
var all = [];
for (node = node.firstChild; node; node = node.nextSibling){
if (node.nodeType == 3)
all.push(node);
else
all = all.concat(getAllTextNodes(node));
}
return all;
};
(function() {
var run = function() {
// loadjscssfile("http://iodine-app.herokuapp.com/med-terms/externs/tooltip/bootstrap.min.css", "css");
// loadjscssfile("http://iodine-app.herokuapp.com/med-terms/bookmarklet.css", "css");
// createToolbar();
// loadDictionary(onDictionaryLoad);
var textNodes = [];
console.time('Translating');
getAllTextNodes(document.body, textNodes);
<div className="drug-basics">
<h2>
<span className="drug-name">
{this.props.selectedDrug.name}
</span>
<span className="drug-name-generic">
{this.props.selectedDrug.name_generic.toLowerCase()}
</span>
</h2>
<h3>
@steida
steida / gist:39e19c53179327e943d6
Created June 16, 2014 22:16
8. Do programmers have quiet working conditions? - From famous Joel article: http://www.joelonsoftware.com/articles/fog0000000043.html
8. Do programmers have quiet working conditions?
There are extensively documented productivity gains provided by giving knowledge workers space, quiet, and privacy. The classic software management book Peopleware documents these productivity benefits extensively.
Here's the trouble. We all know that knowledge workers work best by getting into "flow", also known as being "in the zone", where they are fully concentrated on their work and fully tuned out of their environment. They lose track of time and produce great stuff through absolute concentration. This is when they get all of their productive work done. Writers, programmers, scientists, and even basketball players will tell you about being in the zone.
The trouble is, getting into "the zone" is not easy. When you try to measure it, it looks like it takes an average of 15 minutes to start working at maximum productivity. Sometimes, if you're tired or have already done a lot of creative work that day, you just can't get into the zone and you spend the res