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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
nevir/groc:lib/project.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Project;
Project = (function() {
class Project {
constructor(root, outPath, minLogLevel = Logger.prototype.INFO) {
this.log = new Logger(minLogLevel);
// * Has a single root directory that contains (most of) it.
this.root = path.resolve... | class Project
constructor: (root, outPath, minLogLevel=Logger::INFO) ->
@log = new Logger minLogLevel
# * Has a single root directory that contains (most of) it.
@root = path.resolve root
# * Generally wants documented generated somewhere within its tree. We default the output path
# to be rel... | JavaScript | CoffeeScript | nevir/groc | lib/project.coffee | MIT | 5ff608e104f8c35a6722c9d18be0109b67073caf | 579 | https://github.com/nevir/groc/blob/5ff608e104f8c35a6722c9d18be0109b67073caf/lib/project.coffee | 5 | 54 |
nevir/groc:lib/project.coffee:1:completion | completion | class Project
constructor: (root, outPath, minLogLevel=Logger::INFO) ->
@log = new Logger minLogLevel
# * Has a single root directory that contains (most of) it.
@root = path.resolve root
# * Generally wants documented generated somewhere within its tree. We default the output path
# to be rel... | @log.info 'Generating documentation...'
# We want to support multiple documentation styles, but we don't expect to have a stable API for
# that just yet.
style = new styles.Default @
fileMap = Utils.mapFiles @root, @files, @stripPrefixes
# If we were given an index file, map that
if @index
... | CoffeeScript | CoffeeScript | nevir/groc | lib/project.coffee | MIT | 5ff608e104f8c35a6722c9d18be0109b67073caf | 579 | https://github.com/nevir/groc/blob/5ff608e104f8c35a6722c9d18be0109b67073caf/lib/project.coffee | 5 | 54 |
nevir/groc:lib/project.coffee:2:raw_corpus | raw_corpus | else
if inFlight == 0
style.renderCompleted (error) =>
return callback error if error
@log.info ''
@log.pass 'Documentation generated'
callback()
# End of the line; we're done chaining processFile()
return
fs.readFile currentFile... | CoffeeScript | nevir/groc | lib/project.coffee | MIT | 5ff608e104f8c35a6722c9d18be0109b67073caf | 579 | https://github.com/nevir/groc/blob/5ff608e104f8c35a6722c9d18be0109b67073caf/lib/project.coffee | 55 | 87 | ||
nevir/groc:lib/project.coffee:2:completion | completion | else
if inFlight == 0
style.renderCompleted (error) =>
return callback error if error
@log.info ''
@log.pass 'Documentation generated'
callback()
# End of the line; we're done chaining processFile()
return
fs.readFile currentFile... | style.renderFile data,
language: language
sourcePath: currentFile
targetPath: fileMap[currentFile]
(error) =>
return callback error if error
inFlight -= 1
processFile()
# Kick off the initial batch of files to process. They'll continu... | CoffeeScript | CoffeeScript | nevir/groc | lib/project.coffee | MIT | 5ff608e104f8c35a6722c9d18be0109b67073caf | 579 | https://github.com/nevir/groc/blob/5ff608e104f8c35a6722c9d18be0109b67073caf/lib/project.coffee | 55 | 87 |
nevir/groc:lib/project.coffee:1:raw_corpus | raw_corpus | class Project
constructor: (root, outPath, minLogLevel=Logger::INFO) ->
@log = new Logger minLogLevel
# * Has a single root directory that contains (most of) it.
@root = path.resolve root
# * Generally wants documented generated somewhere within its tree. We default the output path
# to be rel... | CoffeeScript | nevir/groc | lib/project.coffee | MIT | ad591dabaf52da1a92c0996e02818a385b0abc99 | 579 | https://github.com/nevir/groc/blob/ad591dabaf52da1a92c0996e02818a385b0abc99/lib/project.coffee | 5 | 54 | ||
nevir/groc:lib/project.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Project
constructor: (root, outPath, minLogLevel=Logger::INFO) ->
@log = new Logger minLogLevel
# * Has a single root directory that contains (most of) it.
@root = path.resolve root
# * Generally wants documented generated somewhere withi... | var Project;
Project = (function() {
class Project {
constructor(root, outPath, minLogLevel = Logger.prototype.INFO) {
this.log = new Logger(minLogLevel);
// * Has a single root directory that contains (most of) it.
this.root = path.resolve(root);
// * Generally wants documented generated... | CoffeeScript | JavaScript | nevir/groc | lib/project.coffee | MIT | ad591dabaf52da1a92c0996e02818a385b0abc99 | 579 | https://github.com/nevir/groc/blob/ad591dabaf52da1a92c0996e02818a385b0abc99/lib/project.coffee | 5 | 54 |
nevir/groc:lib/project.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Project;
Project = (function() {
class Project {
constructor(root, outPath, minLogLevel = Logger.prototype.INFO) {
this.log = new Logger(minLogLevel);
// * Has a single root directory that contains (most of) it.
this.root = path.resolve... | class Project
constructor: (root, outPath, minLogLevel=Logger::INFO) ->
@log = new Logger minLogLevel
# * Has a single root directory that contains (most of) it.
@root = path.resolve root
# * Generally wants documented generated somewhere within its tree. We default the output path
# to be rel... | JavaScript | CoffeeScript | nevir/groc | lib/project.coffee | MIT | ad591dabaf52da1a92c0996e02818a385b0abc99 | 579 | https://github.com/nevir/groc/blob/ad591dabaf52da1a92c0996e02818a385b0abc99/lib/project.coffee | 5 | 54 |
nevir/groc:lib/project.coffee:1:completion | completion | class Project
constructor: (root, outPath, minLogLevel=Logger::INFO) ->
@log = new Logger minLogLevel
# * Has a single root directory that contains (most of) it.
@root = path.resolve root
# * Generally wants documented generated somewhere within its tree. We default the output path
# to be rel... | @log.info 'Generating documentation...'
# We want to support multiple documentation styles, but we don't expect to have a stable API for
# that just yet.
style = new styles.default.Style @
fileMap = Utils.mapFiles @root, @files, @stripPrefixes
# If we were given an index file, map that
if @ind... | CoffeeScript | CoffeeScript | nevir/groc | lib/project.coffee | MIT | ad591dabaf52da1a92c0996e02818a385b0abc99 | 579 | https://github.com/nevir/groc/blob/ad591dabaf52da1a92c0996e02818a385b0abc99/lib/project.coffee | 5 | 54 |
nevir/groc:lib/project.coffee:2:raw_corpus | raw_corpus | else
if inFlight == 0
style.renderCompleted (error) =>
return callback error if error
@log.info ''
@log.pass 'Documentation generated'
callback()
# End of the line; we're done chaining processFile()
return
fs.readFile currentFile... | CoffeeScript | nevir/groc | lib/project.coffee | MIT | ccaeb7be8ab0ec2321d8bab84e1071d494a509b6 | 579 | https://github.com/nevir/groc/blob/ccaeb7be8ab0ec2321d8bab84e1071d494a509b6/lib/project.coffee | 55 | 82 | ||
nevir/groc:lib/project.coffee:2:completion | completion | else
if inFlight == 0
style.renderCompleted (error) =>
return callback error if error
@log.info ''
@log.pass 'Documentation generated'
callback()
# End of the line; we're done chaining processFile()
return
fs.readFile currentFile... | if error
@log.error "Failed to process %s: %s", currentFile, error.message
return callback error
style.renderFile data, language, currentFile, fileMap[currentFile], (error) =>
return callback error if error
inFlight -= 1
processFile()
# Kick off the initi... | CoffeeScript | CoffeeScript | nevir/groc | lib/project.coffee | MIT | ccaeb7be8ab0ec2321d8bab84e1071d494a509b6 | 579 | https://github.com/nevir/groc/blob/ccaeb7be8ab0ec2321d8bab84e1071d494a509b6/lib/project.coffee | 55 | 82 |
nevir/groc:lib/project.coffee:1:raw_corpus | raw_corpus | class Project
constructor: (root, outPath, minLogLevel=Logger::INFO) ->
@log = new Logger minLogLevel
# * Has a single root directory that contains (most of) it.
@root = path.resolve root
# * Generally wants documented generated somewhere within its tree. We default the output path
# to be rel... | CoffeeScript | nevir/groc | lib/project.coffee | MIT | 9c20a6e2c073c00bb72028f0ac47728353ffd47a | 579 | https://github.com/nevir/groc/blob/9c20a6e2c073c00bb72028f0ac47728353ffd47a/lib/project.coffee | 5 | 54 | ||
nevir/groc:lib/project.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Project
constructor: (root, outPath, minLogLevel=Logger::INFO) ->
@log = new Logger minLogLevel
# * Has a single root directory that contains (most of) it.
@root = path.resolve root
# * Generally wants documented generated somewhere withi... | var Project;
Project = (function() {
class Project {
constructor(root, outPath, minLogLevel = Logger.prototype.INFO) {
this.log = new Logger(minLogLevel);
// * Has a single root directory that contains (most of) it.
this.root = path.resolve(root);
// * Generally wants documented generated... | CoffeeScript | JavaScript | nevir/groc | lib/project.coffee | MIT | 9c20a6e2c073c00bb72028f0ac47728353ffd47a | 579 | https://github.com/nevir/groc/blob/9c20a6e2c073c00bb72028f0ac47728353ffd47a/lib/project.coffee | 5 | 54 |
nevir/groc:lib/project.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Project;
Project = (function() {
class Project {
constructor(root, outPath, minLogLevel = Logger.prototype.INFO) {
this.log = new Logger(minLogLevel);
// * Has a single root directory that contains (most of) it.
this.root = path.resolve... | class Project
constructor: (root, outPath, minLogLevel=Logger::INFO) ->
@log = new Logger minLogLevel
# * Has a single root directory that contains (most of) it.
@root = path.resolve root
# * Generally wants documented generated somewhere within its tree. We default the output path
# to be rel... | JavaScript | CoffeeScript | nevir/groc | lib/project.coffee | MIT | 9c20a6e2c073c00bb72028f0ac47728353ffd47a | 579 | https://github.com/nevir/groc/blob/9c20a6e2c073c00bb72028f0ac47728353ffd47a/lib/project.coffee | 5 | 54 |
nevir/groc:lib/project.coffee:1:completion | completion | class Project
constructor: (root, outPath, minLogLevel=Logger::INFO) ->
@log = new Logger minLogLevel
# * Has a single root directory that contains (most of) it.
@root = path.resolve root
# * Generally wants documented generated somewhere within its tree. We default the output path
# to be rel... | if stats.isFile()
@files.push absPath
# Or directories to be recursively walked to find all files under them.
else if stats.isDirectory()
@add path.join fileOrDir, p for p in fs.readdirSync fileOrDir when path.basename(p)[0] != '.'
# Adds a path prefix that should be stripped from source file pa... | CoffeeScript | CoffeeScript | nevir/groc | lib/project.coffee | MIT | 9c20a6e2c073c00bb72028f0ac47728353ffd47a | 579 | https://github.com/nevir/groc/blob/9c20a6e2c073c00bb72028f0ac47728353ffd47a/lib/project.coffee | 5 | 54 |
nevir/groc:lib/project.coffee:2:raw_corpus | raw_corpus | # We want to support multiple documentation styles, but we don't expect to have a stable API for
# that just yet.
style = new styles.default.Style @
fileMap = Utils.mapFiles @files, @stripPrefixes
# If we were given an index file, map that
if @index
indexPath = path.resolve @root, @index
... | CoffeeScript | nevir/groc | lib/project.coffee | MIT | 9c20a6e2c073c00bb72028f0ac47728353ffd47a | 579 | https://github.com/nevir/groc/blob/9c20a6e2c073c00bb72028f0ac47728353ffd47a/lib/project.coffee | 55 | 104 | ||
nevir/groc:lib/project.coffee:2:completion | completion | # We want to support multiple documentation styles, but we don't expect to have a stable API for
# that just yet.
style = new styles.default.Style @
fileMap = Utils.mapFiles @files, @stripPrefixes
# If we were given an index file, map that
if @index
indexPath = path.resolve @root, @index
... | if inFlight == 0
style.renderCompleted (error) =>
return callback error if error
@log.info ''
@log.pass 'Documentation generated'
callback()
# End of the line; we're done chaining processFile()
return
fs.readFile currentFile, 'utf-8', (e... | CoffeeScript | CoffeeScript | nevir/groc | lib/project.coffee | MIT | 9c20a6e2c073c00bb72028f0ac47728353ffd47a | 579 | https://github.com/nevir/groc/blob/9c20a6e2c073c00bb72028f0ac47728353ffd47a/lib/project.coffee | 55 | 104 |
nevir/groc:lib/project.coffee:1:raw_corpus | raw_corpus | class Project
constructor: (root, outPath, minLogLevel=Logger::INFO) ->
@log = new Logger minLogLevel
# * Has a single root directory that contains (most of) it.
@root = path.resolve root
# * Generally wants documented generated somewhere within its tree. We default the output path
# to be rel... | CoffeeScript | nevir/groc | lib/project.coffee | MIT | 291b1ecf56d55b5aa565e08645b67e5e1a3d4d73 | 579 | https://github.com/nevir/groc/blob/291b1ecf56d55b5aa565e08645b67e5e1a3d4d73/lib/project.coffee | 5 | 54 | ||
nevir/groc:lib/project.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Project
constructor: (root, outPath, minLogLevel=Logger::INFO) ->
@log = new Logger minLogLevel
# * Has a single root directory that contains (most of) it.
@root = path.resolve root
# * Generally wants documented generated somewhere withi... | var Project;
Project = (function() {
class Project {
constructor(root, outPath, minLogLevel = Logger.prototype.INFO) {
this.log = new Logger(minLogLevel);
// * Has a single root directory that contains (most of) it.
this.root = path.resolve(root);
// * Generally wants documented generated... | CoffeeScript | JavaScript | nevir/groc | lib/project.coffee | MIT | 291b1ecf56d55b5aa565e08645b67e5e1a3d4d73 | 579 | https://github.com/nevir/groc/blob/291b1ecf56d55b5aa565e08645b67e5e1a3d4d73/lib/project.coffee | 5 | 54 |
nevir/groc:lib/project.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Project;
Project = (function() {
class Project {
constructor(root, outPath, minLogLevel = Logger.prototype.INFO) {
this.log = new Logger(minLogLevel);
// * Has a single root directory that contains (most of) it.
this.root = path.resolve... | class Project
constructor: (root, outPath, minLogLevel=Logger::INFO) ->
@log = new Logger minLogLevel
# * Has a single root directory that contains (most of) it.
@root = path.resolve root
# * Generally wants documented generated somewhere within its tree. We default the output path
# to be rel... | JavaScript | CoffeeScript | nevir/groc | lib/project.coffee | MIT | 291b1ecf56d55b5aa565e08645b67e5e1a3d4d73 | 579 | https://github.com/nevir/groc/blob/291b1ecf56d55b5aa565e08645b67e5e1a3d4d73/lib/project.coffee | 5 | 54 |
nevir/groc:lib/project.coffee:1:completion | completion | class Project
constructor: (root, outPath, minLogLevel=Logger::INFO) ->
@log = new Logger minLogLevel
# * Has a single root directory that contains (most of) it.
@root = path.resolve root
# * Generally wants documented generated somewhere within its tree. We default the output path
# to be rel... | if stats.isFile()
@files.push absPath
# Or directories to be recursively walked to find all files under them.
else if stats.isDirectory()
@add path.join fileOrDir, p for p in fs.readdirSync fileOrDir when path.basename(p)[0] != '.'
# Adds a path prefix that should be stripped from source file pa... | CoffeeScript | CoffeeScript | nevir/groc | lib/project.coffee | MIT | 291b1ecf56d55b5aa565e08645b67e5e1a3d4d73 | 579 | https://github.com/nevir/groc/blob/291b1ecf56d55b5aa565e08645b67e5e1a3d4d73/lib/project.coffee | 5 | 54 |
nevir/groc:lib/project.coffee:2:raw_corpus | raw_corpus | # We want to support multiple documentation styles, but we don't expect to have a stable API for
# that just yet.
style = new styles.default.Style @
fileMap = Utils.mapFiles @files, @stripPrefixes
# If we were given an index file, map that
if @index
indexPath = path.resolve @root, @index
... | CoffeeScript | nevir/groc | lib/project.coffee | MIT | 291b1ecf56d55b5aa565e08645b67e5e1a3d4d73 | 579 | https://github.com/nevir/groc/blob/291b1ecf56d55b5aa565e08645b67e5e1a3d4d73/lib/project.coffee | 55 | 94 | ||
nevir/groc:lib/project.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
# We want to support multiple documentation styles, but we don't expect to have a stable API for
# that just yet.
style = new styles.default.Style @
fileMap = Utils.mapFiles @files, @stripPrefixes
# If we were given an index file, map that
if... | // We want to support multiple documentation styles, but we don't expect to have a stable API for
// that just yet.
var fileMap, inFlight, indexPath, k, processFile, style, toProcess;
style = new styles.default.Style(this);
fileMap = Utils.mapFiles(this.files, this.stripPrefixes);
// If we were given an index file, ... | CoffeeScript | JavaScript | nevir/groc | lib/project.coffee | MIT | 291b1ecf56d55b5aa565e08645b67e5e1a3d4d73 | 579 | https://github.com/nevir/groc/blob/291b1ecf56d55b5aa565e08645b67e5e1a3d4d73/lib/project.coffee | 55 | 94 |
nevir/groc:lib/project.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
// We want to support multiple documentation styles, but we don't expect to have a stable API for
// that just yet.
var fileMap, inFlight, indexPath, k, processFile, style, toProcess;
style = new styles.default.Style(this);
fileMap = Utils.mapFiles(this.files, th... | # We want to support multiple documentation styles, but we don't expect to have a stable API for
# that just yet.
style = new styles.default.Style @
fileMap = Utils.mapFiles @files, @stripPrefixes
# If we were given an index file, map that
if @index
indexPath = path.resolve @root, @index
... | JavaScript | CoffeeScript | nevir/groc | lib/project.coffee | MIT | 291b1ecf56d55b5aa565e08645b67e5e1a3d4d73 | 579 | https://github.com/nevir/groc/blob/291b1ecf56d55b5aa565e08645b67e5e1a3d4d73/lib/project.coffee | 55 | 94 |
nevir/groc:lib/project.coffee:2:completion | completion | # We want to support multiple documentation styles, but we don't expect to have a stable API for
# that just yet.
style = new styles.default.Style @
fileMap = Utils.mapFiles @files, @stripPrefixes
# If we were given an index file, map that
if @index
indexPath = path.resolve @root, @index
... | @log.error "Failed to process %s: %s", currentFile, error.message
return callback error
style.renderFile data, currentFile, fileMap[currentFile], (error) =>
return callback error if error
inFlight -= 1
if toProcess.length > 0
processFile()
else
... | CoffeeScript | CoffeeScript | nevir/groc | lib/project.coffee | MIT | 291b1ecf56d55b5aa565e08645b67e5e1a3d4d73 | 579 | https://github.com/nevir/groc/blob/291b1ecf56d55b5aa565e08645b67e5e1a3d4d73/lib/project.coffee | 55 | 94 |
nevir/groc:lib/project.coffee:1:raw_corpus | raw_corpus | class Project
constructor: (root, outPath, minLogLevel=Logger::INFO) ->
@log = new Logger minLogLevel
# * Has a single root directory that contains (most of) it.
@root = path.resolve root
# * Generally wants documented generated somewhere within its tree. We default the output path
# to be rel... | CoffeeScript | nevir/groc | lib/project.coffee | MIT | bf64e810e5b468936ccf8e3dc7ddd9f9955b7bd8 | 579 | https://github.com/nevir/groc/blob/bf64e810e5b468936ccf8e3dc7ddd9f9955b7bd8/lib/project.coffee | 5 | 54 | ||
nevir/groc:lib/project.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Project
constructor: (root, outPath, minLogLevel=Logger::INFO) ->
@log = new Logger minLogLevel
# * Has a single root directory that contains (most of) it.
@root = path.resolve root
# * Generally wants documented generated somewhere withi... | var Project;
Project = (function() {
class Project {
constructor(root, outPath, minLogLevel = Logger.prototype.INFO) {
this.log = new Logger(minLogLevel);
// * Has a single root directory that contains (most of) it.
this.root = path.resolve(root);
// * Generally wants documented generated... | CoffeeScript | JavaScript | nevir/groc | lib/project.coffee | MIT | bf64e810e5b468936ccf8e3dc7ddd9f9955b7bd8 | 579 | https://github.com/nevir/groc/blob/bf64e810e5b468936ccf8e3dc7ddd9f9955b7bd8/lib/project.coffee | 5 | 54 |
nevir/groc:lib/project.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Project;
Project = (function() {
class Project {
constructor(root, outPath, minLogLevel = Logger.prototype.INFO) {
this.log = new Logger(minLogLevel);
// * Has a single root directory that contains (most of) it.
this.root = path.resolve... | class Project
constructor: (root, outPath, minLogLevel=Logger::INFO) ->
@log = new Logger minLogLevel
# * Has a single root directory that contains (most of) it.
@root = path.resolve root
# * Generally wants documented generated somewhere within its tree. We default the output path
# to be rel... | JavaScript | CoffeeScript | nevir/groc | lib/project.coffee | MIT | bf64e810e5b468936ccf8e3dc7ddd9f9955b7bd8 | 579 | https://github.com/nevir/groc/blob/bf64e810e5b468936ccf8e3dc7ddd9f9955b7bd8/lib/project.coffee | 5 | 54 |
nevir/groc:lib/project.coffee:1:completion | completion | class Project
constructor: (root, outPath, minLogLevel=Logger::INFO) ->
@log = new Logger minLogLevel
# * Has a single root directory that contains (most of) it.
@root = path.resolve root
# * Generally wants documented generated somewhere within its tree. We default the output path
# to be rel... | @files.push absPath
# Or directories to be recursively walked to find all files under them.
else if stats.isDirectory()
@add path.join fileOrDir, p for p in fs.readdirSync fileOrDir when path.basename(p)[0] != '.'
# Adds a path prefix that should be stripped from source file paths in order to generate... | CoffeeScript | CoffeeScript | nevir/groc | lib/project.coffee | MIT | bf64e810e5b468936ccf8e3dc7ddd9f9955b7bd8 | 579 | https://github.com/nevir/groc/blob/bf64e810e5b468936ccf8e3dc7ddd9f9955b7bd8/lib/project.coffee | 5 | 54 |
nevir/groc:lib/project.coffee:2:raw_corpus | raw_corpus | fileMap = Utils.mapFiles @files, @stripPrefixes
toProcess = (k for k of fileMap)
inFlight = 0
processFile = =>
currentFile = toProcess.pop()
inFlight += 1
@log.trace "Processing %s (%d in flight)", currentFile, inFlight
fs.readFile currentFile, 'utf-8', (error, data) =>
... | CoffeeScript | nevir/groc | lib/project.coffee | MIT | bf64e810e5b468936ccf8e3dc7ddd9f9955b7bd8 | 579 | https://github.com/nevir/groc/blob/bf64e810e5b468936ccf8e3dc7ddd9f9955b7bd8/lib/project.coffee | 55 | 86 | ||
nevir/groc:lib/project.coffee:2:completion | completion | fileMap = Utils.mapFiles @files, @stripPrefixes
toProcess = (k for k of fileMap)
inFlight = 0
processFile = =>
currentFile = toProcess.pop()
inFlight += 1
@log.trace "Processing %s (%d in flight)", currentFile, inFlight
fs.readFile currentFile, 'utf-8', (error, data) =>
... | return callback error if error
inFlight -= 1
if toProcess.length > 0
processFile()
else
if inFlight == 0
style.renderCompleted (error) =>
return callback error if error
@log.info ''
@log.pass 'Documenta... | CoffeeScript | CoffeeScript | nevir/groc | lib/project.coffee | MIT | bf64e810e5b468936ccf8e3dc7ddd9f9955b7bd8 | 579 | https://github.com/nevir/groc/blob/bf64e810e5b468936ccf8e3dc7ddd9f9955b7bd8/lib/project.coffee | 55 | 86 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/test/test_comprehensions.coffee:1:raw_corpus | raw_corpus | store: (obj) -> result: obj
store (x * 2 for x in [3, 2, 1])
ok result.join(' ') is '6 4 2'
# Closure-wrapped comprehensions that refer to the "arguments" object. | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/test/test_comprehensions.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/test/test_comprehensions.coffee | 91 | 97 | ||
twilson63/express-coffee:lib/coffee/lib/coffee-script/test/test_comprehensions.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
store: (obj) -> result: obj
store (x * 2 for x in [3, 2, 1])
ok result.join(' ') is '6 4 2'
# Closure-wrapped comprehensions that refer to the "arguments" object.
``` | var x;
({
store: function(obj) {
return {
result: obj
};
}
});
store((function() {
var i, len, ref, results;
ref = [3, 2, 1];
results = [];
for (i = 0, len = ref.length; i < len; i++) {
x = ref[i];
results.push(x * 2);
}
return results;
})());
ok(result.join(' ') === '6 4 2');
... | CoffeeScript | JavaScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/test/test_comprehensions.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/test/test_comprehensions.coffee | 91 | 97 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/test/test_comprehensions.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var x;
({
store: function(obj) {
return {
result: obj
};
}
});
store((function() {
var i, len, ref, results;
ref = [3, 2, 1];
results = [];
for (i = 0, len = ref.length; i < len; i++) {
x = ref[i];
results.push(x * 2);
}
retu... | store: (obj) -> result: obj
store (x * 2 for x in [3, 2, 1])
ok result.join(' ') is '6 4 2'
# Closure-wrapped comprehensions that refer to the "arguments" object. | JavaScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/test/test_comprehensions.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/test/test_comprehensions.coffee | 91 | 97 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/test/test_comprehensions.coffee:1:completion | completion | store: (obj) -> result: obj
store (x * 2 for x in [3, 2, 1]) | ok result.join(' ') is '6 4 2'
# Closure-wrapped comprehensions that refer to the "arguments" object. | CoffeeScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/test/test_comprehensions.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/test/test_comprehensions.coffee | 91 | 97 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/test/test_comprehensions.coffee:2:raw_corpus | raw_corpus | expr: ->
result: item * item for item in arguments
ok expr(2, 4, 8).join(' ') is '4 16 64' | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/test/test_comprehensions.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/test/test_comprehensions.coffee | 98 | 101 | ||
twilson63/express-coffee:lib/coffee/lib/coffee-script/test/test_comprehensions.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
expr: ->
result: item * item for item in arguments
ok expr(2, 4, 8).join(' ') is '4 16 64'
``` | ({
expr: function() {
var i, item, len, results;
results = [];
for (i = 0, len = arguments.length; i < len; i++) {
item = arguments[i];
results.push({
result: item * item
});
}
return results;
}
});
ok(expr(2, 4, 8).join(' ') === '4 16 64'); | CoffeeScript | JavaScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/test/test_comprehensions.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/test/test_comprehensions.coffee | 98 | 101 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/test/test_comprehensions.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
expr: function() {
var i, item, len, results;
results = [];
for (i = 0, len = arguments.length; i < len; i++) {
item = arguments[i];
results.push({
result: item * item
});
}
return results;
}
});
ok(expr(2, 4, 8... | expr: ->
result: item * item for item in arguments
ok expr(2, 4, 8).join(' ') is '4 16 64' | JavaScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/test/test_comprehensions.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/test/test_comprehensions.coffee | 98 | 101 |
twilson63/express-coffee:lib/coffee/lib/coffee-script/test/test_comprehensions.coffee:2:completion | completion | expr: ->
result: item * item for item in arguments | ok expr(2, 4, 8).join(' ') is '4 16 64' | CoffeeScript | CoffeeScript | twilson63/express-coffee | lib/coffee/lib/coffee-script/test/test_comprehensions.coffee | MIT | 971837f7d7a5e96cf5a5fdb52e52748060ed2c68 | 622 | https://github.com/twilson63/express-coffee/blob/971837f7d7a5e96cf5a5fdb52e52748060ed2c68/lib/coffee/lib/coffee-script/test/test_comprehensions.coffee | 98 | 101 |
jianliaoim/talk-os:talk-account/server/schemas/email.coffee:1:raw_corpus | raw_corpus | module.exports = EmailSchema = new Schema
emailAddress: type: String, trim: true
user: type: Schema.Types.ObjectId, ref: 'User'
createdAt: type: Date, default: Date.now
updatedAt: type: Date, default: Date.now
,
read: 'secondaryPreferred'
toObject:
virtuals: true
getters: true
toJSON:
virtuals... | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/email.coffee | 13 | 33 | ||
jianliaoim/talk-os:talk-account/server/schemas/email.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = EmailSchema = new Schema
emailAddress: type: String, trim: true
user: type: Schema.Types.ObjectId, ref: 'User'
createdAt: type: Date, default: Date.now
updatedAt: type: Date, default: Date.now
,
read: 'secondaryPreferred'
toObject:
... | var EmailSchema;
module.exports = EmailSchema = new Schema({
emailAddress: {
type: String,
trim: true
},
user: {
type: Schema.Types.ObjectId,
ref: 'User'
},
createdAt: {
type: Date,
default: Date.now
},
updatedAt: {
type: Date,
default: Date.now
}
}, {
read: 'secondary... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-account/server/schemas/email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/email.coffee | 13 | 33 |
jianliaoim/talk-os:talk-account/server/schemas/email.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var EmailSchema;
module.exports = EmailSchema = new Schema({
emailAddress: {
type: String,
trim: true
},
user: {
type: Schema.Types.ObjectId,
ref: 'User'
},
createdAt: {
type: Date,
default: Date.now
},
updatedAt: {
type: ... | module.exports = EmailSchema = new Schema
emailAddress: type: String, trim: true
user: type: Schema.Types.ObjectId, ref: 'User'
createdAt: type: Date, default: Date.now
updatedAt: type: Date, default: Date.now
,
read: 'secondaryPreferred'
toObject:
virtuals: true
getters: true
toJSON:
virtuals... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/email.coffee | 13 | 33 |
jianliaoim/talk-os:talk-account/server/schemas/email.coffee:1:completion | completion | module.exports = EmailSchema = new Schema
emailAddress: type: String, trim: true
user: type: Schema.Types.ObjectId, ref: 'User'
createdAt: type: Date, default: Date.now
updatedAt: type: Date, default: Date.now
,
read: 'secondaryPreferred'
toObject:
virtuals: true
getters: true | toJSON:
virtuals: true
getters: true
EmailSchema.virtual 'login'
.get -> 'email'
###*
* 生成绑定信息随机码
* @return {String} bindCode 随机码
### | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/email.coffee | 13 | 33 |
jianliaoim/talk-os:talk-account/server/schemas/email.coffee:2:raw_corpus | raw_corpus | EmailSchema.methods.genBindCode = (callback) ->
bindCode = shortid()
cacheKey = "emailbindcode:#{bindCode}"
data =
_id: @_id
showname: @emailAddress
redis.setex cacheKey, 600, JSON.stringify(data), (err) ->
callback err, bindCode
############################ STATICS ############################
#
#... | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/email.coffee | 34 | 48 | ||
jianliaoim/talk-os:talk-account/server/schemas/email.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
EmailSchema.methods.genBindCode = (callback) ->
bindCode = shortid()
cacheKey = "emailbindcode:#{bindCode}"
data =
_id: @_id
showname: @emailAddress
redis.setex cacheKey, 600, JSON.stringify(data), (err) ->
callback err, bindCode
############... | EmailSchema.methods.genBindCode = function(callback) {
var bindCode, cacheKey, data;
bindCode = shortid();
cacheKey = `emailbindcode:${bindCode}`;
data = {
_id: this._id,
showname: this.emailAddress
};
return redis.setex(cacheKey, 600, JSON.stringify(data), function(err) {
return callback(err, b... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-account/server/schemas/email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/email.coffee | 34 | 48 |
jianliaoim/talk-os:talk-account/server/schemas/email.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
EmailSchema.methods.genBindCode = function(callback) {
var bindCode, cacheKey, data;
bindCode = shortid();
cacheKey = `emailbindcode:${bindCode}`;
data = {
_id: this._id,
showname: this.emailAddress
};
return redis.setex(cacheKey, 600, JSON.stri... | EmailSchema.methods.genBindCode = (callback) ->
bindCode = shortid()
cacheKey = "emailbindcode:#{bindCode}"
data =
_id: @_id
showname: @emailAddress
redis.setex cacheKey, 600, JSON.stringify(data), (err) ->
callback err, bindCode
############################ STATICS ############################
#
#... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/email.coffee | 34 | 48 |
jianliaoim/talk-os:talk-account/server/schemas/email.coffee:2:completion | completion | EmailSchema.methods.genBindCode = (callback) ->
bindCode = shortid()
cacheKey = "emailbindcode:#{bindCode}"
data =
_id: @_id
showname: @emailAddress
redis.setex cacheKey, 600, JSON.stringify(data), (err) -> | callback err, bindCode
############################ STATICS ############################
#
###*
* 验证 bindCode,获取对应 email 对象
* @return {Model} email 对象
### | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/email.coffee | 34 | 48 |
jianliaoim/talk-os:talk-account/server/schemas/email.coffee:3:raw_corpus | raw_corpus | EmailSchema.statics.verifyBindCode = (bindCode, callback) ->
cacheKey = "emailbindcode:#{bindCode}"
EmailModel = this
redis.get cacheKey, (err, data) ->
try
{_id} = JSON.parse data
catch err
return callback(new Err('VERIFY_FAILED')) unless _id
EmailModel.findOne _id: _id, (err, email) ->
... | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/email.coffee | 49 | 68 | ||
jianliaoim/talk-os:talk-account/server/schemas/email.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
EmailSchema.statics.verifyBindCode = (bindCode, callback) ->
cacheKey = "emailbindcode:#{bindCode}"
EmailModel = this
redis.get cacheKey, (err, data) ->
try
{_id} = JSON.parse data
catch err
return callback(new Err('VERIFY_FAILED')) unless... | EmailSchema.statics.verifyBindCode = function(bindCode, callback) {
var EmailModel, cacheKey;
cacheKey = `emailbindcode:${bindCode}`;
EmailModel = this;
return redis.get(cacheKey, function(err, data) {
var _id;
try {
({_id} = JSON.parse(data));
} catch (error) {
err = error;
}
if... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-account/server/schemas/email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/email.coffee | 49 | 68 |
jianliaoim/talk-os:talk-account/server/schemas/email.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
EmailSchema.statics.verifyBindCode = function(bindCode, callback) {
var EmailModel, cacheKey;
cacheKey = `emailbindcode:${bindCode}`;
EmailModel = this;
return redis.get(cacheKey, function(err, data) {
var _id;
try {
({_id} = JSON.parse(data))... | EmailSchema.statics.verifyBindCode = (bindCode, callback) ->
cacheKey = "emailbindcode:#{bindCode}"
EmailModel = this
redis.get cacheKey, (err, data) ->
try
{_id} = JSON.parse data
catch err
return callback(new Err('VERIFY_FAILED')) unless _id
EmailModel.findOne _id: _id, (err, email) ->
... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/email.coffee | 49 | 68 |
jianliaoim/talk-os:talk-account/server/schemas/email.coffee:3:completion | completion | EmailSchema.statics.verifyBindCode = (bindCode, callback) ->
cacheKey = "emailbindcode:#{bindCode}"
EmailModel = this
redis.get cacheKey, (err, data) ->
try
{_id} = JSON.parse data
catch err
return callback(new Err('VERIFY_FAILED')) unless _id
EmailModel.findOne _id: _id, (err, email) ->
... | redis.del cacheKey
callback err, email
###*
* 保存邮箱验证码
* @param {Object} options with emailAddress
* @param {Function} callback
* @return {Object} randomCode: shortId
* @todo 验证手机号格式
### | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/email.coffee | 49 | 68 |
jianliaoim/talk-os:talk-account/server/schemas/email.coffee:4:raw_corpus | raw_corpus | EmailSchema.statics.saveVerifyCode = (options, callback = ->) ->
randomCode = shortid()
cacheKey = "emailverifycode:#{randomCode}"
# 保存新的 verify code
verifyCode = "#{Math.random()}"[2...6]
data =
verifyCode: verifyCode
emailAddress: options.emailAddress
createdAt: Date.now()
$verifyCode = redi... | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/email.coffee | 69 | 89 | ||
jianliaoim/talk-os:talk-account/server/schemas/email.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
EmailSchema.statics.saveVerifyCode = (options, callback = ->) ->
randomCode = shortid()
cacheKey = "emailverifycode:#{randomCode}"
# 保存新的 verify code
verifyCode = "#{Math.random()}"[2...6]
data =
verifyCode: verifyCode
emailAddress: options.ema... | EmailSchema.statics.saveVerifyCode = function(options, callback = function() {}) {
var $verifyCode, cacheKey, data, randomCode, verifyCode;
randomCode = shortid();
cacheKey = `emailverifycode:${randomCode}`;
// 保存新的 verify code
verifyCode = `${Math.random()}`.slice(2, 6);
data = {
verifyCode: verifyCode... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-account/server/schemas/email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/email.coffee | 69 | 89 |
jianliaoim/talk-os:talk-account/server/schemas/email.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
EmailSchema.statics.saveVerifyCode = function(options, callback = function() {}) {
var $verifyCode, cacheKey, data, randomCode, verifyCode;
randomCode = shortid();
cacheKey = `emailverifycode:${randomCode}`;
// 保存新的 verify code
verifyCode = `${Math.random... | EmailSchema.statics.saveVerifyCode = (options, callback = ->) ->
randomCode = shortid()
cacheKey = "emailverifycode:#{randomCode}"
# 保存新的 verify code
verifyCode = "#{Math.random()}"[2...6]
data =
verifyCode: verifyCode
emailAddress: options.emailAddress
createdAt: Date.now()
$verifyCode = redi... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/email.coffee | 69 | 89 |
jianliaoim/talk-os:talk-account/server/schemas/email.coffee:4:completion | completion | EmailSchema.statics.saveVerifyCode = (options, callback = ->) ->
randomCode = shortid()
cacheKey = "emailverifycode:#{randomCode}"
# 保存新的 verify code
verifyCode = "#{Math.random()}"[2...6]
data =
verifyCode: verifyCode
emailAddress: options.emailAddress
createdAt: Date.now() | $verifyCode = redis.setexAsync cacheKey, 3600, JSON.stringify data
.then -> verifyCode
Promise.all [$verifyCode]
.spread (verifyCode) ->
randomCode: randomCode
verifyCode: verifyCode
.nodeify callback | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/email.coffee | 69 | 89 |
jianliaoim/talk-os:talk-account/server/schemas/email.coffee:5:raw_corpus | raw_corpus | EmailSchema.statics.verify = (randomCode, verifyCode, callback) ->
cacheKey = "emailverifycode:#{randomCode}"
redis.get cacheKey, (err, data) ->
try
verifyData = JSON.parse data
catch err
verifyData or= {}
if verifyData.verifyCode?.length and verifyData.verifyCode is verifyCode and
v... | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/email.coffee | 91 | 107 | ||
jianliaoim/talk-os:talk-account/server/schemas/email.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
EmailSchema.statics.verify = (randomCode, verifyCode, callback) ->
cacheKey = "emailverifycode:#{randomCode}"
redis.get cacheKey, (err, data) ->
try
verifyData = JSON.parse data
catch err
verifyData or= {}
if verifyData.verifyCode?.le... | EmailSchema.statics.verify = function(randomCode, verifyCode, callback) {
var cacheKey;
cacheKey = `emailverifycode:${randomCode}`;
return redis.get(cacheKey, function(err, data) {
var ref, ref1, verifyData;
try {
verifyData = JSON.parse(data);
} catch (error) {
err = error;
}
veri... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-account/server/schemas/email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/email.coffee | 91 | 107 |
jianliaoim/talk-os:talk-account/server/schemas/email.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
EmailSchema.statics.verify = function(randomCode, verifyCode, callback) {
var cacheKey;
cacheKey = `emailverifycode:${randomCode}`;
return redis.get(cacheKey, function(err, data) {
var ref, ref1, verifyData;
try {
verifyData = JSON.parse(data);
... | EmailSchema.statics.verify = (randomCode, verifyCode, callback) ->
cacheKey = "emailverifycode:#{randomCode}"
redis.get cacheKey, (err, data) ->
try
verifyData = JSON.parse data
catch err
verifyData or= {}
if verifyData.verifyCode?.length and verifyData.verifyCode is verifyCode and
v... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/email.coffee | 91 | 107 |
jianliaoim/talk-os:talk-account/server/schemas/email.coffee:5:completion | completion | EmailSchema.statics.verify = (randomCode, verifyCode, callback) ->
cacheKey = "emailverifycode:#{randomCode}"
redis.get cacheKey, (err, data) ->
try
verifyData = JSON.parse data
catch err | verifyData or= {}
if verifyData.verifyCode?.length and verifyData.verifyCode is verifyCode and
verifyData.emailAddress?.length
# 邮箱存在且验证码正确
redis.del cacheKey
return callback null, verifyData
callback(new Err('VERIFY_FAILED')) | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-account/server/schemas/email.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-account/server/schemas/email.coffee | 91 | 107 |
nicolaskruchten/pivottable:d3_renderers.coffee:1:raw_corpus | raw_corpus | callWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery"), require("d3")
else if typeof define is "function" and define.amd # AMD
define ["jquery", "d3"], pivotModule
# Plain browser env
else
pivotModule... | CoffeeScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | 8b612144a1b76edbe3eb6df1a420d4d589393c50 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/8b612144a1b76edbe3eb6df1a420d4d589393c50/d3_renderers.coffee | 1 | 50 | ||
nicolaskruchten/pivottable:d3_renderers.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
callWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery"), require("d3")
else if typeof define is "function" and define.amd # AMD
define ["jquery", "d3"], pivotMo... | var callWithJQuery;
callWithJQuery = function(pivotModule) {
if (typeof exports === "object" && typeof module === "object") { // CommonJS
return pivotModule(require("jquery"), require("d3"));
} else if (typeof define === "function" && define.amd) { // AMD
return define(["jquery", "d3"], pivotModule);
} e... | CoffeeScript | JavaScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | 8b612144a1b76edbe3eb6df1a420d4d589393c50 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/8b612144a1b76edbe3eb6df1a420d4d589393c50/d3_renderers.coffee | 1 | 50 |
nicolaskruchten/pivottable:d3_renderers.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var callWithJQuery;
callWithJQuery = function(pivotModule) {
if (typeof exports === "object" && typeof module === "object") { // CommonJS
return pivotModule(require("jquery"), require("d3"));
} else if (typeof define === "function" && define.amd) { // AMD
... | callWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery"), require("d3")
else if typeof define is "function" and define.amd # AMD
define ["jquery", "d3"], pivotModule
# Plain browser env
else
pivotModule... | JavaScript | CoffeeScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | 8b612144a1b76edbe3eb6df1a420d4d589393c50 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/8b612144a1b76edbe3eb6df1a420d4d589393c50/d3_renderers.coffee | 1 | 50 |
nicolaskruchten/pivottable:d3_renderers.coffee:1:completion | completion | callWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery"), require("d3")
else if typeof define is "function" and define.amd # AMD
define ["jquery", "d3"], pivotModule
# Plain browser env
else
pivotModule... | if path.length == 0
tree.value = value
return
tree.children ?= []
x = path.shift()
for child in tree.children when child.name == x
addToTree(child, path, value)
return
newChild = name: x
addToTree... | CoffeeScript | CoffeeScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | 8b612144a1b76edbe3eb6df1a420d4d589393c50 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/8b612144a1b76edbe3eb6df1a420d4d589393c50/d3_renderers.coffee | 1 | 50 |
nicolaskruchten/pivottable:d3_renderers.coffee:1:raw_corpus | raw_corpus | callWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery")
else if typeof define is "function" and define.amd # AMD
define ["jquery"], pivotModule
# Plain browser env
else
pivotModule jQuery
callWithJQue... | CoffeeScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | b0112abdb12247e803f55b734c59d3f215a1cf0b | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/b0112abdb12247e803f55b734c59d3f215a1cf0b/d3_renderers.coffee | 1 | 50 | ||
nicolaskruchten/pivottable:d3_renderers.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
callWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery")
else if typeof define is "function" and define.amd # AMD
define ["jquery"], pivotModule
# Plain brow... | var callWithJQuery;
callWithJQuery = function(pivotModule) {
if (typeof exports === "object" && typeof module === "object") { // CommonJS
return pivotModule(require("jquery"));
} else if (typeof define === "function" && define.amd) { // AMD
return define(["jquery"], pivotModule);
} else {
// Plain br... | CoffeeScript | JavaScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | b0112abdb12247e803f55b734c59d3f215a1cf0b | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/b0112abdb12247e803f55b734c59d3f215a1cf0b/d3_renderers.coffee | 1 | 50 |
nicolaskruchten/pivottable:d3_renderers.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var callWithJQuery;
callWithJQuery = function(pivotModule) {
if (typeof exports === "object" && typeof module === "object") { // CommonJS
return pivotModule(require("jquery"));
} else if (typeof define === "function" && define.amd) { // AMD
return defi... | callWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery")
else if typeof define is "function" and define.amd # AMD
define ["jquery"], pivotModule
# Plain browser env
else
pivotModule jQuery
callWithJQue... | JavaScript | CoffeeScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | b0112abdb12247e803f55b734c59d3f215a1cf0b | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/b0112abdb12247e803f55b734c59d3f215a1cf0b/d3_renderers.coffee | 1 | 50 |
nicolaskruchten/pivottable:d3_renderers.coffee:1:completion | completion | callWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery")
else if typeof define is "function" and define.amd # AMD
define ["jquery"], pivotModule
# Plain browser env
else
pivotModule jQuery
callWithJQue... | if path.length == 0
tree.value = value
return
tree.children ?= []
x = path.shift()
for child in tree.children when child.name == x
addToTree(child, path, value)
return
newChild = name: x
addToTree... | CoffeeScript | CoffeeScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | b0112abdb12247e803f55b734c59d3f215a1cf0b | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/b0112abdb12247e803f55b734c59d3f215a1cf0b/d3_renderers.coffee | 1 | 50 |
nicolaskruchten/pivottable:d3_renderers.coffee:1:raw_corpus | raw_corpus | callWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery")
else if typeof define is "function" and define.amd # AMD
define ["jquery"], pivotModule
# Plain browser env
else
pivotModule jQuery
callWithJQue... | CoffeeScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | e230ebf2d6f806695e7991e8ccf992ac11c0f731 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/e230ebf2d6f806695e7991e8ccf992ac11c0f731/d3_renderers.coffee | 1 | 50 | ||
nicolaskruchten/pivottable:d3_renderers.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
callWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery")
else if typeof define is "function" and define.amd # AMD
define ["jquery"], pivotModule
# Plain brow... | var callWithJQuery;
callWithJQuery = function(pivotModule) {
if (typeof exports === "object" && typeof module === "object") { // CommonJS
return pivotModule(require("jquery"));
} else if (typeof define === "function" && define.amd) { // AMD
return define(["jquery"], pivotModule);
} else {
// Plain br... | CoffeeScript | JavaScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | e230ebf2d6f806695e7991e8ccf992ac11c0f731 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/e230ebf2d6f806695e7991e8ccf992ac11c0f731/d3_renderers.coffee | 1 | 50 |
nicolaskruchten/pivottable:d3_renderers.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var callWithJQuery;
callWithJQuery = function(pivotModule) {
if (typeof exports === "object" && typeof module === "object") { // CommonJS
return pivotModule(require("jquery"));
} else if (typeof define === "function" && define.amd) { // AMD
return defi... | callWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery")
else if typeof define is "function" and define.amd # AMD
define ["jquery"], pivotModule
# Plain browser env
else
pivotModule jQuery
callWithJQue... | JavaScript | CoffeeScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | e230ebf2d6f806695e7991e8ccf992ac11c0f731 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/e230ebf2d6f806695e7991e8ccf992ac11c0f731/d3_renderers.coffee | 1 | 50 |
nicolaskruchten/pivottable:d3_renderers.coffee:1:completion | completion | callWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery")
else if typeof define is "function" and define.amd # AMD
define ["jquery"], pivotModule
# Plain browser env
else
pivotModule jQuery
callWithJQue... | tree.children ?= []
x = path.shift()
for child in tree.children when child.name == x
addToTree(child, path, value)
return
newChild = name: x
addToTree(newChild, path, value)
tree.children.push newChild
for rowKey in piv... | CoffeeScript | CoffeeScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | e230ebf2d6f806695e7991e8ccf992ac11c0f731 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/e230ebf2d6f806695e7991e8ccf992ac11c0f731/d3_renderers.coffee | 1 | 50 |
nicolaskruchten/pivottable:d3_renderers.coffee:2:raw_corpus | raw_corpus | .append("div")
.style("position", "relative")
.style("width", (width + margin*2) + "px")
.style("height", (height + margin*2) + "px")
.style("left", margin + "px")
.style("top", margin + "px")
.datum(tree).selectAll(".node")
... | CoffeeScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | e230ebf2d6f806695e7991e8ccf992ac11c0f731 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/e230ebf2d6f806695e7991e8ccf992ac11c0f731/d3_renderers.coffee | 51 | 70 | ||
nicolaskruchten/pivottable:d3_renderers.coffee:2:completion | completion | .append("div")
.style("position", "relative")
.style("width", (width + margin*2) + "px")
.style("height", (height + margin*2) + "px")
.style("left", margin + "px")
.style("top", margin + "px")
.datum(tree).selectAll(".node")
... | .style("background", (d) -> if d.children? then "lightgrey" else color(d.name) )
.text( (d) -> d.name )
.call ->
this.style("left", (d) -> d.x+"px" )
.style("top", (d) -> d.y+"px" )
.style("width", (d) -> Math.max(0, d.dx - 1... | CoffeeScript | CoffeeScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | e230ebf2d6f806695e7991e8ccf992ac11c0f731 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/e230ebf2d6f806695e7991e8ccf992ac11c0f731/d3_renderers.coffee | 51 | 70 |
nicolaskruchten/pivottable:d3_renderers.coffee:1:raw_corpus | raw_corpus | ncallWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery")
else if typeof define is "function" and define.amd # AMD
define ["jquery"], pivotModule
# Plain browser env
else
pivotModule jQuery
callWithJQu... | CoffeeScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | dd07fc143d3e88611e42c92fc89369d9ce634be6 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/dd07fc143d3e88611e42c92fc89369d9ce634be6/d3_renderers.coffee | 1 | 50 | ||
nicolaskruchten/pivottable:d3_renderers.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
ncallWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery")
else if typeof define is "function" and define.amd # AMD
define ["jquery"], pivotModule
# Plain bro... | var ncallWithJQuery;
ncallWithJQuery = function(pivotModule) {
if (typeof exports === "object" && typeof module === "object") { // CommonJS
return pivotModule(require("jquery"));
} else if (typeof define === "function" && define.amd) { // AMD
return define(["jquery"], pivotModule);
} else {
// Plain ... | CoffeeScript | JavaScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | dd07fc143d3e88611e42c92fc89369d9ce634be6 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/dd07fc143d3e88611e42c92fc89369d9ce634be6/d3_renderers.coffee | 1 | 50 |
nicolaskruchten/pivottable:d3_renderers.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ncallWithJQuery;
ncallWithJQuery = function(pivotModule) {
if (typeof exports === "object" && typeof module === "object") { // CommonJS
return pivotModule(require("jquery"));
} else if (typeof define === "function" && define.amd) { // AMD
return de... | ncallWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery")
else if typeof define is "function" and define.amd # AMD
define ["jquery"], pivotModule
# Plain browser env
else
pivotModule jQuery
callWithJQu... | JavaScript | CoffeeScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | dd07fc143d3e88611e42c92fc89369d9ce634be6 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/dd07fc143d3e88611e42c92fc89369d9ce634be6/d3_renderers.coffee | 1 | 50 |
nicolaskruchten/pivottable:d3_renderers.coffee:1:completion | completion | ncallWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery")
else if typeof define is "function" and define.amd # AMD
define ["jquery"], pivotModule
# Plain browser env
else
pivotModule jQuery
callWithJQu... | tree.children ?= []
x = path.shift()
for child in tree.children when child.name == x
addToTree(child, path, value)
return
newChild = name: x
addToTree(newChild, path, value)
tree.children.push newChild
for rowKey in piv... | CoffeeScript | CoffeeScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | dd07fc143d3e88611e42c92fc89369d9ce634be6 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/dd07fc143d3e88611e42c92fc89369d9ce634be6/d3_renderers.coffee | 1 | 50 |
nicolaskruchten/pivottable:d3_renderers.coffee:1:raw_corpus | raw_corpus | callWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery")
else if typeof define is "function" and define.amd # AMD
define ["jquery"], pivotModule
# Plain browser env
else
pivotModule jQuery
callWithJQue... | CoffeeScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | c08180f08f6d241cc14602623c22eae7a9d69235 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/c08180f08f6d241cc14602623c22eae7a9d69235/d3_renderers.coffee | 1 | 50 | ||
nicolaskruchten/pivottable:d3_renderers.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
callWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery")
else if typeof define is "function" and define.amd # AMD
define ["jquery"], pivotModule
# Plain brow... | var callWithJQuery;
callWithJQuery = function(pivotModule) {
if (typeof exports === "object" && typeof module === "object") { // CommonJS
return pivotModule(require("jquery"));
} else if (typeof define === "function" && define.amd) { // AMD
return define(["jquery"], pivotModule);
} else {
// Plain br... | CoffeeScript | JavaScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | c08180f08f6d241cc14602623c22eae7a9d69235 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/c08180f08f6d241cc14602623c22eae7a9d69235/d3_renderers.coffee | 1 | 50 |
nicolaskruchten/pivottable:d3_renderers.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var callWithJQuery;
callWithJQuery = function(pivotModule) {
if (typeof exports === "object" && typeof module === "object") { // CommonJS
return pivotModule(require("jquery"));
} else if (typeof define === "function" && define.amd) { // AMD
return defi... | callWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery")
else if typeof define is "function" and define.amd # AMD
define ["jquery"], pivotModule
# Plain browser env
else
pivotModule jQuery
callWithJQue... | JavaScript | CoffeeScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | c08180f08f6d241cc14602623c22eae7a9d69235 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/c08180f08f6d241cc14602623c22eae7a9d69235/d3_renderers.coffee | 1 | 50 |
nicolaskruchten/pivottable:d3_renderers.coffee:1:completion | completion | callWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery")
else if typeof define is "function" and define.amd # AMD
define ["jquery"], pivotModule
# Plain browser env
else
pivotModule jQuery
callWithJQue... | tree.children ?= []
x = path.shift()
for child in tree.children when child.name == x
addToTree(child, path, value)
return
newChild = name: x
addToTree(newChild, path, value)
tree.children.push newChild
for rowKey in piv... | CoffeeScript | CoffeeScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | c08180f08f6d241cc14602623c22eae7a9d69235 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/c08180f08f6d241cc14602623c22eae7a9d69235/d3_renderers.coffee | 1 | 50 |
nicolaskruchten/pivottable:d3_renderers.coffee:1:raw_corpus | raw_corpus | (callWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery")
else if typeof define is "function" and define.amd # AMD
define ["jquery"], pivotModule
# Plain browser env
else
pivotModule jQuery
) (jQuery) -... | CoffeeScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | 59fef8bd5b78325d419e21fae8e770b1b6c372b1 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/59fef8bd5b78325d419e21fae8e770b1b6c372b1/d3_renderers.coffee | 1 | 50 | ||
nicolaskruchten/pivottable:d3_renderers.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
(callWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery")
else if typeof define is "function" and define.amd # AMD
define ["jquery"], pivotModule
# Plain bro... | var callWithJQuery;
(callWithJQuery = function(pivotModule) {
if (typeof exports === "object" && typeof module === "object") { // CommonJS
return pivotModule(require("jquery"));
} else if (typeof define === "function" && define.amd) { // AMD
return define(["jquery"], pivotModule);
} else {
// Plain b... | CoffeeScript | JavaScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | 59fef8bd5b78325d419e21fae8e770b1b6c372b1 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/59fef8bd5b78325d419e21fae8e770b1b6c372b1/d3_renderers.coffee | 1 | 50 |
nicolaskruchten/pivottable:d3_renderers.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var callWithJQuery;
(callWithJQuery = function(pivotModule) {
if (typeof exports === "object" && typeof module === "object") { // CommonJS
return pivotModule(require("jquery"));
} else if (typeof define === "function" && define.amd) { // AMD
return def... | (callWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery")
else if typeof define is "function" and define.amd # AMD
define ["jquery"], pivotModule
# Plain browser env
else
pivotModule jQuery
) (jQuery) -... | JavaScript | CoffeeScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | 59fef8bd5b78325d419e21fae8e770b1b6c372b1 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/59fef8bd5b78325d419e21fae8e770b1b6c372b1/d3_renderers.coffee | 1 | 50 |
nicolaskruchten/pivottable:d3_renderers.coffee:1:completion | completion | (callWithJQuery = (pivotModule) ->
if typeof exports is "object" and typeof module is "object" # CommonJS
pivotModule require("jquery")
else if typeof define is "function" and define.amd # AMD
define ["jquery"], pivotModule
# Plain browser env
else
pivotModule jQuery
) (jQuery) -... | x = path.shift()
for child in tree.children when child.name == x
addToTree(child, path, value)
return
newChild = name: x
addToTree(newChild, path, value)
tree.children.push newChild
for rowKey in pivotData.getRowKeys()
... | CoffeeScript | CoffeeScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | 59fef8bd5b78325d419e21fae8e770b1b6c372b1 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/59fef8bd5b78325d419e21fae8e770b1b6c372b1/d3_renderers.coffee | 1 | 50 |
nicolaskruchten/pivottable:d3_renderers.coffee:2:raw_corpus | raw_corpus | .style("position", "relative")
.style("width", (width + margin*2) + "px")
.style("height", (height + margin*2) + "px")
.style("left", margin + "px")
.style("top", margin + "px")
.datum(tree).selectAll(".node")
.data(treemap.padd... | CoffeeScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | 59fef8bd5b78325d419e21fae8e770b1b6c372b1 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/59fef8bd5b78325d419e21fae8e770b1b6c372b1/d3_renderers.coffee | 51 | 69 | ||
nicolaskruchten/pivottable:d3_renderers.coffee:2:completion | completion | .style("position", "relative")
.style("width", (width + margin*2) + "px")
.style("height", (height + margin*2) + "px")
.style("left", margin + "px")
.style("top", margin + "px")
.datum(tree).selectAll(".node")
.data(treemap.padd... | .style("background", (d) -> if d.children? then "lightgrey" else color(d.name) )
.text( (d) -> d.name )
.call ->
this.style("left", (d) -> d.x+"px" )
.style("top", (d) -> d.y+"px" )
.style("width", (d) -> Math.max(0, d.dx - 1... | CoffeeScript | CoffeeScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | 59fef8bd5b78325d419e21fae8e770b1b6c372b1 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/59fef8bd5b78325d419e21fae8e770b1b6c372b1/d3_renderers.coffee | 51 | 69 |
nicolaskruchten/pivottable:d3_renderers.coffee:1:raw_corpus | raw_corpus | $ = jQuery
$.pivotUtilities.d3_renderers = Treemap: (pivotData, opts) ->
defaults =
localeStrings: {}
opts = $.extend defaults, opts
result = $("<div style='width: 100%; height: 100%;'>")
tree = name: "All", children: []
addToTree = (tree, path, value) ->
if path.length == 0
... | CoffeeScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | 787583f7b4b0c6757e2366b53e1c62a57718af21 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/787583f7b4b0c6757e2366b53e1c62a57718af21/d3_renderers.coffee | 1 | 50 | ||
nicolaskruchten/pivottable:d3_renderers.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
$ = jQuery
$.pivotUtilities.d3_renderers = Treemap: (pivotData, opts) ->
defaults =
localeStrings: {}
opts = $.extend defaults, opts
result = $("<div style='width: 100%; height: 100%;'>")
tree = name: "All", children: []
addToTree... | var $;
$ = jQuery;
$.pivotUtilities.d3_renderers = {
Treemap: function(pivotData, opts) {
var addToTree, color, defaults, height, i, len, margin, ref, result, rowKey, tree, treemap, value, width;
defaults = {
localeStrings: {}
};
opts = $.extend(defaults, opts);
result = $("<div style='wid... | CoffeeScript | JavaScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | 787583f7b4b0c6757e2366b53e1c62a57718af21 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/787583f7b4b0c6757e2366b53e1c62a57718af21/d3_renderers.coffee | 1 | 50 |
nicolaskruchten/pivottable:d3_renderers.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var $;
$ = jQuery;
$.pivotUtilities.d3_renderers = {
Treemap: function(pivotData, opts) {
var addToTree, color, defaults, height, i, len, margin, ref, result, rowKey, tree, treemap, value, width;
defaults = {
localeStrings: {}
};
opts = $.... | $ = jQuery
$.pivotUtilities.d3_renderers = Treemap: (pivotData, opts) ->
defaults =
localeStrings: {}
opts = $.extend defaults, opts
result = $("<div style='width: 100%; height: 100%;'>")
tree = name: "All", children: []
addToTree = (tree, path, value) ->
if path.length == 0
... | JavaScript | CoffeeScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | 787583f7b4b0c6757e2366b53e1c62a57718af21 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/787583f7b4b0c6757e2366b53e1c62a57718af21/d3_renderers.coffee | 1 | 50 |
nicolaskruchten/pivottable:d3_renderers.coffee:1:completion | completion | $ = jQuery
$.pivotUtilities.d3_renderers = Treemap: (pivotData, opts) ->
defaults =
localeStrings: {}
opts = $.extend defaults, opts
result = $("<div style='width: 100%; height: 100%;'>")
tree = name: "All", children: []
addToTree = (tree, path, value) ->
if path.length == 0
... | for rowKey in pivotData.getRowKeys()
value = pivotData.getAggregator(rowKey, []).value()
if value?
addToTree(tree, rowKey, value)
color = d3.scale.category10()
width = $(window).width() / 1.4
height = $(window).height() / 1.4
margin = 10
treemap = d3.layout.treemap()
... | CoffeeScript | CoffeeScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | 787583f7b4b0c6757e2366b53e1c62a57718af21 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/787583f7b4b0c6757e2366b53e1c62a57718af21/d3_renderers.coffee | 1 | 50 |
nicolaskruchten/pivottable:d3_renderers.coffee:2:raw_corpus | raw_corpus | .attr("class", "node")
.style("background", (d) -> if d.children? then "lightgrey" else color(d.name) )
.text( (d) -> d.name )
.call ->
this.style("left", (d) -> d.x+"px" )
.style("top", (d) -> d.y+"px" )
.style("width", (d) -> Mat... | CoffeeScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | 787583f7b4b0c6757e2366b53e1c62a57718af21 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/787583f7b4b0c6757e2366b53e1c62a57718af21/d3_renderers.coffee | 51 | 61 | ||
nicolaskruchten/pivottable:d3_renderers.coffee:2:completion | completion | .attr("class", "node")
.style("background", (d) -> if d.children? then "lightgrey" else color(d.name) )
.text( (d) -> d.name )
.call ->
this.style("left", (d) -> d.x+"px" ) | .style("top", (d) -> d.y+"px" )
.style("width", (d) -> Math.max(0, d.dx - 1)+"px" )
.style("height",(d) -> Math.max(0, d.dy - 1)+"px" )
return
return result | CoffeeScript | CoffeeScript | nicolaskruchten/pivottable | d3_renderers.coffee | MIT | 787583f7b4b0c6757e2366b53e1c62a57718af21 | 4,440 | https://github.com/nicolaskruchten/pivottable/blob/787583f7b4b0c6757e2366b53e1c62a57718af21/d3_renderers.coffee | 51 | 61 |
jianliaoim/talk-os:talk-web/client/app/overview.coffee:1:raw_corpus | raw_corpus | React = require 'react'
moment = require 'moment'
Immutable = require 'immutable'
find = require '../util/find'
actions = require '../actions/index'
handlers = require '../handlers/index'
Icon = React.createFactory require '../module/icon'
TeamCard = React.createFactory require './team-card'
ActivityItem = React.crea... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/overview.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/overview.coffee | 1 | 50 | ||
jianliaoim/talk-os:talk-web/client/app/overview.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
React = require 'react'
moment = require 'moment'
Immutable = require 'immutable'
find = require '../util/find'
actions = require '../actions/index'
handlers = require '../handlers/index'
Icon = React.createFactory require '../module/icon'
TeamCard = React.crea... | var ActivityContainer, ActivityItem, ActivitySection, Icon, Immutable, React, TeamCard, TimelineList, a, actions, div, find, handlers, li, moment, span, ul;
React = require('react');
moment = require('moment');
Immutable = require('immutable');
find = require('../util/find');
actions = require('../actions/index');... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/app/overview.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/overview.coffee | 1 | 50 |
jianliaoim/talk-os:talk-web/client/app/overview.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var ActivityContainer, ActivityItem, ActivitySection, Icon, Immutable, React, TeamCard, TimelineList, a, actions, div, find, handlers, li, moment, span, ul;
React = require('react');
moment = require('moment');
Immutable = require('immutable');
find = require('... | React = require 'react'
moment = require 'moment'
Immutable = require 'immutable'
find = require '../util/find'
actions = require '../actions/index'
handlers = require '../handlers/index'
Icon = React.createFactory require '../module/icon'
TeamCard = React.createFactory require './team-card'
ActivityItem = React.crea... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/overview.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/overview.coffee | 1 | 50 |
jianliaoim/talk-os:talk-web/client/app/overview.coffee:1:completion | completion | React = require 'react'
moment = require 'moment'
Immutable = require 'immutable'
find = require '../util/find'
actions = require '../actions/index'
handlers = require '../handlers/index'
Icon = React.createFactory require '../module/icon'
TeamCard = React.createFactory require './team-card'
ActivityItem = React.crea... | transformedData: React.PropTypes.instanceOf(Immutable.List).isRequired
onClose: ->
handlers.router.back()
onRequestNextActivities: ->
_maxId = @props.transformedData.last().get('data').last().get('_id')
actions.activities.getByMaxId @props.team.get('_id'), _maxId
onRequestPrevActivities: ->
_mi... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/overview.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/overview.coffee | 1 | 50 |
jianliaoim/talk-os:talk-web/client/app/overview.coffee:2:raw_corpus | raw_corpus | v.get('months').map (v, k) =>
onClick = => @onRequestSpecificActivities v.get 'value'
li key: k,
a onClick: onClick, v.get 'display'
ActivityContainer
stage: @props.stage
isEmpty: @props.transformedData.size is 0
onRequestAfter: @onRequestN... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/overview.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/overview.coffee | 51 | 72 | ||
jianliaoim/talk-os:talk-web/client/app/overview.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
v.get('months').map (v, k) =>
onClick = => @onRequestSpecificActivities v.get 'value'
li key: k,
a onClick: onClick, v.get 'display'
ActivityContainer
stage: @props.stage
isEmpty: @props.tran... | v.get('months').map((v, k) => {
var onClick;
onClick = () => {
return this.onRequestSpecificActivities(v.get('value'));
};
return li({
key: k
}, a({
onClick: onClick
}, v.get('display')));
});
ActivityContainer({
stage: this.props.stage,
isEmpty: this.props.transformedData.size === 0,
onR... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/app/overview.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/overview.coffee | 51 | 72 |
jianliaoim/talk-os:talk-web/client/app/overview.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
v.get('months').map((v, k) => {
var onClick;
onClick = () => {
return this.onRequestSpecificActivities(v.get('value'));
};
return li({
key: k
}, a({
onClick: onClick
}, v.get('display')));
});
ActivityContainer({
stage: this.props.stage,
... | v.get('months').map (v, k) =>
onClick = => @onRequestSpecificActivities v.get 'value'
li key: k,
a onClick: onClick, v.get 'display'
ActivityContainer
stage: @props.stage
isEmpty: @props.transformedData.size is 0
onRequestAfter: @onRequestN... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/overview.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/overview.coffee | 51 | 72 |
jianliaoim/talk-os:talk-web/client/app/overview.coffee:2:completion | completion | v.get('months').map (v, k) =>
onClick = => @onRequestSpecificActivities v.get 'value'
li key: k,
a onClick: onClick, v.get 'display'
ActivityContainer
stage: @props.stage
isEmpty: @props.transformedData.size is 0
onRequestAfter: @onRequestN... | if v.get('data').size > 0
ul className: 'activity-list',
v.get('data').map (v, k) ->
li key: v.get('_id'), className: 'activity-cell',
ActivityItem activity: v
TeamCard
team: @props.team
contacts: @props.contacts
invitatio... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/overview.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/overview.coffee | 51 | 72 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.