id stringlengths 34 124 | type stringclasses 4
values | prompt stringlengths 0 4.95k | response stringlengths 21 4.89k | source_lang stringclasses 3
values | target_lang stringclasses 2
values | repo stringclasses 75
values | path stringlengths 10 88 | license stringclasses 1
value | commit stringlengths 40 40 | stars int64 431 18.7k | source_url stringlengths 86 176 | line_start int64 1 214 | line_end int64 3 253 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jianliaoim/talk-os:talk-web/client/app/contact-name.coffee:2:completion | completion | if @props.showAvatar
avatarStyle = if @props.contact.get('avatarUrl').length then { backgroundImage: "url(#{ @props.contact.get('avatarUrl') })" } else {}
span className: 'is-leading avatar img-circle img-24', style: avatarStyle
renderStates: ->
isGuest = @props.contact.get('isGuest')
isMe = @pro... | renderMention: ->
# special in mention
@props.children
renderSelect: ->
if @props.active
Icon name: 'tick', size: 18, className: 'flex-static'
render: ->
className = cx 'banner', 'contact-name', 'item', 'line',
'hover': @props.hover
'is-quit': @props.isQuit
div onClick: @onC... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/contact-name.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/contact-name.coffee | 70 | 116 |
jianliaoim/talk-os:talk-api2x/server/middlewares/auth.coffee:1:raw_corpus | raw_corpus | Err = require 'err1st'
async = require 'async'
Promise = require 'bluebird'
request = require 'request'
serviceLoader = require 'talk-services'
logger = require 'graceful-logger'
config = require 'config'
redis = require '../components/redis'
limbo = require 'limbo'
{
UserModel
TeamModel
} = limbo.use 'talk'
_aut... | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/middlewares/auth.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/middlewares/auth.coffee | 1 | 50 | ||
jianliaoim/talk-os:talk-api2x/server/middlewares/auth.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
Err = require 'err1st'
async = require 'async'
Promise = require 'bluebird'
request = require 'request'
serviceLoader = require 'talk-services'
logger = require 'graceful-logger'
config = require 'config'
redis = require '../components/redis'
limbo = require 'li... | var Err, Promise, TeamModel, UserModel, _authAccount, _authService, async, auth, config, limbo, logger, redis, request, serviceLoader;
Err = require('err1st');
async = require('async');
Promise = require('bluebird');
request = require('request');
serviceLoader = require('talk-services');
logger = require('gracefu... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-api2x/server/middlewares/auth.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/middlewares/auth.coffee | 1 | 50 |
jianliaoim/talk-os:talk-api2x/server/middlewares/auth.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Err, Promise, TeamModel, UserModel, _authAccount, _authService, async, auth, config, limbo, logger, redis, request, serviceLoader;
Err = require('err1st');
async = require('async');
Promise = require('bluebird');
request = require('request');
serviceLoader... | Err = require 'err1st'
async = require 'async'
Promise = require 'bluebird'
request = require 'request'
serviceLoader = require 'talk-services'
logger = require 'graceful-logger'
config = require 'config'
redis = require '../components/redis'
limbo = require 'limbo'
{
UserModel
TeamModel
} = limbo.use 'talk'
_aut... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/middlewares/auth.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/middlewares/auth.coffee | 1 | 50 |
jianliaoim/talk-os:talk-api2x/server/middlewares/auth.coffee:1:completion | completion | Err = require 'err1st'
async = require 'async'
Promise = require 'bluebird'
request = require 'request'
serviceLoader = require 'talk-services'
logger = require 'graceful-logger'
config = require 'config'
redis = require '../components/redis'
limbo = require 'limbo'
{
UserModel
TeamModel
} = limbo.use 'talk'
_aut... | _authAccount = (req, res, callback) ->
{accountToken} = req.get()
cacheKey = "talkaid:#{accountToken}"
cacheExpires = 86400
$user = redis.getAsync cacheKey
.then (data) ->
try
user = JSON.parse data
catch err
user = {}
return user if user?._id
UserModel.initByAccountTokenAsync ac... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/middlewares/auth.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/middlewares/auth.coffee | 1 | 50 |
jianliaoim/talk-os:talk-api2x/server/middlewares/auth.coffee:2:raw_corpus | raw_corpus | _auth = (req, res, callback = ->) ->
{appToken} = req.get()
if appToken?
# Authorization of service application
return _authService req, res, callback
if (req.headers?.authorization and req.headers.authorization.indexOf('aid ') is 0)
# Transform authorization to accountToken
[key, to... | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/middlewares/auth.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/middlewares/auth.coffee | 51 | 70 | ||
jianliaoim/talk-os:talk-api2x/server/middlewares/auth.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_auth = (req, res, callback = ->) ->
{appToken} = req.get()
if appToken?
# Authorization of service application
return _authService req, res, callback
if (req.headers?.authorization and req.headers.authorization.indexOf('aid ') is 0)
... | var _auth;
_auth = function(req, res, callback = function() {}) {
var appToken, key, ref, ref1, token;
({appToken} = req.get());
if (appToken != null) {
// Authorization of service application
return _authService(req, res, callback);
}
if (((ref = req.headers) != null ? ref.authorization : void 0) &&... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-api2x/server/middlewares/auth.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/middlewares/auth.coffee | 51 | 70 |
jianliaoim/talk-os:talk-api2x/server/middlewares/auth.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var _auth;
_auth = function(req, res, callback = function() {}) {
var appToken, key, ref, ref1, token;
({appToken} = req.get());
if (appToken != null) {
// Authorization of service application
return _authService(req, res, callback);
}
if (((ref ... | _auth = (req, res, callback = ->) ->
{appToken} = req.get()
if appToken?
# Authorization of service application
return _authService req, res, callback
if (req.headers?.authorization and req.headers.authorization.indexOf('aid ') is 0)
# Transform authorization to accountToken
[key, to... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/middlewares/auth.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/middlewares/auth.coffee | 51 | 70 |
jianliaoim/talk-os:talk-api2x/server/middlewares/auth.coffee:2:completion | completion | _auth = (req, res, callback = ->) ->
{appToken} = req.get()
if appToken?
# Authorization of service application
return _authService req, res, callback
if (req.headers?.authorization and req.headers.authorization.indexOf('aid ') is 0)
# Transform authorization to accountToken
[key, to... | # Authorization of talk account
return _authAccount req, res, callback
# Login with access token for the third part websites
if req.session?._sessionUserId
callback()
else
callback(new Err('NOT_LOGIN'))
return _auth
module.exports = auth | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/middlewares/auth.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/middlewares/auth.coffee | 51 | 70 |
octoblu/meshblu:lib/LimitusThrottle.coffee:1:raw_corpus | raw_corpus | debug = require('debug')('meshblu:LimitusThrottle')
Limitus = require 'limitus'
limiter = new Limitus()
WINDOW_RATE = 1000
class LimitusThrottle
constructor: (@name, rate) ->
debug 'constructor', @name, rate
limiter.rule @name, max: rate, interval: WINDOW_RATE, mode: 'interval'
rateLimit: (id="", callback... | CoffeeScript | octoblu/meshblu | lib/LimitusThrottle.coffee | MIT | 3062961ddc051199277be35d6164d656b8329d6a | 815 | https://github.com/octoblu/meshblu/blob/3062961ddc051199277be35d6164d656b8329d6a/lib/LimitusThrottle.coffee | 1 | 15 | ||
octoblu/meshblu:lib/LimitusThrottle.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
debug = require('debug')('meshblu:LimitusThrottle')
Limitus = require 'limitus'
limiter = new Limitus()
WINDOW_RATE = 1000
class LimitusThrottle
constructor: (@name, rate) ->
debug 'constructor', @name, rate
limiter.rule @name, max: rate, interval: WIN... | var Limitus, LimitusThrottle, WINDOW_RATE, debug, limiter;
debug = require('debug')('meshblu:LimitusThrottle');
Limitus = require('limitus');
limiter = new Limitus();
WINDOW_RATE = 1000;
LimitusThrottle = class LimitusThrottle {
constructor(name, rate) {
this.rateLimit = this.rateLimit.bind(this);
this.n... | CoffeeScript | JavaScript | octoblu/meshblu | lib/LimitusThrottle.coffee | MIT | 3062961ddc051199277be35d6164d656b8329d6a | 815 | https://github.com/octoblu/meshblu/blob/3062961ddc051199277be35d6164d656b8329d6a/lib/LimitusThrottle.coffee | 1 | 15 |
octoblu/meshblu:lib/LimitusThrottle.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Limitus, LimitusThrottle, WINDOW_RATE, debug, limiter;
debug = require('debug')('meshblu:LimitusThrottle');
Limitus = require('limitus');
limiter = new Limitus();
WINDOW_RATE = 1000;
LimitusThrottle = class LimitusThrottle {
constructor(name, rate) {
... | debug = require('debug')('meshblu:LimitusThrottle')
Limitus = require 'limitus'
limiter = new Limitus()
WINDOW_RATE = 1000
class LimitusThrottle
constructor: (@name, rate) ->
debug 'constructor', @name, rate
limiter.rule @name, max: rate, interval: WINDOW_RATE, mode: 'interval'
rateLimit: (id="", callback... | JavaScript | CoffeeScript | octoblu/meshblu | lib/LimitusThrottle.coffee | MIT | 3062961ddc051199277be35d6164d656b8329d6a | 815 | https://github.com/octoblu/meshblu/blob/3062961ddc051199277be35d6164d656b8329d6a/lib/LimitusThrottle.coffee | 1 | 15 |
octoblu/meshblu:lib/LimitusThrottle.coffee:1:completion | completion | debug = require('debug')('meshblu:LimitusThrottle')
Limitus = require 'limitus'
limiter = new Limitus()
WINDOW_RATE = 1000
class LimitusThrottle
constructor: (@name, rate) -> | debug 'constructor', @name, rate
limiter.rule @name, max: rate, interval: WINDOW_RATE, mode: 'interval'
rateLimit: (id="", callback=->) =>
debug 'rateLimit', @name, id
limiter.drop @name, id, callback
module.exports = LimitusThrottle | CoffeeScript | CoffeeScript | octoblu/meshblu | lib/LimitusThrottle.coffee | MIT | 3062961ddc051199277be35d6164d656b8329d6a | 815 | https://github.com/octoblu/meshblu/blob/3062961ddc051199277be35d6164d656b8329d6a/lib/LimitusThrottle.coffee | 1 | 15 |
jnordberg/wintersmith:src/parser.coffee:1:raw_corpus | raw_corpus | {Highlight} = require 'highlight'
marked = require 'marked';
async = require 'async'
path = require 'path'
is_relative = (url) ->
### returns true if *url* is relative; otherwise false ###
!/(^\w+:)|(^\/)/.test url
parseMetadata = (metadata, callback) ->
### takes *metadata* in the format:
key: value
... | CoffeeScript | jnordberg/wintersmith | src/parser.coffee | MIT | e667052259e523500a81ff104ea46f132acb1e04 | 3,484 | https://github.com/jnordberg/wintersmith/blob/e667052259e523500a81ff104ea46f132acb1e04/src/parser.coffee | 1 | 50 | ||
jnordberg/wintersmith:src/parser.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
{Highlight} = require 'highlight'
marked = require 'marked';
async = require 'async'
path = require 'path'
is_relative = (url) ->
### returns true if *url* is relative; otherwise false ###
!/(^\w+:)|(^\/)/.test url
parseMetadata = (metadata, callback) ->
... | var Highlight, async, is_relative, marked, parseMarkdownSync, parseMetadata, path;
({Highlight} = require('highlight'));
marked = require('marked');
async = require('async');
path = require('path');
is_relative = function(url) {
return !/(^\w+:)|(^\/)/.test(url);
};
parseMetadata = function(metadata, callback) ... | CoffeeScript | JavaScript | jnordberg/wintersmith | src/parser.coffee | MIT | e667052259e523500a81ff104ea46f132acb1e04 | 3,484 | https://github.com/jnordberg/wintersmith/blob/e667052259e523500a81ff104ea46f132acb1e04/src/parser.coffee | 1 | 50 |
jnordberg/wintersmith:src/parser.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Highlight, async, is_relative, marked, parseMarkdownSync, parseMetadata, path;
({Highlight} = require('highlight'));
marked = require('marked');
async = require('async');
path = require('path');
is_relative = function(url) {
return !/(^\w+:)|(^\/)/.test(... | {Highlight} = require 'highlight'
marked = require 'marked';
async = require 'async'
path = require 'path'
is_relative = (url) ->
### returns true if *url* is relative; otherwise false ###
!/(^\w+:)|(^\/)/.test url
parseMetadata = (metadata, callback) ->
### takes *metadata* in the format:
key: value
... | JavaScript | CoffeeScript | jnordberg/wintersmith | src/parser.coffee | MIT | e667052259e523500a81ff104ea46f132acb1e04 | 3,484 | https://github.com/jnordberg/wintersmith/blob/e667052259e523500a81ff104ea46f132acb1e04/src/parser.coffee | 1 | 50 |
jnordberg/wintersmith:src/parser.coffee:1:completion | completion | {Highlight} = require 'highlight'
marked = require 'marked';
async = require 'async'
path = require 'path'
is_relative = (url) ->
### returns true if *url* is relative; otherwise false ###
!/(^\w+:)|(^\/)/.test url
parseMetadata = (metadata, callback) ->
### takes *metadata* in the format:
key: value
... | callback null, rv
catch error
callback error
parseMarkdownSync = (content, baseUrl) ->
### takes markdown *content* and returns html using *baseURL* for any relative urls
returns html ###
marked.inlineLexer.formatUrl = (url) ->
if is_relative url
return path.join baseUrl, url
else
... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/parser.coffee | MIT | e667052259e523500a81ff104ea46f132acb1e04 | 3,484 | https://github.com/jnordberg/wintersmith/blob/e667052259e523500a81ff104ea46f132acb1e04/src/parser.coffee | 1 | 50 |
jnordberg/wintersmith:src/parser.coffee:2:raw_corpus | raw_corpus | module.exports = (content, callback) ->
# split metadata and markdown content
split_idx = content.indexOf '\n\n' # should probably make this a bit more robust
async.parallel
metadata: (callback) ->
parseMetadata content.slice(0, split_idx), callback
markdown: (callback) ->
callback null, cont... | CoffeeScript | jnordberg/wintersmith | src/parser.coffee | MIT | e667052259e523500a81ff104ea46f132acb1e04 | 3,484 | https://github.com/jnordberg/wintersmith/blob/e667052259e523500a81ff104ea46f132acb1e04/src/parser.coffee | 51 | 63 | ||
jnordberg/wintersmith:src/parser.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = (content, callback) ->
# split metadata and markdown content
split_idx = content.indexOf '\n\n' # should probably make this a bit more robust
async.parallel
metadata: (callback) ->
parseMetadata content.slice(0, split_idx), callb... | module.exports = function(content, callback) {
var split_idx;
// split metadata and markdown content
split_idx = content.indexOf('\n\n'); // should probably make this a bit more robust
return async.parallel({
metadata: function(callback) {
return parseMetadata(content.slice(0, split_idx), callback);
... | CoffeeScript | JavaScript | jnordberg/wintersmith | src/parser.coffee | MIT | e667052259e523500a81ff104ea46f132acb1e04 | 3,484 | https://github.com/jnordberg/wintersmith/blob/e667052259e523500a81ff104ea46f132acb1e04/src/parser.coffee | 51 | 63 |
jnordberg/wintersmith:src/parser.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = function(content, callback) {
var split_idx;
// split metadata and markdown content
split_idx = content.indexOf('\n\n'); // should probably make this a bit more robust
return async.parallel({
metadata: function(callback) {
return ... | module.exports = (content, callback) ->
# split metadata and markdown content
split_idx = content.indexOf '\n\n' # should probably make this a bit more robust
async.parallel
metadata: (callback) ->
parseMetadata content.slice(0, split_idx), callback
markdown: (callback) ->
callback null, cont... | JavaScript | CoffeeScript | jnordberg/wintersmith | src/parser.coffee | MIT | e667052259e523500a81ff104ea46f132acb1e04 | 3,484 | https://github.com/jnordberg/wintersmith/blob/e667052259e523500a81ff104ea46f132acb1e04/src/parser.coffee | 51 | 63 |
jnordberg/wintersmith:src/parser.coffee:2:completion | completion | module.exports = (content, callback) ->
# split metadata and markdown content
split_idx = content.indexOf '\n\n' # should probably make this a bit more robust
async.parallel
metadata: (callback) -> | parseMetadata content.slice(0, split_idx), callback
markdown: (callback) ->
callback null, content.slice(split_idx + 2)
, callback
module.exports.parseMarkdownSync = parseMarkdownSync | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/parser.coffee | MIT | e667052259e523500a81ff104ea46f132acb1e04 | 3,484 | https://github.com/jnordberg/wintersmith/blob/e667052259e523500a81ff104ea46f132acb1e04/src/parser.coffee | 51 | 63 |
jianliaoim/talk-os:talk-web/client/app/filter-tag.coffee:1:raw_corpus | raw_corpus | module.exports = React.createClass
displayName: 'filter-tag'
mixins: [PureRenderMixin]
propTypes:
_teamId: T.string.isRequired
onChange: T.func.isRequired
_tagId: T.string
hasTag: T.bool
getInitialState: ->
query: ''
showMenu: false
index: 0
componentDidMount: ->
@setState i... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/filter-tag.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/filter-tag.coffee | 23 | 72 | ||
jianliaoim/talk-os:talk-web/client/app/filter-tag.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = React.createClass
displayName: 'filter-tag'
mixins: [PureRenderMixin]
propTypes:
_teamId: T.string.isRequired
onChange: T.func.isRequired
_tagId: T.string
hasTag: T.bool
getInitialState: ->
query: ''
showMenu: fa... | module.exports = React.createClass({
displayName: 'filter-tag',
mixins: [PureRenderMixin],
propTypes: {
_teamId: T.string.isRequired,
onChange: T.func.isRequired,
_tagId: T.string,
hasTag: T.bool
},
getInitialState: function() {
return {
query: '',
showMenu: false,
index:... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/app/filter-tag.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/filter-tag.coffee | 23 | 72 |
jianliaoim/talk-os:talk-web/client/app/filter-tag.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
module.exports = React.createClass({
displayName: 'filter-tag',
mixins: [PureRenderMixin],
propTypes: {
_teamId: T.string.isRequired,
onChange: T.func.isRequired,
_tagId: T.string,
hasTag: T.bool
},
getInitialState: function() {
return... | module.exports = React.createClass
displayName: 'filter-tag'
mixins: [PureRenderMixin]
propTypes:
_teamId: T.string.isRequired
onChange: T.func.isRequired
_tagId: T.string
hasTag: T.bool
getInitialState: ->
query: ''
showMenu: false
index: 0
componentDidMount: ->
@setState i... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/filter-tag.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/filter-tag.coffee | 23 | 72 |
jianliaoim/talk-os:talk-web/client/app/filter-tag.coffee:1:completion | completion | module.exports = React.createClass
displayName: 'filter-tag'
mixins: [PureRenderMixin]
propTypes:
_teamId: T.string.isRequired
onChange: T.func.isRequired
_tagId: T.string
hasTag: T.bool
getInitialState: ->
query: ''
showMenu: false
index: 0
componentDidMount: ->
@setState i... | (@filterTags().findIndex (tag) => tag.get('_id') is @props._tagId) + 2
else if @props.hasTag
1
else 0
filterTags: ->
tags = query.tagsBy(recorder.getState(), @props._teamId) or Immutable.List()
tags = search.forTags tags, @state.query
getListLength: ->
length = @filterTags().size
if ... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/filter-tag.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/filter-tag.coffee | 23 | 72 |
jianliaoim/talk-os:talk-web/client/app/filter-tag.coffee:2:raw_corpus | raw_corpus | @setState index: @state.index + 1
selectCurrent: ->
tags = @filterTags()
if (@state.query.length is 0)
switch @state.index
when 0
@props.onChange undefined, false
when 1
@props.onChange undefined, true
else
current = @state.index - 2
tag =... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/filter-tag.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/filter-tag.coffee | 73 | 122 | ||
jianliaoim/talk-os:talk-web/client/app/filter-tag.coffee:2:completion | completion | @setState index: @state.index + 1
selectCurrent: ->
tags = @filterTags()
if (@state.query.length is 0)
switch @state.index
when 0
@props.onChange undefined, false
when 1
@props.onChange undefined, true
else
current = @state.index - 2
tag =... | scrollEl = @refs.scroll
totalHeight = scrollEl.clientHeight
top = scrollEl.scrollTop
current = @state.index
startY = current * each
if (@state.query.length > 0) and (current >= 2)
startY += hrHeight
if ((startY - top) < 0) or ((startY + each) - top > totalHeight)
y = startY - tot... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/filter-tag.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/filter-tag.coffee | 73 | 122 |
jianliaoim/talk-os:talk-web/client/app/filter-tag.coffee:3:raw_corpus | raw_corpus | if @state.query.length > 0
@setState index: index
else
@setState index: index + 2
onAllClick: ->
@props.onChange undefined, false
@setState index: 0
onAllTagClick: ->
@props.onChange undefined, true
@setState index: 1
onMenuToggle: ->
index = @getDefaultIndex()
@setState... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/filter-tag.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/filter-tag.coffee | 123 | 172 | ||
jianliaoim/talk-os:talk-web/client/app/filter-tag.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if @state.query.length > 0
@setState index: index
else
@setState index: index + 2
onAllClick: ->
@props.onChange undefined, false
@setState index: 0
onAllTagClick: ->
@props.onChange undefined, true
@setState index: 1
onMe... | if (this.state.query.length > 0) {
this.setState({
index: index
});
} else {
this.setState({
index: index + 2
});
}
({
onAllClick: function() {
this.props.onChange(void 0, false);
return this.setState({
index: 0
});
},
onAllTagClick: function() {
this.props.onChange(void 0, ... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/app/filter-tag.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/filter-tag.coffee | 123 | 172 |
jianliaoim/talk-os:talk-web/client/app/filter-tag.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
if (this.state.query.length > 0) {
this.setState({
index: index
});
} else {
this.setState({
index: index + 2
});
}
({
onAllClick: function() {
this.props.onChange(void 0, false);
return this.setState({
index: 0
});
},
onAll... | if @state.query.length > 0
@setState index: index
else
@setState index: index + 2
onAllClick: ->
@props.onChange undefined, false
@setState index: 0
onAllTagClick: ->
@props.onChange undefined, true
@setState index: 1
onMenuToggle: ->
index = @getDefaultIndex()
@setState... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/filter-tag.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/filter-tag.coffee | 123 | 172 |
jianliaoim/talk-os:talk-web/client/app/filter-tag.coffee:3:completion | completion | if @state.query.length > 0
@setState index: index
else
@setState index: index + 2
onAllClick: ->
@props.onChange undefined, false
@setState index: 0
onAllTagClick: ->
@props.onChange undefined, true
@setState index: 1
onMenuToggle: ->
index = @getDefaultIndex()
@setState... | renderTags: ->
tags = @filterTags()
if @state.query.length is 0
current = @state.index - 2
else
current = @state.index
tags.map (tag, index) =>
onClick = => @onItemClick tag, index
className = classnames 'item',
'is-active': (index is current)
div key: tag.get('_id... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/filter-tag.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/filter-tag.coffee | 123 | 172 |
jianliaoim/talk-os:talk-web/client/app/filter-tag.coffee:4:raw_corpus | raw_corpus | 'is-active': (@state.query.length is 0) and (@state.index is 1)
LightDropdown
displayText: tag?.get('name') or undefined
defaultText: defaultText
name: 'filter-tag'
show: @state.showMenu
onToggle: @onMenuToggle
input
className: 'query', value: @state.query, autoFocus: tr... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/filter-tag.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/filter-tag.coffee | 173 | 191 | ||
jianliaoim/talk-os:talk-web/client/app/filter-tag.coffee:4:completion | completion | 'is-active': (@state.query.length is 0) and (@state.index is 1)
LightDropdown
displayText: tag?.get('name') or undefined
defaultText: defaultText
name: 'filter-tag'
show: @state.showMenu
onToggle: @onMenuToggle
input | className: 'query', value: @state.query, autoFocus: true, type: 'text'
onChange: @onQueryChange, onClick: @onInputClick, onKeyDown: @onKeyDown
div ref: 'scroll', className: 'results scroll thin-scroll',
if @state.query.length is 0
div null,
div className: itemAllClass, onClic... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/filter-tag.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/filter-tag.coffee | 173 | 191 |
jnordberg/wintersmith:src/cli/new.coffee:1:raw_corpus | raw_corpus | loadTemplates = (directory) ->
return unless fileExistsSync directory
fs.readdirSync(directory)
.map((filename) -> path.join(directory, filename))
.filter((filename) -> fs.statSync(filename).isDirectory())
.forEach((filename) -> templates[path.basename(filename)] = filename)
loadTemplates path.join __d... | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | be757f5f7d72ddce462f67913c9cd7c578162018 | 3,484 | https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/new.coffee | 12 | 49 | ||
jnordberg/wintersmith:src/cli/new.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
loadTemplates = (directory) ->
return unless fileExistsSync directory
fs.readdirSync(directory)
.map((filename) -> path.join(directory, filename))
.filter((filename) -> fs.statSync(filename).isDirectory())
.forEach((filename) -> templates[path.bas... | var loadTemplates, options, usage;
loadTemplates = function(directory) {
if (!fileExistsSync(directory)) {
return;
}
return fs.readdirSync(directory).map(function(filename) {
return path.join(directory, filename);
}).filter(function(filename) {
return fs.statSync(filename).isDirectory();
}).forEa... | CoffeeScript | JavaScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | be757f5f7d72ddce462f67913c9cd7c578162018 | 3,484 | https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/new.coffee | 12 | 49 |
jnordberg/wintersmith:src/cli/new.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var loadTemplates, options, usage;
loadTemplates = function(directory) {
if (!fileExistsSync(directory)) {
return;
}
return fs.readdirSync(directory).map(function(filename) {
return path.join(directory, filename);
}).filter(function(filename) {
... | loadTemplates = (directory) ->
return unless fileExistsSync directory
fs.readdirSync(directory)
.map((filename) -> path.join(directory, filename))
.filter((filename) -> fs.statSync(filename).isDirectory())
.forEach((filename) -> templates[path.basename(filename)] = filename)
loadTemplates path.join __d... | JavaScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | be757f5f7d72ddce462f67913c9cd7c578162018 | 3,484 | https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/new.coffee | 12 | 49 |
jnordberg/wintersmith:src/cli/new.coffee:1:completion | completion | loadTemplates = (directory) ->
return unless fileExistsSync directory
fs.readdirSync(directory)
.map((filename) -> path.join(directory, filename))
.filter((filename) -> fs.statSync(filename).isDirectory())
.forEach((filename) -> templates[path.basename(filename)] = filename)
loadTemplates path.join __d... | -T, --template <name> template to create new site from (defaults to 'blog')
available templates are: #{ Object.keys(templates).join(', ') }
example:
create a new site in your home directory
$ wintersmith new ~/my-blog
"""
options =
string: ['template']
boolean: ['force']
alias:
force: 'f'... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | be757f5f7d72ddce462f67913c9cd7c578162018 | 3,484 | https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/new.coffee | 12 | 49 |
jnordberg/wintersmith:src/cli/new.coffee:2:raw_corpus | raw_corpus | createSite = (argv) ->
### copy example directory to *location* ###
location = argv._[3]
if !location? or !location.length
logger.error 'you must specify a location'
return
if not templates[argv.template]?
logger.error "unknown template '#{ argv.template }'"
return
from = templates[argv.tem... | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | be757f5f7d72ddce462f67913c9cd7c578162018 | 3,484 | https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/new.coffee | 51 | 98 | ||
jnordberg/wintersmith:src/cli/new.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
createSite = (argv) ->
### copy example directory to *location* ###
location = argv._[3]
if !location? or !location.length
logger.error 'you must specify a location'
return
if not templates[argv.template]?
logger.error "unknown template '#{ ... | var createSite;
createSite = function(argv) {
/* copy example directory to *location* */
var copyTemplate, from, installDeps, location, to, validateDestination;
location = argv._[3];
if ((location == null) || !location.length) {
logger.error('you must specify a location');
return;
}
if (templates[a... | CoffeeScript | JavaScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | be757f5f7d72ddce462f67913c9cd7c578162018 | 3,484 | https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/new.coffee | 51 | 98 |
jnordberg/wintersmith:src/cli/new.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var createSite;
createSite = function(argv) {
/* copy example directory to *location* */
var copyTemplate, from, installDeps, location, to, validateDestination;
location = argv._[3];
if ((location == null) || !location.length) {
logger.error('you must ... | createSite = (argv) ->
### copy example directory to *location* ###
location = argv._[3]
if !location? or !location.length
logger.error 'you must specify a location'
return
if not templates[argv.template]?
logger.error "unknown template '#{ argv.template }'"
return
from = templates[argv.tem... | JavaScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | be757f5f7d72ddce462f67913c9cd7c578162018 | 3,484 | https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/new.coffee | 51 | 98 |
jnordberg/wintersmith:src/cli/new.coffee:2:completion | completion | createSite = (argv) ->
### copy example directory to *location* ###
location = argv._[3]
if !location? or !location.length
logger.error 'you must specify a location'
return
if not templates[argv.template]?
logger.error "unknown template '#{ argv.template }'"
return
from = templates[argv.tem... | copyTemplate = (callback) ->
logger.verbose "recursive copy #{ from } -> #{ to }"
ncp from, to, {}, callback
installDeps = (callback) ->
packagePath = path.join to, 'package.json'
fileExists packagePath, (exists) ->
if exists
logger.verbose "installing template dependencies"
pro... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | be757f5f7d72ddce462f67913c9cd7c578162018 | 3,484 | https://github.com/jnordberg/wintersmith/blob/be757f5f7d72ddce462f67913c9cd7c578162018/src/cli/new.coffee | 51 | 98 |
jnordberg/wintersmith:src/cli/new.coffee:1:raw_corpus | raw_corpus | loadTemplates = (directory) ->
return unless fileExistsSync directory
fs.readdirSync(directory)
.map((filename) -> path.join(directory, filename))
.filter((filename) -> fs.statSync(filename).isDirectory())
.forEach((filename) -> templates[path.basename(filename)] = filename)
loadTemplates path.join __d... | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 43a30af7dec1af73ac52ac625a34539e93475306 | 3,484 | https://github.com/jnordberg/wintersmith/blob/43a30af7dec1af73ac52ac625a34539e93475306/src/cli/new.coffee | 12 | 47 | ||
jnordberg/wintersmith:src/cli/new.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
loadTemplates = (directory) ->
return unless fileExistsSync directory
fs.readdirSync(directory)
.map((filename) -> path.join(directory, filename))
.filter((filename) -> fs.statSync(filename).isDirectory())
.forEach((filename) -> templates[path.bas... | var loadTemplates, options, usage;
loadTemplates = function(directory) {
if (!fileExistsSync(directory)) {
return;
}
return fs.readdirSync(directory).map(function(filename) {
return path.join(directory, filename);
}).filter(function(filename) {
return fs.statSync(filename).isDirectory();
}).forEa... | CoffeeScript | JavaScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 43a30af7dec1af73ac52ac625a34539e93475306 | 3,484 | https://github.com/jnordberg/wintersmith/blob/43a30af7dec1af73ac52ac625a34539e93475306/src/cli/new.coffee | 12 | 47 |
jnordberg/wintersmith:src/cli/new.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var loadTemplates, options, usage;
loadTemplates = function(directory) {
if (!fileExistsSync(directory)) {
return;
}
return fs.readdirSync(directory).map(function(filename) {
return path.join(directory, filename);
}).filter(function(filename) {
... | loadTemplates = (directory) ->
return unless fileExistsSync directory
fs.readdirSync(directory)
.map((filename) -> path.join(directory, filename))
.filter((filename) -> fs.statSync(filename).isDirectory())
.forEach((filename) -> templates[path.basename(filename)] = filename)
loadTemplates path.join __d... | JavaScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 43a30af7dec1af73ac52ac625a34539e93475306 | 3,484 | https://github.com/jnordberg/wintersmith/blob/43a30af7dec1af73ac52ac625a34539e93475306/src/cli/new.coffee | 12 | 47 |
jnordberg/wintersmith:src/cli/new.coffee:1:completion | completion | loadTemplates = (directory) ->
return unless fileExistsSync directory
fs.readdirSync(directory)
.map((filename) -> path.join(directory, filename))
.filter((filename) -> fs.statSync(filename).isDirectory())
.forEach((filename) -> templates[path.basename(filename)] = filename)
loadTemplates path.join __d... | -f, --force overwrite existing files
-T, --template <name> template to create new site from (defaults to 'blog')
available templates are: #{ Object.keys(templates).join(', ') }
example:
create a new site in your home directory
$ wintersmith new ~/my-blog
"""
options =
force:
a... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 43a30af7dec1af73ac52ac625a34539e93475306 | 3,484 | https://github.com/jnordberg/wintersmith/blob/43a30af7dec1af73ac52ac625a34539e93475306/src/cli/new.coffee | 12 | 47 |
jnordberg/wintersmith:src/cli/new.coffee:2:raw_corpus | raw_corpus | createSite = (argv) ->
### copy example directory to *location* ###
location = argv._[1]
if !location? or !location.length
logger.error 'you must specify a location'
return
if not templates[argv.template]?
logger.error "unknown template '#{ argv.template }'"
return
from = templates[argv.tem... | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 43a30af7dec1af73ac52ac625a34539e93475306 | 3,484 | https://github.com/jnordberg/wintersmith/blob/43a30af7dec1af73ac52ac625a34539e93475306/src/cli/new.coffee | 49 | 96 | ||
jnordberg/wintersmith:src/cli/new.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
createSite = (argv) ->
### copy example directory to *location* ###
location = argv._[1]
if !location? or !location.length
logger.error 'you must specify a location'
return
if not templates[argv.template]?
logger.error "unknown template '#{ ... | var createSite;
createSite = function(argv) {
/* copy example directory to *location* */
var copyTemplate, from, installDeps, location, to, validateDestination;
location = argv._[1];
if ((location == null) || !location.length) {
logger.error('you must specify a location');
return;
}
if (templates[a... | CoffeeScript | JavaScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 43a30af7dec1af73ac52ac625a34539e93475306 | 3,484 | https://github.com/jnordberg/wintersmith/blob/43a30af7dec1af73ac52ac625a34539e93475306/src/cli/new.coffee | 49 | 96 |
jnordberg/wintersmith:src/cli/new.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var createSite;
createSite = function(argv) {
/* copy example directory to *location* */
var copyTemplate, from, installDeps, location, to, validateDestination;
location = argv._[1];
if ((location == null) || !location.length) {
logger.error('you must ... | createSite = (argv) ->
### copy example directory to *location* ###
location = argv._[1]
if !location? or !location.length
logger.error 'you must specify a location'
return
if not templates[argv.template]?
logger.error "unknown template '#{ argv.template }'"
return
from = templates[argv.tem... | JavaScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 43a30af7dec1af73ac52ac625a34539e93475306 | 3,484 | https://github.com/jnordberg/wintersmith/blob/43a30af7dec1af73ac52ac625a34539e93475306/src/cli/new.coffee | 49 | 96 |
jnordberg/wintersmith:src/cli/new.coffee:2:completion | completion | createSite = (argv) ->
### copy example directory to *location* ###
location = argv._[1]
if !location? or !location.length
logger.error 'you must specify a location'
return
if not templates[argv.template]?
logger.error "unknown template '#{ argv.template }'"
return
from = templates[argv.tem... | copyTemplate = (callback) ->
logger.verbose "recursive copy #{ from } -> #{ to }"
ncp from, to, {}, callback
installDeps = (callback) ->
packagePath = path.join to, 'package.json'
fileExists packagePath, (exists) ->
if exists
logger.verbose "installing template dependencies"
pro... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 43a30af7dec1af73ac52ac625a34539e93475306 | 3,484 | https://github.com/jnordberg/wintersmith/blob/43a30af7dec1af73ac52ac625a34539e93475306/src/cli/new.coffee | 49 | 96 |
jnordberg/wintersmith:src/cli/new.coffee:2:raw_corpus | raw_corpus | createSite = (argv) ->
### copy example directory to *location* ###
location = argv._[1]
if !location? or !location.length
logger.error 'you must specify a location'
return
if not templates[argv.template]?
logger.error "unknown template '#{ argv.template }'"
return
from = templates[argv.tem... | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | efdf44305f526eb062123efd9b79ebbad8fffd26 | 3,484 | https://github.com/jnordberg/wintersmith/blob/efdf44305f526eb062123efd9b79ebbad8fffd26/src/cli/new.coffee | 49 | 95 | ||
jnordberg/wintersmith:src/cli/new.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
createSite = (argv) ->
### copy example directory to *location* ###
location = argv._[1]
if !location? or !location.length
logger.error 'you must specify a location'
return
if not templates[argv.template]?
logger.error "unknown template '#{ ... | var createSite;
createSite = function(argv) {
/* copy example directory to *location* */
var copyTemplate, from, installDeps, location, to, validateDestination;
location = argv._[1];
if ((location == null) || !location.length) {
logger.error('you must specify a location');
return;
}
if (templates[a... | CoffeeScript | JavaScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | efdf44305f526eb062123efd9b79ebbad8fffd26 | 3,484 | https://github.com/jnordberg/wintersmith/blob/efdf44305f526eb062123efd9b79ebbad8fffd26/src/cli/new.coffee | 49 | 95 |
jnordberg/wintersmith:src/cli/new.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var createSite;
createSite = function(argv) {
/* copy example directory to *location* */
var copyTemplate, from, installDeps, location, to, validateDestination;
location = argv._[1];
if ((location == null) || !location.length) {
logger.error('you must ... | createSite = (argv) ->
### copy example directory to *location* ###
location = argv._[1]
if !location? or !location.length
logger.error 'you must specify a location'
return
if not templates[argv.template]?
logger.error "unknown template '#{ argv.template }'"
return
from = templates[argv.tem... | JavaScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | efdf44305f526eb062123efd9b79ebbad8fffd26 | 3,484 | https://github.com/jnordberg/wintersmith/blob/efdf44305f526eb062123efd9b79ebbad8fffd26/src/cli/new.coffee | 49 | 95 |
jnordberg/wintersmith:src/cli/new.coffee:2:completion | completion | createSite = (argv) ->
### copy example directory to *location* ###
location = argv._[1]
if !location? or !location.length
logger.error 'you must specify a location'
return
if not templates[argv.template]?
logger.error "unknown template '#{ argv.template }'"
return
from = templates[argv.tem... | callback()
copyTemplate = (callback) ->
logger.verbose "recursive copy #{ from } -> #{ to }"
ncp from, to, {}, callback
installDeps = (callback) ->
packagePath = path.join to, 'package.json'
fileExists packagePath, (exists) ->
if exists
logger.verbose "installing template dependencie... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | efdf44305f526eb062123efd9b79ebbad8fffd26 | 3,484 | https://github.com/jnordberg/wintersmith/blob/efdf44305f526eb062123efd9b79ebbad8fffd26/src/cli/new.coffee | 49 | 95 |
jnordberg/wintersmith:src/cli/new.coffee:1:raw_corpus | raw_corpus | templateTypes = fs.readdirSync(templatesDir).filter (filename) ->
fs.statSync(path.join(templatesDir, filename)).isDirectory()
usage = """
usage: wintersmith new [options] <path>
creates a skeleton site in <path>
options:
-f, --force overwrite existing files
-T, --template <name> temp... | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 0a0cced94ce73210fec40832257d03b00f866207 | 3,484 | https://github.com/jnordberg/wintersmith/blob/0a0cced94ce73210fec40832257d03b00f866207/src/cli/new.coffee | 12 | 40 | ||
jnordberg/wintersmith:src/cli/new.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
templateTypes = fs.readdirSync(templatesDir).filter (filename) ->
fs.statSync(path.join(templatesDir, filename)).isDirectory()
usage = """
usage: wintersmith new [options] <path>
creates a skeleton site in <path>
options:
-f, --force ... | var options, templateTypes, usage;
templateTypes = fs.readdirSync(templatesDir).filter(function(filename) {
return fs.statSync(path.join(templatesDir, filename)).isDirectory();
});
usage = `
usage: wintersmith new [options] <path>
creates a skeleton site in <path>
options:
-f, --force overwrite exi... | CoffeeScript | JavaScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 0a0cced94ce73210fec40832257d03b00f866207 | 3,484 | https://github.com/jnordberg/wintersmith/blob/0a0cced94ce73210fec40832257d03b00f866207/src/cli/new.coffee | 12 | 40 |
jnordberg/wintersmith:src/cli/new.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var options, templateTypes, usage;
templateTypes = fs.readdirSync(templatesDir).filter(function(filename) {
return fs.statSync(path.join(templatesDir, filename)).isDirectory();
});
usage = `
usage: wintersmith new [options] <path>
creates a skeleton site in <p... | templateTypes = fs.readdirSync(templatesDir).filter (filename) ->
fs.statSync(path.join(templatesDir, filename)).isDirectory()
usage = """
usage: wintersmith new [options] <path>
creates a skeleton site in <path>
options:
-f, --force overwrite existing files
-T, --template <name> temp... | JavaScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 0a0cced94ce73210fec40832257d03b00f866207 | 3,484 | https://github.com/jnordberg/wintersmith/blob/0a0cced94ce73210fec40832257d03b00f866207/src/cli/new.coffee | 12 | 40 |
jnordberg/wintersmith:src/cli/new.coffee:1:completion | completion | templateTypes = fs.readdirSync(templatesDir).filter (filename) ->
fs.statSync(path.join(templatesDir, filename)).isDirectory()
usage = """
usage: wintersmith new [options] <path>
creates a skeleton site in <path>
options:
-f, --force overwrite existing files
-T, --template <name> temp... | available templates are: #{ templateTypes.join(', ') }
example:
create a new site in your home directory
$ wintersmith new ~/my-blog
"""
options =
force:
alias: 'f'
template:
alias: 'T'
default: 'blog' | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 0a0cced94ce73210fec40832257d03b00f866207 | 3,484 | https://github.com/jnordberg/wintersmith/blob/0a0cced94ce73210fec40832257d03b00f866207/src/cli/new.coffee | 12 | 40 |
jnordberg/wintersmith:src/cli/new.coffee:2:raw_corpus | raw_corpus | createSite = (argv) ->
### copy example directory to *location* ###
location = argv._[1]
if !location? or !location.length
logger.error 'you must specify a location'
return
if argv.template not in templateTypes
logger.error "unknown template type #{ argv.template }"
return
from = path.join ... | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 0a0cced94ce73210fec40832257d03b00f866207 | 3,484 | https://github.com/jnordberg/wintersmith/blob/0a0cced94ce73210fec40832257d03b00f866207/src/cli/new.coffee | 42 | 88 | ||
jnordberg/wintersmith:src/cli/new.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
createSite = (argv) ->
### copy example directory to *location* ###
location = argv._[1]
if !location? or !location.length
logger.error 'you must specify a location'
return
if argv.template not in templateTypes
logger.error "unknown template... | var createSite,
indexOf = [].indexOf;
createSite = function(argv) {
/* copy example directory to *location* */
var copyTemplate, from, installDeps, location, ref, to, validateDestination;
location = argv._[1];
if ((location == null) || !location.length) {
logger.error('you must specify a location');
... | CoffeeScript | JavaScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 0a0cced94ce73210fec40832257d03b00f866207 | 3,484 | https://github.com/jnordberg/wintersmith/blob/0a0cced94ce73210fec40832257d03b00f866207/src/cli/new.coffee | 42 | 88 |
jnordberg/wintersmith:src/cli/new.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var createSite,
indexOf = [].indexOf;
createSite = function(argv) {
/* copy example directory to *location* */
var copyTemplate, from, installDeps, location, ref, to, validateDestination;
location = argv._[1];
if ((location == null) || !location.length) ... | createSite = (argv) ->
### copy example directory to *location* ###
location = argv._[1]
if !location? or !location.length
logger.error 'you must specify a location'
return
if argv.template not in templateTypes
logger.error "unknown template type #{ argv.template }"
return
from = path.join ... | JavaScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 0a0cced94ce73210fec40832257d03b00f866207 | 3,484 | https://github.com/jnordberg/wintersmith/blob/0a0cced94ce73210fec40832257d03b00f866207/src/cli/new.coffee | 42 | 88 |
jnordberg/wintersmith:src/cli/new.coffee:2:completion | completion | createSite = (argv) ->
### copy example directory to *location* ###
location = argv._[1]
if !location? or !location.length
logger.error 'you must specify a location'
return
if argv.template not in templateTypes
logger.error "unknown template type #{ argv.template }"
return
from = path.join ... | callback()
copyTemplate = (callback) ->
logger.verbose "recursive copy #{ from } -> #{ to }"
ncp from, to, {}, callback
installDeps = (callback) ->
packagePath = path.join to, 'package.json'
fileExists packagePath, (exists) ->
if exists
logger.verbose "installing template dependencie... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 0a0cced94ce73210fec40832257d03b00f866207 | 3,484 | https://github.com/jnordberg/wintersmith/blob/0a0cced94ce73210fec40832257d03b00f866207/src/cli/new.coffee | 42 | 88 |
jnordberg/wintersmith:src/cli/new.coffee:1:raw_corpus | raw_corpus | class NpmAdapter extends Stream
### Redirects output of npm to wintersmith logger ###
constructor: ->
@buffer = ''
write: (data) ->
@buffer += data
@flush() if data.indexOf('\n') isnt -1
flush: ->
lines = @buffer.split('\n')
@buffer = ''
for line in lines
continue unless line.le... | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 3fa87471db722fac5d217c6be8a9f82509123807 | 3,484 | https://github.com/jnordberg/wintersmith/blob/3fa87471db722fac5d217c6be8a9f82509123807/src/cli/new.coffee | 11 | 32 | ||
jnordberg/wintersmith:src/cli/new.coffee:1:completion | completion | class NpmAdapter extends Stream
### Redirects output of npm to wintersmith logger ###
constructor: ->
@buffer = ''
write: (data) ->
@buffer += data
@flush() if data.indexOf('\n') isnt -1
flush: -> | lines = @buffer.split('\n')
@buffer = ''
for line in lines
continue unless line.length > 0
line = line.replace /^npm /, ''
if line[0...4] is 'WARN'
logger.warn "npm: #{ line[5..] }"
else
logger.verbose "npm: #{ line }"
templatesDir = path.join __dirname, '../../examples/... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 3fa87471db722fac5d217c6be8a9f82509123807 | 3,484 | https://github.com/jnordberg/wintersmith/blob/3fa87471db722fac5d217c6be8a9f82509123807/src/cli/new.coffee | 11 | 32 |
jnordberg/wintersmith:src/cli/new.coffee:3:raw_corpus | raw_corpus | createSite = (argv) ->
### copy example directory to *location* ###
location = argv._[1]
if !location? or !location.length
logger.error 'you must specify a location'
return
if argv.template not in templateTypes
logger.error "unknown template type #{ argv.template }"
return
from = path.join ... | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 3fa87471db722fac5d217c6be8a9f82509123807 | 3,484 | https://github.com/jnordberg/wintersmith/blob/3fa87471db722fac5d217c6be8a9f82509123807/src/cli/new.coffee | 63 | 109 | ||
jnordberg/wintersmith:src/cli/new.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
createSite = (argv) ->
### copy example directory to *location* ###
location = argv._[1]
if !location? or !location.length
logger.error 'you must specify a location'
return
if argv.template not in templateTypes
logger.error "unknown template... | var createSite,
indexOf = [].indexOf;
createSite = function(argv) {
/* copy example directory to *location* */
var copyTemplate, from, installDeps, location, ref, to, validateDestination;
location = argv._[1];
if ((location == null) || !location.length) {
logger.error('you must specify a location');
... | CoffeeScript | JavaScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 3fa87471db722fac5d217c6be8a9f82509123807 | 3,484 | https://github.com/jnordberg/wintersmith/blob/3fa87471db722fac5d217c6be8a9f82509123807/src/cli/new.coffee | 63 | 109 |
jnordberg/wintersmith:src/cli/new.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var createSite,
indexOf = [].indexOf;
createSite = function(argv) {
/* copy example directory to *location* */
var copyTemplate, from, installDeps, location, ref, to, validateDestination;
location = argv._[1];
if ((location == null) || !location.length) ... | createSite = (argv) ->
### copy example directory to *location* ###
location = argv._[1]
if !location? or !location.length
logger.error 'you must specify a location'
return
if argv.template not in templateTypes
logger.error "unknown template type #{ argv.template }"
return
from = path.join ... | JavaScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 3fa87471db722fac5d217c6be8a9f82509123807 | 3,484 | https://github.com/jnordberg/wintersmith/blob/3fa87471db722fac5d217c6be8a9f82509123807/src/cli/new.coffee | 63 | 109 |
jnordberg/wintersmith:src/cli/new.coffee:3:completion | completion | createSite = (argv) ->
### copy example directory to *location* ###
location = argv._[1]
if !location? or !location.length
logger.error 'you must specify a location'
return
if argv.template not in templateTypes
logger.error "unknown template type #{ argv.template }"
return
from = path.join ... | callback()
copyTemplate = (callback) ->
logger.verbose "recursive copy #{ from } -> #{ to }"
ncp from, to, {}, callback
installDeps = (callback) ->
packagePath = path.join to, 'package.json'
fileExists packagePath, (exists) ->
if exists
logger.verbose "installing template dependencie... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 3fa87471db722fac5d217c6be8a9f82509123807 | 3,484 | https://github.com/jnordberg/wintersmith/blob/3fa87471db722fac5d217c6be8a9f82509123807/src/cli/new.coffee | 63 | 109 |
jnordberg/wintersmith:src/cli/new.coffee:1:raw_corpus | raw_corpus | async = require 'async'
fs = require 'fs'
path = require 'path'
{ncp} = require 'ncp'
{fileExists} = require './../core/utils'
{logger} = require './../core/logger'
templatesDir = path.join __dirname, '../../examples/'
templateTypes = fs.readdirSync(templatesDir).filter (filename) ->
fs.statSync(path.join(templates... | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 43794cd55e461f005be95b9325085ecb642ac37c | 3,484 | https://github.com/jnordberg/wintersmith/blob/43794cd55e461f005be95b9325085ecb642ac37c/src/cli/new.coffee | 1 | 50 | ||
jnordberg/wintersmith:src/cli/new.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
async = require 'async'
fs = require 'fs'
path = require 'path'
{ncp} = require 'ncp'
{fileExists} = require './../core/utils'
{logger} = require './../core/logger'
templatesDir = path.join __dirname, '../../examples/'
templateTypes = fs.readdirSync(templatesDi... | var async, createSite, fileExists, fs, logger, ncp, options, path, templateTypes, templatesDir, usage,
indexOf = [].indexOf;
async = require('async');
fs = require('fs');
path = require('path');
({ncp} = require('ncp'));
({fileExists} = require('./../core/utils'));
({logger} = require('./../core/logger'));
tem... | CoffeeScript | JavaScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 43794cd55e461f005be95b9325085ecb642ac37c | 3,484 | https://github.com/jnordberg/wintersmith/blob/43794cd55e461f005be95b9325085ecb642ac37c/src/cli/new.coffee | 1 | 50 |
jnordberg/wintersmith:src/cli/new.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var async, createSite, fileExists, fs, logger, ncp, options, path, templateTypes, templatesDir, usage,
indexOf = [].indexOf;
async = require('async');
fs = require('fs');
path = require('path');
({ncp} = require('ncp'));
({fileExists} = require('./../core/ut... | async = require 'async'
fs = require 'fs'
path = require 'path'
{ncp} = require 'ncp'
{fileExists} = require './../core/utils'
{logger} = require './../core/logger'
templatesDir = path.join __dirname, '../../examples/'
templateTypes = fs.readdirSync(templatesDir).filter (filename) ->
fs.statSync(path.join(templates... | JavaScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 43794cd55e461f005be95b9325085ecb642ac37c | 3,484 | https://github.com/jnordberg/wintersmith/blob/43794cd55e461f005be95b9325085ecb642ac37c/src/cli/new.coffee | 1 | 50 |
jnordberg/wintersmith:src/cli/new.coffee:1:completion | completion | async = require 'async'
fs = require 'fs'
path = require 'path'
{ncp} = require 'ncp'
{fileExists} = require './../core/utils'
{logger} = require './../core/logger'
templatesDir = path.join __dirname, '../../examples/'
templateTypes = fs.readdirSync(templatesDir).filter (filename) ->
fs.statSync(path.join(templates... | example:
create a new site in your home directory
$ wintersmith new ~/my-blog
"""
options =
force:
alias: 'f'
template:
alias: 'T'
default: 'blog'
createSite = (argv) ->
### copy example directory to *location* ###
location = argv._[1]
if !location? or !location.length
logger.erro... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 43794cd55e461f005be95b9325085ecb642ac37c | 3,484 | https://github.com/jnordberg/wintersmith/blob/43794cd55e461f005be95b9325085ecb642ac37c/src/cli/new.coffee | 1 | 50 |
jnordberg/wintersmith:src/cli/new.coffee:2:raw_corpus | raw_corpus | from = path.join templatesDir, argv.template
to = path.resolve location
logger.info "initializing new wintersmith site in #{ to } using template #{ argv.template }"
async.waterfall [
(callback) ->
logger.verbose "checking validity of #{ to }"
fileExists to, (exists) ->
if exists and !arg... | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 43794cd55e461f005be95b9325085ecb642ac37c | 3,484 | https://github.com/jnordberg/wintersmith/blob/43794cd55e461f005be95b9325085ecb642ac37c/src/cli/new.coffee | 51 | 76 | ||
jnordberg/wintersmith:src/cli/new.coffee:2:completion | completion | from = path.join templatesDir, argv.template
to = path.resolve location
logger.info "initializing new wintersmith site in #{ to } using template #{ argv.template }"
async.waterfall [
(callback) ->
logger.verbose "checking validity of #{ to }"
fileExists to, (exists) ->
if exists and !arg... | callback()
(callback) ->
logger.verbose "recursive copy #{ from } -> #{ to }"
ncp from, to, {}, callback
], (error) ->
if error
logger.error error.message, error
else
logger.info 'done!'
module.exports = createSite
module.exports.usage = usage
module.exports.options = options | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 43794cd55e461f005be95b9325085ecb642ac37c | 3,484 | https://github.com/jnordberg/wintersmith/blob/43794cd55e461f005be95b9325085ecb642ac37c/src/cli/new.coffee | 51 | 76 |
jnordberg/wintersmith:src/cli/new.coffee:1:raw_corpus | raw_corpus | async = require 'async'
fs = require 'fs'
path = require 'path'
{ncp} = require 'ncp'
{fileExists} = require './../core/utils'
{logger} = require './../core/logger'
templateTypes = ['basic', 'blog']
usage = """
usage: wintersmith new [options] <path>
creates a skeleton site in <path>
options:
-f, --for... | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | a3ce2fed749a3e075ca7233fe93f4be3f167a7f1 | 3,484 | https://github.com/jnordberg/wintersmith/blob/a3ce2fed749a3e075ca7233fe93f4be3f167a7f1/src/cli/new.coffee | 1 | 50 | ||
jnordberg/wintersmith:src/cli/new.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
async = require 'async'
fs = require 'fs'
path = require 'path'
{ncp} = require 'ncp'
{fileExists} = require './../core/utils'
{logger} = require './../core/logger'
templateTypes = ['basic', 'blog']
usage = """
usage: wintersmith new [options] <path>
cre... | var async, createSite, fileExists, fs, logger, ncp, options, path, templateTypes, usage,
indexOf = [].indexOf;
async = require('async');
fs = require('fs');
path = require('path');
({ncp} = require('ncp'));
({fileExists} = require('./../core/utils'));
({logger} = require('./../core/logger'));
templateTypes = [... | CoffeeScript | JavaScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | a3ce2fed749a3e075ca7233fe93f4be3f167a7f1 | 3,484 | https://github.com/jnordberg/wintersmith/blob/a3ce2fed749a3e075ca7233fe93f4be3f167a7f1/src/cli/new.coffee | 1 | 50 |
jnordberg/wintersmith:src/cli/new.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var async, createSite, fileExists, fs, logger, ncp, options, path, templateTypes, usage,
indexOf = [].indexOf;
async = require('async');
fs = require('fs');
path = require('path');
({ncp} = require('ncp'));
({fileExists} = require('./../core/utils'));
({log... | async = require 'async'
fs = require 'fs'
path = require 'path'
{ncp} = require 'ncp'
{fileExists} = require './../core/utils'
{logger} = require './../core/logger'
templateTypes = ['basic', 'blog']
usage = """
usage: wintersmith new [options] <path>
creates a skeleton site in <path>
options:
-f, --for... | JavaScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | a3ce2fed749a3e075ca7233fe93f4be3f167a7f1 | 3,484 | https://github.com/jnordberg/wintersmith/blob/a3ce2fed749a3e075ca7233fe93f4be3f167a7f1/src/cli/new.coffee | 1 | 50 |
jnordberg/wintersmith:src/cli/new.coffee:1:completion | completion | async = require 'async'
fs = require 'fs'
path = require 'path'
{ncp} = require 'ncp'
{fileExists} = require './../core/utils'
{logger} = require './../core/logger'
templateTypes = ['basic', 'blog']
usage = """
usage: wintersmith new [options] <path>
creates a skeleton site in <path>
options:
-f, --for... | create a new site in your home directory
$ wintersmith new ~/my-blog
"""
options =
force:
alias: 'f'
template:
alias: 'T'
default: 'blog'
createSite = (argv) ->
### copy example directory to *location* ###
location = argv._[1]
if !location? or !location.length
logger.error 'you must sp... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | a3ce2fed749a3e075ca7233fe93f4be3f167a7f1 | 3,484 | https://github.com/jnordberg/wintersmith/blob/a3ce2fed749a3e075ca7233fe93f4be3f167a7f1/src/cli/new.coffee | 1 | 50 |
jnordberg/wintersmith:src/cli/new.coffee:2:raw_corpus | raw_corpus | to = path.resolve location
logger.info "initializing new wintersmith site in #{ to } using template #{ argv.template }"
async.waterfall [
(callback) ->
logger.verbose "checking validity of #{ to }"
fileExists to, (exists) ->
if exists and !argv.force
callback new Error "#{ to } a... | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | a3ce2fed749a3e075ca7233fe93f4be3f167a7f1 | 3,484 | https://github.com/jnordberg/wintersmith/blob/a3ce2fed749a3e075ca7233fe93f4be3f167a7f1/src/cli/new.coffee | 51 | 74 | ||
jnordberg/wintersmith:src/cli/new.coffee:2:completion | completion | to = path.resolve location
logger.info "initializing new wintersmith site in #{ to } using template #{ argv.template }"
async.waterfall [
(callback) ->
logger.verbose "checking validity of #{ to }"
fileExists to, (exists) ->
if exists and !argv.force
callback new Error "#{ to } a... | (callback) ->
logger.verbose "recursive copy #{ from } -> #{ to }"
ncp from, to, {}, callback
], (error) ->
if error
logger.error error.message, error
else
logger.info 'done!'
module.exports = createSite
module.exports.usage = usage
module.exports.options = options | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | a3ce2fed749a3e075ca7233fe93f4be3f167a7f1 | 3,484 | https://github.com/jnordberg/wintersmith/blob/a3ce2fed749a3e075ca7233fe93f4be3f167a7f1/src/cli/new.coffee | 51 | 74 |
jnordberg/wintersmith:src/cli/new.coffee:1:raw_corpus | raw_corpus | async = require 'async'
{ncp} = require 'ncp'
fs = require 'fs'
path = require 'path'
{fileExists} = require './common' # cli common
{logger} = require '../common' # lib common
templateTypes = ['basic', 'blog']
usage = """
usage: wintersmith new [options] <path>
creates a skeleton site in <path>
options:
... | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 372903cad9bbd185d7a5fbc60a9cd08a5fb1547c | 3,484 | https://github.com/jnordberg/wintersmith/blob/372903cad9bbd185d7a5fbc60a9cd08a5fb1547c/src/cli/new.coffee | 1 | 50 | ||
jnordberg/wintersmith:src/cli/new.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
async = require 'async'
{ncp} = require 'ncp'
fs = require 'fs'
path = require 'path'
{fileExists} = require './common' # cli common
{logger} = require '../common' # lib common
templateTypes = ['basic', 'blog']
usage = """
usage: wintersmith new [options] <p... | var async, createSite, fileExists, fs, logger, ncp, options, path, templateTypes, usage,
indexOf = [].indexOf;
async = require('async');
({ncp} = require('ncp'));
fs = require('fs');
path = require('path');
({fileExists} = require('./common')); // cli common
({logger} = require('../common')); // lib common
tem... | CoffeeScript | JavaScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 372903cad9bbd185d7a5fbc60a9cd08a5fb1547c | 3,484 | https://github.com/jnordberg/wintersmith/blob/372903cad9bbd185d7a5fbc60a9cd08a5fb1547c/src/cli/new.coffee | 1 | 50 |
jnordberg/wintersmith:src/cli/new.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var async, createSite, fileExists, fs, logger, ncp, options, path, templateTypes, usage,
indexOf = [].indexOf;
async = require('async');
({ncp} = require('ncp'));
fs = require('fs');
path = require('path');
({fileExists} = require('./common')); // cli common... | async = require 'async'
{ncp} = require 'ncp'
fs = require 'fs'
path = require 'path'
{fileExists} = require './common' # cli common
{logger} = require '../common' # lib common
templateTypes = ['basic', 'blog']
usage = """
usage: wintersmith new [options] <path>
creates a skeleton site in <path>
options:
... | JavaScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 372903cad9bbd185d7a5fbc60a9cd08a5fb1547c | 3,484 | https://github.com/jnordberg/wintersmith/blob/372903cad9bbd185d7a5fbc60a9cd08a5fb1547c/src/cli/new.coffee | 1 | 50 |
jnordberg/wintersmith:src/cli/new.coffee:1:completion | completion | async = require 'async'
{ncp} = require 'ncp'
fs = require 'fs'
path = require 'path'
{fileExists} = require './common' # cli common
{logger} = require '../common' # lib common
templateTypes = ['basic', 'blog']
usage = """
usage: wintersmith new [options] <path>
creates a skeleton site in <path>
options:
... | $ wintersmith new ~/my-blog
"""
options =
force:
alias: 'f'
template:
alias: 'T'
default: 'blog'
createSite = (argv) ->
### copy example directory to *location* ###
location = argv._[1]
if !location? or !location.length
logger.error 'you must specify a location'
return
if argv.templ... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 372903cad9bbd185d7a5fbc60a9cd08a5fb1547c | 3,484 | https://github.com/jnordberg/wintersmith/blob/372903cad9bbd185d7a5fbc60a9cd08a5fb1547c/src/cli/new.coffee | 1 | 50 |
jnordberg/wintersmith:src/cli/new.coffee:2:raw_corpus | raw_corpus | logger.info "initializing new wintersmith site in #{ to } using template #{ argv.template }"
async.waterfall [
(callback) ->
logger.verbose "checking validity of #{ to }"
fileExists to, (exists) ->
if exists and !argv.force
callback new Error "#{ to } already exists. Add --force to ... | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 372903cad9bbd185d7a5fbc60a9cd08a5fb1547c | 3,484 | https://github.com/jnordberg/wintersmith/blob/372903cad9bbd185d7a5fbc60a9cd08a5fb1547c/src/cli/new.coffee | 51 | 73 | ||
jnordberg/wintersmith:src/cli/new.coffee:2:completion | completion | logger.info "initializing new wintersmith site in #{ to } using template #{ argv.template }"
async.waterfall [
(callback) ->
logger.verbose "checking validity of #{ to }"
fileExists to, (exists) ->
if exists and !argv.force
callback new Error "#{ to } already exists. Add --force to ... | logger.verbose "recursive copy #{ from } -> #{ to }"
ncp from, to, {}, callback
], (error) ->
if error
logger.error error.message, error
else
logger.info 'done!'
module.exports = createSite
module.exports.usage = usage
module.exports.options = options | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 372903cad9bbd185d7a5fbc60a9cd08a5fb1547c | 3,484 | https://github.com/jnordberg/wintersmith/blob/372903cad9bbd185d7a5fbc60a9cd08a5fb1547c/src/cli/new.coffee | 51 | 73 |
jnordberg/wintersmith:src/cli/new.coffee:1:raw_corpus | raw_corpus | async = require 'async'
{ncp} = require 'ncp'
fs = require 'fs'
path = require 'path'
{logger} = require '../common' # lib common
templateTypes = ['basic', 'blog']
usage = """
usage: wintersmith new [options] <path>
creates a skeleton site in <path>
options:
-f, --force overwrite existing fi... | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 3be517055fd7e2e80d584583ff319334309fa842 | 3,484 | https://github.com/jnordberg/wintersmith/blob/3be517055fd7e2e80d584583ff319334309fa842/src/cli/new.coffee | 1 | 50 | ||
jnordberg/wintersmith:src/cli/new.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
async = require 'async'
{ncp} = require 'ncp'
fs = require 'fs'
path = require 'path'
{logger} = require '../common' # lib common
templateTypes = ['basic', 'blog']
usage = """
usage: wintersmith new [options] <path>
creates a skeleton site in <path>
op... | var async, createSite, fs, logger, ncp, options, path, templateTypes, usage,
indexOf = [].indexOf;
async = require('async');
({ncp} = require('ncp'));
fs = require('fs');
path = require('path');
({logger} = require('../common')); // lib common
templateTypes = ['basic', 'blog'];
usage = `
usage: wintersmith new... | CoffeeScript | JavaScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 3be517055fd7e2e80d584583ff319334309fa842 | 3,484 | https://github.com/jnordberg/wintersmith/blob/3be517055fd7e2e80d584583ff319334309fa842/src/cli/new.coffee | 1 | 50 |
jnordberg/wintersmith:src/cli/new.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var async, createSite, fs, logger, ncp, options, path, templateTypes, usage,
indexOf = [].indexOf;
async = require('async');
({ncp} = require('ncp'));
fs = require('fs');
path = require('path');
({logger} = require('../common')); // lib common
templateTypes... | async = require 'async'
{ncp} = require 'ncp'
fs = require 'fs'
path = require 'path'
{logger} = require '../common' # lib common
templateTypes = ['basic', 'blog']
usage = """
usage: wintersmith new [options] <path>
creates a skeleton site in <path>
options:
-f, --force overwrite existing fi... | JavaScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 3be517055fd7e2e80d584583ff319334309fa842 | 3,484 | https://github.com/jnordberg/wintersmith/blob/3be517055fd7e2e80d584583ff319334309fa842/src/cli/new.coffee | 1 | 50 |
jnordberg/wintersmith:src/cli/new.coffee:1:completion | completion | async = require 'async'
{ncp} = require 'ncp'
fs = require 'fs'
path = require 'path'
{logger} = require '../common' # lib common
templateTypes = ['basic', 'blog']
usage = """
usage: wintersmith new [options] <path>
creates a skeleton site in <path>
options:
-f, --force overwrite existing fi... | $ wintersmith new ~/my-blog
"""
options =
force:
alias: 'f'
template:
alias: 'T'
default: 'blog'
createSite = (argv) ->
### copy example directory to *location* ###
location = argv._[1]
if !location? or !location.length
logger.error 'you must specify a location'
return
if argv.templ... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 3be517055fd7e2e80d584583ff319334309fa842 | 3,484 | https://github.com/jnordberg/wintersmith/blob/3be517055fd7e2e80d584583ff319334309fa842/src/cli/new.coffee | 1 | 50 |
jnordberg/wintersmith:src/cli/new.coffee:2:raw_corpus | raw_corpus | logger.info "initializing new wintersmith site in #{ to } using template #{ argv.template }"
async.waterfall [
(callback) ->
logger.verbose "checking validity of #{ to }"
path.exists to, (exists) ->
if exists and !argv.force
callback new Error "#{ to } already exists. Add --force to... | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 3be517055fd7e2e80d584583ff319334309fa842 | 3,484 | https://github.com/jnordberg/wintersmith/blob/3be517055fd7e2e80d584583ff319334309fa842/src/cli/new.coffee | 51 | 72 | ||
jnordberg/wintersmith:src/cli/new.coffee:2:completion | completion | logger.info "initializing new wintersmith site in #{ to } using template #{ argv.template }"
async.waterfall [
(callback) ->
logger.verbose "checking validity of #{ to }"
path.exists to, (exists) ->
if exists and !argv.force
callback new Error "#{ to } already exists. Add --force to... | logger.verbose "recursive copy #{ from } -> #{ to }"
ncp from, to, {}, callback
], (error) ->
if error
logger.error error.message, error
else
logger.info 'done!'
module.exports = createSite
module.exports.usage = usage
module.exports.options = options | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 3be517055fd7e2e80d584583ff319334309fa842 | 3,484 | https://github.com/jnordberg/wintersmith/blob/3be517055fd7e2e80d584583ff319334309fa842/src/cli/new.coffee | 51 | 72 |
jnordberg/wintersmith:src/cli/new.coffee:1:raw_corpus | raw_corpus | async = require 'async'
{ncp} = require 'ncp'
fs = require 'fs'
path = require 'path'
{logger} = require '../common' # lib common
templateTypes = ['basic', 'blog']
usage = """
usage: wintersmith new [options] <path>
creates a skeleton site in <path>
options:
-f, --force overwrite existing fi... | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 27d0909eb7ea900a6138404bd03cd6dd12d58a1b | 3,484 | https://github.com/jnordberg/wintersmith/blob/27d0909eb7ea900a6138404bd03cd6dd12d58a1b/src/cli/new.coffee | 1 | 50 | ||
jnordberg/wintersmith:src/cli/new.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
async = require 'async'
{ncp} = require 'ncp'
fs = require 'fs'
path = require 'path'
{logger} = require '../common' # lib common
templateTypes = ['basic', 'blog']
usage = """
usage: wintersmith new [options] <path>
creates a skeleton site in <path>
op... | var async, createSite, fs, logger, ncp, options, path, templateTypes, usage,
indexOf = [].indexOf;
async = require('async');
({ncp} = require('ncp'));
fs = require('fs');
path = require('path');
({logger} = require('../common')); // lib common
templateTypes = ['basic', 'blog'];
usage = `
usage: wintersmith new... | CoffeeScript | JavaScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 27d0909eb7ea900a6138404bd03cd6dd12d58a1b | 3,484 | https://github.com/jnordberg/wintersmith/blob/27d0909eb7ea900a6138404bd03cd6dd12d58a1b/src/cli/new.coffee | 1 | 50 |
jnordberg/wintersmith:src/cli/new.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var async, createSite, fs, logger, ncp, options, path, templateTypes, usage,
indexOf = [].indexOf;
async = require('async');
({ncp} = require('ncp'));
fs = require('fs');
path = require('path');
({logger} = require('../common')); // lib common
templateTypes... | async = require 'async'
{ncp} = require 'ncp'
fs = require 'fs'
path = require 'path'
{logger} = require '../common' # lib common
templateTypes = ['basic', 'blog']
usage = """
usage: wintersmith new [options] <path>
creates a skeleton site in <path>
options:
-f, --force overwrite existing fi... | JavaScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 27d0909eb7ea900a6138404bd03cd6dd12d58a1b | 3,484 | https://github.com/jnordberg/wintersmith/blob/27d0909eb7ea900a6138404bd03cd6dd12d58a1b/src/cli/new.coffee | 1 | 50 |
jnordberg/wintersmith:src/cli/new.coffee:1:completion | completion | async = require 'async'
{ncp} = require 'ncp'
fs = require 'fs'
path = require 'path'
{logger} = require '../common' # lib common
templateTypes = ['basic', 'blog']
usage = """
usage: wintersmith new [options] <path>
creates a skeleton site in <path>
options:
-f, --force overwrite existing fi... | $ wintersmith new ~/my-blog
"""
options =
force:
alias: 'f'
template:
alias: 'T'
default: 'blog'
createSite = (argv) ->
### copy example directory to *location* ###
location = argv._[1]
if !location? or !location.length
logger.error 'you must specify a location'
return
if argv.templ... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 27d0909eb7ea900a6138404bd03cd6dd12d58a1b | 3,484 | https://github.com/jnordberg/wintersmith/blob/27d0909eb7ea900a6138404bd03cd6dd12d58a1b/src/cli/new.coffee | 1 | 50 |
jnordberg/wintersmith:src/cli/new.coffee:1:raw_corpus | raw_corpus | async = require 'async'
{ncp} = require 'ncp'
fs = require 'fs'
path = require 'path'
{logger} = require '../common' # lib common
usage = """
usage: wintersmith new [options] <path>
creates a skeleton site in <path>
options:
-f, --force overwrite existing files
example:
create a new site in yo... | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 8f2c6ac55db42b208ecc86286472db1df37b7ed6 | 3,484 | https://github.com/jnordberg/wintersmith/blob/8f2c6ac55db42b208ecc86286472db1df37b7ed6/src/cli/new.coffee | 1 | 50 | ||
jnordberg/wintersmith:src/cli/new.coffee:1:completion | completion | async = require 'async'
{ncp} = require 'ncp'
fs = require 'fs'
path = require 'path'
{logger} = require '../common' # lib common
usage = """
usage: wintersmith new [options] <path>
creates a skeleton site in <path>
options:
-f, --force overwrite existing files
example:
create a new site in yo... | alias: 'f'
createSite = (argv) ->
### copy example directory to *location* ###
for val in process.argv[3..]
if val[0] == '-'
continue
location = val
if !location.length
logger.error 'you must specify a location'
return
from = path.join __dirname, '../../example'
to = path.resolve loc... | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 8f2c6ac55db42b208ecc86286472db1df37b7ed6 | 3,484 | https://github.com/jnordberg/wintersmith/blob/8f2c6ac55db42b208ecc86286472db1df37b7ed6/src/cli/new.coffee | 1 | 50 |
jnordberg/wintersmith:src/cli/new.coffee:2:raw_corpus | raw_corpus | else
callback()
(callback) ->
logger.verbose "recursive copy #{ from } -> #{ to }"
ncp from, to, {}, callback
], (error) ->
if error
logger.error error.message, error
else
logger.info 'done!'
module.exports = createSite
module.exports.usage = usage
module.exports.options... | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 8f2c6ac55db42b208ecc86286472db1df37b7ed6 | 3,484 | https://github.com/jnordberg/wintersmith/blob/8f2c6ac55db42b208ecc86286472db1df37b7ed6/src/cli/new.coffee | 51 | 64 | ||
jnordberg/wintersmith:src/cli/new.coffee:2:completion | completion | else
callback()
(callback) ->
logger.verbose "recursive copy #{ from } -> #{ to }"
ncp from, to, {}, callback
], (error) ->
if error | logger.error error.message, error
else
logger.info 'done!'
module.exports = createSite
module.exports.usage = usage
module.exports.options = options | CoffeeScript | CoffeeScript | jnordberg/wintersmith | src/cli/new.coffee | MIT | 8f2c6ac55db42b208ecc86286472db1df37b7ed6 | 3,484 | https://github.com/jnordberg/wintersmith/blob/8f2c6ac55db42b208ecc86286472db1df37b7ed6/src/cli/new.coffee | 51 | 64 |
dropbox/zxcvbn:scoring.coffee:2:raw_corpus | raw_corpus | nPk = (n, k) ->
result = 1
result *= m for m in [n-k+1..n]
result | CoffeeScript | dropbox/zxcvbn | scoring.coffee | MIT | e8185fca76ad1d080dfa7147dadfd1a20eec52b2 | 15,961 | https://github.com/dropbox/zxcvbn/blob/e8185fca76ad1d080dfa7147dadfd1a20eec52b2/scoring.coffee | 3 | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.