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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
buttercoin/buttercoin:test/test_helper.coffee:1:completion | completion | Q = require('q')
global.chai = require 'chai'
chai.should()
global.expect = chai.expect
global.assert = chai.assert
global.sinon = require('sinon')
global.logger = require('../lib/logger')
fs = require('fs')
module.exports = class TestHelpers | constructor: ->
@clean_state_sync: ->
if fs.existsSync 'journal.log'
Q.fcall =>
fs.unlinkSync 'journal.log'
.end()
if fs.existsSync 'test.log'
Q.fcall =>
fs.unlinkSync 'test.log'
.end() | CoffeeScript | CoffeeScript | buttercoin/buttercoin | test/test_helper.coffee | MIT | 1f186911398a725c15be4770d1a60bffb6454c4e | 663 | https://github.com/buttercoin/buttercoin/blob/1f186911398a725c15be4770d1a60bffb6454c4e/test/test_helper.coffee | 1 | 24 |
buttercoin/buttercoin:test/test_helper.coffee:1:raw_corpus | raw_corpus | global.chai = require 'chai'
chai.should()
global.expect = chai.expect
global.assert = chai.assert
global.sinon = require('sinon')
global.logger = require('../lib/logger')
fs = require('fs')
module.exports = class TestHelpers
constructor: ->
@clean_state_sync: ->
if fs.existsSync 'transaction.log'
fs.... | CoffeeScript | buttercoin/buttercoin | test/test_helper.coffee | MIT | 390aea79a869c4571274a3711edaad98028d141a | 663 | https://github.com/buttercoin/buttercoin/blob/390aea79a869c4571274a3711edaad98028d141a/test/test_helper.coffee | 1 | 19 | ||
buttercoin/buttercoin:test/test_helper.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
global.chai = require 'chai'
chai.should()
global.expect = chai.expect
global.assert = chai.assert
global.sinon = require('sinon')
global.logger = require('../lib/logger')
fs = require('fs')
module.exports = class TestHelpers
constructor: ->
@clean_state_... | var TestHelpers, fs;
global.chai = require('chai');
chai.should();
global.expect = chai.expect;
global.assert = chai.assert;
global.sinon = require('sinon');
global.logger = require('../lib/logger');
fs = require('fs');
module.exports = TestHelpers = class TestHelpers {
constructor() {}
static clean_state_... | CoffeeScript | JavaScript | buttercoin/buttercoin | test/test_helper.coffee | MIT | 390aea79a869c4571274a3711edaad98028d141a | 663 | https://github.com/buttercoin/buttercoin/blob/390aea79a869c4571274a3711edaad98028d141a/test/test_helper.coffee | 1 | 19 |
buttercoin/buttercoin:test/test_helper.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var TestHelpers, fs;
global.chai = require('chai');
chai.should();
global.expect = chai.expect;
global.assert = chai.assert;
global.sinon = require('sinon');
global.logger = require('../lib/logger');
fs = require('fs');
module.exports = TestHelpers = class ... | global.chai = require 'chai'
chai.should()
global.expect = chai.expect
global.assert = chai.assert
global.sinon = require('sinon')
global.logger = require('../lib/logger')
fs = require('fs')
module.exports = class TestHelpers
constructor: ->
@clean_state_sync: ->
if fs.existsSync 'transaction.log'
fs.... | JavaScript | CoffeeScript | buttercoin/buttercoin | test/test_helper.coffee | MIT | 390aea79a869c4571274a3711edaad98028d141a | 663 | https://github.com/buttercoin/buttercoin/blob/390aea79a869c4571274a3711edaad98028d141a/test/test_helper.coffee | 1 | 19 |
buttercoin/buttercoin:test/test_helper.coffee:1:completion | completion | global.chai = require 'chai'
chai.should()
global.expect = chai.expect
global.assert = chai.assert
global.sinon = require('sinon')
global.logger = require('../lib/logger')
fs = require('fs') | module.exports = class TestHelpers
constructor: ->
@clean_state_sync: ->
if fs.existsSync 'transaction.log'
fs.unlinkSync 'transaction.log'
if fs.existsSync 'test.log'
fs.unlinkSync 'test.log' | CoffeeScript | CoffeeScript | buttercoin/buttercoin | test/test_helper.coffee | MIT | 390aea79a869c4571274a3711edaad98028d141a | 663 | https://github.com/buttercoin/buttercoin/blob/390aea79a869c4571274a3711edaad98028d141a/test/test_helper.coffee | 1 | 19 |
buttercoin/buttercoin:test/test_helper.coffee:1:raw_corpus | raw_corpus | global.chai = require 'chai'
chai.should()
global.expect = chai.expect
global.assert = chai.assert
global.logger = require('../lib/logger')
fs = require('fs')
module.exports = class TestHelpers
constructor: ->
@clean_state_sync: ->
if fs.existsSync 'transaction.log'
fs.unlinkSync 'transaction.log'
... | CoffeeScript | buttercoin/buttercoin | test/test_helper.coffee | MIT | db5e4cf6ff27f1719cbb36c2e726770cdff9b041 | 663 | https://github.com/buttercoin/buttercoin/blob/db5e4cf6ff27f1719cbb36c2e726770cdff9b041/test/test_helper.coffee | 1 | 18 | ||
buttercoin/buttercoin:test/test_helper.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
global.chai = require 'chai'
chai.should()
global.expect = chai.expect
global.assert = chai.assert
global.logger = require('../lib/logger')
fs = require('fs')
module.exports = class TestHelpers
constructor: ->
@clean_state_sync: ->
if fs.existsSync 't... | var TestHelpers, fs;
global.chai = require('chai');
chai.should();
global.expect = chai.expect;
global.assert = chai.assert;
global.logger = require('../lib/logger');
fs = require('fs');
module.exports = TestHelpers = class TestHelpers {
constructor() {}
static clean_state_sync() {
if (fs.existsSync('tr... | CoffeeScript | JavaScript | buttercoin/buttercoin | test/test_helper.coffee | MIT | db5e4cf6ff27f1719cbb36c2e726770cdff9b041 | 663 | https://github.com/buttercoin/buttercoin/blob/db5e4cf6ff27f1719cbb36c2e726770cdff9b041/test/test_helper.coffee | 1 | 18 |
buttercoin/buttercoin:test/test_helper.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var TestHelpers, fs;
global.chai = require('chai');
chai.should();
global.expect = chai.expect;
global.assert = chai.assert;
global.logger = require('../lib/logger');
fs = require('fs');
module.exports = TestHelpers = class TestHelpers {
constructor() {}
... | global.chai = require 'chai'
chai.should()
global.expect = chai.expect
global.assert = chai.assert
global.logger = require('../lib/logger')
fs = require('fs')
module.exports = class TestHelpers
constructor: ->
@clean_state_sync: ->
if fs.existsSync 'transaction.log'
fs.unlinkSync 'transaction.log'
... | JavaScript | CoffeeScript | buttercoin/buttercoin | test/test_helper.coffee | MIT | db5e4cf6ff27f1719cbb36c2e726770cdff9b041 | 663 | https://github.com/buttercoin/buttercoin/blob/db5e4cf6ff27f1719cbb36c2e726770cdff9b041/test/test_helper.coffee | 1 | 18 |
buttercoin/buttercoin:test/test_helper.coffee:1:completion | completion | global.chai = require 'chai'
chai.should()
global.expect = chai.expect
global.assert = chai.assert
global.logger = require('../lib/logger')
fs = require('fs') | module.exports = class TestHelpers
constructor: ->
@clean_state_sync: ->
if fs.existsSync 'transaction.log'
fs.unlinkSync 'transaction.log'
if fs.existsSync 'test.log'
fs.unlinkSync 'test.log' | CoffeeScript | CoffeeScript | buttercoin/buttercoin | test/test_helper.coffee | MIT | db5e4cf6ff27f1719cbb36c2e726770cdff9b041 | 663 | https://github.com/buttercoin/buttercoin/blob/db5e4cf6ff27f1719cbb36c2e726770cdff9b041/test/test_helper.coffee | 1 | 18 |
js2coffee/js2coffee:lib/report_specs.coffee:1:raw_corpus | raw_corpus | ###
# Generates spec notes (specs.md), invoked via a Makefile
###
{eachGroup} = require('./specs_iterator')
eachGroup (group) ->
return if group.pending
console.log "## #{group.name}\n"
console.log "<table width='100%'>"
for spec in group.specs
console.log """
<tr>
<th width='33%' valign='to... | CoffeeScript | js2coffee/js2coffee | lib/report_specs.coffee | MIT | 6aece4c876bf67af93fc9f81339b7f1a66a4608e | 2,082 | https://github.com/js2coffee/js2coffee/blob/6aece4c876bf67af93fc9f81339b7f1a66a4608e/lib/report_specs.coffee | 1 | 26 | ||
js2coffee/js2coffee:lib/report_specs.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
###
# Generates spec notes (specs.md), invoked via a Makefile
###
{eachGroup} = require('./specs_iterator')
eachGroup (group) ->
return if group.pending
console.log "## #{group.name}\n"
console.log "<table width='100%'>"
for spec in group.specs
co... | /*
* Generates spec notes (specs.md), invoked via a Makefile
*/
var eachGroup;
({eachGroup} = require('./specs_iterator'));
eachGroup(function(group) {
var i, len, ref, spec;
if (group.pending) {
return;
}
console.log(`## ${group.name}\n`);
console.log("<table width='100%'>");
ref = group.specs;
f... | CoffeeScript | JavaScript | js2coffee/js2coffee | lib/report_specs.coffee | MIT | 6aece4c876bf67af93fc9f81339b7f1a66a4608e | 2,082 | https://github.com/js2coffee/js2coffee/blob/6aece4c876bf67af93fc9f81339b7f1a66a4608e/lib/report_specs.coffee | 1 | 26 |
js2coffee/js2coffee:lib/report_specs.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
/*
* Generates spec notes (specs.md), invoked via a Makefile
*/
var eachGroup;
({eachGroup} = require('./specs_iterator'));
eachGroup(function(group) {
var i, len, ref, spec;
if (group.pending) {
return;
}
console.log(`## ${group.name}\n`);
consol... | ###
# Generates spec notes (specs.md), invoked via a Makefile
###
{eachGroup} = require('./specs_iterator')
eachGroup (group) ->
return if group.pending
console.log "## #{group.name}\n"
console.log "<table width='100%'>"
for spec in group.specs
console.log """
<tr>
<th width='33%' valign='to... | JavaScript | CoffeeScript | js2coffee/js2coffee | lib/report_specs.coffee | MIT | 6aece4c876bf67af93fc9f81339b7f1a66a4608e | 2,082 | https://github.com/js2coffee/js2coffee/blob/6aece4c876bf67af93fc9f81339b7f1a66a4608e/lib/report_specs.coffee | 1 | 26 |
js2coffee/js2coffee:lib/report_specs.coffee:1:completion | completion | ###
# Generates spec notes (specs.md), invoked via a Makefile
###
{eachGroup} = require('./specs_iterator')
eachGroup (group) ->
return if group.pending
console.log "## #{group.name}\n"
console.log "<table width='100%'>"
for spec in group.specs | console.log """
<tr>
<th width='33%' valign='top'>#{spec.name}</th>
<td width='33%' valign='top'>
<pre><code class='lang-js'>#{spec.input}</code></pre>
</td>
<td width='33%' valign='top'>
<pre><code class='lang-coffee'>#{spec.output}</code></pre>
</td>
</tr>
"""... | CoffeeScript | CoffeeScript | js2coffee/js2coffee | lib/report_specs.coffee | MIT | 6aece4c876bf67af93fc9f81339b7f1a66a4608e | 2,082 | https://github.com/js2coffee/js2coffee/blob/6aece4c876bf67af93fc9f81339b7f1a66a4608e/lib/report_specs.coffee | 1 | 26 |
Atraci/Atraci:coffee/_settingsPanel.coffee:1:raw_corpus | raw_corpus | class SettingsPanel
constructor: ->
# Selectors
@settingsPanel = $('#settings-panel')
@settingsBtn = $('#Settings .settings')
@devToolsBtn = $('.devTools')
@clearCacheBtn = $('.clearCache')
@resetDatabaseBtn = $('.resetDatabase')
@languageSelect = $('#LanguageSelect')
@themeSelect = $(... | CoffeeScript | Atraci/Atraci | coffee/_settingsPanel.coffee | MIT | d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca | 800 | https://github.com/Atraci/Atraci/blob/d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca/coffee/_settingsPanel.coffee | 3 | 52 | ||
Atraci/Atraci:coffee/_settingsPanel.coffee:1:completion | completion | class SettingsPanel
constructor: ->
# Selectors
@settingsPanel = $('#settings-panel')
@settingsBtn = $('#Settings .settings')
@devToolsBtn = $('.devTools')
@clearCacheBtn = $('.clearCache')
@resetDatabaseBtn = $('.resetDatabase')
@languageSelect = $('#LanguageSelect')
@themeSelect = $(... | win.showDevTools()
@close()
@clearCacheBtn.on 'click', =>
@close()
win.reloadIgnoringCache()
@resetDatabaseBtn.on 'click', =>
@close()
Playlists.clear ->
History.clear ->
win.reloadIgnoringCache()
initCheckboxes: ->
@checkboxSettings.each((index, checkbox... | CoffeeScript | CoffeeScript | Atraci/Atraci | coffee/_settingsPanel.coffee | MIT | d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca | 800 | https://github.com/Atraci/Atraci/blob/d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca/coffee/_settingsPanel.coffee | 3 | 52 |
Atraci/Atraci:coffee/_settingsPanel.coffee:2:raw_corpus | raw_corpus | of: @positionTarget
show:
effect: 'blind',
duration: 500
hide:
effect: 'blind',
duration: 500
title: 'Settings',
modal: true,
dialogClass: 'settingsClass',
buttons:
'Cancel': =>
@close()
,
'Save': =>
window.l... | CoffeeScript | Atraci/Atraci | coffee/_settingsPanel.coffee | MIT | d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca | 800 | https://github.com/Atraci/Atraci/blob/d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca/coffee/_settingsPanel.coffee | 53 | 102 | ||
Atraci/Atraci:coffee/_settingsPanel.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
of: @positionTarget
show:
effect: 'blind',
duration: 500
hide:
effect: 'blind',
duration: 500
title: 'Settings',
modal: true,
dialogClass: 'settingsClass',
buttons:
'Cancel': =>
... | ({
of: this.positionTarget({
show: {
effect: 'blind',
duration: 500
},
hide: {
effect: 'blind',
duration: 500
},
title: 'Settings',
modal: true,
dialogClass: 'settingsClass',
buttons: {
'Cancel': () => {
return this.close();
},
'Save': ... | CoffeeScript | JavaScript | Atraci/Atraci | coffee/_settingsPanel.coffee | MIT | d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca | 800 | https://github.com/Atraci/Atraci/blob/d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca/coffee/_settingsPanel.coffee | 53 | 102 |
Atraci/Atraci:coffee/_settingsPanel.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
of: this.positionTarget({
show: {
effect: 'blind',
duration: 500
},
hide: {
effect: 'blind',
duration: 500
},
title: 'Settings',
modal: true,
dialogClass: 'settingsClass',
buttons: {
'Cancel': () =>... | of: @positionTarget
show:
effect: 'blind',
duration: 500
hide:
effect: 'blind',
duration: 500
title: 'Settings',
modal: true,
dialogClass: 'settingsClass',
buttons:
'Cancel': =>
@close()
,
'Save': =>
window.l... | JavaScript | CoffeeScript | Atraci/Atraci | coffee/_settingsPanel.coffee | MIT | d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca | 800 | https://github.com/Atraci/Atraci/blob/d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca/coffee/_settingsPanel.coffee | 53 | 102 |
Atraci/Atraci:coffee/_settingsPanel.coffee:2:completion | completion | of: @positionTarget
show:
effect: 'blind',
duration: 500
hide:
effect: 'blind',
duration: 500
title: 'Settings',
modal: true,
dialogClass: 'settingsClass',
buttons:
'Cancel': =>
@close()
,
'Save': =>
window.l... | options = []
languages = data.languages
languages.forEach((language) ->
option = $('<option>')
option.prop('value', language.lang)
option.text(language.label)
if language.default
option.prop('selected', true)
options.push(option)
)
@languageSel... | CoffeeScript | CoffeeScript | Atraci/Atraci | coffee/_settingsPanel.coffee | MIT | d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca | 800 | https://github.com/Atraci/Atraci/blob/d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca/coffee/_settingsPanel.coffee | 53 | 102 |
Atraci/Atraci:coffee/_settingsPanel.coffee:3:raw_corpus | raw_corpus | close: ->
@settingsPanel.dialog 'close'
show: ->
@initCheckboxes()
@settingsPanel.dialog 'open'
toggle: ->
isOpen = @settingsPanel.dialog 'isOpen'
if isOpen
@close()
else
@show() | CoffeeScript | Atraci/Atraci | coffee/_settingsPanel.coffee | MIT | d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca | 800 | https://github.com/Atraci/Atraci/blob/d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca/coffee/_settingsPanel.coffee | 103 | 116 | ||
Atraci/Atraci:coffee/_settingsPanel.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
close: ->
@settingsPanel.dialog 'close'
show: ->
@initCheckboxes()
@settingsPanel.dialog 'open'
toggle: ->
isOpen = @settingsPanel.dialog 'isOpen'
if isOpen
@close()
else
@show()
``` | ({
close: function() {
return this.settingsPanel.dialog('close');
},
show: function() {
this.initCheckboxes();
return this.settingsPanel.dialog('open');
},
toggle: function() {
var isOpen;
isOpen = this.settingsPanel.dialog('isOpen');
if (isOpen) {
return this.close();
} else... | CoffeeScript | JavaScript | Atraci/Atraci | coffee/_settingsPanel.coffee | MIT | d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca | 800 | https://github.com/Atraci/Atraci/blob/d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca/coffee/_settingsPanel.coffee | 103 | 116 |
Atraci/Atraci:coffee/_settingsPanel.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
close: function() {
return this.settingsPanel.dialog('close');
},
show: function() {
this.initCheckboxes();
return this.settingsPanel.dialog('open');
},
toggle: function() {
var isOpen;
isOpen = this.settingsPanel.dialog('isOpen');
... | close: ->
@settingsPanel.dialog 'close'
show: ->
@initCheckboxes()
@settingsPanel.dialog 'open'
toggle: ->
isOpen = @settingsPanel.dialog 'isOpen'
if isOpen
@close()
else
@show() | JavaScript | CoffeeScript | Atraci/Atraci | coffee/_settingsPanel.coffee | MIT | d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca | 800 | https://github.com/Atraci/Atraci/blob/d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca/coffee/_settingsPanel.coffee | 103 | 116 |
Atraci/Atraci:coffee/_settingsPanel.coffee:3:completion | completion | close: ->
@settingsPanel.dialog 'close'
show: ->
@initCheckboxes()
@settingsPanel.dialog 'open' | toggle: ->
isOpen = @settingsPanel.dialog 'isOpen'
if isOpen
@close()
else
@show() | CoffeeScript | CoffeeScript | Atraci/Atraci | coffee/_settingsPanel.coffee | MIT | d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca | 800 | https://github.com/Atraci/Atraci/blob/d3fd00622f5f2e6c5d402c7a1ef2cd693f35e9ca/coffee/_settingsPanel.coffee | 103 | 116 |
Atraci/Atraci:coffee/_settingsPanel.coffee:1:raw_corpus | raw_corpus | class SettingsPanel
constructor: ->
# Selectors
@settingsPanel = $('#settings-panel')
@settingsBtn = $('#Settings .settings')
@devToolsBtn = $('.devTools')
@clearCacheBtn = $('.clearCache')
@resetDatabaseBtn = $('.resetDatabase')
@languageSelect = $('#LanguageSelect')
@themeSelect = $(... | CoffeeScript | Atraci/Atraci | coffee/_settingsPanel.coffee | MIT | 24f64be6509083b90aad232c94c542042aa4d603 | 800 | https://github.com/Atraci/Atraci/blob/24f64be6509083b90aad232c94c542042aa4d603/coffee/_settingsPanel.coffee | 3 | 52 | ||
Atraci/Atraci:coffee/_settingsPanel.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class SettingsPanel
constructor: ->
# Selectors
@settingsPanel = $('#settings-panel')
@settingsBtn = $('#Settings .settings')
@devToolsBtn = $('.devTools')
@clearCacheBtn = $('.clearCache')
@resetDatabaseBtn = $('.resetDatabase')
@la... | var SettingsPanel;
SettingsPanel = class SettingsPanel {
constructor() {
// Selectors
this.settingsPanel = $('#settings-panel');
this.settingsBtn = $('#Settings .settings');
this.devToolsBtn = $('.devTools');
this.clearCacheBtn = $('.clearCache');
this.resetDatabaseBtn = $('.resetDatabase');
... | CoffeeScript | JavaScript | Atraci/Atraci | coffee/_settingsPanel.coffee | MIT | 24f64be6509083b90aad232c94c542042aa4d603 | 800 | https://github.com/Atraci/Atraci/blob/24f64be6509083b90aad232c94c542042aa4d603/coffee/_settingsPanel.coffee | 3 | 52 |
Atraci/Atraci:coffee/_settingsPanel.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var SettingsPanel;
SettingsPanel = class SettingsPanel {
constructor() {
// Selectors
this.settingsPanel = $('#settings-panel');
this.settingsBtn = $('#Settings .settings');
this.devToolsBtn = $('.devTools');
this.clearCacheBtn = $('.clearCac... | class SettingsPanel
constructor: ->
# Selectors
@settingsPanel = $('#settings-panel')
@settingsBtn = $('#Settings .settings')
@devToolsBtn = $('.devTools')
@clearCacheBtn = $('.clearCache')
@resetDatabaseBtn = $('.resetDatabase')
@languageSelect = $('#LanguageSelect')
@themeSelect = $(... | JavaScript | CoffeeScript | Atraci/Atraci | coffee/_settingsPanel.coffee | MIT | 24f64be6509083b90aad232c94c542042aa4d603 | 800 | https://github.com/Atraci/Atraci/blob/24f64be6509083b90aad232c94c542042aa4d603/coffee/_settingsPanel.coffee | 3 | 52 |
Atraci/Atraci:coffee/_settingsPanel.coffee:1:completion | completion | class SettingsPanel
constructor: ->
# Selectors
@settingsPanel = $('#settings-panel')
@settingsBtn = $('#Settings .settings')
@devToolsBtn = $('.devTools')
@clearCacheBtn = $('.clearCache')
@resetDatabaseBtn = $('.resetDatabase')
@languageSelect = $('#LanguageSelect')
@themeSelect = $(... | @close()
@clearCacheBtn.on 'click', =>
@close()
win.reloadIgnoringCache()
@resetDatabaseBtn.on 'click', =>
@close()
Playlists.clear ->
History.clear ->
win.reloadIgnoringCache()
initDialog: ->
@settingsPanel.dialog
autoOpen: false,
height: 375,
... | CoffeeScript | CoffeeScript | Atraci/Atraci | coffee/_settingsPanel.coffee | MIT | 24f64be6509083b90aad232c94c542042aa4d603 | 800 | https://github.com/Atraci/Atraci/blob/24f64be6509083b90aad232c94c542042aa4d603/coffee/_settingsPanel.coffee | 3 | 52 |
Atraci/Atraci:coffee/_settingsPanel.coffee:2:raw_corpus | raw_corpus | title: 'Settings',
modal: true,
dialogClass: 'settingsClass',
buttons:
'Cancel': =>
@close()
,
'Save': =>
window.l10n.changeLang(@languageSelect.val())
window.theme.changeTheme(@themeSelect.val())
@close()
initL10nOptions: ->
windo... | CoffeeScript | Atraci/Atraci | coffee/_settingsPanel.coffee | MIT | 24f64be6509083b90aad232c94c542042aa4d603 | 800 | https://github.com/Atraci/Atraci/blob/24f64be6509083b90aad232c94c542042aa4d603/coffee/_settingsPanel.coffee | 53 | 101 | ||
Atraci/Atraci:coffee/_settingsPanel.coffee:2:completion | completion | title: 'Settings',
modal: true,
dialogClass: 'settingsClass',
buttons:
'Cancel': =>
@close()
,
'Save': =>
window.l10n.changeLang(@languageSelect.val())
window.theme.changeTheme(@themeSelect.val())
@close()
initL10nOptions: ->
windo... | if language.default
option.prop('selected', true)
options.push(option)
)
@languageSelect.append(options)
)
reposition: ->
@settingsPanel.dialog('option', 'position',
of: @positionTarget
)
close: ->
@settingsPanel.dialog 'close'
show: ->
@settingsPanel.di... | CoffeeScript | CoffeeScript | Atraci/Atraci | coffee/_settingsPanel.coffee | MIT | 24f64be6509083b90aad232c94c542042aa4d603 | 800 | https://github.com/Atraci/Atraci/blob/24f64be6509083b90aad232c94c542042aa4d603/coffee/_settingsPanel.coffee | 53 | 101 |
Atraci/Atraci:coffee/_settingsPanel.coffee:2:raw_corpus | raw_corpus | title: 'Settings',
modal: true,
dialogClass: 'settingsClass',
buttons:
'Cancel': =>
@close()
,
'Save': =>
window.l10n.changeLang(@languageSelect.val())
window.theme.changeTheme(@themeSelect.val())
@close()
initL10nOptions: ->
windo... | CoffeeScript | Atraci/Atraci | coffee/_settingsPanel.coffee | MIT | 53c2879857aee245b95b35304689a1a83b405a80 | 800 | https://github.com/Atraci/Atraci/blob/53c2879857aee245b95b35304689a1a83b405a80/coffee/_settingsPanel.coffee | 53 | 94 | ||
Atraci/Atraci:coffee/_settingsPanel.coffee:2:completion | completion | title: 'Settings',
modal: true,
dialogClass: 'settingsClass',
buttons:
'Cancel': =>
@close()
,
'Save': =>
window.l10n.changeLang(@languageSelect.val())
window.theme.changeTheme(@themeSelect.val())
@close()
initL10nOptions: ->
windo... | option.prop('value', language.lang)
option.text(language.label)
if language.default
option.prop('selected', true)
options.push(option)
)
@languageSelect.append(options)
)
reposition: ->
@settingsPanel.dialog('option', 'position',
of: @positionTarget
)... | CoffeeScript | CoffeeScript | Atraci/Atraci | coffee/_settingsPanel.coffee | MIT | 53c2879857aee245b95b35304689a1a83b405a80 | 800 | https://github.com/Atraci/Atraci/blob/53c2879857aee245b95b35304689a1a83b405a80/coffee/_settingsPanel.coffee | 53 | 94 |
Atraci/Atraci:coffee/_settingsPanel.coffee:1:raw_corpus | raw_corpus | class SettingsPanel
constructor: ->
# Selectors
@settingsPanel = $('#settings-panel')
@settingsBtn = $('#Settings .settings')
@devToolsBtn = $('.devTools')
@clearCacheBtn = $('.clearCache')
@resetDatabaseBtn = $('.resetDatabase')
@languageSelect = $('#LanguageSelect')
@themeSelect = $(... | CoffeeScript | Atraci/Atraci | coffee/_settingsPanel.coffee | MIT | f60e396080896e2ddfa8149308dc7a2e94ac4819 | 800 | https://github.com/Atraci/Atraci/blob/f60e396080896e2ddfa8149308dc7a2e94ac4819/coffee/_settingsPanel.coffee | 3 | 52 | ||
Atraci/Atraci:coffee/_settingsPanel.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class SettingsPanel
constructor: ->
# Selectors
@settingsPanel = $('#settings-panel')
@settingsBtn = $('#Settings .settings')
@devToolsBtn = $('.devTools')
@clearCacheBtn = $('.clearCache')
@resetDatabaseBtn = $('.resetDatabase')
@la... | var SettingsPanel;
SettingsPanel = class SettingsPanel {
constructor() {
// Selectors
this.settingsPanel = $('#settings-panel');
this.settingsBtn = $('#Settings .settings');
this.devToolsBtn = $('.devTools');
this.clearCacheBtn = $('.clearCache');
this.resetDatabaseBtn = $('.resetDatabase');
... | CoffeeScript | JavaScript | Atraci/Atraci | coffee/_settingsPanel.coffee | MIT | f60e396080896e2ddfa8149308dc7a2e94ac4819 | 800 | https://github.com/Atraci/Atraci/blob/f60e396080896e2ddfa8149308dc7a2e94ac4819/coffee/_settingsPanel.coffee | 3 | 52 |
Atraci/Atraci:coffee/_settingsPanel.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var SettingsPanel;
SettingsPanel = class SettingsPanel {
constructor() {
// Selectors
this.settingsPanel = $('#settings-panel');
this.settingsBtn = $('#Settings .settings');
this.devToolsBtn = $('.devTools');
this.clearCacheBtn = $('.clearCac... | class SettingsPanel
constructor: ->
# Selectors
@settingsPanel = $('#settings-panel')
@settingsBtn = $('#Settings .settings')
@devToolsBtn = $('.devTools')
@clearCacheBtn = $('.clearCache')
@resetDatabaseBtn = $('.resetDatabase')
@languageSelect = $('#LanguageSelect')
@themeSelect = $(... | JavaScript | CoffeeScript | Atraci/Atraci | coffee/_settingsPanel.coffee | MIT | f60e396080896e2ddfa8149308dc7a2e94ac4819 | 800 | https://github.com/Atraci/Atraci/blob/f60e396080896e2ddfa8149308dc7a2e94ac4819/coffee/_settingsPanel.coffee | 3 | 52 |
Atraci/Atraci:coffee/_settingsPanel.coffee:1:completion | completion | class SettingsPanel
constructor: ->
# Selectors
@settingsPanel = $('#settings-panel')
@settingsBtn = $('#Settings .settings')
@devToolsBtn = $('.devTools')
@clearCacheBtn = $('.clearCache')
@resetDatabaseBtn = $('.resetDatabase')
@languageSelect = $('#LanguageSelect')
@themeSelect = $(... | @close()
@clearCacheBtn.on 'click', =>
@close()
win.reloadIgnoringCache()
@resetDatabaseBtn.on 'click', =>
@close()
Playlists.clear ->
History.clear ->
win.reloadIgnoringCache()
initDialog: ->
@settingsPanel.dialog
autoOpen: false,
height: 340,
... | CoffeeScript | CoffeeScript | Atraci/Atraci | coffee/_settingsPanel.coffee | MIT | f60e396080896e2ddfa8149308dc7a2e94ac4819 | 800 | https://github.com/Atraci/Atraci/blob/f60e396080896e2ddfa8149308dc7a2e94ac4819/coffee/_settingsPanel.coffee | 3 | 52 |
js2coffee/js2coffee:test/build.coffee:1:raw_corpus | raw_corpus | foo = ->
`var a`
b = ->
0
a = 1
return
"""
it "doesn't drop loop init statements immediately after variable shadowing", ->
out = js2coffee("""
var a, b = 0;
(function () {
var a;
for (b = 1;;) {
}
})();
""")
expected = """a = undefined
b = 0
do ->
`var a`
a = undefined
b = 1
loop... | CoffeeScript | js2coffee/js2coffee | test/build.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/test/build.coffee | 45 | 81 | ||
js2coffee/js2coffee:test/build.coffee:1:completion | completion | foo = ->
`var a`
b = ->
0
a = 1
return
"""
it "doesn't drop loop init statements immediately after variable shadowing", ->
out = js2coffee("""
var a, b = 0;
(function () {
var a;
for (b = 1;;) {
} | })();
""")
expected = """a = undefined
b = 0
do ->
`var a`
a = undefined
b = 1
loop
continue
return
"""
expect(out).equals(expected)
it "outputs correct unicode escape sequences", ->
out = js2coffee("\"\\u0010\"\n")
expected = "\'\\u0010\'\n"
expect(out).equals(expected) | CoffeeScript | CoffeeScript | js2coffee/js2coffee | test/build.coffee | MIT | 47d3159aba94ffd4377138f7837717d8628eef9f | 2,082 | https://github.com/js2coffee/js2coffee/blob/47d3159aba94ffd4377138f7837717d8628eef9f/test/build.coffee | 45 | 81 |
js2coffee/js2coffee:test/build.coffee:1:raw_corpus | raw_corpus | require 'coffee-script/register'
require './setup'
describe 'build()', ->
it 'works', ->
out = js2coffee.build("// hi\na=2")
expect(out.ast).be.an('object')
expect(out.map).be.an('object')
expect(out.code).be.a('string')
it 'indents nested blocks correctly', ->
out = js2coffee """
while (true... | CoffeeScript | js2coffee/js2coffee | test/build.coffee | MIT | c1841b9599672f1ccc696072af456f314e02320e | 2,082 | https://github.com/js2coffee/js2coffee/blob/c1841b9599672f1ccc696072af456f314e02320e/test/build.coffee | 1 | 50 | ||
js2coffee/js2coffee:test/build.coffee:1:completion | completion | require 'coffee-script/register'
require './setup'
describe 'build()', ->
it 'works', ->
out = js2coffee.build("// hi\na=2")
expect(out.ast).be.an('object')
expect(out.map).be.an('object')
expect(out.code).be.a('string')
it 'indents nested blocks correctly', ->
out = js2coffee """
while (true... | a = 0
b = 1
"""
expect(out).equals(expected)
it 'inserts var statements into correct scope', ->
out = js2coffee """
var a = 0;
var foo = function () {
var b = function () {
return 0;
};
var a = 1;
};
"""
expected = """
a = 0
foo = ->
`var a`
b = ->
0 | CoffeeScript | CoffeeScript | js2coffee/js2coffee | test/build.coffee | MIT | c1841b9599672f1ccc696072af456f314e02320e | 2,082 | https://github.com/js2coffee/js2coffee/blob/c1841b9599672f1ccc696072af456f314e02320e/test/build.coffee | 1 | 50 |
js2coffee/js2coffee:test/build.coffee:2:raw_corpus | raw_corpus | a = 1
return
"""
it "doesn't drop loop init statements immediately after variable shadowing", ->
out = js2coffee("""
var a, b = 0;
(function () {
var a;
for (b = 1;;) {
}
})();
""")
expected = """a = undefined
b = 0
do ->
`var a`
a = undefined
b = 1
loop
continue
return
"""
expect... | CoffeeScript | js2coffee/js2coffee | test/build.coffee | MIT | c1841b9599672f1ccc696072af456f314e02320e | 2,082 | https://github.com/js2coffee/js2coffee/blob/c1841b9599672f1ccc696072af456f314e02320e/test/build.coffee | 51 | 76 | ||
js2coffee/js2coffee:test/build.coffee:2:completion | completion | a = 1
return
"""
it "doesn't drop loop init statements immediately after variable shadowing", ->
out = js2coffee("""
var a, b = 0;
(function () {
var a;
for (b = 1;;) {
}
})(); | """)
expected = """a = undefined
b = 0
do ->
`var a`
a = undefined
b = 1
loop
continue
return
"""
expect(out).equals(expected) | CoffeeScript | CoffeeScript | js2coffee/js2coffee | test/build.coffee | MIT | c1841b9599672f1ccc696072af456f314e02320e | 2,082 | https://github.com/js2coffee/js2coffee/blob/c1841b9599672f1ccc696072af456f314e02320e/test/build.coffee | 51 | 76 |
js2coffee/js2coffee:test/build.coffee:1:raw_corpus | raw_corpus | require 'coffee-script/register'
require './setup'
describe 'build()', ->
it 'works', ->
out = js2coffee.build("// hi\na=2")
expect(out.ast).be.an('object')
expect(out.map).be.an('object')
expect(out.code).be.a('string')
it 'indents nested blocks correctly', ->
out = js2coffee """
while (true)... | CoffeeScript | js2coffee/js2coffee | test/build.coffee | MIT | 5375daf786d8496b75791828671e36d68724d20d | 2,082 | https://github.com/js2coffee/js2coffee/blob/5375daf786d8496b75791828671e36d68724d20d/test/build.coffee | 1 | 50 | ||
js2coffee/js2coffee:test/build.coffee:1:completion | completion | require 'coffee-script/register'
require './setup'
describe 'build()', ->
it 'works', ->
out = js2coffee.build("// hi\na=2")
expect(out.ast).be.an('object')
expect(out.map).be.an('object')
expect(out.code).be.a('string')
it 'indents nested blocks correctly', ->
out = js2coffee """
while (true)... | """
expect(out).equals(expected)
it 'inserts var statements into correct scope', ->
out = js2coffee """
var a = 0;
var foo = function () {
var b = function () {
return 0;
};
var a = 1;
};
"""
expected = """
a = 0
foo = ->
`var a`
b = ->
0
a = 1 | CoffeeScript | CoffeeScript | js2coffee/js2coffee | test/build.coffee | MIT | 5375daf786d8496b75791828671e36d68724d20d | 2,082 | https://github.com/js2coffee/js2coffee/blob/5375daf786d8496b75791828671e36d68724d20d/test/build.coffee | 1 | 50 |
js2coffee/js2coffee:test/build.coffee:2:raw_corpus | raw_corpus | return
"""
expect(out).equals(expected) | CoffeeScript | js2coffee/js2coffee | test/build.coffee | MIT | 5375daf786d8496b75791828671e36d68724d20d | 2,082 | https://github.com/js2coffee/js2coffee/blob/5375daf786d8496b75791828671e36d68724d20d/test/build.coffee | 51 | 54 | ||
js2coffee/js2coffee:test/build.coffee:1:raw_corpus | raw_corpus | require 'coffee-script/register'
require './setup'
describe 'build()', ->
it 'works', ->
out = js2coffee.build("// hi\na=2")
expect(out.ast).be.an('object')
expect(out.map).be.an('object')
expect(out.code).be.a('string')
it 'indents nested blocks correctly', ->
out = js2coffee """
while (true)... | CoffeeScript | js2coffee/js2coffee | test/build.coffee | MIT | 01b9bb23aec0c94b94d71b828004f5d53386320d | 2,082 | https://github.com/js2coffee/js2coffee/blob/01b9bb23aec0c94b94d71b828004f5d53386320d/test/build.coffee | 1 | 28 | ||
js2coffee/js2coffee:test/build.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
require 'coffee-script/register'
require './setup'
describe 'build()', ->
it 'works', ->
out = js2coffee.build("// hi\na=2")
expect(out.ast).be.an('object')
expect(out.map).be.an('object')
expect(out.code).be.a('string')
it 'indents nested b... | require('coffee-script/register');
require('./setup');
describe('build()', function() {
it('works', function() {
var out;
out = js2coffee.build("// hi\na=2");
expect(out.ast).be.an('object');
expect(out.map).be.an('object');
return expect(out.code).be.a('string');
});
return it('indents nest... | CoffeeScript | JavaScript | js2coffee/js2coffee | test/build.coffee | MIT | 01b9bb23aec0c94b94d71b828004f5d53386320d | 2,082 | https://github.com/js2coffee/js2coffee/blob/01b9bb23aec0c94b94d71b828004f5d53386320d/test/build.coffee | 1 | 28 |
js2coffee/js2coffee:test/build.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
require('coffee-script/register');
require('./setup');
describe('build()', function() {
it('works', function() {
var out;
out = js2coffee.build("// hi\na=2");
expect(out.ast).be.an('object');
expect(out.map).be.an('object');
return expect(ou... | require 'coffee-script/register'
require './setup'
describe 'build()', ->
it 'works', ->
out = js2coffee.build("// hi\na=2")
expect(out.ast).be.an('object')
expect(out.map).be.an('object')
expect(out.code).be.a('string')
it 'indents nested blocks correctly', ->
out = js2coffee """
while (true)... | JavaScript | CoffeeScript | js2coffee/js2coffee | test/build.coffee | MIT | 01b9bb23aec0c94b94d71b828004f5d53386320d | 2,082 | https://github.com/js2coffee/js2coffee/blob/01b9bb23aec0c94b94d71b828004f5d53386320d/test/build.coffee | 1 | 28 |
js2coffee/js2coffee:test/build.coffee:1:completion | completion | require 'coffee-script/register'
require './setup'
describe 'build()', ->
it 'works', ->
out = js2coffee.build("// hi\na=2")
expect(out.ast).be.an('object')
expect(out.map).be.an('object')
expect(out.code).be.a('string')
it 'indents nested blocks correctly', ->
out = js2coffee """
while (true)... | {
var a = 0;
var b = 1;
}
}
}
"""
expected = """
loop
a = 0
b = 1
"""
expect(out).equals(expected) | CoffeeScript | CoffeeScript | js2coffee/js2coffee | test/build.coffee | MIT | 01b9bb23aec0c94b94d71b828004f5d53386320d | 2,082 | https://github.com/js2coffee/js2coffee/blob/01b9bb23aec0c94b94d71b828004f5d53386320d/test/build.coffee | 1 | 28 |
yakyak/yakyak:src/ui/util.coffee:1:raw_corpus | raw_corpus | notificationCenterSupportsSound = () ->
# check if sound should be played via notification
# documentation says that only WindowsToaster and
# NotificationCenter supports sound
playSoundIn = ['WindowsToaster', 'NotificationCenter']
# check if currect notifier supports sound
notifierSupportsSou... | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 4 | 12 | ||
yakyak/yakyak:src/ui/util.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
notificationCenterSupportsSound = () ->
# check if sound should be played via notification
# documentation says that only WindowsToaster and
# NotificationCenter supports sound
playSoundIn = ['WindowsToaster', 'NotificationCenter']
# check i... | var notificationCenterSupportsSound;
notificationCenterSupportsSound = function() {
var notifierSupportsSound, playSoundIn;
// check if sound should be played via notification
// documentation says that only WindowsToaster and
// NotificationCenter supports sound
playSoundIn = ['WindowsToaster', 'Notificat... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 4 | 12 |
yakyak/yakyak:src/ui/util.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var notificationCenterSupportsSound;
notificationCenterSupportsSound = function() {
var notifierSupportsSound, playSoundIn;
// check if sound should be played via notification
// documentation says that only WindowsToaster and
// NotificationCenter suppo... | notificationCenterSupportsSound = () ->
# check if sound should be played via notification
# documentation says that only WindowsToaster and
# NotificationCenter supports sound
playSoundIn = ['WindowsToaster', 'NotificationCenter']
# check if currect notifier supports sound
notifierSupportsSou... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 4 | 12 |
yakyak/yakyak:src/ui/util.coffee:1:completion | completion | notificationCenterSupportsSound = () ->
# check if sound should be played via notification
# documentation says that only WindowsToaster and
# NotificationCenter supports sound | playSoundIn = ['WindowsToaster', 'NotificationCenter']
# check if currect notifier supports sound
notifierSupportsSound = playSoundIn.find( (str) ->
str == notifier.constructor.name
)? | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 4 | 12 |
yakyak/yakyak:src/ui/util.coffee:3:raw_corpus | raw_corpus | initialsof = (e) ->
if e?.first_name
name = nameof e
firstname = e?.first_name
return firstname.charAt(0) + name.replace(firstname, "").charAt(1)
else if e?.display_name
name_splitted = e.display_name.split(' ')
firstname = name_splitted[0].charAt(0)
if name_spli... | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 16 | 33 | ||
yakyak/yakyak:src/ui/util.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
initialsof = (e) ->
if e?.first_name
name = nameof e
firstname = e?.first_name
return firstname.charAt(0) + name.replace(firstname, "").charAt(1)
else if e?.display_name
name_splitted = e.display_name.split(' ')
fi... | var initialsof;
initialsof = function(e) {
var firstname, lastname, name, name_splitted;
if (e != null ? e.first_name : void 0) {
name = nameof(e);
firstname = e != null ? e.first_name : void 0;
return firstname.charAt(0) + name.replace(firstname, "").charAt(1);
} else if (e != null ? e.display_name ... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 16 | 33 |
yakyak/yakyak:src/ui/util.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var initialsof;
initialsof = function(e) {
var firstname, lastname, name, name_splitted;
if (e != null ? e.first_name : void 0) {
name = nameof(e);
firstname = e != null ? e.first_name : void 0;
return firstname.charAt(0) + name.replace(firstname, ... | initialsof = (e) ->
if e?.first_name
name = nameof e
firstname = e?.first_name
return firstname.charAt(0) + name.replace(firstname, "").charAt(1)
else if e?.display_name
name_splitted = e.display_name.split(' ')
firstname = name_splitted[0].charAt(0)
if name_spli... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 16 | 33 |
yakyak/yakyak:src/ui/util.coffee:3:completion | completion | initialsof = (e) ->
if e?.first_name
name = nameof e
firstname = e?.first_name
return firstname.charAt(0) + name.replace(firstname, "").charAt(1)
else if e?.display_name
name_splitted = e.display_name.split(' ')
firstname = name_splitted[0].charAt(0)
if name_spli... | return firstname.charAt(0)
# just in case something strange
else if name_splitted?.length == 0
return '?'
else
lastname = name_splitted[name_splitted.length - 1]
return firstname.charAt(0) + lastname.charAt(0)
else
return '?' | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 16 | 33 |
yakyak/yakyak:src/ui/util.coffee:4:raw_corpus | raw_corpus | drawAvatar = (user_id, viewstate, entity, image = null, email = null, initials = null) ->
#
entity.needEntity(user_id) unless entity[user_id]?
#
# overwrites if entity is cached
initials = initialsof(entity[user_id]).toUpperCase() if entity[user_id]?
email = entity[user_id]?.email?[0] unless ... | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 35 | 72 | ||
yakyak/yakyak:src/ui/util.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
drawAvatar = (user_id, viewstate, entity, image = null, email = null, initials = null) ->
#
entity.needEntity(user_id) unless entity[user_id]?
#
# overwrites if entity is cached
initials = initialsof(entity[user_id]).toUpperCase() if entity[us... | var drawAvatar;
drawAvatar = function(user_id, viewstate, entity, image = null, email = null, initials = null) {
var initialsCode, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7;
if (entity[user_id] == null) {
entity.needEntity(user_id);
}
if (entity[user_id] != null) {
// overwrites if entity is cach... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 35 | 72 |
yakyak/yakyak:src/ui/util.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var drawAvatar;
drawAvatar = function(user_id, viewstate, entity, image = null, email = null, initials = null) {
var initialsCode, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7;
if (entity[user_id] == null) {
entity.needEntity(user_id);
}
if (entity[u... | drawAvatar = (user_id, viewstate, entity, image = null, email = null, initials = null) ->
#
entity.needEntity(user_id) unless entity[user_id]?
#
# overwrites if entity is cached
initials = initialsof(entity[user_id]).toUpperCase() if entity[user_id]?
email = entity[user_id]?.email?[0] unless ... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 35 | 72 |
yakyak/yakyak:src/ui/util.coffee:4:completion | completion | drawAvatar = (user_id, viewstate, entity, image = null, email = null, initials = null) ->
#
entity.needEntity(user_id) unless entity[user_id]?
#
# overwrites if entity is cached
initials = initialsof(entity[user_id]).toUpperCase() if entity[user_id]?
email = entity[user_id]?.email?[0] unless ... | div class: 'avatar', 'data-id': user_id, ->
if image?
if !viewstate?.showAnimatedThumbs
image += "?sz=50"
#
img src:fixlink(image)
, "data-initials": initials
, title: email
, class: 'fallback-on'
, onerror: (ev... | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 35 | 72 |
yakyak/yakyak:src/ui/util.coffee:5:raw_corpus | raw_corpus | nameofconv = (c) ->
{entity} = require './models'
part = c?.current_participant ? []
ents = for p in part when not entity.isSelf p.chat_id
entity[p.chat_id]
name = ""
one_to_one = c?.type?.indexOf('ONE_TO_ONE') >= 0
if c?.name? and not one_to_one
name = c.name
else
# ... | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 74 | 89 | ||
yakyak/yakyak:src/ui/util.coffee:5:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
nameofconv = (c) ->
{entity} = require './models'
part = c?.current_participant ? []
ents = for p in part when not entity.isSelf p.chat_id
entity[p.chat_id]
name = ""
one_to_one = c?.type?.indexOf('ONE_TO_ONE') >= 0
if c?.name? and... | var nameofconv;
nameofconv = function(c) {
var entity, ents, name, names, one_to_one, p, part, ref, ref1;
({entity} = require('./models'));
part = (ref = c != null ? c.current_participant : void 0) != null ? ref : [];
ents = (function() {
var i, len, results;
results = [];
for (i = 0, len = part.le... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 74 | 89 |
yakyak/yakyak:src/ui/util.coffee:5:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var nameofconv;
nameofconv = function(c) {
var entity, ents, name, names, one_to_one, p, part, ref, ref1;
({entity} = require('./models'));
part = (ref = c != null ? c.current_participant : void 0) != null ? ref : [];
ents = (function() {
var i, len, r... | nameofconv = (c) ->
{entity} = require './models'
part = c?.current_participant ? []
ents = for p in part when not entity.isSelf p.chat_id
entity[p.chat_id]
name = ""
one_to_one = c?.type?.indexOf('ONE_TO_ONE') >= 0
if c?.name? and not one_to_one
name = c.name
else
# ... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 74 | 89 |
yakyak/yakyak:src/ui/util.coffee:5:completion | completion | nameofconv = (c) ->
{entity} = require './models'
part = c?.current_participant ? []
ents = for p in part when not entity.isSelf p.chat_id
entity[p.chat_id]
name = ""
one_to_one = c?.type?.indexOf('ONE_TO_ONE') >= 0
if c?.name? and not one_to_one | name = c.name
else
# all entities in conversation that is not self
# the names of those entities
names = ents.map nameof
# joined together in a compelling manner
name = names.join ', '
return name | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 74 | 89 |
yakyak/yakyak:src/ui/util.coffee:8:raw_corpus | raw_corpus | throttle = (ms, f) ->
last = 0
tim = null
g = (as...) ->
clearTimeout tim if tim
if (d = (Date.now() - last)) > ms
ret = f as...
last = Date.now()
ret
else
# ensure that last event is always fired
tim = setTimeout (->g as...... | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 96 | 108 | ||
yakyak/yakyak:src/ui/util.coffee:8:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
throttle = (ms, f) ->
last = 0
tim = null
g = (as...) ->
clearTimeout tim if tim
if (d = (Date.now() - last)) > ms
ret = f as...
last = Date.now()
ret
else
# ensure that last even... | var throttle;
throttle = function(ms, f) {
var g, last, tim;
last = 0;
tim = null;
return g = function(...as) {
var d, ret;
if (tim) {
clearTimeout(tim);
}
if ((d = Date.now() - last) > ms) {
ret = f(...as);
last = Date.now();
return ret;
} else {
// ensure tha... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 96 | 108 |
yakyak/yakyak:src/ui/util.coffee:8:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var throttle;
throttle = function(ms, f) {
var g, last, tim;
last = 0;
tim = null;
return g = function(...as) {
var d, ret;
if (tim) {
clearTimeout(tim);
}
if ((d = Date.now() - last) > ms) {
ret = f(...as);
last = Date.no... | throttle = (ms, f) ->
last = 0
tim = null
g = (as...) ->
clearTimeout tim if tim
if (d = (Date.now() - last)) > ms
ret = f as...
last = Date.now()
ret
else
# ensure that last event is always fired
tim = setTimeout (->g as...... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 96 | 108 |
yakyak/yakyak:src/ui/util.coffee:8:completion | completion | throttle = (ms, f) ->
last = 0
tim = null
g = (as...) ->
clearTimeout tim if tim
if (d = (Date.now() - last)) > ms | ret = f as...
last = Date.now()
ret
else
# ensure that last event is always fired
tim = setTimeout (->g as...), d
undefined | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 96 | 108 |
yakyak/yakyak:src/ui/util.coffee:10:raw_corpus | raw_corpus | getProxiedName = (e) ->
s = e?.chat_message?.message_content?.segment?[0]
return unless s
return s?.formatting?.bold and isAboutLink(s?.link_data?.link_target) | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 112 | 115 | ||
yakyak/yakyak:src/ui/util.coffee:10:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
getProxiedName = (e) ->
s = e?.chat_message?.message_content?.segment?[0]
return unless s
return s?.formatting?.bold and isAboutLink(s?.link_data?.link_target)
``` | var getProxiedName;
getProxiedName = function(e) {
var ref, ref1, ref2, ref3, ref4, s;
s = e != null ? (ref = e.chat_message) != null ? (ref1 = ref.message_content) != null ? (ref2 = ref1.segment) != null ? ref2[0] : void 0 : void 0 : void 0 : void 0;
if (!s) {
return;
}
return (s != null ? (ref3 = s.for... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 112 | 115 |
yakyak/yakyak:src/ui/util.coffee:10:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var getProxiedName;
getProxiedName = function(e) {
var ref, ref1, ref2, ref3, ref4, s;
s = e != null ? (ref = e.chat_message) != null ? (ref1 = ref.message_content) != null ? (ref2 = ref1.segment) != null ? ref2[0] : void 0 : void 0 : void 0 : void 0;
if (!s... | getProxiedName = (e) ->
s = e?.chat_message?.message_content?.segment?[0]
return unless s
return s?.formatting?.bold and isAboutLink(s?.link_data?.link_target) | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 112 | 115 |
yakyak/yakyak:src/ui/util.coffee:10:completion | completion | getProxiedName = (e) ->
s = e?.chat_message?.message_content?.segment?[0] | return unless s
return s?.formatting?.bold and isAboutLink(s?.link_data?.link_target) | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 112 | 115 |
yakyak/yakyak:src/ui/util.coffee:14:raw_corpus | raw_corpus | uniqfn = (as, fn) ->
fned = as.map fn
as.filter (v, i) -> fned.indexOf(fned[i]) == i | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 123 | 125 | ||
yakyak/yakyak:src/ui/util.coffee:14:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
uniqfn = (as, fn) ->
fned = as.map fn
as.filter (v, i) -> fned.indexOf(fned[i]) == i
``` | var uniqfn;
uniqfn = function(as, fn) {
var fned;
fned = as.map(fn);
return as.filter(function(v, i) {
return fned.indexOf(fned[i]) === i;
});
}; | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 123 | 125 |
yakyak/yakyak:src/ui/util.coffee:14:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var uniqfn;
uniqfn = function(as, fn) {
var fned;
fned = as.map(fn);
return as.filter(function(v, i) {
return fned.indexOf(fned[i]) === i;
});
};
``` | uniqfn = (as, fn) ->
fned = as.map fn
as.filter (v, i) -> fned.indexOf(fned[i]) == i | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 123 | 125 |
yakyak/yakyak:src/ui/util.coffee:16:raw_corpus | raw_corpus | getImageUrl = (url="") ->
return url if isImg url
parsed = URL.parse url, true
url = parsed.query.q
return url if isImg url
false | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 129 | 134 | ||
yakyak/yakyak:src/ui/util.coffee:16:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
getImageUrl = (url="") ->
return url if isImg url
parsed = URL.parse url, true
url = parsed.query.q
return url if isImg url
false
``` | var getImageUrl;
getImageUrl = function(url = "") {
var parsed;
if (isImg(url)) {
return url;
}
parsed = URL.parse(url, true);
url = parsed.query.q;
if (isImg(url)) {
return url;
}
return false;
}; | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 129 | 134 |
yakyak/yakyak:src/ui/util.coffee:16:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var getImageUrl;
getImageUrl = function(url = "") {
var parsed;
if (isImg(url)) {
return url;
}
parsed = URL.parse(url, true);
url = parsed.query.q;
if (isImg(url)) {
return url;
}
return false;
};
``` | getImageUrl = (url="") ->
return url if isImg url
parsed = URL.parse url, true
url = parsed.query.q
return url if isImg url
false | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 129 | 134 |
yakyak/yakyak:src/ui/util.coffee:16:completion | completion | getImageUrl = (url="") ->
return url if isImg url
parsed = URL.parse url, true | url = parsed.query.q
return url if isImg url
false | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 129 | 134 |
yakyak/yakyak:src/ui/util.coffee:17:raw_corpus | raw_corpus | toggleVisibility = (element) ->
if element.style.display == 'block'
element.style.display = 'none'
else
element.style.display = 'block' | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 136 | 140 | ||
yakyak/yakyak:src/ui/util.coffee:17:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
toggleVisibility = (element) ->
if element.style.display == 'block'
element.style.display = 'none'
else
element.style.display = 'block'
``` | var toggleVisibility;
toggleVisibility = function(element) {
if (element.style.display === 'block') {
return element.style.display = 'none';
} else {
return element.style.display = 'block';
}
}; | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 136 | 140 |
yakyak/yakyak:src/ui/util.coffee:17:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var toggleVisibility;
toggleVisibility = function(element) {
if (element.style.display === 'block') {
return element.style.display = 'none';
} else {
return element.style.display = 'block';
}
};
``` | toggleVisibility = (element) ->
if element.style.display == 'block'
element.style.display = 'none'
else
element.style.display = 'block' | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 136 | 140 |
yakyak/yakyak:src/ui/util.coffee:17:completion | completion | toggleVisibility = (element) ->
if element.style.display == 'block' | element.style.display = 'none'
else
element.style.display = 'block' | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 136 | 140 |
yakyak/yakyak:src/ui/util.coffee:18:raw_corpus | raw_corpus | convertEmoji = (text) ->
unicodeMap = require './emojishortcode'
patterns = [
"(^|[ ])(:[a-zA-Z0-9_\+-]+:)([ ]|$)",
"(^|[ ])(:\\(:\\)|:\\(\\|\\)|:X\\)|:3|\\(=\\^\\.\\.\\^=\\)|\\(=\\^\\.\\^=\\)|=\\^_\\^=|x_x|X-O|X-o|X\\(|X-\\(|O\\.O|:O|:-O|=O|o\\.o|:o|:-o|=o|D:|>_<|T_T|:'\\(|;_;|='\\(|>\\.<|>:\\... | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 142 | 161 | ||
yakyak/yakyak:src/ui/util.coffee:18:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
convertEmoji = (text) ->
unicodeMap = require './emojishortcode'
patterns = [
"(^|[ ])(:[a-zA-Z0-9_\+-]+:)([ ]|$)",
"(^|[ ])(:\\(:\\)|:\\(\\|\\)|:X\\)|:3|\\(=\\^\\.\\.\\^=\\)|\\(=\\^\\.\\^=\\)|=\\^_\\^=|x_x|X-O|X-o|X\\(|X-\\(|O\\.O|:O|:-O... | var convertEmoji;
convertEmoji = function(text) {
var emojiCodeRegex, patterns, unicodeMap;
unicodeMap = require('./emojishortcode');
patterns = ["(^|[ ])(:[a-zA-Z0-9_\+-]+:)([ ]|$)", "(^|[ ])(:\\(:\\)|:\\(\\|\\)|:X\\)|:3|\\(=\\^\\.\\.\\^=\\)|\\(=\\^\\.\\^=\\)|=\\^_\\^=|x_x|X-O|X-o|X\\(|X-\\(|O\\.O|:O|:-O|=O|o\\... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 142 | 161 |
yakyak/yakyak:src/ui/util.coffee:18:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var convertEmoji;
convertEmoji = function(text) {
var emojiCodeRegex, patterns, unicodeMap;
unicodeMap = require('./emojishortcode');
patterns = ["(^|[ ])(:[a-zA-Z0-9_\+-]+:)([ ]|$)", "(^|[ ])(:\\(:\\)|:\\(\\|\\)|:X\\)|:3|\\(=\\^\\.\\.\\^=\\)|\\(=\\^\\.\\^=\... | convertEmoji = (text) ->
unicodeMap = require './emojishortcode'
patterns = [
"(^|[ ])(:[a-zA-Z0-9_\+-]+:)([ ]|$)",
"(^|[ ])(:\\(:\\)|:\\(\\|\\)|:X\\)|:3|\\(=\\^\\.\\.\\^=\\)|\\(=\\^\\.\\^=\\)|=\\^_\\^=|x_x|X-O|X-o|X\\(|X-\\(|O\\.O|:O|:-O|=O|o\\.o|:o|:-o|=o|D:|>_<|T_T|:'\\(|;_;|='\\(|>\\.<|>:\\... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 142 | 161 |
yakyak/yakyak:src/ui/util.coffee:18:completion | completion | convertEmoji = (text) ->
unicodeMap = require './emojishortcode'
patterns = [
"(^|[ ])(:[a-zA-Z0-9_\+-]+:)([ ]|$)",
"(^|[ ])(:\\(:\\)|:\\(\\|\\)|:X\\)|:3|\\(=\\^\\.\\.\\^=\\)|\\(=\\^\\.\\^=\\)|=\\^_\\^=|x_x|X-O|X-o|X\\(|X-\\(|O\\.O|:O|:-O|=O|o\\.o|:o|:-o|=o|D:|>_<|T_T|:'\\(|;_;|='\\(|>\\.<|>:\\... | text = text.replace(emojiCodeRegex, (emoji) ->
suffix = emoji.slice(emoji.trimRight().length)
prefix = emoji.slice(0, emoji.length - emoji.trimLeft().length)
unicode = unicodeMap[emoji.trim()]
if unicode?
prefix + unicode + suffix
else
emoji
)
retu... | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 142 | 161 |
yakyak/yakyak:src/ui/util.coffee:19:raw_corpus | raw_corpus | insertTextAtCursor = (el, text) ->
value = el.value
doc = el.ownerDocument
if typeof el.selectionStart == "number" and typeof el.selectionEnd == "number"
endIndex = el.selectionEnd
el.value = value.slice(0, endIndex) + text + value.slice(endIndex)
el.selectionStart = el.selectionEnd ... | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 163 | 176 | ||
yakyak/yakyak:src/ui/util.coffee:19:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
insertTextAtCursor = (el, text) ->
value = el.value
doc = el.ownerDocument
if typeof el.selectionStart == "number" and typeof el.selectionEnd == "number"
endIndex = el.selectionEnd
el.value = value.slice(0, endIndex) + text + value.sli... | var insertTextAtCursor;
insertTextAtCursor = function(el, text) {
var doc, endIndex, range, value;
value = el.value;
doc = el.ownerDocument;
if (typeof el.selectionStart === "number" && typeof el.selectionEnd === "number") {
endIndex = el.selectionEnd;
el.value = value.slice(0, endIndex) + text + value... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 163 | 176 |
yakyak/yakyak:src/ui/util.coffee:19:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var insertTextAtCursor;
insertTextAtCursor = function(el, text) {
var doc, endIndex, range, value;
value = el.value;
doc = el.ownerDocument;
if (typeof el.selectionStart === "number" && typeof el.selectionEnd === "number") {
endIndex = el.selectionEnd;... | insertTextAtCursor = (el, text) ->
value = el.value
doc = el.ownerDocument
if typeof el.selectionStart == "number" and typeof el.selectionEnd == "number"
endIndex = el.selectionEnd
el.value = value.slice(0, endIndex) + text + value.slice(endIndex)
el.selectionStart = el.selectionEnd ... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 163 | 176 |
yakyak/yakyak:src/ui/util.coffee:19:completion | completion | insertTextAtCursor = (el, text) ->
value = el.value
doc = el.ownerDocument
if typeof el.selectionStart == "number" and typeof el.selectionEnd == "number"
endIndex = el.selectionEnd
el.value = value.slice(0, endIndex) + text + value.slice(endIndex)
el.selectionStart = el.selectionEnd ... | el.focus()
else if doc.selection != "undefined" and doc.selection.createRange
el.focus()
range = doc.selection.createRange()
range.collapse(false)
range.text = text
range.select() | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 48f8e595deb5416d1eeb3f664fea31ee293d4998 | 3,762 | https://github.com/yakyak/yakyak/blob/48f8e595deb5416d1eeb3f664fea31ee293d4998/src/ui/util.coffee | 163 | 176 |
yakyak/yakyak:src/ui/util.coffee:4:raw_corpus | raw_corpus | drawAvatar = (user_id, viewstate, entity, image = null, email = null, initials = null) ->
#
entity.needEntity(user_id) unless entity[user_id]?
#
# overwrites if entity is cached
initials = initialsof(entity[user_id]).toUpperCase() if entity[user_id]?
email = entity[user_id]?.email?[0] unless ... | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 224aa6fe0863e3ac5187b3f846110087d070137a | 3,762 | https://github.com/yakyak/yakyak/blob/224aa6fe0863e3ac5187b3f846110087d070137a/src/ui/util.coffee | 35 | 66 | ||
yakyak/yakyak:src/ui/util.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
drawAvatar = (user_id, viewstate, entity, image = null, email = null, initials = null) ->
#
entity.needEntity(user_id) unless entity[user_id]?
#
# overwrites if entity is cached
initials = initialsof(entity[user_id]).toUpperCase() if entity[us... | var drawAvatar;
drawAvatar = function(user_id, viewstate, entity, image = null, email = null, initials = null) {
var initialsCode, ref, ref1, ref2, ref3, ref4, ref5;
if (entity[user_id] == null) {
entity.needEntity(user_id);
}
if (entity[user_id] != null) {
// overwrites if entity is cached
initi... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/util.coffee | MIT | 224aa6fe0863e3ac5187b3f846110087d070137a | 3,762 | https://github.com/yakyak/yakyak/blob/224aa6fe0863e3ac5187b3f846110087d070137a/src/ui/util.coffee | 35 | 66 |
yakyak/yakyak:src/ui/util.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var drawAvatar;
drawAvatar = function(user_id, viewstate, entity, image = null, email = null, initials = null) {
var initialsCode, ref, ref1, ref2, ref3, ref4, ref5;
if (entity[user_id] == null) {
entity.needEntity(user_id);
}
if (entity[user_id] != n... | drawAvatar = (user_id, viewstate, entity, image = null, email = null, initials = null) ->
#
entity.needEntity(user_id) unless entity[user_id]?
#
# overwrites if entity is cached
initials = initialsof(entity[user_id]).toUpperCase() if entity[user_id]?
email = entity[user_id]?.email?[0] unless ... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 224aa6fe0863e3ac5187b3f846110087d070137a | 3,762 | https://github.com/yakyak/yakyak/blob/224aa6fe0863e3ac5187b3f846110087d070137a/src/ui/util.coffee | 35 | 66 |
yakyak/yakyak:src/ui/util.coffee:4:completion | completion | drawAvatar = (user_id, viewstate, entity, image = null, email = null, initials = null) ->
#
entity.needEntity(user_id) unless entity[user_id]?
#
# overwrites if entity is cached
initials = initialsof(entity[user_id]).toUpperCase() if entity[user_id]?
email = entity[user_id]?.email?[0] unless ... | if image?
if !viewstate?.showAnimatedThumbs
image += "?sz=50"
#
img src:fixlink(image), "data-initials": initials
, title: email
, onerror: (ev) ->
# in case the image is not available, it
# fallbacks to initia... | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 224aa6fe0863e3ac5187b3f846110087d070137a | 3,762 | https://github.com/yakyak/yakyak/blob/224aa6fe0863e3ac5187b3f846110087d070137a/src/ui/util.coffee | 35 | 66 |
yakyak/yakyak:src/ui/util.coffee:4:raw_corpus | raw_corpus | drawAvatar = (user_id, viewstate, entity, image = null, email = null, initials = null) ->
#
entity.needEntity(user_id) unless entity[user_id]?
#
# overwrites if entity is cached
initials = initialsof entity[user_id] if entity[user_id]?
email = entity[user_id]?.email?[0] unless entity[user_id]... | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 90cdc87fd36196151c2ce33ea38e5a4f2a150a11 | 3,762 | https://github.com/yakyak/yakyak/blob/90cdc87fd36196151c2ce33ea38e5a4f2a150a11/src/ui/util.coffee | 35 | 58 | ||
yakyak/yakyak:src/ui/util.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
drawAvatar = (user_id, viewstate, entity, image = null, email = null, initials = null) ->
#
entity.needEntity(user_id) unless entity[user_id]?
#
# overwrites if entity is cached
initials = initialsof entity[user_id] if entity[user_id]?
ema... | var drawAvatar;
drawAvatar = function(user_id, viewstate, entity, image = null, email = null, initials = null) {
var ref, ref1, ref2, ref3, ref4, ref5;
if (entity[user_id] == null) {
entity.needEntity(user_id);
}
if (entity[user_id] != null) {
// overwrites if entity is cached
initials = initials... | CoffeeScript | JavaScript | yakyak/yakyak | src/ui/util.coffee | MIT | 90cdc87fd36196151c2ce33ea38e5a4f2a150a11 | 3,762 | https://github.com/yakyak/yakyak/blob/90cdc87fd36196151c2ce33ea38e5a4f2a150a11/src/ui/util.coffee | 35 | 58 |
yakyak/yakyak:src/ui/util.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var drawAvatar;
drawAvatar = function(user_id, viewstate, entity, image = null, email = null, initials = null) {
var ref, ref1, ref2, ref3, ref4, ref5;
if (entity[user_id] == null) {
entity.needEntity(user_id);
}
if (entity[user_id] != null) {
//... | drawAvatar = (user_id, viewstate, entity, image = null, email = null, initials = null) ->
#
entity.needEntity(user_id) unless entity[user_id]?
#
# overwrites if entity is cached
initials = initialsof entity[user_id] if entity[user_id]?
email = entity[user_id]?.email?[0] unless entity[user_id]... | JavaScript | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 90cdc87fd36196151c2ce33ea38e5a4f2a150a11 | 3,762 | https://github.com/yakyak/yakyak/blob/90cdc87fd36196151c2ce33ea38e5a4f2a150a11/src/ui/util.coffee | 35 | 58 |
yakyak/yakyak:src/ui/util.coffee:4:completion | completion | drawAvatar = (user_id, viewstate, entity, image = null, email = null, initials = null) ->
#
entity.needEntity(user_id) unless entity[user_id]?
#
# overwrites if entity is cached
initials = initialsof entity[user_id] if entity[user_id]?
email = entity[user_id]?.email?[0] unless entity[user_id]... | image += "?sz=50"
#
img src:fixlink(image), "data-initials": initials
, title: email
, onerror: (ev) ->
# in case the image is not available, it
# fallbacks to initials
ev.target.parentElement.classList.add "fallback-on"
... | CoffeeScript | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | 90cdc87fd36196151c2ce33ea38e5a4f2a150a11 | 3,762 | https://github.com/yakyak/yakyak/blob/90cdc87fd36196151c2ce33ea38e5a4f2a150a11/src/ui/util.coffee | 35 | 58 |
yakyak/yakyak:src/ui/util.coffee:4:raw_corpus | raw_corpus | drawAvatar = (user_id, viewstate, entity, image = null, email = null, initials = null) ->
#
entity.needEntity(user_id) unless entity[user_id]?
#
# overwrites if entity is cached
initials = initialsof entity[user_id] if entity[user_id]?
email = entity[user_id]?.email?[0] unless entity[user_id]... | CoffeeScript | yakyak/yakyak | src/ui/util.coffee | MIT | dc332442781b05911398f751dcae340436cee619 | 3,762 | https://github.com/yakyak/yakyak/blob/dc332442781b05911398f751dcae340436cee619/src/ui/util.coffee | 35 | 58 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.