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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
columns[i] = height + ($element.data('height') || $element.height()) + @settings.gutter
x: (column * (@settings.base + @settings.gutter))
y: height
structure: ($elements = @$sorted()) =>
positions = []
columns = (0 for i in [0 .. @settings.col... | columns[i] = height + ($element.data('height') || $element.height()) + this.settings.gutter({
x: column * (this.settings.base + this.settings.gutter),
y: height
});
({
structure: ($elements = this.$sorted()) => {
var columns, i, positions;
positions = [];
columns = (function() {
var j, ref, res... | CoffeeScript | JavaScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 137ac7708acab19d739081593a3588a19ac5f70b | 852 | https://github.com/ksylvest/jquery-gridly/blob/137ac7708acab19d739081593a3588a19ac5f70b/javascripts/jquery.gridly.coffee | 126 | 172 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
columns[i] = height + ($element.data('height') || $element.height()) + this.settings.gutter({
x: column * (this.settings.base + this.settings.gutter),
y: height
});
({
structure: ($elements = this.$sorted()) => {
var columns, i, positions;
positions ... | columns[i] = height + ($element.data('height') || $element.height()) + @settings.gutter
x: (column * (@settings.base + @settings.gutter))
y: height
structure: ($elements = @$sorted()) =>
positions = []
columns = (0 for i in [0 .. @settings.columns])
$elements.each (index, element) =>
$ele... | JavaScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 137ac7708acab19d739081593a3588a19ac5f70b | 852 | https://github.com/ksylvest/jquery-gridly/blob/137ac7708acab19d739081593a3588a19ac5f70b/javascripts/jquery.gridly.coffee | 126 | 172 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:4:completion | completion | columns[i] = height + ($element.data('height') || $element.height()) + @settings.gutter
x: (column * (@settings.base + @settings.gutter))
y: height
structure: ($elements = @$sorted()) =>
positions = []
columns = (0 for i in [0 .. @settings.columns])
$elements.each (index, element) =>
$ele... | structure = @structure($elements)
$elements.each (index, element) =>
$element = $(element)
position = structure.positions[index]
$element.css
position: 'absolute'
left: position.x
top: position.y
@$el.css
height: structure.height
$.fn.extend
gridly: (option... | CoffeeScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 137ac7708acab19d739081593a3588a19ac5f70b | 852 | https://github.com/ksylvest/jquery-gridly/blob/137ac7708acab19d739081593a3588a19ac5f70b/javascripts/jquery.gridly.coffee | 126 | 172 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:2:raw_corpus | raw_corpus | class Gridly
@settings:
base: 60
gutter: 20
columns: 12
draggable: 'enable'
@gridly: ($el, options = {}) ->
new Gridly($el, options)
constructor: ($el, settings = {}) ->
@$el = $el
@settings = $.extend {}, Gridly.settings, settings
@ordinalize(@$('> *'))
ordinalize: ($element... | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 763c359c4c2a6285113e516f4def491816c157e5 | 852 | https://github.com/ksylvest/jquery-gridly/blob/763c359c4c2a6285113e516f4def491816c157e5/javascripts/jquery.gridly.coffee | 26 | 75 | ||
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Gridly
@settings:
base: 60
gutter: 20
columns: 12
draggable: 'enable'
@gridly: ($el, options = {}) ->
new Gridly($el, options)
constructor: ($el, settings = {}) ->
@$el = $el
@settings = $.extend {}, Gridly.settings, set... | var Gridly;
Gridly = (function() {
class Gridly {
static gridly($el, options = {}) {
return new Gridly($el, options);
}
constructor($el, settings = {}) {
this.ordinalize = this.ordinalize.bind(this);
this.$ = this.$.bind(this);
this.start = this.start.bind(this);
this.$el =... | CoffeeScript | JavaScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 763c359c4c2a6285113e516f4def491816c157e5 | 852 | https://github.com/ksylvest/jquery-gridly/blob/763c359c4c2a6285113e516f4def491816c157e5/javascripts/jquery.gridly.coffee | 26 | 75 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Gridly;
Gridly = (function() {
class Gridly {
static gridly($el, options = {}) {
return new Gridly($el, options);
}
constructor($el, settings = {}) {
this.ordinalize = this.ordinalize.bind(this);
this.$ = this.$.bind(this);
... | class Gridly
@settings:
base: 60
gutter: 20
columns: 12
draggable: 'enable'
@gridly: ($el, options = {}) ->
new Gridly($el, options)
constructor: ($el, settings = {}) ->
@$el = $el
@settings = $.extend {}, Gridly.settings, settings
@ordinalize(@$('> *'))
ordinalize: ($element... | JavaScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 763c359c4c2a6285113e516f4def491816c157e5 | 852 | https://github.com/ksylvest/jquery-gridly/blob/763c359c4c2a6285113e516f4def491816c157e5/javascripts/jquery.gridly.coffee | 26 | 75 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:2:completion | completion | class Gridly
@settings:
base: 60
gutter: 20
columns: 12
draggable: 'enable'
@gridly: ($el, options = {}) ->
new Gridly($el, options)
constructor: ($el, settings = {}) ->
@$el = $el
@settings = $.extend {}, Gridly.settings, settings
@ordinalize(@$('> *'))
ordinalize: ($element... | @grid.push()
compare: (d, s) ->
return +1 if d.y > s.y + s.h
return -1 if s.y > d.y + d.h
return +1 if (d.x + (d.w / 2)) > (s.x + (s.w / 2))
return -1 if (s.x + (s.w / 2)) > (d.x + (d.w / 2))
return 0
draggable: ->
@$('> *').draggable
zIndex: 800
drag: @drag
start: @start... | CoffeeScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 763c359c4c2a6285113e516f4def491816c157e5 | 852 | https://github.com/ksylvest/jquery-gridly/blob/763c359c4c2a6285113e516f4def491816c157e5/javascripts/jquery.gridly.coffee | 26 | 75 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:3:raw_corpus | raw_corpus | @ordinalize(@$sorted())
setTimeout @layout, 0
stop: (event, ui) =>
$dragging = $(event.target)
@ordinalize(@$sorted())
setTimeout @layout, 0
$sorted: ($elements) =>
($elements || @$('> *')).sort (a,b) ->
aVal = parseInt($(a).data('position'))
bVal = parseInt($(b).data('position'))
... | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 763c359c4c2a6285113e516f4def491816c157e5 | 852 | https://github.com/ksylvest/jquery-gridly/blob/763c359c4c2a6285113e516f4def491816c157e5/javascripts/jquery.gridly.coffee | 76 | 125 | ||
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:3:completion | completion | @ordinalize(@$sorted())
setTimeout @layout, 0
stop: (event, ui) =>
$dragging = $(event.target)
@ordinalize(@$sorted())
setTimeout @layout, 0
$sorted: ($elements) =>
($elements || @$('> *')).sort (a,b) ->
aVal = parseInt($(a).data('position'))
bVal = parseInt($(b).data('position'))
... | x: $dragging.position().left
y: $dragging.position().top
w: $dragging.width()
h: $dragging.height()
for i in [0 ... $elements.length]
$element = $($elements[i])
continue if $element.is($dragging)
position = positions[i]
if @compare(coordinate, position) < 0
index ... | CoffeeScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 763c359c4c2a6285113e516f4def491816c157e5 | 852 | https://github.com/ksylvest/jquery-gridly/blob/763c359c4c2a6285113e516f4def491816c157e5/javascripts/jquery.gridly.coffee | 76 | 125 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:4:raw_corpus | raw_corpus | max = Math.max columns[i ... (i + size)]...
if max < height
height = max
column = i
for i in [column ... column + size]
columns[i] = height + ($element.data('height') || $element.height()) + @settings.gutter
x: (column * (@settings.base + @settings.gutter))
y: height
structu... | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 763c359c4c2a6285113e516f4def491816c157e5 | 852 | https://github.com/ksylvest/jquery-gridly/blob/763c359c4c2a6285113e516f4def491816c157e5/javascripts/jquery.gridly.coffee | 126 | 175 | ||
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:4:completion | completion | max = Math.max columns[i ... (i + size)]...
if max < height
height = max
column = i
for i in [column ... column + size]
columns[i] = height + ($element.data('height') || $element.height()) + @settings.gutter
x: (column * (@settings.base + @settings.gutter))
y: height
structu... | height: Math.max columns...
positions: positions
layout: ($elements = @$sorted()) =>
structure = @structure($elements)
$elements.each (index, element) =>
$element = $(element)
position = structure.positions[index]
$element.css
position: 'absolute'
left: position.x
... | CoffeeScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 763c359c4c2a6285113e516f4def491816c157e5 | 852 | https://github.com/ksylvest/jquery-gridly/blob/763c359c4c2a6285113e516f4def491816c157e5/javascripts/jquery.gridly.coffee | 126 | 175 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:2:raw_corpus | raw_corpus | class Gridly
@settings:
base: 60
gutter: 20
columns: 12
draggable: 'enable'
@gridly: ($el, options = {}) ->
new Gridly($el, options)
constructor: ($el, settings = {}) ->
@$el = $el
@settings = $.extend {}, Gridly.settings, settings
$: (selector) =>
@$el.find(selector)
grow... | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 589e92a56119d02030dde31945a88d877cc5c925 | 852 | https://github.com/ksylvest/jquery-gridly/blob/589e92a56119d02030dde31945a88d877cc5c925/javascripts/jquery.gridly.coffee | 26 | 75 | ||
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Gridly
@settings:
base: 60
gutter: 20
columns: 12
draggable: 'enable'
@gridly: ($el, options = {}) ->
new Gridly($el, options)
constructor: ($el, settings = {}) ->
@$el = $el
@settings = $.extend {}, Gridly.settings, set... | var Gridly;
Gridly = (function() {
class Gridly {
static gridly($el, options = {}) {
return new Gridly($el, options);
}
constructor($el, settings = {}) {
this.$ = this.$.bind(this);
this.start = this.start.bind(this);
this.$el = $el;
this.settings = $.extend({}, Gridly.sett... | CoffeeScript | JavaScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 589e92a56119d02030dde31945a88d877cc5c925 | 852 | https://github.com/ksylvest/jquery-gridly/blob/589e92a56119d02030dde31945a88d877cc5c925/javascripts/jquery.gridly.coffee | 26 | 75 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Gridly;
Gridly = (function() {
class Gridly {
static gridly($el, options = {}) {
return new Gridly($el, options);
}
constructor($el, settings = {}) {
this.$ = this.$.bind(this);
this.start = this.start.bind(this);
this.$e... | class Gridly
@settings:
base: 60
gutter: 20
columns: 12
draggable: 'enable'
@gridly: ($el, options = {}) ->
new Gridly($el, options)
constructor: ($el, settings = {}) ->
@$el = $el
@settings = $.extend {}, Gridly.settings, settings
$: (selector) =>
@$el.find(selector)
grow... | JavaScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 589e92a56119d02030dde31945a88d877cc5c925 | 852 | https://github.com/ksylvest/jquery-gridly/blob/589e92a56119d02030dde31945a88d877cc5c925/javascripts/jquery.gridly.coffee | 26 | 75 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:2:completion | completion | class Gridly
@settings:
base: 60
gutter: 20
columns: 12
draggable: 'enable'
@gridly: ($el, options = {}) ->
new Gridly($el, options)
constructor: ($el, settings = {}) ->
@$el = $el
@settings = $.extend {}, Gridly.settings, settings
$: (selector) =>
@$el.find(selector)
grow... | return +1 if (d.x + (d.w / 2)) > (s.x + (s.w / 2))
return -1 if (s.x + (s.w / 2)) > (d.x + (d.w / 2))
return 0
draggable: ->
@$('> *').draggable
zIndex: 800
drag: @drag
start: @start
stop: @stop
swap: (array, from, to) ->
element = array[from]
array.splice(from, 1)
... | CoffeeScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 589e92a56119d02030dde31945a88d877cc5c925 | 852 | https://github.com/ksylvest/jquery-gridly/blob/589e92a56119d02030dde31945a88d877cc5c925/javascripts/jquery.gridly.coffee | 26 | 75 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:3:raw_corpus | raw_corpus | stop: (event, ui) =>
$dragging = $(event.target)
$elements = @$sorted()
for i in [0 .. $elements.length]
$element = $($elements[i])
$element.data('positoin', i)
setTimeout @layout, 0
$sorted: ($elements) =>
($elements || @$('> *')).sort (a,b) ->
aVal = parseInt($(a).data('positi... | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 589e92a56119d02030dde31945a88d877cc5c925 | 852 | https://github.com/ksylvest/jquery-gridly/blob/589e92a56119d02030dde31945a88d877cc5c925/javascripts/jquery.gridly.coffee | 76 | 125 | ||
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:3:completion | completion | stop: (event, ui) =>
$dragging = $(event.target)
$elements = @$sorted()
for i in [0 .. $elements.length]
$element = $($elements[i])
$element.data('positoin', i)
setTimeout @layout, 0
$sorted: ($elements) =>
($elements || @$('> *')).sort (a,b) ->
aVal = parseInt($(a).data('positi... | x: $dragging.position().left
y: $dragging.position().top
w: $dragging.width()
h: $dragging.height()
for i in [0 ... $elements.length]
$element = $($elements[i])
continue if $element.is($dragging)
position = positions[i]
if @compare(coordinate, position) < 0
index ... | CoffeeScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 589e92a56119d02030dde31945a88d877cc5c925 | 852 | https://github.com/ksylvest/jquery-gridly/blob/589e92a56119d02030dde31945a88d877cc5c925/javascripts/jquery.gridly.coffee | 76 | 125 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:2:raw_corpus | raw_corpus | class Gridly
@settings:
base: 60
gutter: 20
columns: 12
draggable: 'enable'
@gridly: ($el, options = {}) ->
new Gridly($el, options)
constructor: ($el, settings = {}) ->
@$el = $el
@settings = $.extend {}, Gridly.settings, settings
$: (selector) =>
@$el.find(selector)
grow... | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 426d8311ae50d775e4aa208ff281f3b88dd2b5e6 | 852 | https://github.com/ksylvest/jquery-gridly/blob/426d8311ae50d775e4aa208ff281f3b88dd2b5e6/javascripts/jquery.gridly.coffee | 26 | 75 | ||
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Gridly
@settings:
base: 60
gutter: 20
columns: 12
draggable: 'enable'
@gridly: ($el, options = {}) ->
new Gridly($el, options)
constructor: ($el, settings = {}) ->
@$el = $el
@settings = $.extend {}, Gridly.settings, set... | var Gridly;
Gridly = (function() {
class Gridly {
static gridly($el, options = {}) {
return new Gridly($el, options);
}
constructor($el, settings = {}) {
this.$ = this.$.bind(this);
this.start = this.start.bind(this);
this.$el = $el;
this.settings = $.extend({}, Gridly.sett... | CoffeeScript | JavaScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 426d8311ae50d775e4aa208ff281f3b88dd2b5e6 | 852 | https://github.com/ksylvest/jquery-gridly/blob/426d8311ae50d775e4aa208ff281f3b88dd2b5e6/javascripts/jquery.gridly.coffee | 26 | 75 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Gridly;
Gridly = (function() {
class Gridly {
static gridly($el, options = {}) {
return new Gridly($el, options);
}
constructor($el, settings = {}) {
this.$ = this.$.bind(this);
this.start = this.start.bind(this);
this.$e... | class Gridly
@settings:
base: 60
gutter: 20
columns: 12
draggable: 'enable'
@gridly: ($el, options = {}) ->
new Gridly($el, options)
constructor: ($el, settings = {}) ->
@$el = $el
@settings = $.extend {}, Gridly.settings, settings
$: (selector) =>
@$el.find(selector)
grow... | JavaScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 426d8311ae50d775e4aa208ff281f3b88dd2b5e6 | 852 | https://github.com/ksylvest/jquery-gridly/blob/426d8311ae50d775e4aa208ff281f3b88dd2b5e6/javascripts/jquery.gridly.coffee | 26 | 75 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:2:completion | completion | class Gridly
@settings:
base: 60
gutter: 20
columns: 12
draggable: 'enable'
@gridly: ($el, options = {}) ->
new Gridly($el, options)
constructor: ($el, settings = {}) ->
@$el = $el
@settings = $.extend {}, Gridly.settings, settings
$: (selector) =>
@$el.find(selector)
grow... | return +1 if (d.x + (d.w / 2)) > (s.x + (s.w / 2))
return -1 if (s.x + (s.w / 2)) > (d.x + (d.w / 2))
return 0
draggable: ->
@$('> *').draggable
zIndex: 800
drag: @drag
start: @start
stop: @stop
swap: (array, from, to) ->
element = array[from]
array.splice(from, 1)
... | CoffeeScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 426d8311ae50d775e4aa208ff281f3b88dd2b5e6 | 852 | https://github.com/ksylvest/jquery-gridly/blob/426d8311ae50d775e4aa208ff281f3b88dd2b5e6/javascripts/jquery.gridly.coffee | 26 | 75 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:3:raw_corpus | raw_corpus | stop: (event, ui) =>
return
$sorted: ($elements = @$('> *')) =>
$elements.sort (a,b) ->
aVal = parseInt($(a).data('position'))
bVal = parseInt($(b).data('position'))
return -1 if aVal < bVal
return +1 if aVal > bVal
return 0
drag: (event, ui) =>
$dragging = $(event.target... | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 426d8311ae50d775e4aa208ff281f3b88dd2b5e6 | 852 | https://github.com/ksylvest/jquery-gridly/blob/426d8311ae50d775e4aa208ff281f3b88dd2b5e6/javascripts/jquery.gridly.coffee | 76 | 125 | ||
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
stop: (event, ui) =>
return
$sorted: ($elements = @$('> *')) =>
$elements.sort (a,b) ->
aVal = parseInt($(a).data('position'))
bVal = parseInt($(b).data('position'))
return -1 if aVal < bVal
return +1 if aVal > bVal
return... | ({
stop: (event, ui) => {},
$sorted: ($elements = this.$('> *')) => {
return $elements.sort(function(a, b) {
var aVal, bVal;
aVal = parseInt($(a).data('position'));
bVal = parseInt($(b).data('position'));
if (aVal < bVal) {
return -1;
}
if (aVal > bVal) {
retu... | CoffeeScript | JavaScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 426d8311ae50d775e4aa208ff281f3b88dd2b5e6 | 852 | https://github.com/ksylvest/jquery-gridly/blob/426d8311ae50d775e4aa208ff281f3b88dd2b5e6/javascripts/jquery.gridly.coffee | 76 | 125 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
stop: (event, ui) => {},
$sorted: ($elements = this.$('> *')) => {
return $elements.sort(function(a, b) {
var aVal, bVal;
aVal = parseInt($(a).data('position'));
bVal = parseInt($(b).data('position'));
if (aVal < bVal) {
r... | stop: (event, ui) =>
return
$sorted: ($elements = @$('> *')) =>
$elements.sort (a,b) ->
aVal = parseInt($(a).data('position'))
bVal = parseInt($(b).data('position'))
return -1 if aVal < bVal
return +1 if aVal > bVal
return 0
drag: (event, ui) =>
$dragging = $(event.target... | JavaScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 426d8311ae50d775e4aa208ff281f3b88dd2b5e6 | 852 | https://github.com/ksylvest/jquery-gridly/blob/426d8311ae50d775e4aa208ff281f3b88dd2b5e6/javascripts/jquery.gridly.coffee | 76 | 125 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:3:completion | completion | stop: (event, ui) =>
return
$sorted: ($elements = @$('> *')) =>
$elements.sort (a,b) ->
aVal = parseInt($(a).data('position'))
bVal = parseInt($(b).data('position'))
return -1 if aVal < bVal
return +1 if aVal > bVal
return 0
drag: (event, ui) =>
$dragging = $(event.target... | for i in [0 ... $elements.length]
$element = $($elements[i])
continue if $element.is($dragging)
position = positions[i]
if @compare(coordinate, position) < 0
index = i
break
unless index is original
console.debug(index)
$dragging.data('position', index + 0.5)
... | CoffeeScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 426d8311ae50d775e4aa208ff281f3b88dd2b5e6 | 852 | https://github.com/ksylvest/jquery-gridly/blob/426d8311ae50d775e4aa208ff281f3b88dd2b5e6/javascripts/jquery.gridly.coffee | 76 | 125 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:4:raw_corpus | raw_corpus | for i in [column ... column + size]
columns[i] = height + ($element.data('height') || $element.height()) + @settings.gutter
x: (column * (@settings.base + @settings.gutter))
y: height
structure: ($elements = @$('> *')) =>
positions = []
columns = (0 for i in [0 .. @settings.columns])
$ele... | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 426d8311ae50d775e4aa208ff281f3b88dd2b5e6 | 852 | https://github.com/ksylvest/jquery-gridly/blob/426d8311ae50d775e4aa208ff281f3b88dd2b5e6/javascripts/jquery.gridly.coffee | 126 | 173 | ||
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
for i in [column ... column + size]
columns[i] = height + ($element.data('height') || $element.height()) + @settings.gutter
x: (column * (@settings.base + @settings.gutter))
y: height
structure: ($elements = @$('> *')) =>
positions = []
... | var i, j, ref, ref1;
for (i = j = ref = column, ref1 = column + size; (ref <= ref1 ? j < ref1 : j > ref1); i = ref <= ref1 ? ++j : --j) {
columns[i] = height + ($element.data('height') || $element.height()) + this.settings.gutter;
}
({
x: column * (this.settings.base + this.settings.gutter),
y: height,
struct... | CoffeeScript | JavaScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 426d8311ae50d775e4aa208ff281f3b88dd2b5e6 | 852 | https://github.com/ksylvest/jquery-gridly/blob/426d8311ae50d775e4aa208ff281f3b88dd2b5e6/javascripts/jquery.gridly.coffee | 126 | 173 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var i, j, ref, ref1;
for (i = j = ref = column, ref1 = column + size; (ref <= ref1 ? j < ref1 : j > ref1); i = ref <= ref1 ? ++j : --j) {
columns[i] = height + ($element.data('height') || $element.height()) + this.settings.gutter;
}
({
x: column * (this.setti... | for i in [column ... column + size]
columns[i] = height + ($element.data('height') || $element.height()) + @settings.gutter
x: (column * (@settings.base + @settings.gutter))
y: height
structure: ($elements = @$('> *')) =>
positions = []
columns = (0 for i in [0 .. @settings.columns])
$ele... | JavaScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 426d8311ae50d775e4aa208ff281f3b88dd2b5e6 | 852 | https://github.com/ksylvest/jquery-gridly/blob/426d8311ae50d775e4aa208ff281f3b88dd2b5e6/javascripts/jquery.gridly.coffee | 126 | 173 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:4:completion | completion | for i in [column ... column + size]
columns[i] = height + ($element.data('height') || $element.height()) + @settings.gutter
x: (column * (@settings.base + @settings.gutter))
y: height
structure: ($elements = @$('> *')) =>
positions = []
columns = (0 for i in [0 .. @settings.columns])
$ele... | structure = @structure($elements)
$elements.each (index, element) =>
$element = $(element)
position = structure.positions[index]
$element.css
position: 'absolute'
left: position.x
top: position.y
@$el.css
height: structure.height
$.fn.extend
gridly: (option... | CoffeeScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 426d8311ae50d775e4aa208ff281f3b88dd2b5e6 | 852 | https://github.com/ksylvest/jquery-gridly/blob/426d8311ae50d775e4aa208ff281f3b88dd2b5e6/javascripts/jquery.gridly.coffee | 126 | 173 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:3:raw_corpus | raw_corpus | stop: (event, ui) =>
return
$sorted: ($elements = @$('> *')) =>
$elements.sort (a,b) ->
aVal = parseInt($(a).data('position'))
bVal = parseInt($(b).data('position'))
return -1 if aVal < bVal
return +1 if aVal > bVal
return 0
drag: (event, ui) =>
$dragging = $(event.target... | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 4ebbfbf4aca02b6912788830c9874ecf2183be54 | 852 | https://github.com/ksylvest/jquery-gridly/blob/4ebbfbf4aca02b6912788830c9874ecf2183be54/javascripts/jquery.gridly.coffee | 76 | 125 | ||
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
stop: (event, ui) =>
return
$sorted: ($elements = @$('> *')) =>
$elements.sort (a,b) ->
aVal = parseInt($(a).data('position'))
bVal = parseInt($(b).data('position'))
return -1 if aVal < bVal
return +1 if aVal > bVal
return... | ({
stop: (event, ui) => {},
$sorted: ($elements = this.$('> *')) => {
return $elements.sort(function(a, b) {
var aVal, bVal;
aVal = parseInt($(a).data('position'));
bVal = parseInt($(b).data('position'));
if (aVal < bVal) {
return -1;
}
if (aVal > bVal) {
retu... | CoffeeScript | JavaScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 4ebbfbf4aca02b6912788830c9874ecf2183be54 | 852 | https://github.com/ksylvest/jquery-gridly/blob/4ebbfbf4aca02b6912788830c9874ecf2183be54/javascripts/jquery.gridly.coffee | 76 | 125 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
stop: (event, ui) => {},
$sorted: ($elements = this.$('> *')) => {
return $elements.sort(function(a, b) {
var aVal, bVal;
aVal = parseInt($(a).data('position'));
bVal = parseInt($(b).data('position'));
if (aVal < bVal) {
r... | stop: (event, ui) =>
return
$sorted: ($elements = @$('> *')) =>
$elements.sort (a,b) ->
aVal = parseInt($(a).data('position'))
bVal = parseInt($(b).data('position'))
return -1 if aVal < bVal
return +1 if aVal > bVal
return 0
drag: (event, ui) =>
$dragging = $(event.target... | JavaScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 4ebbfbf4aca02b6912788830c9874ecf2183be54 | 852 | https://github.com/ksylvest/jquery-gridly/blob/4ebbfbf4aca02b6912788830c9874ecf2183be54/javascripts/jquery.gridly.coffee | 76 | 125 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:3:completion | completion | stop: (event, ui) =>
return
$sorted: ($elements = @$('> *')) =>
$elements.sort (a,b) ->
aVal = parseInt($(a).data('position'))
bVal = parseInt($(b).data('position'))
return -1 if aVal < bVal
return +1 if aVal > bVal
return 0
drag: (event, ui) =>
$dragging = $(event.target... | $element = $($elements[i])
continue if $element.is($dragging)
position = positions[i]
if @compare(coordinate, position) < 0
index = i
break
$dragging.data('position', index + 0.5)
@layout(@$sorted())
position: ($element, columns) =>
size = (($element.data('width') || $... | CoffeeScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 4ebbfbf4aca02b6912788830c9874ecf2183be54 | 852 | https://github.com/ksylvest/jquery-gridly/blob/4ebbfbf4aca02b6912788830c9874ecf2183be54/javascripts/jquery.gridly.coffee | 76 | 125 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:4:raw_corpus | raw_corpus | x: (column * (@settings.base + @settings.gutter))
y: height
structure: ($elements = @$('> *')) =>
positions = []
columns = (0 for i in [0 .. @settings.columns])
$elements.each (index, element) =>
$element = $(element)
position = @position($element, columns)
positions.push
... | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 4ebbfbf4aca02b6912788830c9874ecf2183be54 | 852 | https://github.com/ksylvest/jquery-gridly/blob/4ebbfbf4aca02b6912788830c9874ecf2183be54/javascripts/jquery.gridly.coffee | 126 | 171 | ||
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
x: (column * (@settings.base + @settings.gutter))
y: height
structure: ($elements = @$('> *')) =>
positions = []
columns = (0 for i in [0 .. @settings.columns])
$elements.each (index, element) =>
$element = $(element)
position = @... | ({
x: (column * (this.settings.base + this.settings.gutter))({
y: height
}),
structure: ($elements = this.$('> *')) => {
var columns, i, positions;
positions = [];
columns = (function() {
var j, ref, results;
results = [];
for (i = j = 0, ref = this.settings.columns; (0 <= ref ? ... | CoffeeScript | JavaScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 4ebbfbf4aca02b6912788830c9874ecf2183be54 | 852 | https://github.com/ksylvest/jquery-gridly/blob/4ebbfbf4aca02b6912788830c9874ecf2183be54/javascripts/jquery.gridly.coffee | 126 | 171 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
({
x: (column * (this.settings.base + this.settings.gutter))({
y: height
}),
structure: ($elements = this.$('> *')) => {
var columns, i, positions;
positions = [];
columns = (function() {
var j, ref, results;
results = [];
fo... | x: (column * (@settings.base + @settings.gutter))
y: height
structure: ($elements = @$('> *')) =>
positions = []
columns = (0 for i in [0 .. @settings.columns])
$elements.each (index, element) =>
$element = $(element)
position = @position($element, columns)
positions.push
... | JavaScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 4ebbfbf4aca02b6912788830c9874ecf2183be54 | 852 | https://github.com/ksylvest/jquery-gridly/blob/4ebbfbf4aca02b6912788830c9874ecf2183be54/javascripts/jquery.gridly.coffee | 126 | 171 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:4:completion | completion | x: (column * (@settings.base + @settings.gutter))
y: height
structure: ($elements = @$('> *')) =>
positions = []
columns = (0 for i in [0 .. @settings.columns])
$elements.each (index, element) =>
$element = $(element)
position = @position($element, columns)
positions.push
... | $elements.each (index, element) =>
$element = $(element)
position = structure.positions[index]
$element.css
position: 'absolute'
left: position.x
top: position.y
@$el.css
height: structure.height
$.fn.extend
gridly: (option = {}) ->
@each ->
$this = $(... | CoffeeScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 4ebbfbf4aca02b6912788830c9874ecf2183be54 | 852 | https://github.com/ksylvest/jquery-gridly/blob/4ebbfbf4aca02b6912788830c9874ecf2183be54/javascripts/jquery.gridly.coffee | 126 | 171 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:2:raw_corpus | raw_corpus | class Gridly
@settings:
base: 60
gutter: 20
columns: 12
draggable: 'enable'
@gridly: ($el, options = {}) ->
new Gridly($el, options)
constructor: ($el, settings = {}) ->
@$el = $el
@settings = $.extend {}, Gridly.settings, settings
$: (selector) =>
@$el.find(selector)
grow... | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | c7abb672f3902cbefb5317be5f3aff0eefc132a4 | 852 | https://github.com/ksylvest/jquery-gridly/blob/c7abb672f3902cbefb5317be5f3aff0eefc132a4/javascripts/jquery.gridly.coffee | 26 | 75 | ||
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Gridly
@settings:
base: 60
gutter: 20
columns: 12
draggable: 'enable'
@gridly: ($el, options = {}) ->
new Gridly($el, options)
constructor: ($el, settings = {}) ->
@$el = $el
@settings = $.extend {}, Gridly.settings, set... | var Gridly;
Gridly = (function() {
class Gridly {
static gridly($el, options = {}) {
return new Gridly($el, options);
}
constructor($el, settings = {}) {
this.$ = this.$.bind(this);
this.drag = this.drag.bind(this);
this.$el = $el;
this.settings = $.extend({}, Gridly.settin... | CoffeeScript | JavaScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | c7abb672f3902cbefb5317be5f3aff0eefc132a4 | 852 | https://github.com/ksylvest/jquery-gridly/blob/c7abb672f3902cbefb5317be5f3aff0eefc132a4/javascripts/jquery.gridly.coffee | 26 | 75 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Gridly;
Gridly = (function() {
class Gridly {
static gridly($el, options = {}) {
return new Gridly($el, options);
}
constructor($el, settings = {}) {
this.$ = this.$.bind(this);
this.drag = this.drag.bind(this);
this.$el ... | class Gridly
@settings:
base: 60
gutter: 20
columns: 12
draggable: 'enable'
@gridly: ($el, options = {}) ->
new Gridly($el, options)
constructor: ($el, settings = {}) ->
@$el = $el
@settings = $.extend {}, Gridly.settings, settings
$: (selector) =>
@$el.find(selector)
grow... | JavaScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | c7abb672f3902cbefb5317be5f3aff0eefc132a4 | 852 | https://github.com/ksylvest/jquery-gridly/blob/c7abb672f3902cbefb5317be5f3aff0eefc132a4/javascripts/jquery.gridly.coffee | 26 | 75 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:2:completion | completion | class Gridly
@settings:
base: 60
gutter: 20
columns: 12
draggable: 'enable'
@gridly: ($el, options = {}) ->
new Gridly($el, options)
constructor: ($el, settings = {}) ->
@$el = $el
@settings = $.extend {}, Gridly.settings, settings
$: (selector) =>
@$el.find(selector)
grow... | return +1 if (s.y + (s.w / 2)) > (d.y + (d.w / 2))
return 0
draggable: ->
@$('> *').draggable
zIndex: 800
drag: @drag
stop: @stop
drag: (event, ui) =>
$dragging = $(event.target)
$elements = @$('> *')
positions = @structure($elements).positions
index = $elements.index(eve... | CoffeeScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | c7abb672f3902cbefb5317be5f3aff0eefc132a4 | 852 | https://github.com/ksylvest/jquery-gridly/blob/c7abb672f3902cbefb5317be5f3aff0eefc132a4/javascripts/jquery.gridly.coffee | 26 | 75 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:3:raw_corpus | raw_corpus | if @compare coordinate, position > 0
index = i
break
console.debug index
# console.debug($elements[..@_index] + [$elements[@_index]] + $elements[@_index..])
# $elements = $elements[..@_index] + [$elements[@_index]] + $elements[@_index..]
stop: (event, ui) =>
setTimeout @layout, 0 # A... | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | c7abb672f3902cbefb5317be5f3aff0eefc132a4 | 852 | https://github.com/ksylvest/jquery-gridly/blob/c7abb672f3902cbefb5317be5f3aff0eefc132a4/javascripts/jquery.gridly.coffee | 76 | 125 | ||
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
if @compare coordinate, position > 0
index = i
break
console.debug index
# console.debug($elements[..@_index] + [$elements[@_index]] + $elements[@_index..])
# $elements = $elements[..@_index] + [$elements[@_index]] + $elements[@_index... | var index;
if (this.compare(coordinate, position > 0)) {
index = i;
break;
}
console.debug(index);
({
// console.debug($elements[..@_index] + [$elements[@_index]] + $elements[@_index..])
// $elements = $elements[..@_index] + [$elements[@_index]] + $elements[@_index..]
stop: (event, ui) => {
return setT... | CoffeeScript | JavaScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | c7abb672f3902cbefb5317be5f3aff0eefc132a4 | 852 | https://github.com/ksylvest/jquery-gridly/blob/c7abb672f3902cbefb5317be5f3aff0eefc132a4/javascripts/jquery.gridly.coffee | 76 | 125 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var index;
if (this.compare(coordinate, position > 0)) {
index = i;
break;
}
console.debug(index);
({
// console.debug($elements[..@_index] + [$elements[@_index]] + $elements[@_index..])
// $elements = $elements[..@_index] + [$elements[@_index]] + $eleme... | if @compare coordinate, position > 0
index = i
break
console.debug index
# console.debug($elements[..@_index] + [$elements[@_index]] + $elements[@_index..])
# $elements = $elements[..@_index] + [$elements[@_index]] + $elements[@_index..]
stop: (event, ui) =>
setTimeout @layout, 0 # A... | JavaScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | c7abb672f3902cbefb5317be5f3aff0eefc132a4 | 852 | https://github.com/ksylvest/jquery-gridly/blob/c7abb672f3902cbefb5317be5f3aff0eefc132a4/javascripts/jquery.gridly.coffee | 76 | 125 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:3:completion | completion | if @compare coordinate, position > 0
index = i
break
console.debug index
# console.debug($elements[..@_index] + [$elements[@_index]] + $elements[@_index..])
# $elements = $elements[..@_index] + [$elements[@_index]] + $elements[@_index..]
stop: (event, ui) =>
setTimeout @layout, 0 # A... | columns[i] = height + ($element.data('height') || $element.height()) + @settings.gutter
x: (column * (@settings.base + @settings.gutter))
y: height
structure: ($elements = @$('> *')) =>
positions = []
columns = (0 for i in [0 .. @settings.columns])
$elements.each (index, element) =>
$elem... | CoffeeScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | c7abb672f3902cbefb5317be5f3aff0eefc132a4 | 852 | https://github.com/ksylvest/jquery-gridly/blob/c7abb672f3902cbefb5317be5f3aff0eefc132a4/javascripts/jquery.gridly.coffee | 76 | 125 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:4:raw_corpus | raw_corpus | $elements.each (index, element) =>
$element = $(element)
position = structure.positions[index]
$element.css
position: 'absolute'
left: position.x
top: position.y
@$el.css
height: structure.height
$.fn.extend
gridly: (option = {}) ->
@each ->
$this = $(... | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | c7abb672f3902cbefb5317be5f3aff0eefc132a4 | 852 | https://github.com/ksylvest/jquery-gridly/blob/c7abb672f3902cbefb5317be5f3aff0eefc132a4/javascripts/jquery.gridly.coffee | 126 | 148 | ||
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:4:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
$elements.each (index, element) =>
$element = $(element)
position = structure.positions[index]
$element.css
position: 'absolute'
left: position.x
top: position.y
@$el.css
height: structure.height
$.fn.extend... | $elements.each((index, element) => {
var $element, position;
$element = $(element);
position = structure.positions[index];
return $element.css({
position: 'absolute',
left: position.x,
top: position.y
});
});
this.$el.css({
height: structure.height
});
$.fn.extend({
gridly: function(option =... | CoffeeScript | JavaScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | c7abb672f3902cbefb5317be5f3aff0eefc132a4 | 852 | https://github.com/ksylvest/jquery-gridly/blob/c7abb672f3902cbefb5317be5f3aff0eefc132a4/javascripts/jquery.gridly.coffee | 126 | 148 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:4:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
$elements.each((index, element) => {
var $element, position;
$element = $(element);
position = structure.positions[index];
return $element.css({
position: 'absolute',
left: position.x,
top: position.y
});
});
this.$el.css({
height: structur... | $elements.each (index, element) =>
$element = $(element)
position = structure.positions[index]
$element.css
position: 'absolute'
left: position.x
top: position.y
@$el.css
height: structure.height
$.fn.extend
gridly: (option = {}) ->
@each ->
$this = $(... | JavaScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | c7abb672f3902cbefb5317be5f3aff0eefc132a4 | 852 | https://github.com/ksylvest/jquery-gridly/blob/c7abb672f3902cbefb5317be5f3aff0eefc132a4/javascripts/jquery.gridly.coffee | 126 | 148 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:4:completion | completion | $elements.each (index, element) =>
$element = $(element)
position = structure.positions[index]
$element.css
position: 'absolute'
left: position.x
top: position.y
@$el.css
height: structure.height | $.fn.extend
gridly: (option = {}) ->
@each ->
$this = $(@)
options = $.extend {}, $.fn.gridly.defaults, typeof option is "object" and option
action = if typeof option is "string" then option else option.action
action ?= "layout"
Gridly.gridly($this, options)[action]() | CoffeeScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | c7abb672f3902cbefb5317be5f3aff0eefc132a4 | 852 | https://github.com/ksylvest/jquery-gridly/blob/c7abb672f3902cbefb5317be5f3aff0eefc132a4/javascripts/jquery.gridly.coffee | 126 | 148 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:2:raw_corpus | raw_corpus | class Gridly
@settings:
base: 60
gutter: 20
columns: 12
draggable: 'enable'
@gridly: ($el, options = {}) ->
new Gridly($el, options)
constructor: ($el, settings = {}) ->
@$el = $el
@settings = $.extend {}, Gridly.settings, settings
$: (selector) =>
@$el.find(selector)
grow... | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | d5b6f0618a1baf7d7f213ac6445797d243d2fbbf | 852 | https://github.com/ksylvest/jquery-gridly/blob/d5b6f0618a1baf7d7f213ac6445797d243d2fbbf/javascripts/jquery.gridly.coffee | 26 | 75 | ||
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:2:completion | completion | class Gridly
@settings:
base: 60
gutter: 20
columns: 12
draggable: 'enable'
@gridly: ($el, options = {}) ->
new Gridly($el, options)
constructor: ($el, settings = {}) ->
@$el = $el
@settings = $.extend {}, Gridly.settings, settings
$: (selector) =>
@$el.find(selector)
grow... | y = $element.position().top + $element.height() / 2
draggable: () ->
@$('> *').draggable
zIndex: 800
drag: @drag
stop: @stop
drag: (event, ui) =>
$element = $(event.target)
position = $element.position()
x = $element.position().left + $element.width() / 2
y = $element.positio... | CoffeeScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | d5b6f0618a1baf7d7f213ac6445797d243d2fbbf | 852 | https://github.com/ksylvest/jquery-gridly/blob/d5b6f0618a1baf7d7f213ac6445797d243d2fbbf/javascripts/jquery.gridly.coffee | 26 | 75 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:3:raw_corpus | raw_corpus | max = Math.max columns[i ... (i + size)]...
if max < height
height = max
column = i
for i in [column ... column + size]
columns[i] = height + ($element.data('height') || $element.height()) + @settings.gutter
x: (column * (@settings.base + @settings.gutter))
y: height
structu... | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | d5b6f0618a1baf7d7f213ac6445797d243d2fbbf | 852 | https://github.com/ksylvest/jquery-gridly/blob/d5b6f0618a1baf7d7f213ac6445797d243d2fbbf/javascripts/jquery.gridly.coffee | 76 | 125 | ||
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:3:completion | completion | max = Math.max columns[i ... (i + size)]...
if max < height
height = max
column = i
for i in [column ... column + size]
columns[i] = height + ($element.data('height') || $element.height()) + @settings.gutter
x: (column * (@settings.base + @settings.gutter))
y: height
structu... | h: $element.height()
height: Math.max columns...
positions: positions
layout: =>
$elements = @$('> *')
structure = @structure($elements)
$elements.each (index, element) =>
$element = $(element)
position = structure.positions[index]
$element.css
position: 'absolute'
... | CoffeeScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | d5b6f0618a1baf7d7f213ac6445797d243d2fbbf | 852 | https://github.com/ksylvest/jquery-gridly/blob/d5b6f0618a1baf7d7f213ac6445797d243d2fbbf/javascripts/jquery.gridly.coffee | 76 | 125 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:4:raw_corpus | raw_corpus | options = $.extend {}, $.fn.gridly.defaults, typeof option is "object" and option
action = if typeof option is "string" then option else option.action
action ?= "layout"
Gridly.gridly($this, options)[action]() | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | d5b6f0618a1baf7d7f213ac6445797d243d2fbbf | 852 | https://github.com/ksylvest/jquery-gridly/blob/d5b6f0618a1baf7d7f213ac6445797d243d2fbbf/javascripts/jquery.gridly.coffee | 126 | 130 | ||
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:4:completion | completion | options = $.extend {}, $.fn.gridly.defaults, typeof option is "object" and option
action = if typeof option is "string" then option else option.action | action ?= "layout"
Gridly.gridly($this, options)[action]() | CoffeeScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | d5b6f0618a1baf7d7f213ac6445797d243d2fbbf | 852 | https://github.com/ksylvest/jquery-gridly/blob/d5b6f0618a1baf7d7f213ac6445797d243d2fbbf/javascripts/jquery.gridly.coffee | 126 | 130 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:3:raw_corpus | raw_corpus | max = Math.max columns[i ... (i + size)]...
if max < height
height = max
column = i
for i in [column ... column + size]
columns[i] = height + ($element.data('height') || $element.height() + @settings.gutter)
x: (column * (@settings.base + @settings.gutter))
y: height
structu... | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 15b0d8551e09731f4d8cd78e354b5d63530126d8 | 852 | https://github.com/ksylvest/jquery-gridly/blob/15b0d8551e09731f4d8cd78e354b5d63530126d8/javascripts/jquery.gridly.coffee | 76 | 125 | ||
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:3:completion | completion | max = Math.max columns[i ... (i + size)]...
if max < height
height = max
column = i
for i in [column ... column + size]
columns[i] = height + ($element.data('height') || $element.height() + @settings.gutter)
x: (column * (@settings.base + @settings.gutter))
y: height
structu... | h: $element.height()
height: Math.max columns...
positions: positions
layout: =>
$elements = @$('> *')
structure = @structure($elements)
$elements.each (index, element) =>
$element = $(element)
position = structure.positions[index]
$element.css
position: 'absolute'
... | CoffeeScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | 15b0d8551e09731f4d8cd78e354b5d63530126d8 | 852 | https://github.com/ksylvest/jquery-gridly/blob/15b0d8551e09731f4d8cd78e354b5d63530126d8/javascripts/jquery.gridly.coffee | 76 | 125 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:2:raw_corpus | raw_corpus | class Gridly
@settings:
base: 60
gutter: 20
columns: 12
@gridly: ($el, options = {}) ->
new Gridly($el, options)
constructor: ($el, settings = {}) ->
@$el = $el
@settings = $.extend {}, Gridly.settings, settings
$: (selector) =>
@$el.find(selector)
grow: ->
@grid.push()
... | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | d651fc9deb794c9456b49ff785558468b98d633c | 852 | https://github.com/ksylvest/jquery-gridly/blob/d651fc9deb794c9456b49ff785558468b98d633c/javascripts/jquery.gridly.coffee | 26 | 75 | ||
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
class Gridly
@settings:
base: 60
gutter: 20
columns: 12
@gridly: ($el, options = {}) ->
new Gridly($el, options)
constructor: ($el, settings = {}) ->
@$el = $el
@settings = $.extend {}, Gridly.settings, settings
$: (selector) =... | var Gridly;
Gridly = (function() {
class Gridly {
static gridly($el, options = {}) {
return new Gridly($el, options);
}
constructor($el, settings = {}) {
this.$ = this.$.bind(this);
this.layout = this.layout.bind(this);
this.$el = $el;
this.settings = $.extend({}, Gridly.se... | CoffeeScript | JavaScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | d651fc9deb794c9456b49ff785558468b98d633c | 852 | https://github.com/ksylvest/jquery-gridly/blob/d651fc9deb794c9456b49ff785558468b98d633c/javascripts/jquery.gridly.coffee | 26 | 75 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Gridly;
Gridly = (function() {
class Gridly {
static gridly($el, options = {}) {
return new Gridly($el, options);
}
constructor($el, settings = {}) {
this.$ = this.$.bind(this);
this.layout = this.layout.bind(this);
this.... | class Gridly
@settings:
base: 60
gutter: 20
columns: 12
@gridly: ($el, options = {}) ->
new Gridly($el, options)
constructor: ($el, settings = {}) ->
@$el = $el
@settings = $.extend {}, Gridly.settings, settings
$: (selector) =>
@$el.find(selector)
grow: ->
@grid.push()
... | JavaScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | d651fc9deb794c9456b49ff785558468b98d633c | 852 | https://github.com/ksylvest/jquery-gridly/blob/d651fc9deb794c9456b49ff785558468b98d633c/javascripts/jquery.gridly.coffee | 26 | 75 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:2:completion | completion | class Gridly
@settings:
base: 60
gutter: 20
columns: 12
@gridly: ($el, options = {}) ->
new Gridly($el, options)
constructor: ($el, settings = {}) ->
@$el = $el
@settings = $.extend {}, Gridly.settings, settings
$: (selector) =>
@$el.find(selector)
grow: ->
@grid.push()
... | $element = $(element)
size = (($element.data('width') || $element.width()) + @settings.gutter) / (@settings.base + @settings.gutter)
height = Infinity
column = 0
for i in [0 ... (columns.length - size)]
max = Math.max columns[i ... (i + size)]...
if max < height
heigh... | CoffeeScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | d651fc9deb794c9456b49ff785558468b98d633c | 852 | https://github.com/ksylvest/jquery-gridly/blob/d651fc9deb794c9456b49ff785558468b98d633c/javascripts/jquery.gridly.coffee | 26 | 75 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:3:raw_corpus | raw_corpus | @each ->
$this = $(@)
options = $.extend {}, $.fn.gridly.defaults, typeof option is "object" and option
action = if typeof option is "string" then option else option.action
action ?= "layout"
Gridly.gridly($this, options)[action]() | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | d651fc9deb794c9456b49ff785558468b98d633c | 852 | https://github.com/ksylvest/jquery-gridly/blob/d651fc9deb794c9456b49ff785558468b98d633c/javascripts/jquery.gridly.coffee | 76 | 83 | ||
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:3:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
@each ->
$this = $(@)
options = $.extend {}, $.fn.gridly.defaults, typeof option is "object" and option
action = if typeof option is "string" then option else option.action
action ?= "layout"
Gridly.gridly($this, options)[action]()... | this.each(function() {
var $this, action, options;
$this = $(this);
options = $.extend({}, $.fn.gridly.defaults, typeof option === "object" && option);
action = typeof option === "string" ? option : option.action;
if (action == null) {
action = "layout";
}
return Gridly.gridly($this, options)[action](... | CoffeeScript | JavaScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | d651fc9deb794c9456b49ff785558468b98d633c | 852 | https://github.com/ksylvest/jquery-gridly/blob/d651fc9deb794c9456b49ff785558468b98d633c/javascripts/jquery.gridly.coffee | 76 | 83 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:3:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
this.each(function() {
var $this, action, options;
$this = $(this);
options = $.extend({}, $.fn.gridly.defaults, typeof option === "object" && option);
action = typeof option === "string" ? option : option.action;
if (action == null) {
action = "layou... | @each ->
$this = $(@)
options = $.extend {}, $.fn.gridly.defaults, typeof option is "object" and option
action = if typeof option is "string" then option else option.action
action ?= "layout"
Gridly.gridly($this, options)[action]() | JavaScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | d651fc9deb794c9456b49ff785558468b98d633c | 852 | https://github.com/ksylvest/jquery-gridly/blob/d651fc9deb794c9456b49ff785558468b98d633c/javascripts/jquery.gridly.coffee | 76 | 83 |
ksylvest/jquery-gridly:javascripts/jquery.gridly.coffee:3:completion | completion | @each ->
$this = $(@)
options = $.extend {}, $.fn.gridly.defaults, typeof option is "object" and option | action = if typeof option is "string" then option else option.action
action ?= "layout"
Gridly.gridly($this, options)[action]() | CoffeeScript | CoffeeScript | ksylvest/jquery-gridly | javascripts/jquery.gridly.coffee | MIT | d651fc9deb794c9456b49ff785558468b98d633c | 852 | https://github.com/ksylvest/jquery-gridly/blob/d651fc9deb794c9456b49ff785558468b98d633c/javascripts/jquery.gridly.coffee | 76 | 83 |
jianliaoim/talk-os:talk-api2x/server/controllers/mixins/general.coffee:1:raw_corpus | raw_corpus | _ = require 'lodash'
Err = require 'err1st'
Promise = require 'bluebird'
limbo = require 'limbo'
{
UserModel
} = limbo.use 'talk'
module.exports = generalMixin =
# Set sessionUser property
setSessionUser: (req, res, callback) ->
{_sessionUserId} = req.get()
UserModel.findOne _id: _sessionUserId, (err, u... | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/controllers/mixins/general.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/controllers/mixins/general.coffee | 1 | 17 | ||
jianliaoim/talk-os:talk-api2x/server/controllers/mixins/general.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require 'lodash'
Err = require 'err1st'
Promise = require 'bluebird'
limbo = require 'limbo'
{
UserModel
} = limbo.use 'talk'
module.exports = generalMixin =
# Set sessionUser property
setSessionUser: (req, res, callback) ->
{_sessionUserId} = req... | var Err, Promise, UserModel, _, generalMixin, limbo;
_ = require('lodash');
Err = require('err1st');
Promise = require('bluebird');
limbo = require('limbo');
({UserModel} = limbo.use('talk'));
module.exports = generalMixin = {
// Set sessionUser property
setSessionUser: function(req, res, callback) {
var ... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-api2x/server/controllers/mixins/general.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/controllers/mixins/general.coffee | 1 | 17 |
jianliaoim/talk-os:talk-api2x/server/controllers/mixins/general.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var Err, Promise, UserModel, _, generalMixin, limbo;
_ = require('lodash');
Err = require('err1st');
Promise = require('bluebird');
limbo = require('limbo');
({UserModel} = limbo.use('talk'));
module.exports = generalMixin = {
// Set sessionUser property
... | _ = require 'lodash'
Err = require 'err1st'
Promise = require 'bluebird'
limbo = require 'limbo'
{
UserModel
} = limbo.use 'talk'
module.exports = generalMixin =
# Set sessionUser property
setSessionUser: (req, res, callback) ->
{_sessionUserId} = req.get()
UserModel.findOne _id: _sessionUserId, (err, u... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/controllers/mixins/general.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/controllers/mixins/general.coffee | 1 | 17 |
jianliaoim/talk-os:talk-api2x/server/controllers/mixins/general.coffee:1:completion | completion | _ = require 'lodash'
Err = require 'err1st'
Promise = require 'bluebird'
limbo = require 'limbo'
{
UserModel
} = limbo.use 'talk' | module.exports = generalMixin =
# Set sessionUser property
setSessionUser: (req, res, callback) ->
{_sessionUserId} = req.get()
UserModel.findOne _id: _sessionUserId, (err, user) ->
return callback(new Err('NOT_LOGIN')) unless user
req.set 'sessionUser', user
callback() | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-api2x/server/controllers/mixins/general.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-api2x/server/controllers/mixins/general.coffee | 1 | 17 |
jianliaoim/talk-os:talk-web/test/spec/actions/team.spec.coffee:1:raw_corpus | raw_corpus | xdescribe 'Actions: team', ->
beforeEach ->
@action = require 'actions/team'
@api = require 'network/api'
describe 'Method: teamSubscribe', ->
it 'should call api', ->
spyOn(@api.teams.subscribe, 'post').and.callThrough()
teamId = 1
config =
pathParams:
id: teamId
... | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/actions/team.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/team.spec.coffee | 1 | 41 | ||
jianliaoim/talk-os:talk-web/test/spec/actions/team.spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
xdescribe 'Actions: team', ->
beforeEach ->
@action = require 'actions/team'
@api = require 'network/api'
describe 'Method: teamSubscribe', ->
it 'should call api', ->
spyOn(@api.teams.subscribe, 'post').and.callThrough()
teamId = 1... | xdescribe('Actions: team', function() {
beforeEach(function() {
this.action = require('actions/team');
return this.api = require('network/api');
});
describe('Method: teamSubscribe', function() {
return it('should call api', function() {
var config, teamId;
spyOn(this.api.teams.subscribe, ... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/test/spec/actions/team.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/team.spec.coffee | 1 | 41 |
jianliaoim/talk-os:talk-web/test/spec/actions/team.spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
xdescribe('Actions: team', function() {
beforeEach(function() {
this.action = require('actions/team');
return this.api = require('network/api');
});
describe('Method: teamSubscribe', function() {
return it('should call api', function() {
var... | xdescribe 'Actions: team', ->
beforeEach ->
@action = require 'actions/team'
@api = require 'network/api'
describe 'Method: teamSubscribe', ->
it 'should call api', ->
spyOn(@api.teams.subscribe, 'post').and.callThrough()
teamId = 1
config =
pathParams:
id: teamId
... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/actions/team.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/team.spec.coffee | 1 | 41 |
jianliaoim/talk-os:talk-web/test/spec/actions/team.spec.coffee:1:completion | completion | xdescribe 'Actions: team', ->
beforeEach ->
@action = require 'actions/team'
@api = require 'network/api'
describe 'Method: teamSubscribe', ->
it 'should call api', ->
spyOn(@api.teams.subscribe, 'post').and.callThrough()
teamId = 1
config =
pathParams:
id: teamId
... | spyOn(@api.teams.unsubscribe, 'post').and.callThrough()
teamId = 1
config =
pathParams:
id: teamId
@action.teamUnsubscribe(teamId)
expect(@api.teams.unsubscribe.post).toHaveBeenCalledWith config
describe 'Method: teamInvite', ->
it 'should call api', ->
spyOn(@ap... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/actions/team.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/team.spec.coffee | 1 | 41 |
jianliaoim/talk-os:talk-web/test/spec/actions/team.spec.coffee:2:raw_corpus | raw_corpus | @action.teamInvite(teamId, email)
expect(@api.teams.invite.post).toHaveBeenCalledWith config
describe 'Method: batchInvite', ->
it 'should call api', ->
spyOn(@api.teams.batchinvite, 'post').and.callThrough()
teamId = 1
emailArray = ['test1@example.com', 'test2@example.com']
config... | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/actions/team.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/team.spec.coffee | 43 | 82 | ||
jianliaoim/talk-os:talk-web/test/spec/actions/team.spec.coffee:2:completion | completion | @action.teamInvite(teamId, email)
expect(@api.teams.invite.post).toHaveBeenCalledWith config
describe 'Method: batchInvite', ->
it 'should call api', ->
spyOn(@api.teams.batchinvite, 'post').and.callThrough()
teamId = 1
emailArray = ['test1@example.com', 'test2@example.com']
config... | spyOn(@api.teams.update, 'put').and.callThrough()
teamId = 1
data = {}
config =
pathParams:
id: teamId
data: data
@action.teamUpdate(teamId, data)
expect(@api.teams.update.put).toHaveBeenCalledWith config
describe 'Method: teamLeave', ->
it 'should call a... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/actions/team.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/team.spec.coffee | 43 | 82 |
jianliaoim/talk-os:talk-web/test/spec/actions/team.spec.coffee:3:raw_corpus | raw_corpus | @action.teamLeave(teamId)
expect(@api.teams.leave.post).toHaveBeenCalledWith config
describe 'Method: teamCreate', ->
it 'should call api', ->
spyOn(@api.teams.create, 'post').and.callThrough()
name = 'name'
config = data: name: name
@action.teamCreate(name)
expect(@api.team... | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/actions/team.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/team.spec.coffee | 84 | 126 | ||
jianliaoim/talk-os:talk-web/test/spec/actions/team.spec.coffee:3:completion | completion | @action.teamLeave(teamId)
expect(@api.teams.leave.post).toHaveBeenCalledWith config
describe 'Method: teamCreate', ->
it 'should call api', ->
spyOn(@api.teams.create, 'post').and.callThrough()
name = 'name'
config = data: name: name
@action.teamCreate(name)
expect(@api.team... | spyOn(@api.teams.unpin, 'post').and.callThrough()
teamId = 1
targetId = 2
config =
pathParams:
id: teamId
targetId: targetId
@action.teamUnpin(teamId, targetId)
expect(@api.teams.unpin.post).toHaveBeenCalledWith config
describe 'Method: teamPin', ->
it ... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/actions/team.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/team.spec.coffee | 84 | 126 |
jianliaoim/talk-os:talk-web/test/spec/actions/team.spec.coffee:4:raw_corpus | raw_corpus | @action.teamPin(teamId, targetId)
expect(@api.teams.pin.post).toHaveBeenCalledWith config
describe 'Method: getArchivedTopics', ->
it 'should call api', ->
spyOn(@api.teams.rooms, 'get').and.callThrough()
teamId = 1
config =
pathParams:
id: teamId
queryParams:
... | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/actions/team.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/team.spec.coffee | 128 | 158 | ||
jianliaoim/talk-os:talk-web/test/spec/actions/team.spec.coffee:4:completion | completion | @action.teamPin(teamId, targetId)
expect(@api.teams.pin.post).toHaveBeenCalledWith config
describe 'Method: getArchivedTopics', ->
it 'should call api', ->
spyOn(@api.teams.rooms, 'get').and.callThrough()
teamId = 1
config =
pathParams:
id: teamId
queryParams:
... | expect(@api.teams.rooms.get).toHaveBeenCalledWith config
describe 'Method: resetInviteUrl', ->
it 'should call api', ->
spyOn(@api.teams.refresh, 'post').and.callThrough()
teamId = 1
config =
pathParams:
id: teamId
data:
properties:
inviteCode: 1... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/test/spec/actions/team.spec.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/test/spec/actions/team.spec.coffee | 128 | 158 |
jianliaoim/talk-os:talk-web/client/module/modal-beta.coffee:1:raw_corpus | raw_corpus | cx = require 'classnames'
React = require 'react'
keycode = require 'keycode'
mixinLayered = require '../mixin/layered'
Transition = React.createFactory require './transition'
{ a, div, span, noscript } = React.DOM
T = React.PropTypes
module.exports = React.createClass
displayName: 'lite-modal'
mixins: [mixinLa... | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/modal-beta.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/modal-beta.coffee | 1 | 50 | ||
jianliaoim/talk-os:talk-web/client/module/modal-beta.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
cx = require 'classnames'
React = require 'react'
keycode = require 'keycode'
mixinLayered = require '../mixin/layered'
Transition = React.createFactory require './transition'
{ a, div, span, noscript } = React.DOM
T = React.PropTypes
module.exports = React.c... | var React, T, Transition, a, cx, div, keycode, mixinLayered, noscript, span;
cx = require('classnames');
React = require('react');
keycode = require('keycode');
mixinLayered = require('../mixin/layered');
Transition = React.createFactory(require('./transition'));
({a, div, span, noscript} = React.DOM);
T = React... | CoffeeScript | JavaScript | jianliaoim/talk-os | talk-web/client/module/modal-beta.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/modal-beta.coffee | 1 | 50 |
jianliaoim/talk-os:talk-web/client/module/modal-beta.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
var React, T, Transition, a, cx, div, keycode, mixinLayered, noscript, span;
cx = require('classnames');
React = require('react');
keycode = require('keycode');
mixinLayered = require('../mixin/layered');
Transition = React.createFactory(require('./transition'... | cx = require 'classnames'
React = require 'react'
keycode = require 'keycode'
mixinLayered = require '../mixin/layered'
Transition = React.createFactory require './transition'
{ a, div, span, noscript } = React.DOM
T = React.PropTypes
module.exports = React.createClass
displayName: 'lite-modal'
mixins: [mixinLa... | JavaScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/modal-beta.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/modal-beta.coffee | 1 | 50 |
jianliaoim/talk-os:talk-web/client/module/modal-beta.coffee:1:completion | completion | cx = require 'classnames'
React = require 'react'
keycode = require 'keycode'
mixinLayered = require '../mixin/layered'
Transition = React.createFactory require './transition'
{ a, div, span, noscript } = React.DOM
T = React.PropTypes
module.exports = React.createClass
displayName: 'lite-modal'
mixins: [mixinLa... | unbindWindowEvents: ->
window.removeEventListener 'keydown', @onWindowKeydown
onWindowKeydown: (event) ->
if keycode(event.keyCode) is 'esc'
@onCloseClick()
onCloseClick: ->
@props.onCloseClick()
onBackdropClick: (event) ->
event.stopPropagation()
if not @props.showCornerClose && even... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/modal-beta.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/modal-beta.coffee | 1 | 50 |
jianliaoim/talk-os:talk-web/client/module/modal-beta.coffee:2:raw_corpus | raw_corpus | span className: 'name', @props.title
span className: 'icon icon-remove', onClick: @onCloseClick
@props.children
render: ->
noscript() | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/modal-beta.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/modal-beta.coffee | 51 | 56 | ||
jianliaoim/talk-os:talk-web/client/module/modal-beta.coffee:2:completion | completion | span className: 'name', @props.title
span className: 'icon icon-remove', onClick: @onCloseClick
@props.children | render: ->
noscript() | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/module/modal-beta.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/module/modal-beta.coffee | 51 | 56 |
jianliaoim/talk-os:talk-web/client/app/user-menu.coffee:1:raw_corpus | raw_corpus | React = require 'react'
PureRenderMixin = require 'react-addons-pure-render-mixin'
lang = require '../locales/lang'
time = require '../util/time'
config = require '../config'
Icon = React.createFactory require '../module/icon'
{ div, span, hr } = React.DOM
T = React.PropTypes
module.exports = React.createClass
... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/user-menu.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/user-menu.coffee | 1 | 50 | ||
jianliaoim/talk-os:talk-web/client/app/user-menu.coffee:1:completion | completion | React = require 'react'
PureRenderMixin = require 'react-addons-pure-render-mixin'
lang = require '../locales/lang'
time = require '../util/time'
config = require '../config'
Icon = React.createFactory require '../module/icon'
{ div, span, hr } = React.DOM
T = React.PropTypes
module.exports = React.createClass
... | @props.onSettingsClick()
@props.onPopoverClose()
onDownloadClick: ->
@props.onDownloadClick()
@props.onPopoverClose()
onFeedbackClick: ->
@props.onFeedbackClick()
@props.onPopoverClose()
onSupportClick: ->
window.open '/site/support', true
@props.onPopoverClose()
onLogoutClick: -... | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/user-menu.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/user-menu.coffee | 1 | 50 |
jianliaoim/talk-os:talk-web/client/app/user-menu.coffee:2:raw_corpus | raw_corpus | { icon: 'life-belt', text: 'help-center', onClick: @onSupportClick }
{ icon: 'log-out', text: 'logout', onClick: @onLogoutClick }
]
div className: 'user-menu',
MenuItems.map (item, index) ->
div key: index, className: 'item line flex-horiz flex-vcenter', onClick: item.onClick,
Ico... | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/user-menu.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/user-menu.coffee | 51 | 62 | ||
jianliaoim/talk-os:talk-web/client/app/user-menu.coffee:2:completion | completion | { icon: 'life-belt', text: 'help-center', onClick: @onSupportClick }
{ icon: 'log-out', text: 'logout', onClick: @onLogoutClick }
]
div className: 'user-menu',
MenuItems.map (item, index) -> | div key: index, className: 'item line flex-horiz flex-vcenter', onClick: item.onClick,
Icon name: item.icon, size: 18
lang.getText item.text
div className: 'item line is-version',
span className: 'version',
"v#{config.version}" | CoffeeScript | CoffeeScript | jianliaoim/talk-os | talk-web/client/app/user-menu.coffee | MIT | 2545c4497865779a55762e03963a39237df9046b | 2,703 | https://github.com/jianliaoim/talk-os/blob/2545c4497865779a55762e03963a39237df9046b/talk-web/client/app/user-menu.coffee | 51 | 62 |
alekseykulikov/backbone-offline:spec/lib/offline_spec.coffee:1:raw_corpus | raw_corpus | describe 'Offline', ->
beforeEach ->
localStorage.setItem('dreams', '')
@dreams = new Dreams()
afterEach ->
window.localStorage.clear()
describe 'onLine', ->
it 'should returns true when onLine is undefined', ->
window.navigator = {}
expect(Offline.onLine()).toBeTruthy()
it 'sho... | CoffeeScript | alekseykulikov/backbone-offline | spec/lib/offline_spec.coffee | MIT | 2db4d38dcbafe42fc8431e21a5838513feaad7a0 | 717 | https://github.com/alekseykulikov/backbone-offline/blob/2db4d38dcbafe42fc8431e21a5838513feaad7a0/spec/lib/offline_spec.coffee | 1 | 41 | ||
alekseykulikov/backbone-offline:spec/lib/offline_spec.coffee:1:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
describe 'Offline', ->
beforeEach ->
localStorage.setItem('dreams', '')
@dreams = new Dreams()
afterEach ->
window.localStorage.clear()
describe 'onLine', ->
it 'should returns true when onLine is undefined', ->
window.navigator = {}... | describe('Offline', function() {
beforeEach(function() {
localStorage.setItem('dreams', '');
return this.dreams = new Dreams();
});
afterEach(function() {
return window.localStorage.clear();
});
describe('onLine', function() {
it('should returns true when onLine is undefined', function() {
... | CoffeeScript | JavaScript | alekseykulikov/backbone-offline | spec/lib/offline_spec.coffee | MIT | 2db4d38dcbafe42fc8431e21a5838513feaad7a0 | 717 | https://github.com/alekseykulikov/backbone-offline/blob/2db4d38dcbafe42fc8431e21a5838513feaad7a0/spec/lib/offline_spec.coffee | 1 | 41 |
alekseykulikov/backbone-offline:spec/lib/offline_spec.coffee:1:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
describe('Offline', function() {
beforeEach(function() {
localStorage.setItem('dreams', '');
return this.dreams = new Dreams();
});
afterEach(function() {
return window.localStorage.clear();
});
describe('onLine', function() {
it('should r... | describe 'Offline', ->
beforeEach ->
localStorage.setItem('dreams', '')
@dreams = new Dreams()
afterEach ->
window.localStorage.clear()
describe 'onLine', ->
it 'should returns true when onLine is undefined', ->
window.navigator = {}
expect(Offline.onLine()).toBeTruthy()
it 'sho... | JavaScript | CoffeeScript | alekseykulikov/backbone-offline | spec/lib/offline_spec.coffee | MIT | 2db4d38dcbafe42fc8431e21a5838513feaad7a0 | 717 | https://github.com/alekseykulikov/backbone-offline/blob/2db4d38dcbafe42fc8431e21a5838513feaad7a0/spec/lib/offline_spec.coffee | 1 | 41 |
alekseykulikov/backbone-offline:spec/lib/offline_spec.coffee:1:completion | completion | describe 'Offline', ->
beforeEach ->
localStorage.setItem('dreams', '')
@dreams = new Dreams()
afterEach ->
window.localStorage.clear()
describe 'onLine', ->
it 'should returns true when onLine is undefined', ->
window.navigator = {}
expect(Offline.onLine()).toBeTruthy()
it 'sho... | describe 'localSync', ->
beforeEach ->
@storage = @dreams.storage
@dream = @dreams.create()
registerFakeAjax url: '/api/dreams', successData: {}
it 'should call "findAll" when reading collection', ->
spyOn(@storage, 'findAll')
@dreams.fetch()
expect(@storage.findAll).toHaveB... | CoffeeScript | CoffeeScript | alekseykulikov/backbone-offline | spec/lib/offline_spec.coffee | MIT | 2db4d38dcbafe42fc8431e21a5838513feaad7a0 | 717 | https://github.com/alekseykulikov/backbone-offline/blob/2db4d38dcbafe42fc8431e21a5838513feaad7a0/spec/lib/offline_spec.coffee | 1 | 41 |
alekseykulikov/backbone-offline:spec/lib/offline_spec.coffee:2:raw_corpus | raw_corpus | it 'should call "update" when update model', ->
spyOn(@storage, 'update')
@dream.save(name: 'New dream')
expect(@storage.update).toHaveBeenCalledWith(@dream, jasmine.any(Object))
it 'should call "destroy" when delete model', ->
spyOn(@storage, 'destroy')
@dream.destroy()
expect(... | CoffeeScript | alekseykulikov/backbone-offline | spec/lib/offline_spec.coffee | MIT | 2db4d38dcbafe42fc8431e21a5838513feaad7a0 | 717 | https://github.com/alekseykulikov/backbone-offline/blob/2db4d38dcbafe42fc8431e21a5838513feaad7a0/spec/lib/offline_spec.coffee | 43 | 83 | ||
alekseykulikov/backbone-offline:spec/lib/offline_spec.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should call "update" when update model', ->
spyOn(@storage, 'update')
@dream.save(name: 'New dream')
expect(@storage.update).toHaveBeenCalledWith(@dream, jasmine.any(Object))
it 'should call "destroy" when delete model', ->
spyOn(... | it('should call "update" when update model', function() {
spyOn(this.storage, 'update');
this.dream.save({
name: 'New dream'
});
return expect(this.storage.update).toHaveBeenCalledWith(this.dream, jasmine.any(Object));
});
it('should call "destroy" when delete model', function() {
spyOn(this.storage, 'de... | CoffeeScript | JavaScript | alekseykulikov/backbone-offline | spec/lib/offline_spec.coffee | MIT | 2db4d38dcbafe42fc8431e21a5838513feaad7a0 | 717 | https://github.com/alekseykulikov/backbone-offline/blob/2db4d38dcbafe42fc8431e21a5838513feaad7a0/spec/lib/offline_spec.coffee | 43 | 83 |
alekseykulikov/backbone-offline:spec/lib/offline_spec.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should call "update" when update model', function() {
spyOn(this.storage, 'update');
this.dream.save({
name: 'New dream'
});
return expect(this.storage.update).toHaveBeenCalledWith(this.dream, jasmine.any(Object));
});
it('should call "destroy" whe... | it 'should call "update" when update model', ->
spyOn(@storage, 'update')
@dream.save(name: 'New dream')
expect(@storage.update).toHaveBeenCalledWith(@dream, jasmine.any(Object))
it 'should call "destroy" when delete model', ->
spyOn(@storage, 'destroy')
@dream.destroy()
expect(... | JavaScript | CoffeeScript | alekseykulikov/backbone-offline | spec/lib/offline_spec.coffee | MIT | 2db4d38dcbafe42fc8431e21a5838513feaad7a0 | 717 | https://github.com/alekseykulikov/backbone-offline/blob/2db4d38dcbafe42fc8431e21a5838513feaad7a0/spec/lib/offline_spec.coffee | 43 | 83 |
alekseykulikov/backbone-offline:spec/lib/offline_spec.coffee:2:completion | completion | it 'should call "update" when update model', ->
spyOn(@storage, 'update')
@dream.save(name: 'New dream')
expect(@storage.update).toHaveBeenCalledWith(@dream, jasmine.any(Object))
it 'should call "destroy" when delete model', ->
spyOn(@storage, 'destroy')
@dream.destroy()
expect(... | describe 'sync', ->
beforeEach ->
spyOn(Offline, 'localSync')
spyOn(Backbone, 'ajaxSync')
describe 'when @storage exists', ->
it 'should delegates actions to Offline.localSync if @support equal true', ->
@dreams.fetch()
expect(Offline.localSync).toHaveBeenCalled()
it 's... | CoffeeScript | CoffeeScript | alekseykulikov/backbone-offline | spec/lib/offline_spec.coffee | MIT | 2db4d38dcbafe42fc8431e21a5838513feaad7a0 | 717 | https://github.com/alekseykulikov/backbone-offline/blob/2db4d38dcbafe42fc8431e21a5838513feaad7a0/spec/lib/offline_spec.coffee | 43 | 83 |
alekseykulikov/backbone-offline:spec/lib/offline_spec.coffee:2:raw_corpus | raw_corpus | it 'should call "update" when update model', ->
spyOn(@storage, 'update')
@dream.save(name: 'New dream')
expect(@storage.update).toHaveBeenCalledWith(@dream, jasmine.any(Object))
it 'should call "destroy" when delete model', ->
spyOn(@storage, 'destroy')
@dream.destroy()
expect(... | CoffeeScript | alekseykulikov/backbone-offline | spec/lib/offline_spec.coffee | MIT | 4d8a2dae90612dfefe5764666475b4c72b729580 | 717 | https://github.com/alekseykulikov/backbone-offline/blob/4d8a2dae90612dfefe5764666475b4c72b729580/spec/lib/offline_spec.coffee | 43 | 83 | ||
alekseykulikov/backbone-offline:spec/lib/offline_spec.coffee:2:coffee_to_js | coffee_to_js | Convert this CoffeeScript to JavaScript.
```coffeescript
it 'should call "update" when update model', ->
spyOn(@storage, 'update')
@dream.save(name: 'New dream')
expect(@storage.update).toHaveBeenCalledWith(@dream, jasmine.any(Object))
it 'should call "destroy" when delete model', ->
spyOn(... | it('should call "update" when update model', function() {
spyOn(this.storage, 'update');
this.dream.save({
name: 'New dream'
});
return expect(this.storage.update).toHaveBeenCalledWith(this.dream, jasmine.any(Object));
});
it('should call "destroy" when delete model', function() {
spyOn(this.storage, 'de... | CoffeeScript | JavaScript | alekseykulikov/backbone-offline | spec/lib/offline_spec.coffee | MIT | 4d8a2dae90612dfefe5764666475b4c72b729580 | 717 | https://github.com/alekseykulikov/backbone-offline/blob/4d8a2dae90612dfefe5764666475b4c72b729580/spec/lib/offline_spec.coffee | 43 | 83 |
alekseykulikov/backbone-offline:spec/lib/offline_spec.coffee:2:js_to_coffee | js_to_coffee | Convert this JavaScript to CoffeeScript.
```javascript
it('should call "update" when update model', function() {
spyOn(this.storage, 'update');
this.dream.save({
name: 'New dream'
});
return expect(this.storage.update).toHaveBeenCalledWith(this.dream, jasmine.any(Object));
});
it('should call "destroy" whe... | it 'should call "update" when update model', ->
spyOn(@storage, 'update')
@dream.save(name: 'New dream')
expect(@storage.update).toHaveBeenCalledWith(@dream, jasmine.any(Object))
it 'should call "destroy" when delete model', ->
spyOn(@storage, 'destroy')
@dream.destroy()
expect(... | JavaScript | CoffeeScript | alekseykulikov/backbone-offline | spec/lib/offline_spec.coffee | MIT | 4d8a2dae90612dfefe5764666475b4c72b729580 | 717 | https://github.com/alekseykulikov/backbone-offline/blob/4d8a2dae90612dfefe5764666475b4c72b729580/spec/lib/offline_spec.coffee | 43 | 83 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.