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
meltingice/psd.js:lib/psd/header.coffee:1:raw_corpus
raw_corpus
RSVP = require ('rsvp') module.exports = class Header constructor: (@file) -> @version = null @channels = null @rows = null @cols = null @depth = null @mode = null parse: -> new RSVP.Promise (resolve, reject) => sig = @file.readString(4) console.log sig resolve(@)
CoffeeScript
meltingice/psd.js
lib/psd/header.coffee
MIT
cdb4392ad1cbdc0867201dfcf74736b895689f41
2,846
https://github.com/meltingice/psd.js/blob/cdb4392ad1cbdc0867201dfcf74736b895689f41/lib/psd/header.coffee
1
16
meltingice/psd.js:lib/psd/header.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript RSVP = require ('rsvp') module.exports = class Header constructor: (@file) -> @version = null @channels = null @rows = null @cols = null @depth = null @mode = null parse: -> new RSVP.Promise (resolve, reject) => sig = @file...
var Header, RSVP; RSVP = require('rsvp'); module.exports = Header = class Header { constructor(file) { this.file = file; this.version = null; this.channels = null; this.rows = null; this.cols = null; this.depth = null; this.mode = null; } parse() { return new RSVP.Promise((resol...
CoffeeScript
JavaScript
meltingice/psd.js
lib/psd/header.coffee
MIT
cdb4392ad1cbdc0867201dfcf74736b895689f41
2,846
https://github.com/meltingice/psd.js/blob/cdb4392ad1cbdc0867201dfcf74736b895689f41/lib/psd/header.coffee
1
16
meltingice/psd.js:lib/psd/header.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var Header, RSVP; RSVP = require('rsvp'); module.exports = Header = class Header { constructor(file) { this.file = file; this.version = null; this.channels = null; this.rows = null; this.cols = null; this.depth = null; this.mode = nu...
RSVP = require ('rsvp') module.exports = class Header constructor: (@file) -> @version = null @channels = null @rows = null @cols = null @depth = null @mode = null parse: -> new RSVP.Promise (resolve, reject) => sig = @file.readString(4) console.log sig resolve(@)
JavaScript
CoffeeScript
meltingice/psd.js
lib/psd/header.coffee
MIT
cdb4392ad1cbdc0867201dfcf74736b895689f41
2,846
https://github.com/meltingice/psd.js/blob/cdb4392ad1cbdc0867201dfcf74736b895689f41/lib/psd/header.coffee
1
16
meltingice/psd.js:lib/psd/header.coffee:1:completion
completion
RSVP = require ('rsvp') module.exports = class Header constructor: (@file) -> @version = null @channels = null @rows = null @cols = null
@depth = null @mode = null parse: -> new RSVP.Promise (resolve, reject) => sig = @file.readString(4) console.log sig resolve(@)
CoffeeScript
CoffeeScript
meltingice/psd.js
lib/psd/header.coffee
MIT
cdb4392ad1cbdc0867201dfcf74736b895689f41
2,846
https://github.com/meltingice/psd.js/blob/cdb4392ad1cbdc0867201dfcf74736b895689f41/lib/psd/header.coffee
1
16
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:1:raw_corpus
raw_corpus
numOfPx = (str) -> if str? == false or not str.endsWith('px') console.log("failed to get size of #{str}") return undefined return Number(str.slice(0, -2))
CoffeeScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
3
7
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript numOfPx = (str) -> if str? == false or not str.endsWith('px') console.log("failed to get size of #{str}") return undefined return Number(str.slice(0, -2)) ```
var numOfPx; numOfPx = function(str) { if ((str != null) === false || !str.endsWith('px')) { console.log(`failed to get size of ${str}`); return void 0; } return Number(str.slice(0, -2)); };
CoffeeScript
JavaScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
3
7
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var numOfPx; numOfPx = function(str) { if ((str != null) === false || !str.endsWith('px')) { console.log(`failed to get size of ${str}`); return void 0; } return Number(str.slice(0, -2)); }; ```
numOfPx = (str) -> if str? == false or not str.endsWith('px') console.log("failed to get size of #{str}") return undefined return Number(str.slice(0, -2))
JavaScript
CoffeeScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
3
7
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:1:completion
completion
numOfPx = (str) -> if str? == false or not str.endsWith('px')
console.log("failed to get size of #{str}") return undefined return Number(str.slice(0, -2))
CoffeeScript
CoffeeScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
3
7
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:2:raw_corpus
raw_corpus
relativeNumOfPx = (str, basisSize) -> if not str?.endsWith('%') return numOfPx(str) pct = Number(str.slice(0, -1)) return 0.01*pct * basisSize
CoffeeScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
9
14
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:2:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript relativeNumOfPx = (str, basisSize) -> if not str?.endsWith('%') return numOfPx(str) pct = Number(str.slice(0, -1)) return 0.01*pct * basisSize ```
var relativeNumOfPx; relativeNumOfPx = function(str, basisSize) { var pct; if (!(str != null ? str.endsWith('%') : void 0)) { return numOfPx(str); } pct = Number(str.slice(0, -1)); return 0.01 * pct * basisSize; };
CoffeeScript
JavaScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
9
14
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:2:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var relativeNumOfPx; relativeNumOfPx = function(str, basisSize) { var pct; if (!(str != null ? str.endsWith('%') : void 0)) { return numOfPx(str); } pct = Number(str.slice(0, -1)); return 0.01 * pct * basisSize; }; ```
relativeNumOfPx = (str, basisSize) -> if not str?.endsWith('%') return numOfPx(str) pct = Number(str.slice(0, -1)) return 0.01*pct * basisSize
JavaScript
CoffeeScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
9
14
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:2:completion
completion
relativeNumOfPx = (str, basisSize) -> if not str?.endsWith('%') return numOfPx(str)
pct = Number(str.slice(0, -1)) return 0.01*pct * basisSize
CoffeeScript
CoffeeScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
9
14
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:3:raw_corpus
raw_corpus
colorIsVisible = (str) -> return false if str? == false str = str.replace(/\s*/g, '') if rgba_match = /rgba\((\d+),(\d+),(\d+),(\d+)\)/.exec(str)?.slice(1)?.map(Number) [r, g, b, a] = rgba_match else if rgb_match = /rgb\((\d+),(\d+),(\d+)\)/.exec(str)?.slice(1)?.map(Number) [r, g, b] = r...
CoffeeScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
16
30
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:3:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript colorIsVisible = (str) -> return false if str? == false str = str.replace(/\s*/g, '') if rgba_match = /rgba\((\d+),(\d+),(\d+),(\d+)\)/.exec(str)?.slice(1)?.map(Number) [r, g, b, a] = rgba_match else if rgb_match = /rgb\((\d+),(\d+),(\d+)\...
var colorIsVisible; colorIsVisible = function(str) { var a, b, g, r, ref, ref1, ref2, ref3, rgb_match, rgba_match; if ((str != null) === false) { return false; } str = str.replace(/\s*/g, ''); if (rgba_match = (ref = /rgba\((\d+),(\d+),(\d+),(\d+)\)/.exec(str)) != null ? (ref1 = ref.slice(1)) != null ? r...
CoffeeScript
JavaScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
16
30
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:3:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var colorIsVisible; colorIsVisible = function(str) { var a, b, g, r, ref, ref1, ref2, ref3, rgb_match, rgba_match; if ((str != null) === false) { return false; } str = str.replace(/\s*/g, ''); if (rgba_match = (ref = /rgba\((\d+),(\d+),(\d+),(\d+)\)/...
colorIsVisible = (str) -> return false if str? == false str = str.replace(/\s*/g, '') if rgba_match = /rgba\((\d+),(\d+),(\d+),(\d+)\)/.exec(str)?.slice(1)?.map(Number) [r, g, b, a] = rgba_match else if rgb_match = /rgb\((\d+),(\d+),(\d+)\)/.exec(str)?.slice(1)?.map(Number) [r, g, b] = r...
JavaScript
CoffeeScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
16
30
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:3:completion
completion
colorIsVisible = (str) -> return false if str? == false str = str.replace(/\s*/g, '') if rgba_match = /rgba\((\d+),(\d+),(\d+),(\d+)\)/.exec(str)?.slice(1)?.map(Number) [r, g, b, a] = rgba_match else if rgb_match = /rgb\((\d+),(\d+),(\d+)\)/.exec(str)?.slice(1)?.map(Number) [r, g, b] = r...
a = 1 else return true # assume visible on failure return false if a == 0 #return false if r == b == g == 255 # pretend white is assumed background color return true
CoffeeScript
CoffeeScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
16
30
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:4:raw_corpus
raw_corpus
getCSSValueUrl = (cssvalue) -> return undefined unless cssvalue? patterns = [/url\('(.*)'\)/, /url\("(.*)"\)/] for p in patterns url = p.exec(cssvalue)?[1] return url if url? return undefined
CoffeeScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
32
38
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:4:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript getCSSValueUrl = (cssvalue) -> return undefined unless cssvalue? patterns = [/url\('(.*)'\)/, /url\("(.*)"\)/] for p in patterns url = p.exec(cssvalue)?[1] return url if url? return undefined ```
var getCSSValueUrl; getCSSValueUrl = function(cssvalue) { var i, len, p, patterns, ref, url; if (cssvalue == null) { return void 0; } patterns = [/url\('(.*)'\)/, /url\("(.*)"\)/]; for (i = 0, len = patterns.length; i < len; i++) { p = patterns[i]; url = (ref = p.exec(cssvalue)) != null ? ref[1] ...
CoffeeScript
JavaScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
32
38
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:4:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var getCSSValueUrl; getCSSValueUrl = function(cssvalue) { var i, len, p, patterns, ref, url; if (cssvalue == null) { return void 0; } patterns = [/url\('(.*)'\)/, /url\("(.*)"\)/]; for (i = 0, len = patterns.length; i < len; i++) { p = patterns[i...
getCSSValueUrl = (cssvalue) -> return undefined unless cssvalue? patterns = [/url\('(.*)'\)/, /url\("(.*)"\)/] for p in patterns url = p.exec(cssvalue)?[1] return url if url? return undefined
JavaScript
CoffeeScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
32
38
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:4:completion
completion
getCSSValueUrl = (cssvalue) -> return undefined unless cssvalue? patterns = [/url\('(.*)'\)/, /url\("(.*)"\)/]
for p in patterns url = p.exec(cssvalue)?[1] return url if url? return undefined
CoffeeScript
CoffeeScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
32
38
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:5:raw_corpus
raw_corpus
clientRect = (domnode) -> r = new Range() r.selectNode(domnode) return r.getBoundingClientRect()
CoffeeScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
40
43
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:5:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript clientRect = (domnode) -> r = new Range() r.selectNode(domnode) return r.getBoundingClientRect() ```
var clientRect; clientRect = function(domnode) { var r; r = new Range(); r.selectNode(domnode); return r.getBoundingClientRect(); };
CoffeeScript
JavaScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
40
43
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:5:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var clientRect; clientRect = function(domnode) { var r; r = new Range(); r.selectNode(domnode); return r.getBoundingClientRect(); }; ```
clientRect = (domnode) -> r = new Range() r.selectNode(domnode) return r.getBoundingClientRect()
JavaScript
CoffeeScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
40
43
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:5:completion
completion
clientRect = (domnode) -> r = new Range()
r.selectNode(domnode) return r.getBoundingClientRect()
CoffeeScript
CoffeeScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
40
43
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:7:raw_corpus
raw_corpus
hasVisibleText = (dom) -> return (dom.nodeType == Node.TEXT_NODE and not isOffscreen clientRect(dom)) or \ _.any(dom.childNodes, hasVisibleText) ## DEBUG=true if DEBUG? urlpath = document.location.href else # get page's url path component urlpath = document.location.pathname # get blocks
CoffeeScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
49
63
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:7:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript hasVisibleText = (dom) -> return (dom.nodeType == Node.TEXT_NODE and not isOffscreen clientRect(dom)) or \ _.any(dom.childNodes, hasVisibleText) ## DEBUG=true if DEBUG? urlpath = document.location.href else # get page's url path component ...
var DEBUG, hasVisibleText, urlpath; hasVisibleText = function(dom) { return (dom.nodeType === Node.TEXT_NODE && !isOffscreen(clientRect(dom))) || _.any(dom.childNodes, hasVisibleText); }; //# DEBUG = true; if (DEBUG != null) { urlpath = document.location.href; } else { // get page's url path component urlpat...
CoffeeScript
JavaScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
49
63
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:7:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var DEBUG, hasVisibleText, urlpath; hasVisibleText = function(dom) { return (dom.nodeType === Node.TEXT_NODE && !isOffscreen(clientRect(dom))) || _.any(dom.childNodes, hasVisibleText); }; //# DEBUG = true; if (DEBUG != null) { urlpath = document.location.hre...
hasVisibleText = (dom) -> return (dom.nodeType == Node.TEXT_NODE and not isOffscreen clientRect(dom)) or \ _.any(dom.childNodes, hasVisibleText) ## DEBUG=true if DEBUG? urlpath = document.location.href else # get page's url path component urlpath = document.location.pathname # get blocks
JavaScript
CoffeeScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
49
63
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:7:completion
completion
hasVisibleText = (dom) -> return (dom.nodeType == Node.TEXT_NODE and not isOffscreen clientRect(dom)) or \ _.any(dom.childNodes, hasVisibleText) ## DEBUG=true
if DEBUG? urlpath = document.location.href else # get page's url path component urlpath = document.location.pathname # get blocks
CoffeeScript
CoffeeScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
49
63
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:8:raw_corpus
raw_corpus
blocks = $("*").toArray().map($).map (domBlock) -> styles = window.getComputedStyle(domBlock[0]) # $.offset() gets us the element's offset from the origin (upper left) of the page # it INCLUDES the element's margin but does NOT include border width or padding # it also MAY BREAK if the page zoom != 1 ...
CoffeeScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
64
113
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:8:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript blocks = $("*").toArray().map($).map (domBlock) -> styles = window.getComputedStyle(domBlock[0]) # $.offset() gets us the element's offset from the origin (upper left) of the page # it INCLUDES the element's margin but does NOT include border width o...
var blocks; blocks = $("*").toArray().map($).map(function(domBlock) { var block, btype, height, left, ref, styles, top, width; styles = window.getComputedStyle(domBlock[0]); // $.offset() gets us the element's offset from the origin (upper left) of the page // it INCLUDES the element's margin but does NOT incl...
CoffeeScript
JavaScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
64
113
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:8:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var blocks; blocks = $("*").toArray().map($).map(function(domBlock) { var block, btype, height, left, ref, styles, top, width; styles = window.getComputedStyle(domBlock[0]); // $.offset() gets us the element's offset from the origin (upper left) of the page ...
blocks = $("*").toArray().map($).map (domBlock) -> styles = window.getComputedStyle(domBlock[0]) # $.offset() gets us the element's offset from the origin (upper left) of the page # it INCLUDES the element's margin but does NOT include border width or padding # it also MAY BREAK if the page zoom != 1 ...
JavaScript
CoffeeScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
64
113
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:8:completion
completion
blocks = $("*").toArray().map($).map (domBlock) -> styles = window.getComputedStyle(domBlock[0]) # $.offset() gets us the element's offset from the origin (upper left) of the page # it INCLUDES the element's margin but does NOT include border width or padding # it also MAY BREAK if the page zoom != 1 ...
styles.display == 'none' or styles.visibility == 'hidden' btype = 'layout' block = { top, left, height, width "color": styles.backgroundColor # ? "rgba(200, 200, 180, 0.06)" "image": getCSSValueUrl(styles.backgroundImage) "borderRadius": relativeNumOfPx(styles.borderRadius, height) ...
CoffeeScript
CoffeeScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
64
113
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:9:raw_corpus
raw_corpus
# it's actually fairly difficult to figure out whether we're the same # color as the background or a single child or something, but or now, # assume white means no color else if not colorIsVisible(block.color) and not block.image? return null block.__ty = "/block/#{btype}" return block # t...
CoffeeScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
114
123
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:9:completion
completion
# it's actually fairly difficult to figure out whether we're the same # color as the background or a single child or something, but or now, # assume white means no color else if not colorIsVisible(block.color) and not block.image? return null
block.__ty = "/block/#{btype}" return block # throw out the ones we rejected
CoffeeScript
CoffeeScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
114
123
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:11:raw_corpus
raw_corpus
output = (json) -> chrome.extension.sendMessage(json) # send it to server output { url: urlpath blocks: blocks } # report success console.log("content imported")
CoffeeScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
126
136
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:11:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript output = (json) -> chrome.extension.sendMessage(json) # send it to server output { url: urlpath blocks: blocks } # report success console.log("content imported") ```
var output; output = function(json) { return chrome.extension.sendMessage(json); }; // send it to server output({ url: urlpath, blocks: blocks }); // report success console.log("content imported");
CoffeeScript
JavaScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
126
136
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:11:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var output; output = function(json) { return chrome.extension.sendMessage(json); }; // send it to server output({ url: urlpath, blocks: blocks }); // report success console.log("content imported"); ```
output = (json) -> chrome.extension.sendMessage(json) # send it to server output { url: urlpath blocks: blocks } # report success console.log("content imported")
JavaScript
CoffeeScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
126
136
Pagedraw/pagedraw:html-importer/chrome-plugin/reader.coffee:11:completion
completion
output = (json) -> chrome.extension.sendMessage(json) # send it to server output {
url: urlpath blocks: blocks } # report success console.log("content imported")
CoffeeScript
CoffeeScript
Pagedraw/pagedraw
html-importer/chrome-plugin/reader.coffee
MIT
aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e
3,558
https://github.com/Pagedraw/pagedraw/blob/aba1bd1b8ef6bb7f58866a9d11ebb7f1e0e18a8e/html-importer/chrome-plugin/reader.coffee
126
136
jianliaoim/talk-os:talk-web/client/app/topic-profile.coffee:1:raw_corpus
raw_corpus
module.exports = React.createClass displayName: 'topic-profile' mixins: [PureRenderMixin] propTypes: topic: T.instanceOf(Immutable.Map) _teamId: T.string hasPermission: T.bool.isRequired saveConfigs: T.func.isRequired getInitialState: -> topic: @props.topic.get('topic')...
CoffeeScript
jianliaoim/talk-os
talk-web/client/app/topic-profile.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/topic-profile.coffee
20
69
jianliaoim/talk-os:talk-web/client/app/topic-profile.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript module.exports = React.createClass displayName: 'topic-profile' mixins: [PureRenderMixin] propTypes: topic: T.instanceOf(Immutable.Map) _teamId: T.string hasPermission: T.bool.isRequired saveConfigs: T.func.isRequired ...
module.exports = React.createClass({ displayName: 'topic-profile', mixins: [PureRenderMixin], propTypes: { topic: T.instanceOf(Immutable.Map), _teamId: T.string, hasPermission: T.bool.isRequired, saveConfigs: T.func.isRequired }, getInitialState: function() { return { topic: this.pro...
CoffeeScript
JavaScript
jianliaoim/talk-os
talk-web/client/app/topic-profile.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/topic-profile.coffee
20
69
jianliaoim/talk-os:talk-web/client/app/topic-profile.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript module.exports = React.createClass({ displayName: 'topic-profile', mixins: [PureRenderMixin], propTypes: { topic: T.instanceOf(Immutable.Map), _teamId: T.string, hasPermission: T.bool.isRequired, saveConfigs: T.func.isRequired }, getInitia...
module.exports = React.createClass displayName: 'topic-profile' mixins: [PureRenderMixin] propTypes: topic: T.instanceOf(Immutable.Map) _teamId: T.string hasPermission: T.bool.isRequired saveConfigs: T.func.isRequired getInitialState: -> topic: @props.topic.get('topic')...
JavaScript
CoffeeScript
jianliaoim/talk-os
talk-web/client/app/topic-profile.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/topic-profile.coffee
20
69
jianliaoim/talk-os:talk-web/client/app/topic-profile.coffee:1:completion
completion
module.exports = React.createClass displayName: 'topic-profile' mixins: [PureRenderMixin] propTypes: topic: T.instanceOf(Immutable.Map) _teamId: T.string hasPermission: T.bool.isRequired saveConfigs: T.func.isRequired getInitialState: -> topic: @props.topic.get('topic')...
isNameUnique: -> @getRooms().concat(@getArchivedTopics()) .filterNot (room) => room.get('_id') is @props.topic.get('_id') .every (room) => room.get('topic') isnt @state.topic.trim() needSave: -> if @state.topic isnt @props.topic.get('topic') then return true if @state.purpose isn...
CoffeeScript
CoffeeScript
jianliaoim/talk-os
talk-web/client/app/topic-profile.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/topic-profile.coffee
20
69
jianliaoim/talk-os:talk-web/client/app/topic-profile.coffee:2:raw_corpus
raw_corpus
if @state.color isnt @props.topic.get('color') then data.color = @state.color if @state.isPrivate isnt @props.topic.get('isPrivate') then data.isPrivate = @state.isPrivate if Object.keys(data).length > 0 @setState buttonDisabled: true @props.saveConfigs data , (resp) => @setS...
CoffeeScript
jianliaoim/talk-os
talk-web/client/app/topic-profile.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/topic-profile.coffee
70
119
jianliaoim/talk-os:talk-web/client/app/topic-profile.coffee:2:completion
completion
if @state.color isnt @props.topic.get('color') then data.color = @state.color if @state.isPrivate isnt @props.topic.get('isPrivate') then data.isPrivate = @state.isPrivate if Object.keys(data).length > 0 @setState buttonDisabled: true @props.saveConfigs data , (resp) => @setS...
@setState {color} onPublicClick: -> if @props.hasPermission then @setState isPrivate: false onPrivateClick: -> if @props.hasPermission then @setState isPrivate: true # render methods renderPrivate: -> if not @props.topic.get('isGeneral') div className: 'section', lang.getText('openness') ...
CoffeeScript
CoffeeScript
jianliaoim/talk-os
talk-web/client/app/topic-profile.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/topic-profile.coffee
70
119
jianliaoim/talk-os:talk-web/client/app/topic-profile.coffee:3:raw_corpus
raw_corpus
unless @props.topic.get('isGeneral') div className: 'section', lang.getText('topic-name') input type: 'text', key: 'input', className: 'form-control', value: @state.topic placeholder: lang.getText('topic-name-placeholder') onChange: @onTopicChange ...
CoffeeScript
jianliaoim/talk-os
talk-web/client/app/topic-profile.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/topic-profile.coffee
120
137
jianliaoim/talk-os:talk-web/client/app/topic-profile.coffee:3:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript unless @props.topic.get('isGeneral') div className: 'section', lang.getText('topic-name') input type: 'text', key: 'input', className: 'form-control', value: @state.topic placeholder: lang.getText('topic-name-pl...
if (!this.props.topic.get('isGeneral')) { div({ className: 'section' }, lang.getText('topic-name'), input({ type: 'text', key: 'input', className: 'form-control', value: this.state.topic, placeholder: lang.getText('topic-name-placeholder'), onChange: this.onTopicChange, readOnly: !th...
CoffeeScript
JavaScript
jianliaoim/talk-os
talk-web/client/app/topic-profile.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/topic-profile.coffee
120
137
jianliaoim/talk-os:talk-web/client/app/topic-profile.coffee:3:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript if (!this.props.topic.get('isGeneral')) { div({ className: 'section' }, lang.getText('topic-name'), input({ type: 'text', key: 'input', className: 'form-control', value: this.state.topic, placeholder: lang.getText('topic-name-placeholder...
unless @props.topic.get('isGeneral') div className: 'section', lang.getText('topic-name') input type: 'text', key: 'input', className: 'form-control', value: @state.topic placeholder: lang.getText('topic-name-placeholder') onChange: @onTopicChange ...
JavaScript
CoffeeScript
jianliaoim/talk-os
talk-web/client/app/topic-profile.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/topic-profile.coffee
120
137
jianliaoim/talk-os:talk-web/client/app/topic-profile.coffee:3:completion
completion
unless @props.topic.get('isGeneral') div className: 'section', lang.getText('topic-name') input type: 'text', key: 'input', className: 'form-control', value: @state.topic placeholder: lang.getText('topic-name-placeholder') onChange: @onTopicChange ...
div className: 'section', lang.getText('topic-purpose') textarea className: 'form-control is-static', value: @state.purpose placeholder: lang.getText('topic-purpose-placeholder') onChange: @onPurposeChange readOnly: (not @props.hasPermission) @renderPrivate(...
CoffeeScript
CoffeeScript
jianliaoim/talk-os
talk-web/client/app/topic-profile.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/topic-profile.coffee
120
137
jianliaoim/talk-os:talk-web/test/spec/util/clock.spec.coffee:1:raw_corpus
raw_corpus
describe 'util: clock', -> beforeEach -> @clock = require 'util/clock' it 'should add functions to clock and run the functions after 10 seconds', -> fn1 = jasmine.createSpy 'fn1' fn2 = jasmine.createSpy 'fn2' id1 = '1' id2 = '2' @clock.add(id1, fn1) @clock.add(id2, fn2) jasmine.c...
CoffeeScript
jianliaoim/talk-os
talk-web/test/spec/util/clock.spec.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/util/clock.spec.coffee
1
44
jianliaoim/talk-os:talk-web/test/spec/util/clock.spec.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript describe 'util: clock', -> beforeEach -> @clock = require 'util/clock' it 'should add functions to clock and run the functions after 10 seconds', -> fn1 = jasmine.createSpy 'fn1' fn2 = jasmine.createSpy 'fn2' id1 = '1' id2 = '2' @cl...
describe('util: clock', function() { beforeEach(function() { return this.clock = require('util/clock'); }); it('should add functions to clock and run the functions after 10 seconds', function() { var fn1, fn2, id1, id2; fn1 = jasmine.createSpy('fn1'); fn2 = jasmine.createSpy('fn2'); id1 = '1';...
CoffeeScript
JavaScript
jianliaoim/talk-os
talk-web/test/spec/util/clock.spec.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/util/clock.spec.coffee
1
44
jianliaoim/talk-os:talk-web/test/spec/util/clock.spec.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript describe('util: clock', function() { beforeEach(function() { return this.clock = require('util/clock'); }); it('should add functions to clock and run the functions after 10 seconds', function() { var fn1, fn2, id1, id2; fn1 = jasmine.createSpy('fn...
describe 'util: clock', -> beforeEach -> @clock = require 'util/clock' it 'should add functions to clock and run the functions after 10 seconds', -> fn1 = jasmine.createSpy 'fn1' fn2 = jasmine.createSpy 'fn2' id1 = '1' id2 = '2' @clock.add(id1, fn1) @clock.add(id2, fn2) jasmine.c...
JavaScript
CoffeeScript
jianliaoim/talk-os
talk-web/test/spec/util/clock.spec.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/util/clock.spec.coffee
1
44
jianliaoim/talk-os:talk-web/test/spec/util/clock.spec.coffee:1:completion
completion
describe 'util: clock', -> beforeEach -> @clock = require 'util/clock' it 'should add functions to clock and run the functions after 10 seconds', -> fn1 = jasmine.createSpy 'fn1' fn2 = jasmine.createSpy 'fn2' id1 = '1' id2 = '2' @clock.add(id1, fn1) @clock.add(id2, fn2) jasmine.c...
id1 = '1' id2 = '2' @clock.add(id1, fn1) @clock.add(id2, fn2) @clock.remove(id1) jasmine.clock().tick(10000) expect(fn1).not.toHaveBeenCalled() expect(fn2).toHaveBeenCalled() fn1.calls.reset() fn2.calls.reset() @clock.remove(id2) jasmine.clock().tick(10000) expect...
CoffeeScript
CoffeeScript
jianliaoim/talk-os
talk-web/test/spec/util/clock.spec.coffee
MIT
2545c4497865779a55762e03963a39237df9046b
2,703
https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/util/clock.spec.coffee
1
44
lmaccherone/node-localstorage:test/json-storage-test.coffee:1:raw_corpus
raw_corpus
{JSONStorage} = require('../') path = require('path') tape = require('tape') tape('JSONStorage', (test) => localStorage = new JSONStorage('./scratch') test.equal(localStorage._location, path.resolve('./scratch')) localStorage.setItem('/', 'something') test.equal(localStorage.getItem('/'), 'something') o = ...
CoffeeScript
lmaccherone/node-localstorage
test/json-storage-test.coffee
MIT
23eff752dc603ad9559c50739589d3ec673c07f7
460
https://github.com/lmaccherone/node-localstorage/blob/23eff752dc603ad9559c50739589d3ec673c07f7/test/json-storage-test.coffee
1
50
lmaccherone/node-localstorage:test/json-storage-test.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript {JSONStorage} = require('../') path = require('path') tape = require('tape') tape('JSONStorage', (test) => localStorage = new JSONStorage('./scratch') test.equal(localStorage._location, path.resolve('./scratch')) localStorage.setItem('/', 'something') ...
var JSONStorage, path, tape; ({JSONStorage} = require('../')); path = require('path'); tape = require('tape'); tape('JSONStorage', (test) => { var a, localStorage, o; localStorage = new JSONStorage('./scratch'); test.equal(localStorage._location, path.resolve('./scratch')); localStorage.setItem('/', 'someth...
CoffeeScript
JavaScript
lmaccherone/node-localstorage
test/json-storage-test.coffee
MIT
23eff752dc603ad9559c50739589d3ec673c07f7
460
https://github.com/lmaccherone/node-localstorage/blob/23eff752dc603ad9559c50739589d3ec673c07f7/test/json-storage-test.coffee
1
50
lmaccherone/node-localstorage:test/json-storage-test.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var JSONStorage, path, tape; ({JSONStorage} = require('../')); path = require('path'); tape = require('tape'); tape('JSONStorage', (test) => { var a, localStorage, o; localStorage = new JSONStorage('./scratch'); test.equal(localStorage._location, path.res...
{JSONStorage} = require('../') path = require('path') tape = require('tape') tape('JSONStorage', (test) => localStorage = new JSONStorage('./scratch') test.equal(localStorage._location, path.resolve('./scratch')) localStorage.setItem('/', 'something') test.equal(localStorage.getItem('/'), 'something') o = ...
JavaScript
CoffeeScript
lmaccherone/node-localstorage
test/json-storage-test.coffee
MIT
23eff752dc603ad9559c50739589d3ec673c07f7
460
https://github.com/lmaccherone/node-localstorage/blob/23eff752dc603ad9559c50739589d3ec673c07f7/test/json-storage-test.coffee
1
50
lmaccherone/node-localstorage:test/json-storage-test.coffee:1:completion
completion
{JSONStorage} = require('../') path = require('path') tape = require('tape') tape('JSONStorage', (test) => localStorage = new JSONStorage('./scratch') test.equal(localStorage._location, path.resolve('./scratch')) localStorage.setItem('/', 'something') test.equal(localStorage.getItem('/'), 'something') o = ...
test.deepEqual(localStorage._keys, ['/']) test.equal(localStorage.length, 1) test.equal(localStorage.key(0), '/') localStorage.clear() test.equal(localStorage.length, 0) localStorage._deleteLocation() test.end() ) # tape('no new keyword', (test) => # local = JSONStorage('./scratch3') # local.setItem(...
CoffeeScript
CoffeeScript
lmaccherone/node-localstorage
test/json-storage-test.coffee
MIT
23eff752dc603ad9559c50739589d3ec673c07f7
460
https://github.com/lmaccherone/node-localstorage/blob/23eff752dc603ad9559c50739589d3ec673c07f7/test/json-storage-test.coffee
1
50
lmaccherone/node-localstorage:test/json-storage-test.coffee:1:raw_corpus
raw_corpus
{JSONStorage} = require('../') path = require('path') tape = require('tape') tape('JSONStorage', (test) => localStorage = new JSONStorage('./scratch') test.equal(localStorage._location, path.resolve('./scratch')) localStorage.setItem('/', 'something') test.equal(localStorage.getItem('/'), 'something') o = ...
CoffeeScript
lmaccherone/node-localstorage
test/json-storage-test.coffee
MIT
5c4b3306014091cd9071f63f4a845b6ebf84fffc
460
https://github.com/lmaccherone/node-localstorage/blob/5c4b3306014091cd9071f63f4a845b6ebf84fffc/test/json-storage-test.coffee
1
50
lmaccherone/node-localstorage:test/json-storage-test.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript {JSONStorage} = require('../') path = require('path') tape = require('tape') tape('JSONStorage', (test) => localStorage = new JSONStorage('./scratch') test.equal(localStorage._location, path.resolve('./scratch')) localStorage.setItem('/', 'something') ...
var JSONStorage, path, tape; ({JSONStorage} = require('../')); path = require('path'); tape = require('tape'); tape('JSONStorage', (test) => { var a, localStorage, o; localStorage = new JSONStorage('./scratch'); test.equal(localStorage._location, path.resolve('./scratch')); localStorage.setItem('/', 'someth...
CoffeeScript
JavaScript
lmaccherone/node-localstorage
test/json-storage-test.coffee
MIT
5c4b3306014091cd9071f63f4a845b6ebf84fffc
460
https://github.com/lmaccherone/node-localstorage/blob/5c4b3306014091cd9071f63f4a845b6ebf84fffc/test/json-storage-test.coffee
1
50
lmaccherone/node-localstorage:test/json-storage-test.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var JSONStorage, path, tape; ({JSONStorage} = require('../')); path = require('path'); tape = require('tape'); tape('JSONStorage', (test) => { var a, localStorage, o; localStorage = new JSONStorage('./scratch'); test.equal(localStorage._location, path.res...
{JSONStorage} = require('../') path = require('path') tape = require('tape') tape('JSONStorage', (test) => localStorage = new JSONStorage('./scratch') test.equal(localStorage._location, path.resolve('./scratch')) localStorage.setItem('/', 'something') test.equal(localStorage.getItem('/'), 'something') o = ...
JavaScript
CoffeeScript
lmaccherone/node-localstorage
test/json-storage-test.coffee
MIT
5c4b3306014091cd9071f63f4a845b6ebf84fffc
460
https://github.com/lmaccherone/node-localstorage/blob/5c4b3306014091cd9071f63f4a845b6ebf84fffc/test/json-storage-test.coffee
1
50
lmaccherone/node-localstorage:test/json-storage-test.coffee:1:completion
completion
{JSONStorage} = require('../') path = require('path') tape = require('tape') tape('JSONStorage', (test) => localStorage = new JSONStorage('./scratch') test.equal(localStorage._location, path.resolve('./scratch')) localStorage.setItem('/', 'something') test.equal(localStorage.getItem('/'), 'something') o = ...
test.deepEqual(localStorage._keys, ['/']) test.equal(localStorage.length, 1) test.equal(localStorage.key(0), '/') localStorage.clear() test.equal(localStorage.length, 0) localStorage._deleteLocation() test.end() ) tape('no new keyword', (test) => local = JSONStorage('./scratch3') local.setItem('Hello...
CoffeeScript
CoffeeScript
lmaccherone/node-localstorage
test/json-storage-test.coffee
MIT
5c4b3306014091cd9071f63f4a845b6ebf84fffc
460
https://github.com/lmaccherone/node-localstorage/blob/5c4b3306014091cd9071f63f4a845b6ebf84fffc/test/json-storage-test.coffee
1
50
hipchat/hubot-hipchat:src/hipchat.coffee:1:raw_corpus
raw_corpus
class HipChat extends Adapter constructor: (robot) -> super robot @logger = robot.logger send: (envelope, strings...) -> {user, room} = envelope user = envelope if not user # pre-2.4.2 style target_jid = # most common case - we're replying to a user in a room or 1-1 user?.reply_to...
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961
661
https://github.com/hipchat/hubot-hipchat/blob/a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961/src/hipchat.coffee
6
55
hipchat/hubot-hipchat:src/hipchat.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript class HipChat extends Adapter constructor: (robot) -> super robot @logger = robot.logger send: (envelope, strings...) -> {user, room} = envelope user = envelope if not user # pre-2.4.2 style target_jid = # most common case - we're...
var HipChat; HipChat = class HipChat extends Adapter { constructor(robot) { super(robot); this.logger = robot.logger; } send(envelope, ...strings) { var i, len, results, room, str, target_jid, user; ({user, room} = envelope); if (!user) { // pre-2.4.2 style user = envelope; } /...
CoffeeScript
JavaScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961
661
https://github.com/hipchat/hubot-hipchat/blob/a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961/src/hipchat.coffee
6
55
hipchat/hubot-hipchat:src/hipchat.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var HipChat; HipChat = class HipChat extends Adapter { constructor(robot) { super(robot); this.logger = robot.logger; } send(envelope, ...strings) { var i, len, results, room, str, target_jid, user; ({user, room} = envelope); if (!user) ...
class HipChat extends Adapter constructor: (robot) -> super robot @logger = robot.logger send: (envelope, strings...) -> {user, room} = envelope user = envelope if not user # pre-2.4.2 style target_jid = # most common case - we're replying to a user in a room or 1-1 user?.reply_to...
JavaScript
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961
661
https://github.com/hipchat/hubot-hipchat/blob/a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961/src/hipchat.coffee
6
55
hipchat/hubot-hipchat:src/hipchat.coffee:1:completion
completion
class HipChat extends Adapter constructor: (robot) -> super robot @logger = robot.logger send: (envelope, strings...) -> {user, room} = envelope user = envelope if not user # pre-2.4.2 style target_jid = # most common case - we're replying to a user in a room or 1-1 user?.reply_to...
reply: (envelope, strings...) -> user = if envelope.user then envelope.user else envelope @send envelope, "@#{user.mention_name} #{str}" for str in strings run: -> @options = jid: process.env.HUBOT_HIPCHAT_JID password: process.env.HUBOT_HIPCHAT_PASSWORD token: process.env...
CoffeeScript
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961
661
https://github.com/hipchat/hubot-hipchat/blob/a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961/src/hipchat.coffee
6
55
hipchat/hubot-hipchat:src/hipchat.coffee:2:raw_corpus
raw_corpus
@logger.info "Connected to #{host} as @#{connector.mention_name}" # Provide our name to Hubot @robot.name = connector.mention_name # Tell Hubot we're connected so it can load scripts @emit "connected" # Join requested rooms if @options.rooms is "All" or @options.rooms is "@All" ...
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961
661
https://github.com/hipchat/hubot-hipchat/blob/a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961/src/hipchat.coffee
56
105
hipchat/hubot-hipchat:src/hipchat.coffee:2:completion
completion
@logger.info "Connected to #{host} as @#{connector.mention_name}" # Provide our name to Hubot @robot.name = connector.mention_name # Tell Hubot we're connected so it can load scripts @emit "connected" # Join requested rooms if @options.rooms is "All" or @options.rooms is "@All" ...
for user in users @robot.brain.userForId @userIdFromJid(user.jid), user else @logger.error "Can't list users: #{err}" connector.onDisconnect => @logger.info "Disconnected from #{host}" connector.onError => @logger.error [].slice.call(arguments).map(inspect).join(", ")...
CoffeeScript
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961
661
https://github.com/hipchat/hubot-hipchat/blob/a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961/src/hipchat.coffee
56
105
hipchat/hubot-hipchat:src/hipchat.coffee:3:raw_corpus
raw_corpus
connector.onMessage (channel, from, message) => handleMessage message: message from: from reply_to: channel room: @roomNameFromJid(channel) connector.onPrivateMessage (from, message) => handleMessage message: message from: from reply_to: from ...
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961
661
https://github.com/hipchat/hubot-hipchat/blob/a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961/src/hipchat.coffee
106
155
hipchat/hubot-hipchat:src/hipchat.coffee:3:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript connector.onMessage (channel, from, message) => handleMessage message: message from: from reply_to: channel room: @roomNameFromJid(channel) connector.onPrivateMessage (from, message) => handleMessage messag...
connector.onMessage((channel, from, message) => { return handleMessage({ message: message, from: from, reply_to: channel, room: this.roomNameFromJid(channel) }); }); connector.onPrivateMessage((from, message) => { return handleMessage({ message: message, from: from, reply_to: from }...
CoffeeScript
JavaScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961
661
https://github.com/hipchat/hubot-hipchat/blob/a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961/src/hipchat.coffee
106
155
hipchat/hubot-hipchat:src/hipchat.coffee:3:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript connector.onMessage((channel, from, message) => { return handleMessage({ message: message, from: from, reply_to: channel, room: this.roomNameFromJid(channel) }); }); connector.onPrivateMessage((from, message) => { return handleMessage({ m...
connector.onMessage (channel, from, message) => handleMessage message: message from: from reply_to: channel room: @roomNameFromJid(channel) connector.onPrivateMessage (from, message) => handleMessage message: message from: from reply_to: from ...
JavaScript
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961
661
https://github.com/hipchat/hubot-hipchat/blob/a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961/src/hipchat.coffee
106
155
hipchat/hubot-hipchat:src/hipchat.coffee:3:completion
completion
connector.onMessage (channel, from, message) => handleMessage message: message from: from reply_to: channel room: @roomNameFromJid(channel) connector.onPrivateMessage (from, message) => handleMessage message: message from: from reply_to: from ...
try jid.match(/^\d+_(\d+)@chat\./)[1] catch e @logger.error "Bad user JID: #{jid}" roomNameFromJid: (jid) -> try jid.match(/^\d+_(.+)@conf\./)[1] catch e @logger.error "Bad room JID: #{jid}" # Convenience HTTP Methods for posting on behalf of the token'd user get: (path, call...
CoffeeScript
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961
661
https://github.com/hipchat/hubot-hipchat/blob/a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961/src/hipchat.coffee
106
155
hipchat/hubot-hipchat:src/hipchat.coffee:4:raw_corpus
raw_corpus
options = agent : false host : host port : 443 path : path += "?auth_token=#{@options.token}" method : method headers: headers if method is "POST" headers["Content-Type"] = "application/x-www-form-urlencoded" options.headers["Content-Length"] = body.length ...
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961
661
https://github.com/hipchat/hubot-hipchat/blob/a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961/src/hipchat.coffee
156
191
hipchat/hubot-hipchat:src/hipchat.coffee:4:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript options = agent : false host : host port : 443 path : path += "?auth_token=#{@options.token}" method : method headers: headers if method is "POST" headers["Content-Type"] = "application/x-www-form-urlencoded" ...
var options, request; options = { agent: false, host: host, port: 443, path: path += `?auth_token=${this.options.token}`, method: method, headers: headers }; if (method === "POST") { headers["Content-Type"] = "application/x-www-form-urlencoded"; options.headers["Content-Length"] = body.length; } requ...
CoffeeScript
JavaScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961
661
https://github.com/hipchat/hubot-hipchat/blob/a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961/src/hipchat.coffee
156
191
hipchat/hubot-hipchat:src/hipchat.coffee:4:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var options, request; options = { agent: false, host: host, port: 443, path: path += `?auth_token=${this.options.token}`, method: method, headers: headers }; if (method === "POST") { headers["Content-Type"] = "application/x-www-form-urlencoded"; o...
options = agent : false host : host port : 443 path : path += "?auth_token=#{@options.token}" method : method headers: headers if method is "POST" headers["Content-Type"] = "application/x-www-form-urlencoded" options.headers["Content-Length"] = body.length ...
JavaScript
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961
661
https://github.com/hipchat/hubot-hipchat/blob/a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961/src/hipchat.coffee
156
191
hipchat/hubot-hipchat:src/hipchat.coffee:4:completion
completion
options = agent : false host : host port : 443 path : path += "?auth_token=#{@options.token}" method : method headers: headers if method is "POST" headers["Content-Type"] = "application/x-www-form-urlencoded" options.headers["Content-Length"] = body.length ...
if response.statusCode >= 400 @logger.error "HipChat API error: #{response.statusCode}" try callback null, JSON.parse(data) catch err callback null, data or { } response.on "error", (err) -> callback err, null if method is "POST" request.end(body, "...
CoffeeScript
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961
661
https://github.com/hipchat/hubot-hipchat/blob/a2b07a302bd7e9f1d6a68d8a8dee13d4de87c961/src/hipchat.coffee
156
191
hipchat/hubot-hipchat:src/hipchat.coffee:1:raw_corpus
raw_corpus
class HipChat extends Adapter send: (user, strings...) -> if !user.reply_to and user.room user.reply_to = user.room for str in strings @bot.message user.reply_to, str reply: (user, strings...) -> for str in strings @send user, "@#{user.mention_name} #{str}" run: -> self = @ ...
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
46979ea3fef04facb7920feb2e2a63697a4d0a08
661
https://github.com/hipchat/hubot-hipchat/blob/46979ea3fef04facb7920feb2e2a63697a4d0a08/src/hipchat.coffee
7
56
hipchat/hubot-hipchat:src/hipchat.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript class HipChat extends Adapter send: (user, strings...) -> if !user.reply_to and user.room user.reply_to = user.room for str in strings @bot.message user.reply_to, str reply: (user, strings...) -> for str in strings @send user, "...
var HipChat; HipChat = class HipChat extends Adapter { send(user, ...strings) { var i, len, results, str; if (!user.reply_to && user.room) { user.reply_to = user.room; } results = []; for (i = 0, len = strings.length; i < len; i++) { str = strings[i]; results.push(this.bot.messa...
CoffeeScript
JavaScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
46979ea3fef04facb7920feb2e2a63697a4d0a08
661
https://github.com/hipchat/hubot-hipchat/blob/46979ea3fef04facb7920feb2e2a63697a4d0a08/src/hipchat.coffee
7
56
hipchat/hubot-hipchat:src/hipchat.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var HipChat; HipChat = class HipChat extends Adapter { send(user, ...strings) { var i, len, results, str; if (!user.reply_to && user.room) { user.reply_to = user.room; } results = []; for (i = 0, len = strings.length; i < len; i++) { ...
class HipChat extends Adapter send: (user, strings...) -> if !user.reply_to and user.room user.reply_to = user.room for str in strings @bot.message user.reply_to, str reply: (user, strings...) -> for str in strings @send user, "@#{user.mention_name} #{str}" run: -> self = @ ...
JavaScript
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
46979ea3fef04facb7920feb2e2a63697a4d0a08
661
https://github.com/hipchat/hubot-hipchat/blob/46979ea3fef04facb7920feb2e2a63697a4d0a08/src/hipchat.coffee
7
56
hipchat/hubot-hipchat:src/hipchat.coffee:1:completion
completion
class HipChat extends Adapter send: (user, strings...) -> if !user.reply_to and user.room user.reply_to = user.room for str in strings @bot.message user.reply_to, str reply: (user, strings...) -> for str in strings @send user, "@#{user.mention_name} #{str}" run: -> self = @ ...
password: @options.password, debug: @options.debug == 'true', host: @options.host ) console.log "Wobot object:", bot bot.onConnect => console.log "Connected to HipChat as @#{bot.mention_name}!" # Provide our name to Hubot self.robot.name = bot.mention_name # Tell Hubot...
CoffeeScript
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
46979ea3fef04facb7920feb2e2a63697a4d0a08
661
https://github.com/hipchat/hubot-hipchat/blob/46979ea3fef04facb7920feb2e2a63697a4d0a08/src/hipchat.coffee
7
56
hipchat/hubot-hipchat:src/hipchat.coffee:2:raw_corpus
raw_corpus
for room_jid in @options.rooms.split(',') console.log "Joining #{room_jid}" bot.join room_jid # Fetch user info bot.getRoster (err, users, stanza) -> if users for user in users self.userForId self.userIdFromJid(user.jid), user else console...
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
46979ea3fef04facb7920feb2e2a63697a4d0a08
661
https://github.com/hipchat/hubot-hipchat/blob/46979ea3fef04facb7920feb2e2a63697a4d0a08/src/hipchat.coffee
57
106
hipchat/hubot-hipchat:src/hipchat.coffee:2:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript for room_jid in @options.rooms.split(',') console.log "Joining #{room_jid}" bot.join room_jid # Fetch user info bot.getRoster (err, users, stanza) -> if users for user in users self.userForId self.use...
var i, len, ref, room_jid; ref = this.options.rooms.split(','); for (i = 0, len = ref.length; i < len; i++) { room_jid = ref[i]; console.log(`Joining ${room_jid}`); bot.join(room_jid); } // Fetch user info bot.getRoster(function(err, users, stanza) { var j, len1, results, user; if (users) { results = []...
CoffeeScript
JavaScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
46979ea3fef04facb7920feb2e2a63697a4d0a08
661
https://github.com/hipchat/hubot-hipchat/blob/46979ea3fef04facb7920feb2e2a63697a4d0a08/src/hipchat.coffee
57
106
hipchat/hubot-hipchat:src/hipchat.coffee:2:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var i, len, ref, room_jid; ref = this.options.rooms.split(','); for (i = 0, len = ref.length; i < len; i++) { room_jid = ref[i]; console.log(`Joining ${room_jid}`); bot.join(room_jid); } // Fetch user info bot.getRoster(function(err, users, stanza) { var ...
for room_jid in @options.rooms.split(',') console.log "Joining #{room_jid}" bot.join room_jid # Fetch user info bot.getRoster (err, users, stanza) -> if users for user in users self.userForId self.userIdFromJid(user.jid), user else console...
JavaScript
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
46979ea3fef04facb7920feb2e2a63697a4d0a08
661
https://github.com/hipchat/hubot-hipchat/blob/46979ea3fef04facb7920feb2e2a63697a4d0a08/src/hipchat.coffee
57
106
hipchat/hubot-hipchat:src/hipchat.coffee:2:completion
completion
for room_jid in @options.rooms.split(',') console.log "Joining #{room_jid}" bot.join room_jid # Fetch user info bot.getRoster (err, users, stanza) -> if users for user in users self.userForId self.userIdFromJid(user.jid), user else console...
author.room = self.roomNameFromJid(channel) # reformat leading @mention name to be like "name: message" which is # what hubot expects regex = new RegExp("^@#{bot.mention_name}\\b", "i") hubot_msg = message.replace(regex, "#{bot.mention_name}: ") self.receive new TextMessage(author, hubot...
CoffeeScript
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
46979ea3fef04facb7920feb2e2a63697a4d0a08
661
https://github.com/hipchat/hubot-hipchat/blob/46979ea3fef04facb7920feb2e2a63697a4d0a08/src/hipchat.coffee
57
106
hipchat/hubot-hipchat:src/hipchat.coffee:3:raw_corpus
raw_corpus
bot.connect() @bot = bot userIdFromJid: (jid) -> try return jid.match(/^\d+_(\d+)@chat\./)[1] catch e console.log "Bad user JID: #{jid}" return null roomNameFromJid: (jid) -> try return jid.match(/^\d+_(.+)@conf\./)[1] catch e console.log "Bad room JID: #{jid}" ...
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
46979ea3fef04facb7920feb2e2a63697a4d0a08
661
https://github.com/hipchat/hubot-hipchat/blob/46979ea3fef04facb7920feb2e2a63697a4d0a08/src/hipchat.coffee
107
156
hipchat/hubot-hipchat:src/hipchat.coffee:3:completion
completion
bot.connect() @bot = bot userIdFromJid: (jid) -> try return jid.match(/^\d+_(\d+)@chat\./)[1] catch e console.log "Bad user JID: #{jid}" return null roomNameFromJid: (jid) -> try return jid.match(/^\d+_(.+)@conf\./)[1] catch e console.log "Bad room JID: #{jid}" ...
request: (method, path, body, callback) -> console.log method, path, body host = @options.host or "api.hipchat.com" headers = "Host": host unless @options.token callback "No API token provided to Hubot", null return options = "agent" : false "host" : host "port" ...
CoffeeScript
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
46979ea3fef04facb7920feb2e2a63697a4d0a08
661
https://github.com/hipchat/hubot-hipchat/blob/46979ea3fef04facb7920feb2e2a63697a4d0a08/src/hipchat.coffee
107
156
hipchat/hubot-hipchat:src/hipchat.coffee:4:raw_corpus
raw_corpus
options.path += "?auth_token=#{@options.token}" request = HTTPS.request options, (response) -> data = "" response.on "data", (chunk) -> data += chunk response.on "end", -> if response.statusCode >= 400 console.log "HipChat API error: #{response.statusCode}" try ...
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
46979ea3fef04facb7920feb2e2a63697a4d0a08
661
https://github.com/hipchat/hubot-hipchat/blob/46979ea3fef04facb7920feb2e2a63697a4d0a08/src/hipchat.coffee
157
182
hipchat/hubot-hipchat:src/hipchat.coffee:4:completion
completion
options.path += "?auth_token=#{@options.token}" request = HTTPS.request options, (response) -> data = "" response.on "data", (chunk) -> data += chunk response.on "end", -> if response.statusCode >= 400 console.log "HipChat API error: #{response.statusCode}" try ...
callback null, data or { } response.on "error", (err) -> callback err, null if method is "POST" request.end(body, 'binary') else request.end() request.on "error", (err) -> console.log err console.log err.stack callback err
CoffeeScript
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
46979ea3fef04facb7920feb2e2a63697a4d0a08
661
https://github.com/hipchat/hubot-hipchat/blob/46979ea3fef04facb7920feb2e2a63697a4d0a08/src/hipchat.coffee
157
182
hipchat/hubot-hipchat:src/hipchat.coffee:1:raw_corpus
raw_corpus
class HipChat extends Adapter send: (user, strings...) -> for str in strings @bot.message user.reply_to, str reply: (user, strings...) -> for str in strings @send user, "@#{user.mention_name} #{str}" run: -> self = @ @options = jid: process.env.HUBOT_HIPCHAT_JID pass...
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
d44949531575838e77eb4190098070791f521e30
661
https://github.com/hipchat/hubot-hipchat/blob/d44949531575838e77eb4190098070791f521e30/src/hipchat.coffee
7
56
hipchat/hubot-hipchat:src/hipchat.coffee:1:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript class HipChat extends Adapter send: (user, strings...) -> for str in strings @bot.message user.reply_to, str reply: (user, strings...) -> for str in strings @send user, "@#{user.mention_name} #{str}" run: -> self = @ @options =...
var HipChat; HipChat = class HipChat extends Adapter { send(user, ...strings) { var i, len, results, str; results = []; for (i = 0, len = strings.length; i < len; i++) { str = strings[i]; results.push(this.bot.message(user.reply_to, str)); } return results; } reply(user, ...strin...
CoffeeScript
JavaScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
d44949531575838e77eb4190098070791f521e30
661
https://github.com/hipchat/hubot-hipchat/blob/d44949531575838e77eb4190098070791f521e30/src/hipchat.coffee
7
56
hipchat/hubot-hipchat:src/hipchat.coffee:1:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var HipChat; HipChat = class HipChat extends Adapter { send(user, ...strings) { var i, len, results, str; results = []; for (i = 0, len = strings.length; i < len; i++) { str = strings[i]; results.push(this.bot.message(user.reply_to, str))...
class HipChat extends Adapter send: (user, strings...) -> for str in strings @bot.message user.reply_to, str reply: (user, strings...) -> for str in strings @send user, "@#{user.mention_name} #{str}" run: -> self = @ @options = jid: process.env.HUBOT_HIPCHAT_JID pass...
JavaScript
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
d44949531575838e77eb4190098070791f521e30
661
https://github.com/hipchat/hubot-hipchat/blob/d44949531575838e77eb4190098070791f521e30/src/hipchat.coffee
7
56
hipchat/hubot-hipchat:src/hipchat.coffee:1:completion
completion
class HipChat extends Adapter send: (user, strings...) -> for str in strings @bot.message user.reply_to, str reply: (user, strings...) -> for str in strings @send user, "@#{user.mention_name} #{str}" run: -> self = @ @options = jid: process.env.HUBOT_HIPCHAT_JID pass...
host: @options.host ) console.log "Wobot object:", bot bot.onConnect => console.log "Connected to HipChat as @#{bot.mention_name}!" # Provide our name to Hubot self.robot.name = bot.mention_name # Tell Hubot we're connected so it can load scripts self.emit "connected" ...
CoffeeScript
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
d44949531575838e77eb4190098070791f521e30
661
https://github.com/hipchat/hubot-hipchat/blob/d44949531575838e77eb4190098070791f521e30/src/hipchat.coffee
7
56
hipchat/hubot-hipchat:src/hipchat.coffee:2:raw_corpus
raw_corpus
bot.join room_jid # Fetch user info bot.getRoster (err, users, stanza) -> if users for user in users self.userForId self.userIdFromJid(user.jid), user else console.log "Can't list users: #{err}" bot.onError (message) -> # If HipChat sends an error,...
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
d44949531575838e77eb4190098070791f521e30
661
https://github.com/hipchat/hubot-hipchat/blob/d44949531575838e77eb4190098070791f521e30/src/hipchat.coffee
57
106
hipchat/hubot-hipchat:src/hipchat.coffee:2:completion
completion
bot.join room_jid # Fetch user info bot.getRoster (err, users, stanza) -> if users for user in users self.userForId self.userIdFromJid(user.jid), user else console.log "Can't list users: #{err}" bot.onError (message) -> # If HipChat sends an error,...
# reformat leading @mention name to be like "name: message" which is # what hubot expects regex = new RegExp("^@#{bot.mention_name}\\b", "i") hubot_msg = message.replace(regex, "#{bot.mention_name}: ") self.receive new TextMessage(author, hubot_msg) bot.onPrivateMessage (from, message) -> ...
CoffeeScript
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
d44949531575838e77eb4190098070791f521e30
661
https://github.com/hipchat/hubot-hipchat/blob/d44949531575838e77eb4190098070791f521e30/src/hipchat.coffee
57
106
hipchat/hubot-hipchat:src/hipchat.coffee:3:raw_corpus
raw_corpus
@bot = bot userIdFromJid: (jid) -> try return jid.match(/^\d+_(\d+)@chat\./)[1] catch e console.log "Bad user JID: #{jid}" return null roomNameFromJid: (jid) -> try return jid.match(/^\d+_(.+)@conf\./)[1] catch e console.log "Bad room JID: #{jid}" return null ...
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
d44949531575838e77eb4190098070791f521e30
661
https://github.com/hipchat/hubot-hipchat/blob/d44949531575838e77eb4190098070791f521e30/src/hipchat.coffee
107
156
hipchat/hubot-hipchat:src/hipchat.coffee:3:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript @bot = bot userIdFromJid: (jid) -> try return jid.match(/^\d+_(\d+)@chat\./)[1] catch e console.log "Bad user JID: #{jid}" return null roomNameFromJid: (jid) -> try return jid.match(/^\d+_(.+)@conf\./)[1] catch e ...
this.bot = bot({ userIdFromJid: function(jid) { var e; try { return jid.match(/^\d+_(\d+)@chat\./)[1]; } catch (error) { e = error; console.log(`Bad user JID: ${jid}`); return null; } }, roomNameFromJid: function(jid) { var e; try { return jid.match(/^\d+_(.+)...
CoffeeScript
JavaScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
d44949531575838e77eb4190098070791f521e30
661
https://github.com/hipchat/hubot-hipchat/blob/d44949531575838e77eb4190098070791f521e30/src/hipchat.coffee
107
156
hipchat/hubot-hipchat:src/hipchat.coffee:3:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript this.bot = bot({ userIdFromJid: function(jid) { var e; try { return jid.match(/^\d+_(\d+)@chat\./)[1]; } catch (error) { e = error; console.log(`Bad user JID: ${jid}`); return null; } }, roomNameFromJid: function(jid) {...
@bot = bot userIdFromJid: (jid) -> try return jid.match(/^\d+_(\d+)@chat\./)[1] catch e console.log "Bad user JID: #{jid}" return null roomNameFromJid: (jid) -> try return jid.match(/^\d+_(.+)@conf\./)[1] catch e console.log "Bad room JID: #{jid}" return null ...
JavaScript
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
d44949531575838e77eb4190098070791f521e30
661
https://github.com/hipchat/hubot-hipchat/blob/d44949531575838e77eb4190098070791f521e30/src/hipchat.coffee
107
156
hipchat/hubot-hipchat:src/hipchat.coffee:3:completion
completion
@bot = bot userIdFromJid: (jid) -> try return jid.match(/^\d+_(\d+)@chat\./)[1] catch e console.log "Bad user JID: #{jid}" return null roomNameFromJid: (jid) -> try return jid.match(/^\d+_(.+)@conf\./)[1] catch e console.log "Bad room JID: #{jid}" return null ...
console.log method, path, body host = @options.host or "api.hipchat.com" headers = "Host": host unless @options.token callback "No API token provided to Hubot", null return options = "agent" : false "host" : host "port" : 443 "path" : path "method" : me...
CoffeeScript
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
d44949531575838e77eb4190098070791f521e30
661
https://github.com/hipchat/hubot-hipchat/blob/d44949531575838e77eb4190098070791f521e30/src/hipchat.coffee
107
156
hipchat/hubot-hipchat:src/hipchat.coffee:4:raw_corpus
raw_corpus
request = HTTPS.request options, (response) -> data = "" response.on "data", (chunk) -> data += chunk response.on "end", -> if response.statusCode >= 400 console.log "HipChat API error: #{response.statusCode}" try callback null, JSON.parse(data) cat...
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
d44949531575838e77eb4190098070791f521e30
661
https://github.com/hipchat/hubot-hipchat/blob/d44949531575838e77eb4190098070791f521e30/src/hipchat.coffee
157
180
hipchat/hubot-hipchat:src/hipchat.coffee:4:coffee_to_js
coffee_to_js
Convert this CoffeeScript to JavaScript. ```coffeescript request = HTTPS.request options, (response) -> data = "" response.on "data", (chunk) -> data += chunk response.on "end", -> if response.statusCode >= 400 console.log "HipChat API error: #{response.statusCode}" ...
var request; request = HTTPS.request(options, function(response) { var data; data = ""; response.on("data", function(chunk) { return data += chunk; }); response.on("end", function() { var err; if (response.statusCode >= 400) { console.log(`HipChat API error: ${response.statusCode}`); } ...
CoffeeScript
JavaScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
d44949531575838e77eb4190098070791f521e30
661
https://github.com/hipchat/hubot-hipchat/blob/d44949531575838e77eb4190098070791f521e30/src/hipchat.coffee
157
180
hipchat/hubot-hipchat:src/hipchat.coffee:4:js_to_coffee
js_to_coffee
Convert this JavaScript to CoffeeScript. ```javascript var request; request = HTTPS.request(options, function(response) { var data; data = ""; response.on("data", function(chunk) { return data += chunk; }); response.on("end", function() { var err; if (response.statusCode >= 400) { console.l...
request = HTTPS.request options, (response) -> data = "" response.on "data", (chunk) -> data += chunk response.on "end", -> if response.statusCode >= 400 console.log "HipChat API error: #{response.statusCode}" try callback null, JSON.parse(data) cat...
JavaScript
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
d44949531575838e77eb4190098070791f521e30
661
https://github.com/hipchat/hubot-hipchat/blob/d44949531575838e77eb4190098070791f521e30/src/hipchat.coffee
157
180
hipchat/hubot-hipchat:src/hipchat.coffee:4:completion
completion
request = HTTPS.request options, (response) -> data = "" response.on "data", (chunk) -> data += chunk response.on "end", -> if response.statusCode >= 400 console.log "HipChat API error: #{response.statusCode}" try callback null, JSON.parse(data) cat...
response.on "error", (err) -> callback err, null if method is "POST" request.end(body, 'binary') else request.end() request.on "error", (err) -> console.log err console.log err.stack callback err
CoffeeScript
CoffeeScript
hipchat/hubot-hipchat
src/hipchat.coffee
MIT
d44949531575838e77eb4190098070791f521e30
661
https://github.com/hipchat/hubot-hipchat/blob/d44949531575838e77eb4190098070791f521e30/src/hipchat.coffee
157
180