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
const Component = React.createClass({ | |
propTypes: { | |
file: requireThisOr('files', React.PropTypes.instanceOf(File).isRequired), | |
files: requireThisOr('file', React.PropTypes.arrayOf(React.PropTypes.instanceOf(File)).isRequired) | |
} | |
}) |
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
'use strict'; | |
/* | |
* Express server using ES6 generators | |
* Use node 0.11 | |
* run with node --harmony express-server-generator.js | |
*/ | |
var Q = require('q'), | |
HTTP = require('q-io/http'), | |
express = require('express'), | |
http = require('http'); |
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
class BaseVideoListView extends Backbone.View | |
initialize: (opts) -> | |
@collection.selectedCount.assign @subNav.find('.selected_count'), 'text' | |
@collection.selectedCount.onValue (val) => | |
@subNav.find('.library-nav').toggleClass 'singular-selection', val == 1 | |
this.$el.toggleClass 'multiple-selection', val > 1 | |
@collection.hasSelected.assign @subNav.find('.visible-selected'), 'toggle' | |
@collection.hasSelected.not().assign @subNav.find('.hidden-selected'), 'toggle' |
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
function calculate (objects) { | |
return _.chain(objects) | |
.map(function(p) { return [p.vat, p.price]; }) | |
.reduce(function(memo, pair) { | |
var o = {}; | |
o[pair[0]] = (memo[pair[0]] || 0) + pair[1]; | |
return _.extend({}, memo, o); | |
}, {}).value(); | |
}; |
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
id=$(docker ps | grep myimage:latest | awk '{ print $1 }') | |
docker pull quay.io/nnarhinen/myimage | |
new_id=$(docker run -d -p 3000 \ | |
-e ENVIRONMENT=PRODUCTION quay.io/nnarhinen/myimage) | |
id=$new_id ./update-nginx-port.bash | |
docker stop $id |
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 fs = require('fs'), | |
fooTemplate = fs.readFileSync(__dirname + '/templates/foo-template.html'), | |
_ = require('underscore'), | |
app = require('../app'); | |
var FooView = module.exports = function FooView(model) { | |
var self = this; | |
self.model = model; | |
self.element = $(fooTemplate); |
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
grunt.initConfig({ | |
///blabla | |
browserify: { | |
basic: { | |
src: ['<%= yeoman.app %>/scripts/main.js'], | |
options: { | |
transform: ['brfs'] | |
}, | |
dest: '.tmp/scripts/application.js' | |
} |
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
<p>Observable plain javascript objects with jQuery (rendered with transparency.js)</p> | |
<ul class="items"> | |
<li class="title"></li> | |
</ul> | |
<p>Wait for a few seconds and watch the last item in list</p> |
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
description "Foo application Node.js service" | |
author "Niklas Närhinen" | |
setuid foo | |
start on (local-filesystems and net-device-up) | |
stop on shutdown | |
respawn | |
respawn limit 5 60 |
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
#!/bin/bash | |
#find out scanner model with scanimage -L | |
scanimage -d hp3900:libusb:003:005 --resolution=600 --mode=Gray > raw.pnm | |
#gamma correction (fiddle around with the value suitable for your printer) | |
convert raw.pnm -gamma 0.5 out.pnm | |
#convert to pdf | |
gm convert out.pnm out.pdf |