Below is a quick start guide to developing node.js on OSX. These tools and settings will give you just about everything you would need on a clean install of OSX 10.10.X to get setup and coding.
This file contains hidden or 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'; | |
var m = require('mithril'); | |
var t = require('client/utils/translate'); | |
var vagueTime = require('vague-time'); | |
var l16n = require('client/utils/l16n'); | |
function assignValue(obj, objAttr) { | |
return function (event) { |
npm run scripts to handle the following:
- LESS for CSS pre-processor
- browserify for npm dependencies
- watchify for fast incremental bundling
- LiveReload browser refresh on bundle change
- LiveReload CSS injection on
*.less
change - budo to serve port 9966 and bring together some of the above tasks
- babelify for ES6 -> ES5
- errorify to show syntax errors in the browser during development
This file contains hidden or 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
Widget = { | |
controller: function () { | |
this.css = Widget.stylesheet().classes | |
}, | |
view: function (ctrl) { | |
return m('.widget', [ | |
m('h3', { class: ctrl.css.head }), | |
m('div', { class: ctrl.css.body }) | |
]) | |
}, |
This file contains hidden or 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'; | |
var m = require('mithril'); | |
var extend = require('lodash').extend; | |
var setFocus = require('../util/viewhelper').setFocus; | |
var keymage = require('keymage'); | |
function noop(){} | |
function addClass(el, className) { |
This file contains hidden or 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
// Mithril utilities | |
// Multi allows you to execute multiple functions as one. | |
// Especially useful when you want to bind several event handlers | |
// or run several config functions, for example binding a DOM plugin | |
// & assigning routing to a link. | |
// | |
// m( 'a.select2', { | |
// config : multi( m.route, select2plugin ) | |
// }, [] ); |
Just saw Douglas Crockfords talk at Craft Conference
http://www.ustream.tv/recorded/46640057
Just tried it and must say, it has a certain beauty in it.
No tangeling with prototypes and this/that fuckup.
var Animal = function(name, legs) {
This file contains hidden or 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'); | |
var lame = require('lame'); | |
var Speaker = require('speaker'); | |
fs.createReadStream(process.argv[2]) | |
.pipe(new lame.Decoder()) | |
.on('format', function (format) { | |
this.pipe(new Speaker(format)); | |
}); |
This file contains hidden or 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
# in config/env.yml | |
defaults: &defaults | |
ENV_YAML: true | |
development: | |
<<: *defaults | |
test: | |
<<: *defaults |
If you are using gs for managing your gem sets and you are also using any tool that relies on Ghostscript for converting PDF files to other formats (e.g. GraphicsMagick, docsplit, etc.), you may find that one of the two will fail due to a conflict between the two gs
commands.
There are two possible solutions to this problem:
- rename the gs command to something else (e.g.
gset
,gs_
, etc), and leave Ghostscript'sgs
as the onlygs
command in your system. - edit GraphicMagick's delegates file and specify the full path to the
gs
command. This file is located in thelib/GraphicsMagick/config
directory of your GraphicsMagick's installation. If GraphicsMagick was installed via homebrew, you can find the full path to this file by runningbrew list graphicsmagick | grep delegates
.
NewerOlder