commit stringlengths 40 40 | old_file stringlengths 9 134 | new_file stringlengths 9 134 | old_contents stringlengths 0 2.21k | new_contents stringlengths 34 3.19k | subject stringlengths 14 340 | message stringlengths 15 1.43k | lang stringclasses 1
value | license stringclasses 13
values | repos stringlengths 9 29k |
|---|---|---|---|---|---|---|---|---|---|
874d3024233aba38be12383c2779fc2824c948d3 | grammars/vp.cson | grammars/vp.cson | 'scopeName': 'source.vp'
'name': 'Valkyrie Profile'
'fileTypes': ['vp']
'patterns': [
{
'match': '^[^\t]*$',
'name': 'entity name function vp'
}
]
| 'scopeName': 'source.vp'
'name': 'Valkyrie Profile'
'fileTypes': ['vp']
'patterns': [
{
'match': '^[^\t]*$',
'name': 'entity name function vp'
},
{
'match': '^\t{2}.*$'
'name': 'constant language vp'
}
]
| Update grammar to take Windows into account | Update grammar to take Windows into account
| CoffeeScript | mit | MalikKeio/language-vp |
66686e3c00dc7c2baa0a51beda91bbd0f5383bd4 | lib/debug.coffee | lib/debug.coffee | EventEmitter = require('events').EventEmitter
class Debug extends EventEmitter
###
@options Which debug details should be sent.
data - dump of packet data
payload - details of decoded payload
###
constructor: (@options) ->
@options = @options || {}
@options.data = @options.data || false
@options.payload = @options.payload || false
@options.token = @options.token || false
@indent = ' '
packet: (direction, packet) ->
if @haveListeners() && @options.packet
@log('')
@log(direction)
@log(packet.headerToString(@indent))
data: (packet) ->
if @haveListeners() && @options.data
@log(packet.dataToString(@indent))
payload: (generatePayloadText) ->
if @haveListeners() && @options.payload
@log(generatePayloadText())
token: (token) ->
if @haveListeners() && @options.token
@log(token)
# Only incur the overhead of producing formatted messages when necessary.
haveListeners: ->
@listeners('debug').length > 0
log: (text) ->
@emit('debug', text)
module.exports = Debug
| EventEmitter = require('events').EventEmitter
class Debug extends EventEmitter
###
@options Which debug details should be sent.
data - dump of packet data
payload - details of decoded payload
###
constructor: (@options) ->
@options = @options || {}
@options.data = @options.data || false
@options.payload = @options.payload || false
@options.packet = @options.packet || false
@options.token = @options.token || false
@indent = ' '
packet: (direction, packet) ->
if @haveListeners() && @options.packet
@log('')
@log(direction)
@log(packet.headerToString(@indent))
data: (packet) ->
if @haveListeners() && @options.data
@log(packet.dataToString(@indent))
payload: (generatePayloadText) ->
if @haveListeners() && @options.payload
@log(generatePayloadText())
token: (token) ->
if @haveListeners() && @options.token
@log(token)
# Only incur the overhead of producing formatted messages when necessary.
haveListeners: ->
@listeners('debug').length > 0
log: (text) ->
@emit('debug', text)
module.exports = Debug
| Set a default for Connection's config.options.default . | Set a default for Connection's config.options.default .
| CoffeeScript | mit | tediousjs/tedious,spanditcaa/tedious,arthurschreiber/tedious,Sage-ERP-X3/tedious,LeanKit-Labs/tedious,tediousjs/tedious,pekim/tedious |
80f5a2ab25dd4a3311c0bd3fcb1142f82a87bfed | javascripts/lib.coffee | javascripts/lib.coffee | #= require almond
window.ttm ||= {}
ttm.ClassMixer = (klass)->
klass.build = ->
it = new klass
it.initialize && it.initialize.apply(it, arguments)
it
klass.prototype.klass = klass
klass
define "lib/class_mixer", ->
return ttm.ClassMixer
| #= require almond
window.ttm ||= {}
window.decorators ||= {}
ttm.ClassMixer = (klass)->
klass.build = ->
it = new klass
it.initialize && it.initialize.apply(it, arguments)
it
klass.prototype.klass = klass
klass
define "lib/class_mixer", ->
return ttm.ClassMixer
| Implement decorator pattern for student dashboard. | WIP: Implement decorator pattern for student dashboard.
| CoffeeScript | mit | thinkthroughmath/javascript-calculator,thinkthroughmath/javascript-calculator |
0bc7c3c8714c71d96fbdf4ef7b2bb545790b6d36 | spec/spec-helper.coffee | spec/spec-helper.coffee | require 'coffee-cache'
jasmine.getEnv().addEqualityTester(require('underscore-plus').isEqual)
| require 'coffee-cache'
jasmine.getEnv().addEqualityTester(require('underscore-plus').isEqual)
require('grim').includeDeprecatedAPIs = false
| Exclude deprecated APIs when running specs | Exclude deprecated APIs when running specs
| CoffeeScript | mit | jacekkopecky/text-buffer,jacekkopecky/text-buffer,atom/text-buffer,atom/text-buffer,pombredanne/text-buffer,whodatninja/text-buffer,pombredanne/text-buffer |
770d38cf825ddacd31a0343f3a0ad72a13245530 | app/assets/javascripts/all_aboard/routes/slides.js.coffee | app/assets/javascripts/all_aboard/routes/slides.js.coffee | AllAboard.SlidesRoute = Em.Route.extend
model: ->
# FIXME: So this is great, except that it doesn't work on a Board that was
# created by the app while that same instance is still running. It just
# sits and hangs resolving the model.
@modelFor("board").get("slides")
afterModel: (slides) ->
if slides.get("length") > 0
@transitionTo("slide", @modelFor("board"), slides.get("firstObject"))
| AllAboard.SlidesRoute = Em.Route.extend
model: ->
@modelFor("board").get("slides")
afterModel: (slides) ->
if slides.get("length") > 0
@transitionTo("slide", @modelFor("board"), slides.get("firstObject"))
| Remove a FIXME that got fixed with data beta3. | Remove a FIXME that got fixed with data beta3.
| CoffeeScript | mit | dpetersen/all_aboard,dpetersen/all_aboard |
7bcef35be642095f0899ef7d353444b3bf027a1d | brunch-config.coffee | brunch-config.coffee | exports.config =
files:
javascripts:
joinTo:
'js/app.js': /^(vendor|bower_components|app)/
stylesheets:
joinTo: 'css/app.css'
templates:
joinTo: 'js/app.js'
plugins:
jshint:
pattern: /^app\/.*\.js$/
options:
curly: true
bitwise: true
globals:
_: true
jQuery: true
Zeppelin: true
Backbone: true
warnOnly: true
handlebars:
include:
enabled: false
| exports.config =
files:
javascripts:
joinTo:
'js/app.js': /^(vendor|bower_components|app)/
stylesheets:
joinTo: 'css/app.css'
templates:
joinTo: 'js/app.js'
plugins:
handlebars:
include:
enabled: false
| Use .jshintrc file instead of brunch jshint plugin configurations. | Use .jshintrc file instead of brunch jshint plugin configurations.
| CoffeeScript | agpl-3.0 | jessamynsmith/boards-web,GetBlimp/boards-web,jessamynsmith/boards-web |
4e46c484dec3fe06c7bb0ac10ed8b49deeac3a05 | src/util.coffee | src/util.coffee | # Utility functions ---------------------------------------
extend = (dest, src) ->
dest[name] = src[name] for name in src when src[name] and !dest[name]
dest
| # Utility functions ---------------------------------------
extend = (dest, src) ->
dest[key] = value for key, value of src when !dest[key]
dest
| Fix bug (with my understanding of CoffeeScript) | Fix bug (with my understanding of CoffeeScript)
| CoffeeScript | bsd-3-clause | myna/myna-js |
9ca3081ce85647a0d3b3cc529a58dd8fd863fbaa | plugins/email/index.coffee | plugins/email/index.coffee | NotificationPlugin = require "../../notification-plugin"
class Email extends NotificationPlugin
SIDEKIQ_WORKER = "ErrorEmailWorker"
SIDEKIQ_QUEUE = "error_emails"
@receiveEvent: (config, event, callback) ->
sidekiq = config.sidekiq
delete config.sidekiq
sidekiq.enqueue SIDEKIQ_WORKER, [event.trigger.type, event.error.id, config, event.trigger.message],
retry: false
queue: SIDEKIQ_QUEUE
callback null
module.exports = Email
| NotificationPlugin = require "../../notification-plugin"
class Email extends NotificationPlugin
SIDEKIQ_WORKER = "ErrorEmailWorker"
SIDEKIQ_QUEUE = "error_emails"
@receiveEvent: (config, event, callback) ->
sidekiq = config.sidekiq
delete config.sidekiq
sidekiq.enqueue SIDEKIQ_WORKER, [event.trigger.type, event.error.id, config, event.trigger.message, event],
retry: false
queue: SIDEKIQ_QUEUE
callback null
module.exports = Email
| Send entire payload to Sidekiq | Send entire payload to Sidekiq
| CoffeeScript | mit | sharesight/bugsnag-notification-plugins,cagedata/bugsnag-notification-plugins,6wunderkinder/bugsnag-notification-plugins,indirect/bugsnag-notification-plugins,korealert/bugsnag-notification-plugins,jacobmarshall/bugsnag-notification-plugins,korealert/bugsnag-notification-plugins,kstream001/bugsnag-notification-plugins,6wunderkinder/bugsnag-notification-plugins |
1811fd18d0554bef905872fdf3c91220de8237b0 | app/pages/lab/science-case.cjsx | app/pages/lab/science-case.cjsx | React = require 'react'
AutoSave = require '../../components/auto-save'
handleInputChange = require '../../lib/handle-input-change'
module.exports = React.createClass
displayName: 'EditProjectScienceCase'
getDefaultProps: ->
project: {}
render: ->
<div>
<p className="form-help">This page is for you to describe your research motivations and goals to the volunteers. Feel free to add detail, but try to avoid jargon. This page renders markdown, so you can format it and add images (externally hosted for now) and links. The site will show your team members with their profile pictures and roles to the side of the text.</p>
<p>
<AutoSave resource={@props.project}>
<span className="form-label">Science case</span>
<br />
<textarea className="standard-input full" name="science_case" value={@props.project.science_case} rows="20" onChange={handleInputChange.bind @props.project} />
</AutoSave>
</p>
</div>
| React = require 'react'
AutoSave = require '../../components/auto-save'
handleInputChange = require '../../lib/handle-input-change'
module.exports = React.createClass
displayName: 'EditProjectScienceCase'
getDefaultProps: ->
project: {}
render: ->
<div>
<p className="form-help">This page is for you to describe your research motivations and goals to the volunteers. Feel free to add detail, but try to avoid jargon. This page renders markdown, so you can format it and add images via the Media Library and links. The site will show your team members with their profile pictures and roles to the side of the text.</p>
<p>
<AutoSave resource={@props.project}>
<span className="form-label">Science case</span>
<br />
<textarea className="standard-input full" name="science_case" value={@props.project.science_case} rows="20" onChange={handleInputChange.bind @props.project} />
</AutoSave>
</p>
</div>
| Update science page help text | Update science page help text
| CoffeeScript | apache-2.0 | alexbfree/Panoptes-Front-End,edpaget/Panoptes-Front-End,fmnhExhibits/Panoptes-Front-End,zooniverse/Panoptes-Front-End,amyrebecca/Panoptes-Front-End,edpaget/Panoptes-Front-End,alexbfree/Panoptes-Front-End,jelliotartz/Panoptes-Front-End,amyrebecca/Panoptes-Front-End,CKrawczyk/Panoptes-Front-End,alexbfree/Panoptes-Front-End,parrish/Panoptes-Front-End,camallen/Panoptes-Front-End,parrish/Panoptes-Front-End,CKrawczyk/Panoptes-Front-End,camallen/Panoptes-Front-End,jelliotartz/Panoptes-Front-End,tfmorris/Panoptes-Front-End,edpaget/Panoptes-Front-End,fmnhExhibits/Panoptes-Front-End,mrniaboc/Panoptes-Front-End,tfmorris/Panoptes-Front-End,mrniaboc/Panoptes-Front-End,jelliotartz/Panoptes-Front-End,fmnhExhibits/Panoptes-Front-End,mrniaboc/Panoptes-Front-End,aliburchard/Panoptes-Front-End,camallen/Panoptes-Front-End,amyrebecca/Panoptes-Front-End,aliburchard/Panoptes-Front-End,CKrawczyk/Panoptes-Front-End,parrish/Panoptes-Front-End |
fb659301965d99291c40b7531f0460e005b87ead | app/assets/javascripts/sprangular/directives/checkoutButton.coffee | app/assets/javascripts/sprangular/directives/checkoutButton.coffee | 'use strict'
Sprangular.directive 'checkoutButton', ->
restrict: 'E'
scope:
user: '='
templateUrl: 'directives/checkout_button.html'
controller: ($scope, $location, Cart, Checkout) ->
$scope.allowOneClick = false
$scope.processing = false
$scope.$watch 'user', (user) ->
$scope.allowOneClick = user.allowOneClick
$scope.standardCheckout = ->
$scope.processing = true
$location.path("/checkout")
$scope.oneClickCheckout = ->
$scope.processing = true
order = Cart.current
user = $scope.user
order.resetAddresses(user)
order.resetCreditCard(user)
Checkout.update('payment')
.then ->
$location.path('/checkout')
$scope.checkout = ->
if $scope.allowOneClick
$scope.oneClickCheckout()
else
$scope.standardCheckout()
| 'use strict'
Sprangular.directive 'checkoutButton', ->
restrict: 'E'
scope:
user: '='
templateUrl: 'directives/checkout_button.html'
controller: ($scope, $location, Cart, Checkout) ->
$scope.processing = false
$scope.checkout = ->
$scope.processing = true
$location.path("/checkout")
| Refactor checkout button to remove one-click-logic (checkout ctrl already doest it) | Refactor checkout button to remove one-click-logic (checkout ctrl already doest it)
| CoffeeScript | mit | sprangular/sprangular,sprangular/sprangular,sprangular/sprangular |
5a61efbbc23a5382cfd009deea8f9a6147afd61f | js/ab_test_definitions.coffee | js/ab_test_definitions.coffee | # 1. Don't define a test with null as one of the options
# 2. If you change a test's options, you must also change the test's name
#
# You can add overrides, which will set the option if override_p returns true.
exports = this
exports.ab_test_definitions =
options:
quick_setup_or_trial: ["14-day free trial.", "Run your first test with 3 clicks."]
github_warning_modal: [true, false]
home_red_buttons: [true, false]
home_text_hero: [true, false]
show_add_repos_blank_slate: [true, false] # true shows the show_add_repos_blank_slate div, false hides it
home_extra_ctas: [true, false]
home_cta_plan_price_trial: [true, false] # around the home button CTA, include text about plans starting from $19, and 14 day trial
number_one_instead_of_happy_customers_callout: [true, false]
home_speed_level: ["4-way", "8-way", "12-way"]
overrides:
[
override_p: ->
window.circleEnvironment is 'test'
options:
github_warning_modal: false
]
| # 1. Don't define a test with null as one of the options
# 2. If you change a test's options, you must also change the test's name
#
# You can add overrides, which will set the option if override_p returns true.
exports = this
exports.ab_test_definitions =
options:
github_warning_modal: [true, false]
home_red_buttons: [true, false]
home_text_hero: [true, false]
show_add_repos_blank_slate: [true, false] # true shows the show_add_repos_blank_slate div, false hides it
home_extra_ctas: [true, false]
home_cta_plan_price_trial: [true, false] # around the home button CTA, include text about plans starting from $19, and 14 day trial
number_one_instead_of_happy_customers_callout: [true, false]
home_speed_level: ["4-way", "8-way", "12-way"]
overrides:
[
override_p: ->
window.circleEnvironment is 'test'
options:
github_warning_modal: false
]
| Remove quick-test-or-trial, it's not used. | Remove quick-test-or-trial, it's not used.
| CoffeeScript | epl-1.0 | prathamesh-sonpatki/frontend,RayRutjes/frontend,circleci/frontend,prathamesh-sonpatki/frontend,RayRutjes/frontend,circleci/frontend,circleci/frontend |
2bc74be767bdc8c6b0a44f12147dc4460980f6b6 | Gruntfile.coffee | Gruntfile.coffee | module.exports = (grunt) ->
grunt.initConfig
clean:
package: ['lib']
coffee:
options:
bare: true
files:
expand: true
cwd: 'src'
src: ['**/*.coffee']
dest: 'lib'
ext: '.js'
mochacli:
options:
compilers: ['coffee:coffee-script/register']
files: ['test/brave-mouse']
grunt.loadNpmTasks 'grunt-contrib-clean'
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-mocha-cli'
grunt.registerTask 'build', ['clean:package', 'coffee']
grunt.registerTask 'default', []
| module.exports = (grunt) ->
grunt.initConfig
clean:
package: ['lib']
coffee:
options:
bare: true
files:
expand: true
cwd: 'src'
src: ['**/*.coffee']
dest: 'lib'
ext: '.js'
mochacli:
options:
compilers: ['coffee:coffee-script/register']
files: ['test/brave-mouse']
grunt.loadNpmTasks 'grunt-contrib-clean'
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.loadNpmTasks 'grunt-mocha-cli'
grunt.registerTask 'build', ['clean:package', 'coffee']
grunt.registerTask 'test', ['mochacli']
grunt.registerTask 'default', []
| Add Grunt task alias test | Add Grunt task alias test
| CoffeeScript | bsd-2-clause | SonicHedgehog/brave-mouse |
bef1fec6fcb7686aa8f0fe5af906fbfcfbcbd9e6 | workers/social/lib/social/traits/filterable.coffee | workers/social/lib/social/traits/filterable.coffee | module.exports = class Filterable
{secure, ObjectId} = require 'bongo'
{permit} = require '../models/group/permissionset'
@findSuggestions = ()->
throw new Error "Filterable must implement static method findSuggestions!"
@byRelevance = (client, seed, options, callback)->
[callback, options] = [options, callback] unless callback
{limit, blacklist, skip} = options
limit ?= 10
blacklist or= []
blacklist = blacklist.map(ObjectId)
cleanSeed = seed.replace(/[^\w\s-]/).trim() #TODO: this is wrong for international charsets
startsWithSeedTest = RegExp '^'+cleanSeed, "i"
startsWithOptions = {limit, blacklist, skip}
@findSuggestions client, startsWithSeedTest, startsWithOptions, (err, suggestions)=>
if err
callback err
else if limit is suggestions.length
callback null, suggestions
else
containsSeedTest = RegExp cleanSeed, 'i'
containsOptions =
skip : skip
limit : limit-suggestions.length
blacklist : blacklist.concat(suggestions.map (o)-> o.getId())
@findSuggestions client, containsSeedTest, containsOptions, (err, moreSuggestions)->
if err
callback err
else
allSuggestions = suggestions.concat moreSuggestions
callback null, allSuggestions
@byRelevance$ = permit 'query collection',
success: (client, seed, options, callback)->
@byRelevance client, seed, options, callback | module.exports = class Filterable
{secure, ObjectId} = require 'bongo'
{permit} = require '../models/group/permissionset'
@findSuggestions = ()->
throw new Error "Filterable must implement static method findSuggestions!"
@byRelevance = (client, seed, options, callback)->
[callback, options] = [options, callback] unless callback
{limit, blacklist, skip} = options
limit ?= 10
blacklist or= []
blacklist = blacklist.map(ObjectId)
cleanSeed = seed.replace(/[^\w\s-]/).trim() #TODO: this is wrong for international charsets
startsWithSeedTest = RegExp '^'+cleanSeed, "i"
startsWithOptions = {limit, blacklist, skip}
@findSuggestions client, startsWithSeedTest, startsWithOptions, (err, suggestions)=>
if err
callback err
else if suggestions and limit is suggestions.length
callback null, suggestions
else
containsSeedTest = RegExp cleanSeed, 'i'
containsOptions =
skip : skip
limit : limit-suggestions.length
blacklist : blacklist.concat(suggestions.map (o)-> o.getId())
@findSuggestions client, containsSeedTest, containsOptions, (err, moreSuggestions)->
if err
callback err
else
allSuggestions = suggestions.concat moreSuggestions
callback null, allSuggestions
@byRelevance$ = permit 'query collection',
success: (client, seed, options, callback)->
@byRelevance client, seed, options, callback | Make sure there are suggestions | Filterable: Make sure there are suggestions
| CoffeeScript | agpl-3.0 | acbodine/koding,cihangir/koding,gokmen/koding,kwagdy/koding-1,koding/koding,rjeczalik/koding,alex-ionochkin/koding,acbodine/koding,jack89129/koding,sinan/koding,sinan/koding,drewsetski/koding,gokmen/koding,gokmen/koding,drewsetski/koding,mertaytore/koding,sinan/koding,alex-ionochkin/koding,koding/koding,szkl/koding,drewsetski/koding,cihangir/koding,szkl/koding,mertaytore/koding,gokmen/koding,jack89129/koding,andrewjcasal/koding,andrewjcasal/koding,szkl/koding,andrewjcasal/koding,andrewjcasal/koding,andrewjcasal/koding,alex-ionochkin/koding,usirin/koding,rjeczalik/koding,kwagdy/koding-1,alex-ionochkin/koding,szkl/koding,alex-ionochkin/koding,cihangir/koding,koding/koding,gokmen/koding,acbodine/koding,jack89129/koding,acbodine/koding,mertaytore/koding,szkl/koding,kwagdy/koding-1,andrewjcasal/koding,sinan/koding,kwagdy/koding-1,koding/koding,usirin/koding,rjeczalik/koding,sinan/koding,alex-ionochkin/koding,usirin/koding,usirin/koding,acbodine/koding,jack89129/koding,usirin/koding,koding/koding,usirin/koding,cihangir/koding,kwagdy/koding-1,mertaytore/koding,kwagdy/koding-1,mertaytore/koding,drewsetski/koding,szkl/koding,koding/koding,cihangir/koding,mertaytore/koding,rjeczalik/koding,mertaytore/koding,koding/koding,jack89129/koding,rjeczalik/koding,jack89129/koding,cihangir/koding,jack89129/koding,szkl/koding,rjeczalik/koding,jack89129/koding,alex-ionochkin/koding,sinan/koding,rjeczalik/koding,acbodine/koding,gokmen/koding,alex-ionochkin/koding,cihangir/koding,cihangir/koding,gokmen/koding,szkl/koding,kwagdy/koding-1,drewsetski/koding,andrewjcasal/koding,kwagdy/koding-1,mertaytore/koding,sinan/koding,sinan/koding,koding/koding,usirin/koding,drewsetski/koding,usirin/koding,andrewjcasal/koding,gokmen/koding,drewsetski/koding,rjeczalik/koding,acbodine/koding,acbodine/koding,drewsetski/koding |
2e2268b34e2d6c72ac590ce9252d28d4e765f956 | bin/layer-template.coffee | bin/layer-template.coffee | #! /usr/bin/env coffee
args = require('../src/args').camelized 'template'
templates = require '../src/templates'
templates.show args.template | #! /usr/bin/env coffee
args = require '../src/args'
templates = require '../src/templates'
args.withDefaultOptions('template')
.option 'show',
alias: 's'
describe: 'Print the raw template jade and data to the console'
type: 'boolean'
.option 'new',
alias: 'n'
describe: 'Create a new template with the provided name'
requiresArg: true
type: 'string'
.option 'delete',
alias: 'n'
describe: 'Delete a reference to a template (not the files themselves)'
requiresArg: true
type: 'string'
templates.show args.camelize().template | Add (unimplemented) options to template command | Add (unimplemented) options to template command
| CoffeeScript | mit | dp28/layer,dp28/layer |
e07972711ed9e9404d4e6051c1ad23275a6d6645 | lib/assets/javascripts/cable/connection.coffee | lib/assets/javascripts/cable/connection.coffee | # Encapsulate the cable connection held by the consumer. This is an internal class not intended for direct user manipulation.
class Cable.Connection
constructor: (@consumer) ->
@open()
send: (data) ->
if @isOpen()
@webSocket.send(JSON.stringify(data))
true
else
false
open: ->
if @isOpen()
throw new Error("Must close existing connection before opening")
else
@webSocket = new WebSocket(@consumer.url)
@installEventHandlers()
close: ->
@webSocket?.close()
reopen: ->
@close()
@open()
isOpen: ->
@isState("open")
# Private
isState: (states...) ->
@getState() in states
getState: ->
return state.toLowerCase() for state, value of WebSocket when value is @webSocket?.readyState
null
installEventHandlers: ->
for eventName of @events
handler = @events[eventName].bind(this)
@webSocket["on#{eventName}"] = handler
events:
message: (event) ->
{identifier, message} = JSON.parse(event.data)
@consumer.subscriptions.notify(identifier, "received", message)
open: ->
@disconnected = false
@consumer.subscriptions.reload()
close: ->
@disconnect()
error: ->
@disconnect()
disconnect: ->
return if @disconnected
@disconnected = true
@consumer.subscriptions.notifyAll("disconnected")
toJSON: ->
state: @getState()
| # Encapsulate the cable connection held by the consumer. This is an internal class not intended for direct user manipulation.
class Cable.Connection
constructor: (@consumer) ->
@open()
send: (data) ->
if @isOpen()
@webSocket.send(JSON.stringify(data))
true
else
false
open: =>
if @webSocket and not @isState("closed")
throw new Error("Existing connection must be closed before opening")
else
@webSocket = new WebSocket(@consumer.url)
@installEventHandlers()
true
close: ->
@webSocket?.close()
reopen: ->
@close()
@open()
isOpen: ->
@isState("open")
# Private
isState: (states...) ->
@getState() in states
getState: ->
return state.toLowerCase() for state, value of WebSocket when value is @webSocket?.readyState
null
installEventHandlers: ->
for eventName of @events
handler = @events[eventName].bind(this)
@webSocket["on#{eventName}"] = handler
events:
message: (event) ->
{identifier, message} = JSON.parse(event.data)
@consumer.subscriptions.notify(identifier, "received", message)
open: ->
@disconnected = false
@consumer.subscriptions.reload()
close: ->
@disconnect()
error: ->
@disconnect()
disconnect: ->
return if @disconnected
@disconnected = true
@consumer.subscriptions.notifyAll("disconnected")
toJSON: ->
state: @getState()
| Improve guard against opening multiple web sockets | Improve guard against opening multiple web sockets
| CoffeeScript | mit | printercu/rails,rails/rails,untidy-hair/rails,joonyou/rails,bolek/rails,yasslab/railsguides.jp,kmayer/rails,ngpestelos/rails,prathamesh-sonpatki/rails,starknx/rails,ledestin/rails,kmcphillips/rails,yhirano55/rails,arjes/rails,assain/rails,amoody2108/TechForJustice,ttanimichi/rails,printercu/rails,samphilipd/rails,Stellenticket/rails,BlakeWilliams/rails,kamipo/rails,gfvcastro/rails,Erol/rails,Edouard-chin/rails,Spin42/rails,kamipo/rails,gcourtemanche/rails,illacceptanything/illacceptanything,illacceptanything/illacceptanything,odedniv/rails,Edouard-chin/rails,georgeclaghorn/rails,mechanicles/rails,richseviora/rails,rushingfitness/actioncable,vipulnsward/rails,marklocklear/rails,untidy-hair/rails,mohitnatoo/rails,odedniv/rails,utilum/rails,sergey-alekseev/rails,tjschuck/rails,maicher/rails,kmcphillips/rails,shioyama/rails,schuetzm/rails,hanystudy/rails,kaspth/rails,fabianoleittes/rails,xlymian/rails,mechanicles/rails,EmmaB/rails-1,rails/rails,kenta-s/rails,Envek/rails,EmmaB/rails-1,gavingmiller/rails,aditya-kapoor/rails,Erol/rails,gauravtiwari/rails,yawboakye/rails,shioyama/rails,ledestin/rails,ngpestelos/rails,mijoharas/rails,notapatch/rails,kenta-s/rails,tijwelch/rails,rossta/rails,Sen-Zhang/rails,arjes/rails,alecspopa/rails,untidy-hair/rails,arunagw/rails,schuetzm/rails,lcreid/rails,utilum/rails,esparta/rails,marklocklear/rails,yhirano55/rails,voray/rails,amoody2108/TechForJustice,lsylvester/actioncable,xlymian/rails,marklocklear/rails,xlymian/rails,palkan/rails,kachick/rails,stefanmb/rails,georgeclaghorn/rails,felipecvo/rails,Sen-Zhang/rails,illacceptanything/illacceptanything,illacceptanything/illacceptanything,kddeisz/rails,kmcphillips/rails,Sen-Zhang/rails,Vasfed/rails,kaspth/rails,esparta/rails,MSP-Greg/rails,Spin42/rails,illacceptanything/illacceptanything,mohitnatoo/rails,lucasmazza/rails,EmmaB/rails-1,travisofthenorth/rails,odedniv/rails,BlakeWilliams/rails,rafaelfranca/omg-rails,pvalena/rails,Erol/rails,yhirano55/rails,elfassy/rails,pvalena/rails,assain/rails,lcreid/rails,yawboakye/rails,alecspopa/rails,utilum/rails,MichaelSp/rails,arjes/rails,kddeisz/rails,travisofthenorth/rails,valencar/actioncable,mathieujobin/reduced-rails-for-travis,illacceptanything/illacceptanything,iainbeeston/rails,vipulnsward/rails,vassilevsky/rails,maicher/rails,eileencodes/rails,Spin42/rails,iainbeeston/rails,alecspopa/rails,aditya-kapoor/rails,mtsmfm/railstest,kirs/rails-1,gauravtiwari/rails,mijoharas/rails,eileencodes/rails,assain/rails,kddeisz/rails,printercu/rails,MichaelSp/rails,notapatch/rails,kirs/rails-1,yasslab/railsguides.jp,MSP-Greg/rails,matrinox/rails,joonyou/rails,stefanmb/rails,baerjam/rails,pschambacher/rails,tgxworld/rails,kmayer/rails,rbhitchcock/rails,rafaelfranca/omg-rails,vipulnsward/rails,pschambacher/rails,elfassy/rails,mtsmfm/rails,vipulnsward/rails,mechanicles/rails,coreyward/rails,kachick/rails,mathieujobin/reduced-rails-for-travis,bogdanvlviv/rails,illacceptanything/illacceptanything,bogdanvlviv/rails,mtsmfm/rails,hanystudy/rails,mechanicles/rails,tijwelch/rails,fabianoleittes/rails,bolek/rails,amoody2108/TechForJustice,betesh/rails,esparta/rails,matrinox/rails,vassilevsky/rails,rossta/rails,lcreid/rails,coreyward/rails,koic/rails,kddeisz/rails,koic/rails,brchristian/rails,tijwelch/rails,betesh/rails,eileencodes/rails,tgxworld/rails,kenta-s/rails,Erol/rails,Stellenticket/rails,rossta/rails,yawboakye/rails,valencar/actioncable,koic/rails,prathamesh-sonpatki/rails,Stellenticket/rails,mathieujobin/reduced-rails-for-travis,assain/rails,palkan/rails,richseviora/rails,ngpestelos/rails,bogdanvlviv/rails,bradleypriest/rails,yalab/rails,Vasfed/rails,yalab/rails,tgxworld/rails,notapatch/rails,joonyou/rails,fabianoleittes/rails,joonyou/rails,gfvcastro/rails,lcreid/rails,voray/rails,mtsmfm/railstest,untidy-hair/rails,Edouard-chin/rails,kmcphillips/rails,jeremy/rails,printercu/rails,prathamesh-sonpatki/rails,jeremy/rails,mohitnatoo/rails,riseshia/railsguides.kr,rbhitchcock/rails,kmayer/rails,felipecvo/rails,mohitnatoo/rails,illacceptanything/illacceptanything,hanystudy/rails,shioyama/rails,bolek/rails,betesh/rails,illacceptanything/illacceptanything,brchristian/rails,repinel/rails,starknx/rails,BlakeWilliams/rails,gcourtemanche/rails,Envek/rails,ttanimichi/rails,gavingmiller/rails,rails/rails,stefanmb/rails,yahonda/rails,kirs/rails-1,prathamesh-sonpatki/rails,betesh/rails,illacceptanything/illacceptanything,pvalena/rails,maicher/rails,samphilipd/rails,kaspth/rails,mtsmfm/railstest,arunagw/rails,travisofthenorth/rails,illacceptanything/illacceptanything,MSP-Greg/rails,schuetzm/rails,bradleypriest/rails,schuetzm/rails,starknx/rails,aditya-kapoor/rails,gfvcastro/rails,lucasmazza/rails,baerjam/rails,richseviora/rails,bogdanvlviv/rails,shioyama/rails,Edouard-chin/rails,yhirano55/rails,yawboakye/rails,ttanimichi/rails,flanger001/rails,illacceptanything/illacceptanything,flanger001/rails,gavingmiller/rails,yalab/rails,baerjam/rails,eileencodes/rails,jeremy/rails,repinel/rails,tgxworld/rails,gcourtemanche/rails,tjschuck/rails,aditya-kapoor/rails,sergey-alekseev/rails,kamipo/rails,yalab/rails,MichaelSp/rails,coreyward/rails,BlakeWilliams/rails,kachick/rails,mtsmfm/rails,Envek/rails,flanger001/rails,tjschuck/rails,deraru/rails,sealocal/rails,mijoharas/rails,elfassy/rails,illacceptanything/illacceptanything,deraru/rails,arunagw/rails,iainbeeston/rails,fabianoleittes/rails,vassilevsky/rails,felipecvo/rails,palkan/rails,matrinox/rails,deraru/rails,brchristian/rails,gauravtiwari/rails,travisofthenorth/rails,repinel/rails,yasslab/railsguides.jp,notapatch/rails,tjschuck/rails,voray/rails,rafaelfranca/omg-rails,yahonda/rails,yasslab/railsguides.jp,riseshia/railsguides.kr,palkan/rails,Stellenticket/rails,Vasfed/rails,MSP-Greg/rails,gfvcastro/rails,riseshia/railsguides.kr,pschambacher/rails,ledestin/rails,Vasfed/rails,repinel/rails,sealocal/rails,baerjam/rails,samphilipd/rails,iainbeeston/rails,yahonda/rails,flanger001/rails,pvalena/rails,Envek/rails,bradleypriest/rails,rbhitchcock/rails,illacceptanything/illacceptanything,rushingfitness/actioncable,rails/rails,esparta/rails,illacceptanything/illacceptanything,georgeclaghorn/rails,georgeclaghorn/rails,yahonda/rails,sealocal/rails,lucasmazza/rails,utilum/rails,jeremy/rails,arunagw/rails,riseshia/railsguides.kr,deraru/rails,sergey-alekseev/rails |
8e452df49254e378f2473a9a0a2ebf77b63e451b | src/object-selection.coffee | src/object-selection.coffee | {Emitter, CompositeDisposable} = require 'event-kit'
# The display for a selected object. i.e. the red or blue outline around the
# selected object.
#
# It basically cops the underlying object's attributes (path definition, etc.)
module.exports =
class ObjectSelection
constructor: (@svgDocument, @options={}) ->
@emitter = new Emitter
@options.class ?= 'object-selection'
on: (args...) -> @emitter.on(args...)
setObject: (object) ->
@_unbindObject()
old = object
@object = object
@_bindObject(@object)
@trackingObject.remove() if @trackingObject
@trackingObject = null
if @object
@trackingObject = @object.cloneElement(@svgDocument)
@trackingObject.node.setAttribute('class', @options.class + ' invisible-to-hit-test')
@svgDocument.getToolLayer().add(@trackingObject)
@trackingObject.back()
@render()
@emitter.emit 'change:object', {objectSelection: this, @object, old}
render: =>
@object.render(@trackingObject)
_bindObject: (object) ->
return unless object
@selectedObjectSubscriptions = new CompositeDisposable
@selectedObjectSubscriptions.add object.on('change', @render)
_unbindObject: ->
@selectedObjectSubscriptions?.dispose()
@selectedObjectSubscriptions = null
| {CompositeDisposable} = require 'event-kit'
# The display for a selected object. i.e. the red or blue outline around the
# selected object.
#
# It basically cops the underlying object's attributes (path definition, etc.)
module.exports =
class ObjectSelection
constructor: (@svgDocument, @options={}) ->
@options.class ?= 'object-selection'
setObject: (object) ->
return if object is @object
@_unbindObject()
@object = object
@_bindObject(@object)
@trackingObject.remove() if @trackingObject
@trackingObject = null
if @object
@trackingObject = @object.cloneElement(@svgDocument)
@trackingObject.node.setAttribute('class', @options.class + ' invisible-to-hit-test')
@svgDocument.getToolLayer().add(@trackingObject)
@trackingObject.back()
@render()
return
render: =>
@object.render(@trackingObject)
_bindObject: (object) ->
return unless object
@selectedObjectSubscriptions = new CompositeDisposable
@selectedObjectSubscriptions.add object.on('change', @render)
_unbindObject: ->
@selectedObjectSubscriptions?.dispose()
@selectedObjectSubscriptions = null
| Remove event junk from the obj selection | Remove event junk from the obj selection | CoffeeScript | mit | benogle/curve,benogle/curve |
c45241807ee6998dc5e02d85023f31f518b4b8d0 | components/logged_in_navigation/components/channel_create/view.coffee | components/logged_in_navigation/components/channel_create/view.coffee | Promise = require 'bluebird-q'
Backbone = require 'backbone'
template = -> require('./index.jade') arguments...
module.exports = class ChannelCreateView extends Backbone.View
events:
'mouseover': 'focus'
'input .js-title': 'title'
'click .js-status': 'status'
'click .js-create': 'create'
initialize: ({ @user }) ->
@listenTo @model, 'change', @render
focus: ->
@dom.title.focus()
title: ->
@model.set 'title', @dom.title.val(), silent: true
status: (e) ->
e.preventDefault()
status = $(e.currentTarget).data 'value'
@model.set 'status', status
create: (e) ->
e.preventDefault()
return unless @model.has('title')
@dom.create.text 'Creating...'
Promise(@model.save())
.then =>
@dom.create.text 'Redirecting...'
window.location.href = "/#{@model.get('user').slug}/#{@model.get('slug')}"
.catch =>
@dom.create.text 'Error'
render: ->
@$el.html template
user: @user
channel: @model
@dom =
title: @$('.js-title')
create: @$('.js-create')
@focus()
this
| Promise = require 'bluebird-q'
Backbone = require 'backbone'
template = -> require('./index.jade') arguments...
module.exports = class ChannelCreateView extends Backbone.View
events:
'mouseover': 'focus'
'keyup .js-title': 'onKeyup'
'input .js-title': 'title'
'click .js-status': 'status'
'click .js-create': 'create'
initialize: ({ @user }) ->
@listenTo @model, 'change', @render
onKeyup: (e) ->
return unless e.keyCode is 13
@create e
focus: ->
@dom.title.focus()
title: ->
@model.set 'title', @dom.title.val(), silent: true
status: (e) ->
e.preventDefault()
status = $(e.currentTarget).data 'value'
@model.set 'status', status
create: (e) ->
e.preventDefault()
return unless @model.has('title')
@dom.create.text 'Creating...'
Promise(@model.save())
.then =>
@dom.create.text 'Redirecting...'
window.location.href = "/#{@model.get('user').slug}/#{@model.get('slug')}"
.catch =>
@dom.create.text 'Error'
render: ->
@$el.html template
user: @user
channel: @model
@dom =
title: @$('.js-title')
create: @$('.js-create')
@focus()
this
| Handle <enter> for creating channels | Handle <enter> for creating channels
| CoffeeScript | mit | aredotna/ervell,aredotna/ervell,aredotna/ervell,aredotna/ervell,aredotna/ervell |
187e30016799e6d4ea01a12c01d6fbfe59baae57 | src/window-bootstrap.coffee | src/window-bootstrap.coffee | # Like sands through the hourglass, so are the days of our lives.
startTime = Date.now()
require './window'
Atom = require './atom'
window.atom = Atom.loadOrCreate('editor')
atom.initialize()
atom.startEditorWindow()
window.atom.loadTime = Date.now() - startTime
console.log "Window load time: #{atom.getWindowLoadTime()}ms"
| # Like sands through the hourglass, so are the days of our lives.
startTime = Date.now()
require './window'
Atom = require './atom'
window.atom = Atom.loadOrCreate('editor')
atom.initialize()
atom.startEditorWindow()
window.atom.loadTime = Date.now() - startTime
console.log "Window load time: #{atom.getWindowLoadTime()}ms"
# Workaround for focus getting cleared upon window creation
windowFocused = (e) ->
window.removeEventListener('focus', windowFocused)
setTimeout (-> document.querySelector('.workspace').focus()), 0
window.addEventListener('focus', windowFocused)
| Apply workaround for clearing of focus upon loading of window | Apply workaround for clearing of focus upon loading of window
After the first window focus event, the focus is getting cleared back
to document.body regardless of the prior active element. Refocusing
workspace on a delay after the first window focus event works around
the problem. | CoffeeScript | mit | Rodjana/atom,helber/atom,qskycolor/atom,lpommers/atom,kdheepak89/atom,matthewclendening/atom,ivoadf/atom,ykeisuke/atom,CraZySacX/atom,devmario/atom,rlugojr/atom,chengky/atom,champagnez/atom,andrewleverette/atom,originye/atom,folpindo/atom,dannyflax/atom,acontreras89/atom,sekcheong/atom,chengky/atom,Rychard/atom,russlescai/atom,charleswhchan/atom,MjAbuz/atom,mostafaeweda/atom,wiggzz/atom,ilovezy/atom,Ju2ender/atom,prembasumatary/atom,liuderchi/atom,lovesnow/atom,basarat/atom,KENJU/atom,fedorov/atom,codex8/atom,dkfiresky/atom,liuxiong332/atom,daxlab/atom,kdheepak89/atom,ardeshirj/atom,ilovezy/atom,decaffeinate-examples/atom,Abdillah/atom,NunoEdgarGub1/atom,Galactix/atom,tanin47/atom,daxlab/atom,liuxiong332/atom,fang-yufeng/atom,mnquintana/atom,avdg/atom,devmario/atom,Jdesk/atom,jjz/atom,amine7536/atom,oggy/atom,jjz/atom,kdheepak89/atom,sebmck/atom,Huaraz2/atom,ardeshirj/atom,gontadu/atom,bencolon/atom,jacekkopecky/atom,pombredanne/atom,helber/atom,AlbertoBarrago/atom,pengshp/atom,john-kelly/atom,florianb/atom,Austen-G/BlockBuilder,synaptek/atom,scv119/atom,atom/atom,hakatashi/atom,palita01/atom,sekcheong/atom,Mokolea/atom,Jdesk/atom,crazyquark/atom,decaffeinate-examples/atom,transcranial/atom,AlexxNica/atom,n-riesco/atom,yomybaby/atom,hagb4rd/atom,woss/atom,MjAbuz/atom,ReddTea/atom,Ju2ender/atom,FIT-CSE2410-A-Bombs/atom,einarmagnus/atom,niklabh/atom,chengky/atom,boomwaiza/atom,sotayamashita/atom,devmario/atom,rlugojr/atom,SlimeQ/atom,phord/atom,xream/atom,jjz/atom,rxkit/atom,t9md/atom,prembasumatary/atom,yamhon/atom,Locke23rus/atom,sekcheong/atom,hagb4rd/atom,nvoron23/atom,sxgao3001/atom,kjav/atom,liuderchi/atom,kandros/atom,jlord/atom,scv119/atom,gabrielPeart/atom,kittens/atom,matthewclendening/atom,omarhuanca/atom,alexandergmann/atom,yalexx/atom,yomybaby/atom,Rodjana/atom,Arcanemagus/atom,KENJU/atom,fscherwi/atom,Ingramz/atom,russlescai/atom,Hasimir/atom,oggy/atom,daxlab/atom,synaptek/atom,Jonekee/atom,Andrey-Pavlov/atom,liuxiong332/atom,ppamorim/atom,bcoe/atom,Andrey-Pavlov/atom,dannyflax/atom,splodingsocks/atom,kandros/atom,jeremyramin/atom,scippio/atom,BogusCurry/atom,fredericksilva/atom,basarat/atom,nrodriguez13/atom,ashneo76/atom,Klozz/atom,atom/atom,targeter21/atom,einarmagnus/atom,Sangaroonaom/atom,Jandersolutions/atom,isghe/atom,rmartin/atom,stinsonga/atom,brettle/atom,basarat/atom,nucked/atom,omarhuanca/atom,Jdesk/atom,kjav/atom,nrodriguez13/atom,ironbox360/atom,acontreras89/atom,ReddTea/atom,constanzaurzua/atom,stuartquin/atom,mostafaeweda/atom,vcarrera/atom,bj7/atom,BogusCurry/atom,hharchani/atom,amine7536/atom,acontreras89/atom,qiujuer/atom,pombredanne/atom,AlisaKiatkongkumthon/atom,efatsi/atom,deepfox/atom,ppamorim/atom,jlord/atom,RuiDGoncalves/atom,Rodjana/atom,dannyflax/atom,crazyquark/atom,gzzhanghao/atom,MjAbuz/atom,hharchani/atom,001szymon/atom,pkdevbox/atom,CraZySacX/atom,fedorov/atom,Galactix/atom,Jandersolutions/atom,ObviouslyGreen/atom,rjattrill/atom,mertkahyaoglu/atom,pkdevbox/atom,mnquintana/atom,mostafaeweda/atom,scippio/atom,yangchenghu/atom,johnrizzo1/atom,n-riesco/atom,lpommers/atom,ppamorim/atom,liuderchi/atom,me-benni/atom,Sangaroonaom/atom,tony612/atom,0x73/atom,NunoEdgarGub1/atom,bsmr-x-script/atom,kc8wxm/atom,Huaraz2/atom,brettle/atom,stinsonga/atom,qiujuer/atom,deoxilix/atom,vcarrera/atom,yangchenghu/atom,Ju2ender/atom,KENJU/atom,g2p/atom,sekcheong/atom,stinsonga/atom,charleswhchan/atom,niklabh/atom,yalexx/atom,jlord/atom,SlimeQ/atom,fscherwi/atom,kaicataldo/atom,hagb4rd/atom,Shekharrajak/atom,splodingsocks/atom,hharchani/atom,svanharmelen/atom,qskycolor/atom,florianb/atom,FoldingText/atom,lisonma/atom,gisenberg/atom,0x73/atom,yalexx/atom,burodepeper/atom,kdheepak89/atom,decaffeinate-examples/atom,ppamorim/atom,Austen-G/BlockBuilder,omarhuanca/atom,MjAbuz/atom,avdg/atom,Jandersoft/atom,bolinfest/atom,ivoadf/atom,rmartin/atom,Galactix/atom,Austen-G/BlockBuilder,toqz/atom,bsmr-x-script/atom,panuchart/atom,AlexxNica/atom,mdumrauf/atom,pombredanne/atom,paulcbetts/atom,Abdillah/atom,abcP9110/atom,originye/atom,brumm/atom,ironbox360/atom,matthewclendening/atom,YunchengLiao/atom,dkfiresky/atom,florianb/atom,BogusCurry/atom,crazyquark/atom,yalexx/atom,GHackAnonymous/atom,constanzaurzua/atom,Jandersolutions/atom,ashneo76/atom,t9md/atom,GHackAnonymous/atom,dsandstrom/atom,alexandergmann/atom,jtrose2/atom,Abdillah/atom,Locke23rus/atom,jtrose2/atom,kjav/atom,rjattrill/atom,Shekharrajak/atom,rsvip/aTom,FoldingText/atom,seedtigo/atom,YunchengLiao/atom,gisenberg/atom,gontadu/atom,Hasimir/atom,githubteacher/atom,qiujuer/atom,kittens/atom,sotayamashita/atom,ezeoleaf/atom,targeter21/atom,ralphtheninja/atom,russlescai/atom,atom/atom,nucked/atom,bryonwinger/atom,pombredanne/atom,PKRoma/atom,Andrey-Pavlov/atom,ilovezy/atom,dkfiresky/atom,synaptek/atom,ali/atom,g2p/atom,yomybaby/atom,nvoron23/atom,SlimeQ/atom,folpindo/atom,rjattrill/atom,johnhaley81/atom,Jandersoft/atom,synaptek/atom,deepfox/atom,sxgao3001/atom,CraZySacX/atom,palita01/atom,kandros/atom,NunoEdgarGub1/atom,YunchengLiao/atom,isghe/atom,Mokolea/atom,hharchani/atom,AlisaKiatkongkumthon/atom,devmario/atom,yalexx/atom,paulcbetts/atom,jeremyramin/atom,Huaraz2/atom,KENJU/atom,jacekkopecky/atom,deepfox/atom,russlescai/atom,alfredxing/atom,prembasumatary/atom,Neron-X5/atom,Mokolea/atom,einarmagnus/atom,johnhaley81/atom,RuiDGoncalves/atom,bcoe/atom,hpham04/atom,anuwat121/atom,lovesnow/atom,avdg/atom,Shekharrajak/atom,charleswhchan/atom,wiggzz/atom,FoldingText/atom,anuwat121/atom,n-riesco/atom,kdheepak89/atom,liuderchi/atom,mostafaeweda/atom,ali/atom,nrodriguez13/atom,SlimeQ/atom,fang-yufeng/atom,rjattrill/atom,jordanbtucker/atom,vcarrera/atom,prembasumatary/atom,charleswhchan/atom,stuartquin/atom,Jandersolutions/atom,jordanbtucker/atom,johnrizzo1/atom,PKRoma/atom,stinsonga/atom,svanharmelen/atom,tisu2tisu/atom,AlbertoBarrago/atom,fredericksilva/atom,burodepeper/atom,medovob/atom,targeter21/atom,hakatashi/atom,h0dgep0dge/atom,me6iaton/atom,targeter21/atom,toqz/atom,nvoron23/atom,abcP9110/atom,hakatashi/atom,dijs/atom,qskycolor/atom,dijs/atom,prembasumatary/atom,gzzhanghao/atom,codex8/atom,efatsi/atom,sotayamashita/atom,charleswhchan/atom,yangchenghu/atom,bsmr-x-script/atom,cyzn/atom,kjav/atom,bencolon/atom,hellendag/atom,RobinTec/atom,panuchart/atom,acontreras89/atom,jtrose2/atom,chengky/atom,transcranial/atom,vjeux/atom,sebmck/atom,tjkr/atom,chfritz/atom,mnquintana/atom,john-kelly/atom,Klozz/atom,basarat/atom,Jandersoft/atom,tisu2tisu/atom,dijs/atom,vjeux/atom,tjkr/atom,fscherwi/atom,harshdattani/atom,rookie125/atom,RobinTec/atom,jtrose2/atom,Neron-X5/atom,constanzaurzua/atom,bencolon/atom,ykeisuke/atom,efatsi/atom,john-kelly/atom,yamhon/atom,tony612/atom,chengky/atom,ralphtheninja/atom,DiogoXRP/atom,jtrose2/atom,gzzhanghao/atom,seedtigo/atom,tony612/atom,alfredxing/atom,paulcbetts/atom,qskycolor/atom,florianb/atom,codex8/atom,andrewleverette/atom,mostafaeweda/atom,boomwaiza/atom,sillvan/atom,bj7/atom,hpham04/atom,batjko/atom,champagnez/atom,mnquintana/atom,DiogoXRP/atom,devoncarew/atom,PKRoma/atom,woss/atom,omarhuanca/atom,G-Baby/atom,tmunro/atom,me6iaton/atom,kevinrenaers/atom,fredericksilva/atom,decaffeinate-examples/atom,lisonma/atom,devmario/atom,brumm/atom,rsvip/aTom,alfredxing/atom,davideg/atom,isghe/atom,jacekkopecky/atom,burodepeper/atom,mrodalgaard/atom,batjko/atom,tanin47/atom,devoncarew/atom,scv119/atom,vinodpanicker/atom,vjeux/atom,YunchengLiao/atom,fredericksilva/atom,hpham04/atom,sillvan/atom,SlimeQ/atom,ali/atom,abcP9110/atom,KENJU/atom,rmartin/atom,bj7/atom,qiujuer/atom,pkdevbox/atom,einarmagnus/atom,seedtigo/atom,githubteacher/atom,Jdesk/atom,GHackAnonymous/atom,davideg/atom,vinodpanicker/atom,targeter21/atom,lisonma/atom,RobinTec/atom,toqz/atom,Neron-X5/atom,Austen-G/BlockBuilder,scv119/atom,beni55/atom,crazyquark/atom,einarmagnus/atom,toqz/atom,ilovezy/atom,dsandstrom/atom,bcoe/atom,ObviouslyGreen/atom,basarat/atom,Hasimir/atom,jlord/atom,darwin/atom,vhutheesing/atom,Dennis1978/atom,jlord/atom,fang-yufeng/atom,Jonekee/atom,Jdesk/atom,Ingramz/atom,brumm/atom,elkingtonmcb/atom,AdrianVovk/substance-ide,dannyflax/atom,medovob/atom,dkfiresky/atom,elkingtonmcb/atom,paulcbetts/atom,hpham04/atom,nvoron23/atom,woss/atom,001szymon/atom,Rychard/atom,fang-yufeng/atom,bcoe/atom,Ingramz/atom,AlexxNica/atom,jacekkopecky/atom,githubteacher/atom,lpommers/atom,YunchengLiao/atom,sxgao3001/atom,vinodpanicker/atom,ReddTea/atom,h0dgep0dge/atom,Locke23rus/atom,devoncarew/atom,devoncarew/atom,Jandersoft/atom,wiggzz/atom,ralphtheninja/atom,kc8wxm/atom,Jonekee/atom,tmunro/atom,liuxiong332/atom,bolinfest/atom,g2p/atom,johnhaley81/atom,vjeux/atom,ali/atom,matthewclendening/atom,MjAbuz/atom,xream/atom,sillvan/atom,kevinrenaers/atom,h0dgep0dge/atom,Jandersolutions/atom,nucked/atom,woss/atom,AlisaKiatkongkumthon/atom,jjz/atom,yomybaby/atom,Jandersoft/atom,amine7536/atom,Galactix/atom,rsvip/aTom,sxgao3001/atom,rookie125/atom,codex8/atom,Sangaroonaom/atom,sebmck/atom,rsvip/aTom,champagnez/atom,gontadu/atom,chfritz/atom,hpham04/atom,kaicataldo/atom,FoldingText/atom,alexandergmann/atom,yamhon/atom,phord/atom,dannyflax/atom,vinodpanicker/atom,vcarrera/atom,rmartin/atom,devoncarew/atom,batjko/atom,deepfox/atom,n-riesco/atom,hellendag/atom,abcP9110/atom,Austen-G/BlockBuilder,beni55/atom,sebmck/atom,harshdattani/atom,bcoe/atom,panuchart/atom,me6iaton/atom,cyzn/atom,Klozz/atom,isghe/atom,dsandstrom/atom,beni55/atom,me6iaton/atom,stuartquin/atom,davideg/atom,tony612/atom,kaicataldo/atom,jjz/atom,t9md/atom,ironbox360/atom,batjko/atom,rxkit/atom,Neron-X5/atom,sillvan/atom,dannyflax/atom,lovesnow/atom,Shekharrajak/atom,folpindo/atom,hagb4rd/atom,isghe/atom,fedorov/atom,ReddTea/atom,basarat/atom,bryonwinger/atom,anuwat121/atom,ezeoleaf/atom,n-riesco/atom,mdumrauf/atom,andrewleverette/atom,cyzn/atom,ali/atom,tony612/atom,AdrianVovk/substance-ide,rxkit/atom,qiujuer/atom,woss/atom,palita01/atom,abcP9110/atom,amine7536/atom,davideg/atom,kc8wxm/atom,h0dgep0dge/atom,medovob/atom,rookie125/atom,hellendag/atom,Rychard/atom,Galactix/atom,Arcanemagus/atom,Andrey-Pavlov/atom,kittens/atom,Abdillah/atom,lisonma/atom,darwin/atom,helber/atom,jacekkopecky/atom,mertkahyaoglu/atom,transcranial/atom,gabrielPeart/atom,oggy/atom,mertkahyaoglu/atom,jacekkopecky/atom,Ju2ender/atom,ivoadf/atom,pengshp/atom,batjko/atom,mertkahyaoglu/atom,Austen-G/BlockBuilder,me6iaton/atom,qskycolor/atom,ppamorim/atom,xream/atom,johnrizzo1/atom,ezeoleaf/atom,liuxiong332/atom,phord/atom,deoxilix/atom,toqz/atom,kittens/atom,GHackAnonymous/atom,sekcheong/atom,originye/atom,bolinfest/atom,russlescai/atom,pengshp/atom,fedorov/atom,gisenberg/atom,boomwaiza/atom,DiogoXRP/atom,ilovezy/atom,mrodalgaard/atom,sxgao3001/atom,kc8wxm/atom,mnquintana/atom,Hasimir/atom,RuiDGoncalves/atom,tjkr/atom,AlbertoBarrago/atom,0x73/atom,0x73/atom,FoldingText/atom,dsandstrom/atom,svanharmelen/atom,acontreras89/atom,darwin/atom,ezeoleaf/atom,Shekharrajak/atom,vcarrera/atom,RobinTec/atom,vhutheesing/atom,davideg/atom,lisonma/atom,splodingsocks/atom,NunoEdgarGub1/atom,Ju2ender/atom,jordanbtucker/atom,pombredanne/atom,gabrielPeart/atom,dsandstrom/atom,kittens/atom,hharchani/atom,elkingtonmcb/atom,ardeshirj/atom,tmunro/atom,Arcanemagus/atom,kevinrenaers/atom,synaptek/atom,gisenberg/atom,GHackAnonymous/atom,hagb4rd/atom,G-Baby/atom,jeremyramin/atom,RobinTec/atom,NunoEdgarGub1/atom,vinodpanicker/atom,harshdattani/atom,Hasimir/atom,oggy/atom,oggy/atom,ashneo76/atom,FIT-CSE2410-A-Bombs/atom,deoxilix/atom,ObviouslyGreen/atom,lovesnow/atom,niklabh/atom,ykeisuke/atom,G-Baby/atom,vjeux/atom,bryonwinger/atom,ReddTea/atom,bryonwinger/atom,vhutheesing/atom,florianb/atom,Dennis1978/atom,chfritz/atom,rlugojr/atom,tanin47/atom,crazyquark/atom,tisu2tisu/atom,AdrianVovk/substance-ide,nvoron23/atom,john-kelly/atom,splodingsocks/atom,fredericksilva/atom,constanzaurzua/atom,sebmck/atom,amine7536/atom,constanzaurzua/atom,john-kelly/atom,rmartin/atom,dkfiresky/atom,mrodalgaard/atom,FoldingText/atom,Neron-X5/atom,gisenberg/atom,omarhuanca/atom,yomybaby/atom,kjav/atom,Andrey-Pavlov/atom,deepfox/atom,lovesnow/atom,hakatashi/atom,mdumrauf/atom,rsvip/aTom,sillvan/atom,001szymon/atom,FIT-CSE2410-A-Bombs/atom,Dennis1978/atom,scippio/atom,mertkahyaoglu/atom,Abdillah/atom,fang-yufeng/atom,matthewclendening/atom,kc8wxm/atom,me-benni/atom,brettle/atom,codex8/atom,fedorov/atom,me-benni/atom |
e034afbfa918e0c6f1e74132d6c25efac339d466 | client/Main/navigation/navigationlist.coffee | client/Main/navigation/navigationlist.coffee | class NavigationList extends KDListView
constructor:->
super
@viewWidth = 70
@on 'ItemWasAdded', (view)=>
view.once 'viewAppended', =>
view._index ?= @getItemIndex view
view.setX view._index * @viewWidth
@_width = @viewWidth * @items.length
lastChange = 0
view.on 'DragInAction', (x, y)=>
return if x + view._x > @_width or x + view._x < 0
if x > @viewWidth
current = Math.floor x / @viewWidth
else if x < -@viewWidth
current = Math.ceil x / @viewWidth
else
current = 0
if current > lastChange
@moveItemsTemporarily view, 1
lastChange = current
else if current < lastChange
@moveItemsTemporarily view, -1
lastChange = current
view.on 'DragFinished', =>
view.setX view._index * @viewWidth
@moveItemToIndex view, view._index
item._index = i for item, i in @items
lastChange = 0
moveItemsTemporarily:(view, step)->
newIndex = Math.max(0, Math.min(view._index + step, @items.length-1))
return if newIndex is view._index
for item, index in @items
if item._index is newIndex
item.setX item.getRelativeX() - (step * @viewWidth)
item._index = view._index
view._index = newIndex
break
| class NavigationList extends KDListView
constructor:->
super
@viewWidth = 70
@on 'ItemWasAdded', (view)=>
view.once 'viewAppended', =>
view._index ?= @getItemIndex view
view.setX view._index * @viewWidth
@_width = @viewWidth * @items.length
lastChange = 0
view.on 'DragInAction', (x, y)=>
return if x + view._x > @_width or x + view._x < 0
if x > @viewWidth
current = Math.floor x / @viewWidth
else if x < -@viewWidth
current = Math.ceil x / @viewWidth
else
current = 0
if current > lastChange
@moveItemToIndex view, view._index+1
lastChange = current
else if current < lastChange
@moveItemToIndex view, view._index-1
lastChange = current
view.on 'DragFinished', =>
view.setX view._index * @viewWidth
view.setY view._y
lastChange = 0
moveItemToIndex:(item, index)->
super item, index
for _item, index in @items
_item._index = index
_item.setX index * @viewWidth unless item is _item
| Fix DND, simple is better | NavigationList: Fix DND, simple is better
| CoffeeScript | agpl-3.0 | usirin/koding,sinan/koding,kwagdy/koding-1,koding/koding,mertaytore/koding,szkl/koding,rjeczalik/koding,acbodine/koding,jack89129/koding,szkl/koding,gokmen/koding,acbodine/koding,usirin/koding,mertaytore/koding,andrewjcasal/koding,rjeczalik/koding,mertaytore/koding,acbodine/koding,alex-ionochkin/koding,gokmen/koding,koding/koding,rjeczalik/koding,rjeczalik/koding,sinan/koding,szkl/koding,acbodine/koding,sinan/koding,kwagdy/koding-1,andrewjcasal/koding,rjeczalik/koding,alex-ionochkin/koding,jack89129/koding,koding/koding,mertaytore/koding,szkl/koding,jack89129/koding,gokmen/koding,kwagdy/koding-1,koding/koding,drewsetski/koding,gokmen/koding,sinan/koding,koding/koding,cihangir/koding,usirin/koding,andrewjcasal/koding,jack89129/koding,cihangir/koding,rjeczalik/koding,andrewjcasal/koding,kwagdy/koding-1,usirin/koding,jack89129/koding,mertaytore/koding,drewsetski/koding,sinan/koding,drewsetski/koding,drewsetski/koding,jack89129/koding,alex-ionochkin/koding,sinan/koding,acbodine/koding,drewsetski/koding,gokmen/koding,alex-ionochkin/koding,gokmen/koding,kwagdy/koding-1,usirin/koding,drewsetski/koding,andrewjcasal/koding,cihangir/koding,mertaytore/koding,alex-ionochkin/koding,kwagdy/koding-1,rjeczalik/koding,szkl/koding,andrewjcasal/koding,kwagdy/koding-1,usirin/koding,cihangir/koding,acbodine/koding,gokmen/koding,alex-ionochkin/koding,sinan/koding,alex-ionochkin/koding,jack89129/koding,andrewjcasal/koding,mertaytore/koding,szkl/koding,szkl/koding,andrewjcasal/koding,szkl/koding,rjeczalik/koding,usirin/koding,cihangir/koding,kwagdy/koding-1,mertaytore/koding,gokmen/koding,jack89129/koding,cihangir/koding,alex-ionochkin/koding,drewsetski/koding,acbodine/koding,koding/koding,cihangir/koding,usirin/koding,cihangir/koding,acbodine/koding,koding/koding,koding/koding,sinan/koding,drewsetski/koding |
2e42700217497d65d07ececd1413a9dc0bd05545 | app/assets/javascripts/priority.js.coffee | app/assets/javascripts/priority.js.coffee | #= require lazysizes/plugins/rias/ls.rias
#= require lazysizes/plugins/bgset/ls.bgset
#= require lazysizes/plugins/unload/ls.unload
#= require lazysizes
| #= require lazysizes/plugins/rias/ls.rias
#= require lazysizes/plugins/bgset/ls.bgset
#= require lazysizes/plugins/respimg/ls.respimg
# require lazysizes/plugins/custommedia/ls.custommedia
#= require lazysizes | Revert "remove respimg plugin and add unload plugin" | Revert "remove respimg plugin and add unload plugin"
This reverts commit f3fd6164a86c2ac25ee4156ee0adb232403d1856.
| CoffeeScript | mit | JRF-tw/sunshine.jrf.org.tw,JRF-tw/sunshine.jrf.org.tw,JRF-tw/sunshine.jrf.org.tw |
3b9855d641baf9bb88949b709c8be614cfa6a603 | client/view/agenda.coffee | client/view/agenda.coffee | mid = new Date('02/25/14 00:00:00')
Template.agenda.day1 = ->
@items.filter((i) -> i.time < mid).sort((a, b) -> a.time >= b.time)
Template.agenda.day2 = ->
@items.filter((i) -> i.time > mid).sort((a, b) -> a.time >= b.time)
Template.agenda.canSee = ->
u = User.current()
u and (u.admin() or u.moderator())
Template.agenda.canEdit = ->
u = User.current()
u and u.admin()
Template.agenda.events
'submit #add-form': (event, context) ->
event.preventDefault()
time = context.find('#time').value
class1 = context.find('#class1').value
icon1 = context.find('#icon1').value
class2 = context.find('#class2').value
icon2 = context.find('#icon2').value
class3 = context.find('#class3').value
icon3 = context.find('#icon3').value
if not time then return
time = new Date(time)
if not time
console.error('bad time string')
return
AgendaItem.create
time: time
class1: class1
class2: class2
class3: class3
icon1: icon1
icon2: icon2
icon3: icon3
'click #edit': ->
Session.set('editingAgenda', not Session.get('editingAgenda')) | mid = new Date('02/25/14 00:00:00')
Template.agenda.day1 = ->
@items.filter((i) -> i.time < mid).sort((a, b) -> a.time > b.time)
Template.agenda.day2 = ->
@items.filter((i) -> i.time > mid).sort((a, b) -> a.time > b.time)
Template.agenda.canSee = ->
u = User.current()
u and (u.admin() or u.moderator())
Template.agenda.canEdit = ->
u = User.current()
u and u.admin()
Template.agenda.events
'submit #add-form': (event, context) ->
event.preventDefault()
time = context.find('#time').value
class1 = context.find('#class1').value
icon1 = context.find('#icon1').value
class2 = context.find('#class2').value
icon2 = context.find('#icon2').value
class3 = context.find('#class3').value
icon3 = context.find('#icon3').value
if not time then return
time = new Date(time)
if not time
console.error('bad time string')
return
AgendaItem.create
time: time
class1: class1
class2: class2
class3: class3
icon1: icon1
icon2: icon2
icon3: icon3
'click #edit': ->
Session.set('editingAgenda', not Session.get('editingAgenda')) | Change sort to use > and not >= | Change sort to use > and not >=
| CoffeeScript | apache-2.0 | rantav/reversim-summit-2015,rantav/reversim-summit-2014,rantav/reversim-summit-2015,rantav/reversim-summit-2015,rantav/reversim-summit-2014 |
650db222af7ff496522ff4f27b9ac502c8399f1f | app/assets/javascripts/sprangular/services/orders.coffee | app/assets/javascripts/sprangular/services/orders.coffee | Sprangular.service "Orders", ($http) ->
service =
find: (number) ->
$http.get("/api/orders/#{number}")
.then (response) ->
order = new Sprangular.Order
order.load(response.data)
service
| Sprangular.service "Orders", ($http) ->
service =
find: (number) ->
$http.get("/api/orders/#{number}")
.then (response) ->
Sprangular.extend(response.data, Sprangular.Order)
service
| Refactor loading of order in Orders.find() | Refactor loading of order in Orders.find()
| CoffeeScript | mit | sprangular/sprangular,sprangular/sprangular,sprangular/sprangular |
8478c3bfed41dd43671c556b61edb98f8278e412 | src/biskoto.coffee | src/biskoto.coffee | define ->
class Biskoto
encode = encodeURIComponent
decode = decodeURIComponent
@get: (name) ->
if document.cookie
cookies = decode(document.cookie).split(/;\s/g)
for cookie in cookies
if cookie.indexOf(name) is 0
try
return JSON.parse(cookie.split('=')[1])
catch err
return cookie.split('=')[1]
return null
@set: (name, value, options = {}) ->
document.cookie = "#{name}=#{JSON.stringify(value)}#{@_cookieOptions(options)}"
@expire: (name, options = {}) ->
options.expires = -1
@set(name, '', options)
###
options = {
expires : Integer (seconds)
secure : Boolean
domain : String
path : String
}
###
@_cookieOptions: (options = {}) ->
cookie_str = ''
for key, value of options
if key is 'expires'
cookie_str += "; expires=#{@_createExpireDate(options.expires)}"
else if key is 'domain'
cookie_str += "; domain=#{value}"
cookie_str += "; path=#{if options.path then options.path else '/'}"
@_createExpireDate: (seconds) ->
new Date(
+new Date() + (seconds * 1000)
).toUTCString()
window.Biskoto = Biskoto
return Biskoto
| define ->
class Biskoto
encode = encodeURIComponent
decode = decodeURIComponent
@get: (name) ->
if document.cookie
cookies = document.cookie.split(/;\s/g)
for cookie in cookies
if cookie.indexOf(name) is 0
value = decode(cookie.split('=')[1])
try
return JSON.parse(value)
catch err
return value
return null
@set: (name, value, options = {}) ->
document.cookie = "#{name}=#{encode( JSON.stringify(value) )}#{@_cookieOptions(options)}"
@expire: (name, options = {}) ->
options.expires = -1
@set(name, '', options)
###
options = {
expires : Integer (seconds)
secure : Boolean
domain : String
path : String
}
###
@_cookieOptions: (options = {}) ->
cookie_str = ''
for key, value of options
if key is 'expires'
cookie_str += "; expires=#{@_createExpireDate(options.expires)}"
else if key is 'domain'
cookie_str += "; domain=#{value}"
cookie_str += "; path=#{if options.path then options.path else '/'}"
@_createExpireDate: (seconds) ->
new Date(
+new Date() + (seconds * 1000)
).toUTCString()
return Biskoto
| Fix Biskoto to be compatible with PhantomJS's escaping of cookies | Fix Biskoto to be compatible with PhantomJS's escaping of cookies
| CoffeeScript | mit | skroutz/analytics.js,skroutz/analytics.js,skroutz/analytics.js |
6e1969b4904a149d6cbe73fda4a5c1b9a9a22025 | components/ConvertStreetLight.coffee | components/ConvertStreetLight.coffee | noflo = require 'noflo'
class ConvertStreetLight extends noflo.Component
icon: 'filter'
description: 'Convert street light RGB values so we can send them to PWM'
constructor: ->
@inPorts = new noflo.InPorts
colors:
datatype: 'array'
description: 'Street light values'
@outPorts = new noflo.OutPorts
street1:
datatype: 'int'
addressable: true
street2:
datatype: 'int'
addressable: true
street3:
datatype: 'int'
addressable: true
street4:
datatype: 'int'
addressable: true
@inPorts.colors.on 'data', (data) =>
@convert data
convertLight: (light, colors) ->
for color, idx in colors
@outPorts.ports["street#{light}"].send color, idx
convert: (data) ->
return unless data.length is 4
for light, idx in data
@convertLight idx+1, light
exports.getComponent = -> new ConvertStreetLight
| noflo = require 'noflo'
class ConvertStreetLight extends noflo.Component
icon: 'filter'
description: 'Convert street light RGB values so we can send them to PWM'
constructor: ->
@inPorts = new noflo.InPorts
colors:
datatype: 'array'
description: 'Street light values'
@outPorts = new noflo.OutPorts
street1:
datatype: 'int'
addressable: true
street2:
datatype: 'int'
addressable: true
street3:
datatype: 'int'
addressable: true
street4:
datatype: 'int'
addressable: true
@inPorts.colors.on 'data', (data) =>
@convert data
convertLight: (light, colors) ->
for color, idx in colors
continue unless @outPorts.ports["street#{light}"].isAttached idx
@outPorts.ports["street#{light}"].send color, idx
convert: (data) ->
return unless data.length is 4
for light, idx in data
@convertLight idx+1, light
exports.getComponent = -> new ConvertStreetLight
| Allow street lights to be not connected | Allow street lights to be not connected
| CoffeeScript | mit | c-base/ingress-table,c-base/ingress-table,c-base/ingress-table,c-base/ingress-table |
98a4e0a9af131625209db641ffe3257362ed5f47 | atom/config.cson | atom/config.cson | "*":
core:
ignoredNames: [
".DS_Store"
".git"
"vendor"
]
disabledPackages: [
"center-line"
"branch-status"
"open-in-atom"
"terminal"
]
themes: [
"atom-dark-ui"
"solarized-dark-syntax"
]
destroyEmptyPanes: false
editor:
fontSize: 13
autoIndentOnPaste: false
scrollPastEnd: true
invisibles: {}
"spell-check":
grammars: [
"text.plain"
"source.gfm"
"text.git-commit"
]
welcome:
showOnStartup: false
"find-and-replace":
openProjectFindResultsInRightPane: true
"wrap-guide":
columns: [
{
pattern: "COMMIT_EDITMSG"
column: 72
}
]
autocomplete:
includeCompletionsFromAllBuffers: true
"merge-conflicts":
gitPath: "bin/git"
"one-light-ui":
layoutMode: "Compact"
"one-dark-ui":
layoutMode: "Compact"
| "*":
core:
ignoredNames: [
".DS_Store"
".git"
"vendor"
]
disabledPackages: [
"center-line"
"branch-status"
"open-in-atom"
"terminal"
]
themes: [
"atom-dark-ui"
"solarized-dark-syntax"
]
destroyEmptyPanes: false
editor:
fontSize: 13
autoIndentOnPaste: false
scrollPastEnd: true
invisibles: {}
"spell-check":
grammars: [
"text.plain"
"source.gfm"
"text.git-commit"
]
welcome:
showOnStartup: false
"find-and-replace":
openProjectFindResultsInRightPane: true
"wrap-guide":
columns: [
{
pattern: "COMMIT_EDITMSG"
column: 72
}
]
"merge-conflicts":
gitPath: "bin/git"
"one-light-ui":
layoutMode: "Compact"
"one-dark-ui":
layoutMode: "Compact"
| Remove setting for obsolete autocomplete package | Remove setting for obsolete autocomplete package
| CoffeeScript | mit | jasonrudolph/dotfiles,jasonrudolph/dotfiles,jasonrudolph/dotfiles,jasonrudolph/dotfiles |
8d9b5236ce968d1b1e04babadf89ed9a3400f345 | app/assets/javascripts/components/overview/inline_users.cjsx | app/assets/javascripts/components/overview/inline_users.cjsx | React = require 'react'
EnrollButton = require '../students/enroll_button'
InlineUsers = React.createClass(
displayName: 'InlineUsers'
render: ->
key = @props.title + '_' + @props.role
last_user_index = @props.users.length - 1
user_list = @props.users.map (user, index) ->
link = "https://en.wikipedia.org/wiki/User:#{user.wiki_id}"
if user.real_name?
extra_info = " (#{user.real_name}#{if user.email? then " / " + user.email else ""})"
else
extra_info = ''
extra_info = extra_info + ', ' unless index == last_user_index
<span key={user.wiki_id}><a href={link}>{user.wiki_id}</a>{extra_info}</span>
user_list = if user_list.length > 0 then user_list else 'None'
if @props.users.length > 0 || @props.editable
inline_list = <span>{@props.title}: {user_list}</span>
allowed = @props.role != 4 || (@props.current_user.role == 4 || @props.current_user.admin)
button = <EnrollButton {...@props} users={@props.users} role={@props.role} key={key} inline=true allowed={allowed} show={@props.editable && allowed} />
<p key={key}>{inline_list}{button}</p>
)
module.exports = InlineUsers
| React = require 'react'
EnrollButton = require '../students/enroll_button'
InlineUsers = React.createClass(
displayName: 'InlineUsers'
render: ->
key = @props.title + '_' + @props.role
last_user_index = @props.users.length - 1
user_list = @props.users.map (user, index) ->
link = "https://en.wikipedia.org/wiki/User:#{user.wiki_id}"
if user.real_name?
extra_info = " (#{user.real_name}#{if user.email? then " / " + user.email else ""})"
else
extra_info = ''
extra_info = extra_info + ', ' unless index == last_user_index
<span key={user.wiki_id}><a href={link}>{user.wiki_id}</a>{extra_info}</span>
user_list = if user_list.length > 0 then user_list else 'None'
if @props.users.length > 0 || @props.editable
inline_list = <span>{@props.title}: {user_list}</span>
allowed = @props.role != 4 || (@props.current_user.role == 4 || @props.current_user.admin)
button = <EnrollButton {...@props} users={@props.users} role={@props.role} key={key} inline=true allowed={allowed} show={@props.editable && allowed} />
<div key={key}>{inline_list}{button}</div>
)
module.exports = InlineUsers
| Fix warnings caused by invalid nesting of p elems | Fix warnings caused by invalid nesting of p elems
| CoffeeScript | mit | alpha721/WikiEduDashboard,Wowu/WikiEduDashboard,Wowu/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,alpha721/WikiEduDashboard,KarmaHater/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,majakomel/WikiEduDashboard,majakomel/WikiEduDashboard,sejalkhatri/WikiEduDashboard,MusikAnimal/WikiEduDashboard,alpha721/WikiEduDashboard,majakomel/WikiEduDashboard,sejalkhatri/WikiEduDashboard,Wowu/WikiEduDashboard,feelfreelinux/WikiEduDashboard,KarmaHater/WikiEduDashboard,alpha721/WikiEduDashboard,adamwight/WikiEduDashboard,KarmaHater/WikiEduDashboard,adamwight/WikiEduDashboard,MusikAnimal/WikiEduDashboard,MusikAnimal/WikiEduDashboard,majakomel/WikiEduDashboard,feelfreelinux/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,MusikAnimal/WikiEduDashboard,feelfreelinux/WikiEduDashboard,feelfreelinux/WikiEduDashboard,sejalkhatri/WikiEduDashboard,adamwight/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,KarmaHater/WikiEduDashboard,sejalkhatri/WikiEduDashboard,Wowu/WikiEduDashboard,sejalkhatri/WikiEduDashboard |
685505f7bca0ad35aaf71c6cc016733782f58915 | src/scripts/Syntho.coffee | src/scripts/Syntho.coffee | #
# Syntho - A Web based Synthesizer
# by Michael Marner <michael@20papercups.net>
#
audioContext = new (window.AudioContext || window.webkitAudioContext)();
vco1 = audioContext.createOscillator()
vco1.type = 'square'
vco1.frequency.value = 440
vco1.start()
gate = audioContext.createGain()
gate.gain.value = 0
vco1.connect(gate)
gate.connect(audioContext.destination)
kbd = new KeyboardInput
freqMap = new FrequencyMap
callback = (message, note) ->
if note >= 0
vco1.frequency.value = freqMap.getFrequency(note)
gate.gain.value = 1
else
gate.gain.value = 0
PubSub.subscribe('Keyboard', callback)
| #
# Syntho - A Web based Synthesizer
# by Michael Marner <michael@20papercups.net>
#
audioContext = new (window.AudioContext || window.webkitAudioContext)();
vco1 = audioContext.createOscillator()
vco1.type = 'square'
vco1.frequency.value = 440
vco1.start()
gate = audioContext.createGain()
gate.gain.value = 0
vco1.connect(gate)
gate.connect(audioContext.destination)
kbd = new KeyboardInput
freqMap = new FrequencyMap
callback = (message, note) ->
if note >= 0
vco1.frequency.setValueAtTime(freqMap.getFrequency(note), audioContext.currentTime)
gate.gain.value = 1
else
gate.gain.value = 0
PubSub.subscribe('Keyboard', callback)
| Fix portamento by using setValueAtTime instead of just changing the value. | Fix portamento by using setValueAtTime instead of just changing the value.
| CoffeeScript | mit | MichaelMarner/Syntho,MichaelMarner/Syntho |
d09e4eaa29375b0c4dd752e14d56675426e55b0b | scripts/configs/github.coffee | scripts/configs/github.coffee | define [], () ->
defaultRepo:
repoUser: 'oerpub'
repoName: 'textbook-demo'
branch: 'master'
| define [], () ->
defaultRepo:
repoUser: 'oerpub'
repoName: 'textbook-demo'
branch: ''
| Set the branch to '', that makes it use the default. | Set the branch to '', that makes it use the default.
It also means the repo in the url does not by default contain /branch/master.
| CoffeeScript | agpl-3.0 | oerpub/bookish,oerpub/bookish,oerpub/github-bookeditor,oerpub/github-bookeditor,oerpub/github-bookeditor |
c70af5615c0618fd25873ff2d3363247918aee6c | app/views/dialog.coffee | app/views/dialog.coffee | BaseView = require 'views/base_view'
class Dialog extends BaseView
className: 'dialog'
tag: 'div'
dialogTemplate: require './templates/dialog'
initialize: (options) ->
@parent = options.parent
close: =>
@remove()
confirm: (e) =>
unless e.type is 'keypress' and e.which isnt 13
@confirmCallback(e)
@close()
events:
'click span.window-close' : 'close'
'click button.close' : 'close'
'click button.confirm' : 'confirm'
'keypress' : 'confirm'
render: =>
@$el.html @dialogTemplate
title: @title
confirmation: @confirmation
@
content: (content) =>
@$('.dialog-content').html content
module.exports = Dialog
| BaseView = require 'views/base_view'
class Dialog extends BaseView
className: 'dialog'
tag: 'div'
dialogTemplate: require './templates/dialog'
initialize: (options) ->
@parent = options.parent
close: =>
@remove()
confirm: (e) =>
unless e.type is 'keypress' and e.which isnt 13
e.preventDefault()
@confirmCallback(e)
@close()
events:
'click span.window-close' : 'close'
'click button.close' : 'close'
'click button.confirm' : 'confirm'
'keypress' : 'confirm'
render: =>
@$el.html @dialogTemplate
title: @title
confirmation: @confirmation
@
content: (content) =>
@$('.dialog-content').html content
module.exports = Dialog
| Fix param posting in chrome | Fix param posting in chrome
| CoffeeScript | apache-2.0 | zooniverse/Ubret-Dashboard |
4112c3cc75ac3dc4565c8659cad23df4b2746db9 | app/assets/javascripts/darkswarm/darkswarm.js.coffee | app/assets/javascripts/darkswarm/darkswarm.js.coffee | window.Darkswarm = angular.module("Darkswarm", ["ngResource",
'mm.foundation',
'LocalStorageModule',
'infinite-scroll',
'angular-flash.service',
'templates',
'ngSanitize',
'ngAnimate',
'google-maps',
'duScroll',
'angularFileUpload',
'angularSlideables'
]).config ($httpProvider, $tooltipProvider, $locationProvider, $anchorScrollProvider) ->
$httpProvider.defaults.headers.post['X-CSRF-Token'] = $('meta[name="csrf-token"]').attr('content')
$httpProvider.defaults.headers.put['X-CSRF-Token'] = $('meta[name="csrf-token"]').attr('content')
$httpProvider.defaults.headers['common']['X-Requested-With'] = 'XMLHttpRequest'
$httpProvider.defaults.headers.common.Accept = "application/json, text/javascript, */*"
# This allows us to trigger these two events on tooltips
$tooltipProvider.setTriggers( 'openTrigger': 'closeTrigger' )
# We manually handle our scrolling
$anchorScrollProvider.disableAutoScrolling()
| window.Darkswarm = angular.module("Darkswarm", ["ngResource",
'mm.foundation',
'LocalStorageModule',
'infinite-scroll',
'angular-flash.service',
'templates',
'ngSanitize',
'ngAnimate',
'google-maps',
'duScroll',
'angularFileUpload',
'angularSlideables'
]).config ($httpProvider, $tooltipProvider, $locationProvider, $anchorScrollProvider) ->
$httpProvider.defaults.headers['common']['X-CSRF-Token'] = $('meta[name="csrf-token"]').attr('content')
$httpProvider.defaults.headers['common']['X-Requested-With'] = 'XMLHttpRequest'
$httpProvider.defaults.headers.common.Accept = "application/json, text/javascript, */*"
# This allows us to trigger these two events on tooltips
$tooltipProvider.setTriggers( 'openTrigger': 'closeTrigger' )
# We manually handle our scrolling
$anchorScrollProvider.disableAutoScrolling()
| Set auth token for all JS HTTP requests | Set auth token for all JS HTTP requests
| CoffeeScript | agpl-3.0 | oeoeaio/openfoodnetwork,Matt-Yorkley/openfoodnetwork,Matt-Yorkley/openfoodnetwork,openfoodfoundation/openfoodnetwork,openfoodfoundation/openfoodnetwork,KateDavis/openfoodnetwork,mkllnk/openfoodnetwork,openfoodfoundation/openfoodnetwork,mkllnk/openfoodnetwork,KateDavis/openfoodnetwork,oeoeaio/openfoodnetwork,Matt-Yorkley/openfoodnetwork,mkllnk/openfoodnetwork,Em-AK/openfoodnetwork,oeoeaio/openfoodnetwork,lin-d-hop/openfoodnetwork,KateDavis/openfoodnetwork,openfoodfoundation/openfoodnetwork,lin-d-hop/openfoodnetwork,Em-AK/openfoodnetwork,lin-d-hop/openfoodnetwork,Matt-Yorkley/openfoodnetwork,mkllnk/openfoodnetwork,KateDavis/openfoodnetwork,Em-AK/openfoodnetwork,Em-AK/openfoodnetwork,oeoeaio/openfoodnetwork,lin-d-hop/openfoodnetwork |
30bcd63564e2f6f7aa7c829678e9fc078646c31c | views/outer/about/_team.coffee | views/outer/about/_team.coffee | root = exports ? this
root.team =
paul:
name: "Paul Bigger"
role: "Founder"
photo: "paul.jpg"
github: "pbiggar"
email: "paul@circleci.com"
bio: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam at eros non dui sollicitudin mattis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aenean elementum mi tincidunt orci rhoncus tempus. Cras tincidunt feugiat purus a venenatis. Morbi sollicitudin turpis sapien, sed consequat justo. Sed semper sagittis ornare. Etiam et est tortor, at tristique sem. Maecenas a quam magna."
visible: true
| root = exports ? this
root.team =
paul:
name: "Paul Bigger"
role: "Founder"
github: "pbiggar"
email: "paul@circleci.com"
bio: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam at eros non dui sollicitudin mattis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aenean elementum mi tincidunt orci rhoncus tempus. Cras tincidunt feugiat purus a venenatis. Morbi sollicitudin turpis sapien, sed consequat justo. Sed semper sagittis ornare. Etiam et est tortor, at tristique sem. Maecenas a quam magna."
visible: true
allen:
name: "Allen Rohner"
role: "Founder"
github: "arohner"
email: "allen@circleci.com"
bio: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam at eros non dui sollicitudin mattis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aenean elementum mi tincidunt orci rhoncus tempus. Cras tincidunt feugiat purus a venenatis. Morbi sollicitudin turpis sapien, sed consequat justo. Sed semper sagittis ornare. Etiam et est tortor, at tristique sem. Maecenas a quam magna."
visible: true
| Add Allen's information to team | Add Allen's information to team
| CoffeeScript | epl-1.0 | circleci/frontend,circleci/frontend,RayRutjes/frontend,RayRutjes/frontend,prathamesh-sonpatki/frontend,prathamesh-sonpatki/frontend,circleci/frontend |
d28d1f9b6788f469544277959ee7c5aaded0a6da | core/app/backbone/views/channels/add_channel_to_channels_button_view.coffee | core/app/backbone/views/channels/add_channel_to_channels_button_view.coffee | #= require ./add_channel_to_channels_modal_view
class window.AddChannelToChannelsButtonView extends Backbone.Marionette.Layout
template: 'channels/add_channel_to_channels_button'
events:
"click .js-add-to-channel-button": "openAddToChannelModal"
initialize: ->
@collection = @model.getOwnContainingChannels(this)
@bindTo @collection, "add remove reset", (channel) => @updateButton()
onRender: ->
@updateButton()
updateButton: =>
added = @collection.length > 0
@$('.added-to-channel-button-label').toggle added
@$('.add-to-channel-button-label').toggle not added
openAddToChannelModal: (e) ->
e.stopImmediatePropagation()
e.preventDefault()
suggestion_collection = @options.suggested_topics || new SuggestedTopics([@model.topic()])
FactlinkApp.Modal.show 'Add to Channels',
new AddChannelToChannelsModalView
model: @model,
collection: @collection
suggestions: suggestion_collection
| #= require ./add_channel_to_channels_modal_view
class window.AddChannelToChannelsButtonView extends Backbone.Marionette.Layout
template: 'channels/add_channel_to_channels_button'
events:
"click .js-add-to-channel-button": "openAddToChannelModal"
initialize: ->
@collection = @model.getOwnContainingChannels(this)
@bindTo @collection, "add remove reset", (channel) => @updateButton()
onRender: ->
@updateButton()
updateButton: =>
added = @collection.length > 0
@$('.added-to-channel-button-label').toggle added
@$('.add-to-channel-button-label').toggle not added
topic_suggestions: ->
@options.suggested_topics || new SuggestedTopics([@model.topic()])
openAddToChannelModal: (e) ->
e.stopImmediatePropagation()
e.preventDefault()
FactlinkApp.Modal.show 'Add to Channels',
new AddChannelToChannelsModalView
model: @model,
collection: @collection
suggestions: @topic_suggestions()
| Use suggested_topics passed as parameter, and fall back to collection with the single model | Use suggested_topics passed as parameter, and fall back to collection with the single model
| CoffeeScript | mit | Factlink/factlink-core,daukantas/factlink-core,daukantas/factlink-core,daukantas/factlink-core,Factlink/factlink-core,daukantas/factlink-core,Factlink/factlink-core,Factlink/factlink-core |
4fe02405ae858e4155ef46258a20d1fcf9c2f418 | js/libs/github.coffee | js/libs/github.coffee | checkOuterPages = (url) =>
outerPages = ["docs", "about", "privacy", "pricing"]
for page in outerPages
if (url.match "^/#{page}.*")
return "/"
return url
CI.github =
# we encode each parameter separately (one of them twice!) to get the right format
authUrl: (scope=["user:email", "repo"]) =>
destination = window.location.pathname + window.location.hash
destination = checkOuterPages(destination)
destination = encodeURIComponent(destination)
csrf_token = CSRFToken
csrf_token = encodeURIComponent(csrf_token)
path = "https://github.com/login/oauth/authorize"
client_id = window.renderContext.githubClientId
l = window.location
redirect = "#{l.protocol}//#{l.host}/auth/github?return-to=#{destination}&CSRFToken=#{csrf_token}"
redirect = encodeURIComponent(redirect)
url = "#{path}?client_id=#{client_id}&redirect_uri=#{redirect}"
if scope
scope = scope.join ","
scope = encodeURIComponent(scope)
url += "&scope=#{scope}"
url
| checkOuterPages = (url) =>
outerPages = ["docs", "about", "privacy", "pricing", "integrations", "features"]
for page in outerPages
if (url.match "^/#{page}.*")
return "/"
return url
CI.github =
# we encode each parameter separately (one of them twice!) to get the right format
authUrl: (scope=["user:email", "repo"]) =>
destination = window.location.pathname + window.location.hash
destination = checkOuterPages(destination)
destination = encodeURIComponent(destination)
csrf_token = CSRFToken
csrf_token = encodeURIComponent(csrf_token)
path = "https://github.com/login/oauth/authorize"
client_id = window.renderContext.githubClientId
l = window.location
redirect = "#{l.protocol}//#{l.host}/auth/github?return-to=#{destination}&CSRFToken=#{csrf_token}"
redirect = encodeURIComponent(redirect)
url = "#{path}?client_id=#{client_id}&redirect_uri=#{redirect}"
if scope
scope = scope.join ","
scope = encodeURIComponent(scope)
url += "&scope=#{scope}"
url
| Update 'outerPages' so that features/integrations pages don't redirect to themselves | Update 'outerPages' so that features/integrations pages don't redirect to themselves
| CoffeeScript | epl-1.0 | circleci/frontend,RayRutjes/frontend,prathamesh-sonpatki/frontend,prathamesh-sonpatki/frontend,RayRutjes/frontend,circleci/frontend,circleci/frontend |
ce547a97010714337c5d460efe1d2b4a1913bba1 | app/assets/javascripts/util/url.js.coffee | app/assets/javascripts/util/url.js.coffee | this.edsc.util.url = do(window,
document,
History,
extend = jQuery.extend,
param = jQuery.param) ->
pushPath = (path, title=document.title, data=null) ->
History.pushState(data, title, path + window.location.search)
savedState = null
savedPath = null
saveState = (path, state, push = false) ->
paramStr = param(state)
paramStr = '?' + paramStr if paramStr.length > 0
if window.location.pathname != path || window.location.search != paramStr
savedState = paramStr
savedPath = path
if push
History.pushState(state, document.title, path + paramStr)
else
History.replaceState(state, document.title, path + paramStr)
true
else
false
# Raise a new event to avoid getting a statechange event when we ourselves change the state
$(window).on 'statechange anchorchange', ->
if window.location.search != savedState || window.location.pathname != savedPath
$(window).trigger('edsc.pagechange')
exports =
pushPath: pushPath
saveState: saveState
| this.edsc.util.url = do(window,
document,
History,
extend = jQuery.extend,
param = jQuery.param) ->
cleanPath = ->
# Remove everything up to the third slash
History.getState().cleanUrl.replace(/^[^\/]*\/\/[^\/]*/, '')
pushPath = (path, title=document.title, data=null) ->
# Replace everything before the first ?
path = cleanPath().replace(/^[^\?]*/, path)
History.pushState(data, title, path)
savedPath = null
saveState = (path, state, push = false) ->
paramStr = param(state)
paramStr = '?' + paramStr if paramStr.length > 0
path = path + paramStr
if cleanPath() != path
savedPath = path
if push
History.pushState(state, document.title, path)
else
History.replaceState(state, document.title, path)
true
else
false
# Raise a new event to avoid getting a statechange event when we ourselves change the state
$(window).on 'statechange anchorchange', ->
if cleanPath() != savedPath
$(window).trigger('edsc.pagechange')
exports =
pushPath: pushPath
saveState: saveState
| Fix landing page behavior when transitioning using the enter key | EDSC-149: Fix landing page behavior when transitioning using the enter key
| CoffeeScript | apache-2.0 | bilts/earthdata-search,bilts/earthdata-search,mightynimble/earthdata-search,bilts/earthdata-search,mightynimble/earthdata-search,mightynimble/earthdata-search,mightynimble/earthdata-search,bilts/earthdata-search |
88f4eb3f5a5026beb5490de71aa9197472268adf | src/coffee/cilantro/utils.coffee | src/coffee/cilantro/utils.coffee | define [
'jquery'
'./utils/numbers'
'./utils/url'
'./utils/version'
], ($, mods...) ->
# Convenience method for getting a value using the dot-notion for
# accessing nested structures.
getDotProp = (obj, key) ->
toks = key.split('.')
for tok in toks
if not (obj = obj[tok])?
return
return obj
# Convenience method for setting a value using the dot-notion for
# accessing nested structures.
setDotProp = (obj, key, value) ->
if typeof key is 'object'
# Second argument is a boolean to whether or not to replace
# the options
if value is true
return $.extend(true, {}, key)
return $.extend(true, obj, key)
toks = key.split('.')
last = toks.pop()
for tok in toks
if not obj[tok]?
obj[tok] = {}
obj = obj[tok]
obj[last] = value
return
$.extend { getDotProp, setDotProp }, mods...
| define [
'jquery'
'./utils/numbers'
'./utils/url'
'./utils/version'
], ($, mods...) ->
# Convenience method for getting a value using the dot-notion for
# accessing nested structures.
getDotProp = (obj, key) ->
toks = key.split('.')
for tok in toks
if not (obj = obj[tok])?
return
return obj
# Convenience method for setting a value using the dot-notion for
# accessing nested structures.
setDotProp = (obj, key, value) ->
if typeof key is 'object'
# Second argument is a boolean to whether or not to replace
# the options
if value is true
return $.extend(true, {}, key)
return $.extend(true, obj, key)
toks = key.split('.')
last = toks.pop()
for tok in toks
if not obj[tok]?
obj[tok] = {}
obj = obj[tok]
obj[last] = value
return
pprint = (obj) ->
console.log(JSON.stringify(obj, null, 4))
$.extend { getDotProp, setDotProp, pprint }, mods...
| Add pprint utility function for JSON-based structures | Add pprint utility function for JSON-based structures
| CoffeeScript | bsd-2-clause | chop-dbhi/cilantro,chop-dbhi/cilantro,chop-dbhi/cilantro |
f9e2cb7e7363f0ad259e31e71b166027b39e57df | src/utils.coffee | src/utils.coffee | util = require 'util'
exports.is =
fun: util.isFunction
str: util.isString
arr: util.isArray
obj: util.isObject
exports.normalize = (params, options, fn) ->
if util.isFunction params
fn = params
params = null
options = null
else if util.isFunction options
fn = options
options = null
if not util.isFunction fn
fn = ->
{params, options, fn} | fun = (f) -> typeof f is 'function'
str = (s) -> typeof s is 'string'
arr = (a) -> a instanceof Array
obj = (o) -> o instanceof Object and not fun(o) and not arr(o)
exports.is =
fun: fun
str: str
arr: arr
obj: obj
exports.normalize = (params, options, fn) ->
if fun params
fn = params
params = null
options = null
else if fun options
fn = options
options = null
if not fun fn
fn = ->
{params, options, fn} | Revert "Replace validation to node built-in functions" | Revert "Replace validation to node built-in functions"
This reverts commit 9e4ff9f9d1dfa10098ec9fdbcd44420e2af64332.
| CoffeeScript | mit | meritt/easymongo |
d8f7c70c5d6544fd819e2dc120b8603ec80c1e49 | apps/show/components/related_shows/index.coffee | apps/show/components/related_shows/index.coffee | _ = require 'underscore'
{ Cities, FeaturedCities } = require 'places'
PartnerShows = require '../../../../collections/partner_shows.coffee'
RelatedShowsView = require './view.coffee'
module.exports = (type, show) ->
el = $('.js-related-shows')
city = _.findWhere(Cities, name: show.formatCity())
criteria =
sort: 'end_at'
size: 20
displayable: true
relatedShows = new PartnerShows
switch type
when 'fair'
data = _.extend criteria, {
fair_id: show.related().fair.get('_id')
}
title = "More Booths from #{show.related().fair.get('name')}"
when 'gallery'
data = _.extend criteria, {
sort: '-start_at'
status: "upcoming"
}
relatedShows.url = "#{show.related().partner.url()}/shows"
title = "Other Shows from #{show.partnerName()}"
when 'featured'
data = _.extend criteria, {
featured: true
status: 'running'
}
el = $('.js-featured-shows')
title = "Featured Shows"
when 'city'
data = _.extend criteria, {
near: show.location().getMapsLocation()
status: 'running'
}
title = "Current Shows in #{show.formatCity()}"
new RelatedShowsView
collection: relatedShows
title: title
el: el
show: show
city: city
relatedShows.fetch
data: data
success: ->
relatedShows.getShowsRelatedImages()
| _ = require 'underscore'
{ Cities, FeaturedCities } = require 'places'
PartnerShows = require '../../../../collections/partner_shows.coffee'
RelatedShowsView = require './view.coffee'
module.exports = (type, show) ->
el = $('.js-related-shows')
city = _.findWhere(Cities, name: show.formatCity())
criteria =
sort: 'end_at'
size: 20
displayable: true
relatedShows = new PartnerShows
switch type
when 'fair'
data = _.extend criteria, {
fair_id: show.related().fair.get('_id')
}
title = "More Booths from #{show.related().fair.get('name')}"
when 'gallery'
data = _.extend criteria, {
sort: '-start_at'
}
relatedShows.url = "#{show.related().partner.url()}/shows"
title = "Other Shows from #{show.partnerName()}"
when 'featured'
data = _.extend criteria, {
featured: true
status: 'running'
}
el = $('.js-featured-shows')
title = "Featured Shows"
when 'city'
data = _.extend criteria, {
near: show.location().getMapsLocation()
status: 'running'
}
title = "Current Shows in #{show.formatCity()}"
new RelatedShowsView
collection: relatedShows
title: title
el: el
show: show
city: city
relatedShows.fetch
data: data
success: ->
relatedShows.getShowsRelatedImages()
| Include past shows in related shows on gallery pages | Include past shows in related shows on gallery pages
| CoffeeScript | mit | izakp/force,kanaabe/force,oxaudo/force,yuki24/force,erikdstock/force,cavvia/force-1,xtina-starr/force,anandaroop/force,dblock/force,joeyAghion/force,yuki24/force,damassi/force,artsy/force-public,cavvia/force-1,yuki24/force,joeyAghion/force,mzikherman/force,mzikherman/force,yuki24/force,kanaabe/force,erikdstock/force,dblock/force,eessex/force,mzikherman/force,xtina-starr/force,kanaabe/force,anandaroop/force,damassi/force,oxaudo/force,kanaabe/force,artsy/force,artsy/force,eessex/force,oxaudo/force,TribeMedia/force-public,xtina-starr/force,mzikherman/force,artsy/force,dblock/force,damassi/force,erikdstock/force,oxaudo/force,cavvia/force-1,kanaabe/force,anandaroop/force,joeyAghion/force,xtina-starr/force,anandaroop/force,joeyAghion/force,damassi/force,artsy/force,erikdstock/force,izakp/force,izakp/force,TribeMedia/force-public,eessex/force,cavvia/force-1,eessex/force,artsy/force-public,izakp/force |
a348026ff3975541e2144a6aa6840fd8571324eb | lib/tag-reader.coffee | lib/tag-reader.coffee | {Task} = require 'atom'
ctags = require 'ctags'
async = require 'async'
getTagsFile = require "./get-tags-file"
handlerPath = require.resolve './load-tags-handler'
module.exports =
find: (editor, callback) ->
symbol = editor.getSelectedText()
unless symbol
cursor = editor.getLastCursor()
scopes = cursor.getScopeDescriptor().getScopesArray()
rubyScopes = scopes.filter (scope) -> /^source\.ruby($|\.)/.test(scope)
wordRegex = /[a-zA-Z_][\w!?]*/g if rubyScopes.length
range = cursor.getCurrentWordBufferRange({wordRegex})
symbol = editor.getTextInRange(range)
unless symbol
return process.nextTick -> callback(null, [])
allTags = []
async.each(
atom.project.getPaths(),
(projectPath, done) ->
tagsFile = getTagsFile(projectPath)
return done() unless tagsFile?
ctags.findTags tagsFile, symbol, (err, tags=[]) ->
tag.directory = projectPath for tag in tags
allTags = allTags.concat(tags)
done(err)
(err) -> callback(err, allTags)
)
getAllTags: (callback) ->
projectTags = []
task = Task.once handlerPath, atom.project.getPaths(), -> callback(projectTags)
task.on 'tags', (tags) -> projectTags.push(tags...)
task
| {Task} = require 'atom'
ctags = require 'ctags'
async = require 'async'
getTagsFile = require "./get-tags-file"
handlerPath = require.resolve './load-tags-handler'
module.exports =
find: (editor, callback) ->
symbol = editor.getSelectedText()
unless symbol
cursor = editor.getLastCursor()
scopes = cursor.getScopeDescriptor().getScopesArray()
rubyScopes = scopes.filter (scope) -> /^source\.ruby($|\.)/.test(scope)
wordRegex = /[\w!?]*/g if rubyScopes.length
range = cursor.getCurrentWordBufferRange({wordRegex})
symbol = editor.getTextInRange(range)
unless symbol
return process.nextTick -> callback(null, [])
allTags = []
async.each(
atom.project.getPaths(),
(projectPath, done) ->
tagsFile = getTagsFile(projectPath)
return done() unless tagsFile?
ctags.findTags tagsFile, symbol, (err, tags=[]) ->
tag.directory = projectPath for tag in tags
allTags = allTags.concat(tags)
done(err)
(err) -> callback(err, allTags)
)
getAllTags: (callback) ->
projectTags = []
task = Task.once handlerPath, atom.project.getPaths(), -> callback(projectTags)
task.on 'tags', (tags) -> projectTags.push(tags...)
task
| Fix go-to-declaration for various cursor position within Ruby identifier | Fix go-to-declaration for various cursor position within Ruby identifier
Even though technically the Ruby "word" can only start with a letter or
underscore, in practice it's not a good idea to define such regexp here,
because due to Atom's implementation of `editor.scanInBufferRange`, the
"word" under cursor will be looked up twice: once considering everything
up to the cursor position, and the second time considering everything
from the cursor position to the end of file.
So, if the cursor was positioned between "c" and "!" in `abc!`
identifier, the go-to-declaration for `abc!` symbol would fail.
| CoffeeScript | mit | kainwinterheart/symbols-view,atom/symbols-view |
22b7d9666d8775b5e4db7ef0e289d72378ce2899 | app/assets/javascripts/bsat/sidebar.js.coffee | app/assets/javascripts/bsat/sidebar.js.coffee | window.bsat.utils.readyOrPageChange ->
#
# Setup sidebar open/close state when the user
# clicks on sidebar toggle button. The sidebar
# gets closed on small devices using media queries,
# so we need to take this into account.
#
$('#sidebar-toggle-button').click (e) ->
e.preventDefault()
if $(window).width() <= 768
$('body').toggleClass('sidebar-open')
$('body').removeClass('sidebar-close')
else
$('body').removeClass('sidebar-open')
$('body').toggleClass('sidebar-close')
#
# Detect if there is no sidebar
#
unless $('#sidebar')[0]
$('body').addClass('no-sidebar')
#
# Use IScroll for scrolling the sidebar
#
for selector in ['#sidebar']
new IScroll(selector, {
scrollbars: true,
fadeScrollbars: true,
mouseWheel: true
}) if $(selector)[0]
| window.bsat.utils.readyOrPageChange ->
#
# Setup sidebar open/close state when the user
# clicks on sidebar toggle button. The sidebar
# gets closed on small devices using media queries,
# so we need to take this into account.
#
$('#sidebar-toggle-button').click (e) ->
e.preventDefault()
if $(window).width() <= 768
$('body').toggleClass('sidebar-open')
$('body').removeClass('sidebar-close')
else
$('body').removeClass('sidebar-open')
$('body').toggleClass('sidebar-close')
#
# Detect if there is no sidebar
#
unless $('#sidebar')[0]
$('body').addClass('no-sidebar')
#
# Use IScroll for scrolling the sidebar
#
selector = '#sidebar'
new IScroll(selector, {
scrollbars: true,
fadeScrollbars: true,
mouseWheel: true,
click: true
}) if $(selector)[0]
| Enable click support on mobile devices. | Enable click support on mobile devices.
| CoffeeScript | mit | metaminded/bsat,metaminded/bsat |
ee01430c52fa6cdc576a403077a3c7b8196e88c4 | roles/developer-atom/templates/atom/init.coffee | roles/developer-atom/templates/atom/init.coffee | # Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
# console.log "Saved! #{editor.getPath()}"
{extname} = require 'path'
fileTypes =
'.swig' : 'text.html.twig'
atom.workspace.observeTextEditors (editor) ->
scopeName = fileTypes[extname editor.getPath()]
return unless scopeName?
g = atom.grammars.grammarForScopeName scopeName
return unless g?
editor.setGrammar g
process.env.PATH = ["/usr/local/bin", process.env.PATH].join(":")
| # Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
# console.log "Saved! #{editor.getPath()}"
{extname} = require 'path'
process.env.PATH = ["/usr/local/bin", process.env.PATH].join(":")
| Remove deprecated swig file type | Remove deprecated swig file type
| CoffeeScript | mit | luishdez/osx-playbook,ansible-macos/macos-playbook,ansible-macos/macos-playbook |
2d90c96aa205d3ffc5fdcda5f270463c22ae5cd5 | command-register.coffee | command-register.coffee | commander = require 'commander'
meshblu = require 'meshblu'
class KeygenCommand
parseOptions: =>
commander
.parse process.argv
run: =>
@parseOptions()
@config = {server: 'meshblu.octoblu.com', port: 80, uuid: 'wrong'}
@conn = meshblu.createConnection @config
@conn.on 'notReady', @onReady
onReady: (credentials) =>
@conn.register {}, (credentials) =>
@config.uuid = credentials.uuid
@config.token = credentials.token
console.log JSON.stringify(@config, null, 2)
process.exit 0
(new KeygenCommand()).run()
| commander = require 'commander'
_ = require 'lodash'
meshblu = require 'meshblu'
url = require 'url'
DEFAULT_HOST = 'meshblu.octoblu.com'
DEFAULT_PORT = 80
class KeygenCommand
parseOptions: =>
commander
.option '-s, --server <host[:port]>', 'Meshblu host'
.parse process.argv
parseConfig: =>
unless commander.server?
return {server: DEFAULT_HOST, port: DEFAULT_PORT}
server = commander.server
unless _.startsWith server, 'ws'
protocol = if port == 443 then 'wss://' else 'ws://'
server = protocol + server
{hostname, port} = url.parse server
port ?= 80
{server: hostname, port: port}
run: =>
@parseOptions()
@config = @parseConfig()
@config.uuid = 'wrong' # to force a notReady
@conn = meshblu.createConnection @config
@conn.on 'notReady', @onReady
onReady: (credentials) =>
@conn.register {}, (credentials) =>
@config.uuid = credentials.uuid
@config.token = credentials.token
console.log JSON.stringify(@config, null, 2)
process.exit 0
(new KeygenCommand()).run()
| Add optional server and port | Add optional server and port
| CoffeeScript | mit | octoblu/meshblu-util,octoblu/meshblu-util |
1e3ce6ce3efe67adf934eb13d7342d46cce84ea1 | lib/main.coffee | lib/main.coffee | GitHubFile = require './github-file'
module.exports =
config:
includeLineNumbersInUrls:
default: true
type: 'boolean'
activate: ->
atom.commands.add 'atom-pane',
'open-on-github:file': ->
if itemPath = getActivePath()
GitHubFile.fromPath(itemPath).open(getSelectedRange())
'open-on-github:blame': ->
if itemPath = getActivePath()
GitHubFile.fromPath(itemPath).blame(getSelectedRange())
'open-on-github:history': ->
if itemPath = getActivePath()
GitHubFile.fromPath(itemPath).history()
'open-on-github:issues': ->
if itemPath = getActivePath()
GitHubFile.fromPath(itemPath).openIssues()
'open-on-github:copy-url': ->
if itemPath = getActivePath()
GitHubFile.fromPath(itemPath).copyUrl(getSelectedRange())
'open-on-github:branch-compare': ->
if itemPath = getActivePath()
GitHubFile.fromPath(itemPath).openBranchCompare()
'open-on-github:repository': ->
if itemPath = getActivePath()
GitHubFile.fromPath(itemPath).openRepository()
getActivePath = ->
atom.workspace.getActivePaneItem()?.getPath?()
getSelectedRange = ->
atom.workspace.getActivePaneItem()?.getSelectedBufferRange?()
| GitHubFile = require './github-file'
module.exports =
config:
includeLineNumbersInUrls:
default: true
type: 'boolean'
description: 'Include the line range selected in the editor when opening or copying URLs to the clipboard. When opened in the browser, the GitHub page will automatically scroll to the selected line range.'
activate: ->
atom.commands.add 'atom-pane',
'open-on-github:file': ->
if itemPath = getActivePath()
GitHubFile.fromPath(itemPath).open(getSelectedRange())
'open-on-github:blame': ->
if itemPath = getActivePath()
GitHubFile.fromPath(itemPath).blame(getSelectedRange())
'open-on-github:history': ->
if itemPath = getActivePath()
GitHubFile.fromPath(itemPath).history()
'open-on-github:issues': ->
if itemPath = getActivePath()
GitHubFile.fromPath(itemPath).openIssues()
'open-on-github:copy-url': ->
if itemPath = getActivePath()
GitHubFile.fromPath(itemPath).copyUrl(getSelectedRange())
'open-on-github:branch-compare': ->
if itemPath = getActivePath()
GitHubFile.fromPath(itemPath).openBranchCompare()
'open-on-github:repository': ->
if itemPath = getActivePath()
GitHubFile.fromPath(itemPath).openRepository()
getActivePath = ->
atom.workspace.getActivePaneItem()?.getPath?()
getSelectedRange = ->
atom.workspace.getActivePaneItem()?.getSelectedBufferRange?()
| Add description for config setting | Add description for config setting
| CoffeeScript | mit | atom/open-on-github |
b5e447a21e634d7da2e14259884d2611e3bdb8d5 | lib/utilities.coffee | lib/utilities.coffee | fs = require('fs')
isFile= (name,foundCB)->
try
fs.stat name, (err,stats)->
foundCB(!err && stats.isFile())
isFileSync= (name)->
try
fs.statSync(name).isFile()
catch e
throw e unless e.code == 'ENOENT'
false
moduleExtensions= ['.js','.coffee','.json']
hasAnExtension= (name,extensions,foundCB)->
i= -1
looper= (found)->
return foundCB(extensions[i]) if found
i+= 1
return foundCB(false) unless i<extensions.length
isFile(name+extensions[i],looper)
looper(false) #initiate the process
module.exports=
# is the given name that of a regular file?
isFile: isFile
isFileSync: isFileSync
# does a file with one of the given extensions exist?
hasAnExtension: hasAnExtension
# Would adding the proper extension to the given name find a file whose extension
# suggested that it could be a module?
isModule: (name,foundCB)->
hasAnExtension(name,moduleExtensions,foundCB)
isModuleSync: (name)->
return true for ext in moduleExtensions when isFileSync(name+ext)
false | fs = require('fs')
isFile= (name,foundCB)->
fs.stat name, (err,stats)->
foundCB(!err && stats.isFile())
isFileSync= (name)->
try
fs.statSync(name).isFile()
catch e
throw e unless e.code == 'ENOENT'
false
moduleExtensions= ['.js','.coffee','.json']
hasAnExtension= (name,extensions,foundCB)->
i= -1
looper= (found)->
return foundCB(extensions[i]) if found
i+= 1
return foundCB(false) unless i<extensions.length
isFile(name+extensions[i],looper)
looper(false) #initiate the process
module.exports=
# is the given name that of a regular file?
isFile: isFile
isFileSync: isFileSync
# does a file with one of the given extensions exist?
hasAnExtension: hasAnExtension
# Would adding the proper extension to the given name find a file whose extension
# suggested that it could be a module?
isModule: (name,foundCB)->
hasAnExtension(name,moduleExtensions,foundCB)
isModuleSync: (name)->
return true for ext in moduleExtensions when isFileSync(name+ext)
false | Remove try without a catch | Remove try without a catch
| CoffeeScript | mit | randymized/malifi |
9883ba66d731b72a0d010e3f931501bdba41c3c1 | src/scripts/loader.coffee | src/scripts/loader.coffee | define (require) ->
$ = require('jquery')
Backbone = require('backbone')
router = require('cs!router')
analytics = require('cs!helpers/handlers/analytics') # Setup Analytics Handler
# The root URI prefixed on all non-external AJAX and Backbone URIs
root = '/'
init = (options = {}) ->
# Append /test to the root if the app is in test mode
if options.test
root += 'test/'
external = new RegExp('^((f|ht)tps?:)?//')
# Catch internal application links and let Backbone handle the routing
$(document).on 'click', 'a:not([data-bypass])', (e) ->
href = $(this).attr('href')
# Only handle links intended to be processed by Backbone
if e.isDefaultPrevented() or href.charAt(0) is '#' or /^mailto:.+/.test(href) then return
e.preventDefault()
if external.test(href)
window.open(href, '_blank')
else
router.navigate(href, {trigger: true})
Backbone.history.start
pushState: true
root: root
# Prefix all non-external AJAX requests with the root URI
$.ajaxPrefilter (options, originalOptions, jqXHR) ->
if not external.test(options.url)
options.url = root + options.url
return
return {init: init}
| define (require) ->
$ = require('jquery')
Backbone = require('backbone')
router = require('cs!router')
analytics = require('cs!helpers/handlers/analytics') # Setup Analytics Handler
# The root URI prefixed on all non-external AJAX and Backbone URIs
root = '/'
init = (options = {}) ->
# Append /test to the root if the app is in test mode
if options.test
root += 'test/'
external = new RegExp('^((f|ht)tps?:)?//')
# Catch internal application links and let Backbone handle the routing
$(document).on 'click', 'a:not([data-bypass])', (e) ->
href = $(this).attr('href')
# Only handle links intended to be processed by Backbone
if e.isDefaultPrevented() or href.charAt(0) is '#' or /^mailto:.+/.test(href) then return
e.preventDefault()
if external.test(href)
window.open(href, '_blank')
else
router.navigate(href, {trigger: true})
Backbone.history.start
pushState: true
root: root
# Force Backbone to register the full path including the query in its history
if location.search
router.navigate(location.pathname + location.search, {replace: true})
# Prefix all non-external AJAX requests with the root URI
$.ajaxPrefilter (options, originalOptions, jqXHR) ->
if not external.test(options.url)
options.url = root + options.url
return
return {init: init}
| Include query strings in backbone history | Include query strings in backbone history
| CoffeeScript | agpl-3.0 | dak/webview,katalysteducation/webview,katalysteducation/webview,dak/webview,katalysteducation/webview,carolinelane10/webview,Connexions/webview,Connexions/webview,katalysteducation/webview,Connexions/webview,dak/webview,Connexions/webview |
acc0a2e4ba6fd5a378956335b2bc04a1606aaaef | lib/image.coffee | lib/image.coffee | ###
PDFImage - embeds images in PDF documents
By Devon Govett
###
fs = require 'fs'
Data = require './data'
JPEG = require './image/jpeg'
PNG = require './image/png'
class PDFImage
@open: (src, label) ->
if Buffer.isBuffer(src)
data = src
else
if src[0..4] is 'data:' and src.indexOf(';base64,') > -1
base64String = src.split(';base64,')[1]
data = new Buffer(base64String, 'base64')
else
data = fs.readFileSync src
return unless data
if data[0] is 0xff and data[1] is 0xd8
return new JPEG(data, label)
else if data[0] is 0x89 and data.toString('ascii', 1, 4) is 'PNG'
return new PNG(data, label)
else
throw new Error 'Unknown image format.'
module.exports = PDFImage | ###
PDFImage - embeds images in PDF documents
By Devon Govett
###
fs = require 'fs'
Data = require './data'
JPEG = require './image/jpeg'
PNG = require './image/png'
class PDFImage
@open: (src, label) ->
if Buffer.isBuffer(src)
data = src
else
if match = /^data:.+;base64,(.*)$/.exec(src)
data = new Buffer(match[1], 'base64')
else
data = fs.readFileSync src
return unless data
if data[0] is 0xff and data[1] is 0xd8
return new JPEG(data, label)
else if data[0] is 0x89 and data.toString('ascii', 1, 4) is 'PNG'
return new PNG(data, label)
else
throw new Error 'Unknown image format.'
module.exports = PDFImage | Use a regex to capture the base64 encoded string | Use a regex to capture the base64 encoded string
| CoffeeScript | mit | ixiom/pdfkit,ixiom/pdfkit,greyhwndz/pdfkit,mauricionr/pdfkit,devongovett/pdfkit,datphan/pdfkit,moyogo/pdfkit,pomahtuk/pdfkit,ashelley/pdfkit,gabrieldelatorreicg/pdfkit,jkol/pdfkit,mauricionr/pdfkit,jordonbiondo/pdfkit,gradecam/pdfkit,billcowan/pdfkit,backspace/pdfkit,joadr/pdfkit,jkol/pdfkit,billcowan/pdfkit,gabrieldelatorreicg/pdfkit,greyhwndz/pdfkit,aendrew/pdfkit,bpampuch/pdfkit,datphan/pdfkit,devongovett/pdfkit,jordonbiondo/pdfkit,pomahtuk/pdfkit,moyogo/pdfkit,gradecam/pdfkit,joadr/pdfkit |
331bea68bf03b965678d257e097a541586c50076 | client/landing/app/Applications/Chat.kdapplication/Views/conversationlistitemtitle.coffee | client/landing/app/Applications/Chat.kdapplication/Views/conversationlistitemtitle.coffee | class ChatConversationListItemTitle extends JView
constructor:(options = {}, data)->
options.cssClass = 'chat-item'
# data = [nick for nick in data when nick isnt KD.nick()].first
super
viewAppended:->
invitees = @getData()
@accounts = []
for invitee in invitees
KD.remote.cacheable invitee, (err, account)=>
warn err if err
@accounts.push account?.first or Object
@setTemplate @pistachio() if @accounts.length is @getData().length
getName:(index)->
"#{@accounts[index].profile.firstName} #{@accounts[index].profile.lastName}"
pistachio:->
@setClass 'multiple' if @accounts.length > 1
@avatar = new AvatarView
size : {width: 30, height: 30}
origin : @accounts.first
@participants = switch @accounts.length
when 1 then @getName 0
when 2 then "#{@getName(0)} <span>and</span> #{@getName(1)}"
else "#{@getName(0)}, #{@getName(1)} <span>and <strong>#{data.length - 2} more.</strong></span>"
"""
<div class='avatar-wrapper fl'>
{{> @avatar}}
</div>
<div class='right-overflow'>
<h3>#{@participants}</h3>
</div>
"""
| class ChatConversationListItemTitle extends JView
constructor:(options = {}, data)->
options.cssClass = 'chat-item'
# data = [nick for nick in data when nick isnt KD.nick()].first
super
viewAppended:->
invitees = @getData()
@accounts = []
for invitee in invitees
KD.remote.cacheable invitee, (err, account)=>
warn err if err
@accounts.push account?.first or Object
@setTemplate @pistachio() if @accounts.length is @getData().length
getName:(index)->
"#{@accounts[index].profile.firstName} #{@accounts[index].profile.lastName}"
pistachio:->
@setClass 'multiple' if @accounts.length > 1
@avatar = new AvatarView
size : {width: 30, height: 30}
origin : @accounts.first
@participants = switch @accounts.length
when 1 then @getName 0
when 2 then "#{@getName(0)} <span>and</span> #{@getName(1)}"
else "#{@getName(0)}, #{@getName(1)} <span>and <strong>#{@accounts.length - 2} more.</strong></span>"
"""
<div class='avatar-wrapper fl'>
{{> @avatar}}
</div>
<div class='right-overflow'>
<h3>#{@participants}</h3>
</div>
"""
| Check accounts length since its the data | Check accounts length since its the data
| CoffeeScript | agpl-3.0 | cihangir/koding,andrewjcasal/koding,alex-ionochkin/koding,rjeczalik/koding,acbodine/koding,alex-ionochkin/koding,usirin/koding,gokmen/koding,szkl/koding,mertaytore/koding,gokmen/koding,mertaytore/koding,cihangir/koding,szkl/koding,koding/koding,jack89129/koding,koding/koding,mertaytore/koding,sinan/koding,alex-ionochkin/koding,gokmen/koding,gokmen/koding,rjeczalik/koding,rjeczalik/koding,alex-ionochkin/koding,mertaytore/koding,mertaytore/koding,mertaytore/koding,szkl/koding,koding/koding,gokmen/koding,kwagdy/koding-1,jack89129/koding,usirin/koding,sinan/koding,cihangir/koding,usirin/koding,drewsetski/koding,cihangir/koding,szkl/koding,andrewjcasal/koding,usirin/koding,gokmen/koding,mertaytore/koding,drewsetski/koding,sinan/koding,acbodine/koding,cihangir/koding,koding/koding,alex-ionochkin/koding,kwagdy/koding-1,koding/koding,kwagdy/koding-1,kwagdy/koding-1,gokmen/koding,drewsetski/koding,alex-ionochkin/koding,jack89129/koding,acbodine/koding,acbodine/koding,szkl/koding,szkl/koding,rjeczalik/koding,usirin/koding,jack89129/koding,acbodine/koding,acbodine/koding,andrewjcasal/koding,drewsetski/koding,andrewjcasal/koding,andrewjcasal/koding,acbodine/koding,mertaytore/koding,kwagdy/koding-1,alex-ionochkin/koding,jack89129/koding,koding/koding,andrewjcasal/koding,rjeczalik/koding,andrewjcasal/koding,jack89129/koding,cihangir/koding,alex-ionochkin/koding,rjeczalik/koding,rjeczalik/koding,kwagdy/koding-1,usirin/koding,szkl/koding,drewsetski/koding,drewsetski/koding,gokmen/koding,sinan/koding,sinan/koding,szkl/koding,cihangir/koding,koding/koding,acbodine/koding,usirin/koding,jack89129/koding,rjeczalik/koding,jack89129/koding,cihangir/koding,kwagdy/koding-1,sinan/koding,koding/koding,sinan/koding,sinan/koding,kwagdy/koding-1,drewsetski/koding,drewsetski/koding,andrewjcasal/koding,usirin/koding |
624c8825c105e16a9671a410466a3b7cdab1039d | lib/Watchers/Template.coffee | lib/Watchers/Template.coffee | fs = require 'graceful-fs'
AssetWatcher = require './Asset'
class TemplateWatcher extends AssetWatcher
constructor: (@config)->
super()
pattern: -> super ["**/template.jade"]
getPaths: -> ['/templates.js', "/templates-#{@hash()}.js"]
getShortPath: (path)->
@pathpart(path)
.substr(1)
.replace('.jade', '')
.replace('/template', '')
getModuleName: (shortPath)->
module = shortPath.replace(/\//g, '.') + '.template'
if moduleRoot = @getModuleRoot()
module = "#{moduleRoot}.#{module}"
module
getModuleRoot: -> @config.templateModuleRoot
stripNewlines: (content)->
content.replace(/\r?\n/g, '\\n\' +\n \'')
# Normalize backslashes and strip newlines.
escapeContent: (content)->
@stripNewlines(content)
.replace(/\\/g, '\\\\')
.replace(/'/g, '\\\'')
render: (code, path)->
options = filename: path
content = require('jade').render(code, options)
@wrap path, content
wrap: (path, content)->
shortPath = @getShortPath path
module = @getModuleName shortPath
"""
angular.module('#{module}', [])
.run(function($templateCache){
$templateCache.put('#{shortPath}', '#{@escapeContent(content)}');
});
"""
module.exports = TemplateWatcher
| fs = require 'graceful-fs'
AssetWatcher = require './Asset'
class TemplateWatcher extends AssetWatcher
constructor: (@config)->
super()
pattern: -> super ["**/template.jade"]
getPaths: -> ['/templates.js', "/templates-#{@hash()}.js"]
getShortPath: (path)->
@pathpart(path)
.substr(1)
.replace('.jade', '')
.replace('/template', '')
getModuleName: (shortPath)->
module = shortPath.replace(/[\/\\]/g, '.') + '.template'
if moduleRoot = @getModuleRoot()
module = "#{moduleRoot}.#{module}"
module
getModuleRoot: -> @config.templateModuleRoot
stripNewlines: (content)->
content.replace(/\r?\n/g, '\\n\' +\n \'')
# Normalize backslashes and strip newlines.
escapeContent: (content)->
@stripNewlines(content)
.replace(/\\/g, '\\\\')
.replace(/'/g, '\\\'')
render: (code, path)->
options = filename: path
content = require('jade').render(code, options)
@wrap path, content
wrap: (path, content)->
shortPath = @getShortPath path
module = @getModuleName shortPath
"""
angular.module('#{module}', [])
.run(function($templateCache){
$templateCache.put('#{shortPath}', '#{@escapeContent(content)}');
});
"""
module.exports = TemplateWatcher
| Fix for windows template paths. | Fix for windows template paths.
| CoffeeScript | isc | DavidSouther/stassets,DavidSouther/stassets,RupertJS/stassets,RupertJS/stassets,RupertJS/stassets,DavidSouther/stassets |
80fea416e75782cf219f5e067a83790dc1f7849d | app/assets/asset/pdfViewer.coffee | app/assets/asset/pdfViewer.coffee | 'use strict'
app.directive 'pdfViewer', [
() ->
restrict: 'E'
scope:
asset: '=asset'
link: ($scope, $elem) ->
pdfElement = $($elem)[0]
objectTag = document.createElement('object')
objectTag.setAttribute('data', $scope.asset.downloadRoute(true))
pdfElement.appendChild(objectTag)
return
]
| 'use strict'
app.directive 'pdfViewer', [
() ->
restrict: 'E'
scope:
asset: '=asset'
link: ($scope, $elem) ->
pdfElement = $($elem)[0]
objectTag = document.createElement('object')
objectTag.setAttribute('data', $scope.asset.downloadRoute(true))
objectTag.setAttribute('width', '80%')
pdfElement.appendChild(objectTag)
return
]
| Fix width on PDF viewer | Fix width on PDF viewer
| CoffeeScript | agpl-3.0 | databrary/databrary,databrary/databrary,databrary/databrary,databrary/databrary |
76f360d72649ac92737ac1bd59d4d348c3108e16 | site/lib/utils.coffee | site/lib/utils.coffee | moment = require('lib/moment')
exports.isDev = (req) ->
# We are on DEV when Host has string like
# '/dev.' or '/staging.' or '.local' or '.dev' or 'localhost'
found = req.headers.Host.search(/(\/dev\.|\/staging\.|\.local$|\.dev$|localhost)/) > -1
return found
exports.prettyDate = (date) ->
moment.utc(date).local().format('MMM Do YYYY')
exports.halfDate = (date) ->
moment.utc(date).local().format('MMM D')
exports.isItFresh = (date) ->
if moment.utc().eod() < moment.utc(date).add('days', 30).eod()
return true
return false
exports.capitalize = (str) ->
str ?= ''
str.charAt(0).toUpperCase() + str.slice(1) | moment = require('lib/moment')
exports.isDev = (req) ->
# We are on DEV when Host has string like
# '/dev.' or '/staging.' or '.local' or '.dev' or 'localhost'
re = /(\/dev\.|\/staging\.|\.local$|\.dev$|localhost)/
return re.test(req.headers.Host)
exports.prettyDate = (date) ->
moment.utc(date).local().format('MMM Do YYYY')
exports.halfDate = (date) ->
moment.utc(date).local().format('MMM D')
exports.isItFresh = (date) ->
if moment.utc().eod() < moment.utc(date).add('days', 30).eod()
return true
return false
exports.capitalize = (str) ->
str ?= ''
str.charAt(0).toUpperCase() + str.slice(1) | Change isDev util function to use re.test() instead of search() | Change isDev util function to use re.test() instead of search()
| CoffeeScript | mit | markuso/kleks,markuso/kleks |
9b32132117c8f9a2a33783c931f2da9051314dcf | src/bang.coffee | src/bang.coffee | program = require "commander"
fs = require "fs"
path = require "path"
bang = process.env.HOME + "/.bang"
data = {}
if path.existsSync bang
data = JSON.parse(fs.readFileSync bang)
save = ->
console.log "save called"
fs.writeFileSync bang, JSON.stringify(data)
get = (key) ->
console.log data[key] if data[key]
set = (key, value) ->
data[key] = value
save()
remove = ->
delete data[key] if data[key]
save()
exports.start = ->
program.version("0.0.1")
.usage("[options] [key] [value]")
.option("-d, --delete", "delete the specified key")
.parse(process.argv)
[key, value] = program.args
if key and program.delete
remove key
else if key and value
set key, value
else if key
get key
else
console.log program.helpInformation()
| program = require "commander"
fs = require "fs"
path = require "path"
bang = process.env.HOME + "/.bang"
data = {}
if path.existsSync bang
data = JSON.parse(fs.readFileSync bang)
save = ->
fs.writeFileSync bang, JSON.stringify(data)
get = (key) ->
console.log data[key] if data[key]
set = (key, value) ->
data[key] = value
save()
remove = ->
delete data[key] if data[key]
save()
exports.start = ->
program.version("0.0.1")
.usage("[options] [key] [value]")
.option("-d, --delete", "delete the specified key")
.parse(process.argv)
[key, value] = program.args
if key and program.delete
remove key
else if key and value
set key, value
else if key
get key
else
console.log program.helpInformation()
| Remove debug message from save method. | Remove debug message from save method.
| CoffeeScript | mit | jimmycuadra/bang |
9a32c562e0b0522a31fe744ac32bf5ee8d30db3f | collections/user_interests.coffee | collections/user_interests.coffee | _ = require 'underscore'
Backbone = require 'backbone'
{ API_URL } = require('sharify').data
UserInterest = require '../models/user_interest.coffee'
module.exports = class UserInterests extends Backbone.Collection
model: UserInterest
url: ->
if (id = @collectorProfile?.id)?
"#{API_URL}/api/v1/collector_profile/#{id}/user_interest"
else
"#{API_URL}/api/v1/me/user_interest"
initialize: (models, { @collectorProfile } = {}) -> #
parse: (response) ->
_.filter response, (obj) ->
not _.isEmpty(obj.interest)
fetch: (options = {}) ->
options.url = "#{@url()}/artists" # Temporary hack for this non-RESTful endpoint
if @collectorProfile?
options.data = _.extend options.data or {}, @collectorProfile.pick('anonymous_session_id')
super options
comparator: (userInterest) ->
-Date.parse(userInterest.get 'updated_at')
findByInterestId: (id) ->
@find (userInterest) ->
userInterest.related().interest.id is id
alreadyInterested: (interest) ->
@findByInterestId(interest.id)?
addInterest: (interest) ->
return if @alreadyInterested interest
@unshift
interest_id: interest.id
interest: interest.attributes
| _ = require 'underscore'
Backbone = require 'backbone'
{ API_URL } = require('sharify').data
UserInterest = require '../models/user_interest.coffee'
module.exports = class UserInterests extends Backbone.Collection
model: UserInterest
interestType: 'Artist' # Should/will be configurable
url: ->
if @collectorProfile?
"#{API_URL}/api/v1/user_interests"
else
"#{API_URL}/api/v1/me/user_interest/artists"
initialize: (models, { @collectorProfile } = {}) ->
@model::urlRoot = if @collectorProfile?
"#{API_URL}/api/v1/user_interest"
else
"#{API_URL}/api/v1/me/user_interest"
parse: (response) ->
_.filter response, (obj) ->
not _.isEmpty(obj.interest)
fetch: (options = {}) ->
if @collectorProfile?
options.data = _.extend options.data or {}, @owner(),
interest_type: @interestType
super options
comparator: (userInterest) ->
-Date.parse(userInterest.get 'updated_at')
findByInterestId: (id) ->
@find (userInterest) ->
userInterest.related().interest.id is id
alreadyInterested: (interest) ->
@findByInterestId(interest.id)?
owner: ->
if @collectorProfile?
owner_id: @collectorProfile.id, owner_type: 'CollectorProfile'
addInterest: (interest) ->
return if @alreadyInterested interest
@unshift _.extend {
interest_type: @interestType
interest_id: interest.id
interest: interest.attributes
}, @owner()
| Use updated endpoint and fix for legacy endpoint | Use updated endpoint and fix for legacy endpoint
| CoffeeScript | mit | artsy/force,TribeMedia/force-public,damassi/force,erikdstock/force,kanaabe/force,erikdstock/force,artsy/force,dblock/force,oxaudo/force,kanaabe/force,dblock/force,TribeMedia/force-public,kanaabe/force,eessex/force,artsy/force,yuki24/force,anandaroop/force,dblock/force,mzikherman/force,oxaudo/force,joeyAghion/force,mzikherman/force,cavvia/force-1,izakp/force,anandaroop/force,mzikherman/force,yuki24/force,yuki24/force,joeyAghion/force,eessex/force,oxaudo/force,izakp/force,erikdstock/force,xtina-starr/force,eessex/force,kanaabe/force,joeyAghion/force,erikdstock/force,kanaabe/force,damassi/force,oxaudo/force,damassi/force,artsy/force-public,izakp/force,yuki24/force,artsy/force-public,xtina-starr/force,eessex/force,mzikherman/force,joeyAghion/force,cavvia/force-1,izakp/force,cavvia/force-1,xtina-starr/force,cavvia/force-1,anandaroop/force,anandaroop/force,artsy/force,xtina-starr/force,damassi/force |
979c369bbb73ec34329ee8cf8d5ae20047f5834a | app/assets/javascripts/components/users/base.js.coffee | app/assets/javascripts/components/users/base.js.coffee | window.UsersComponent = class UsersComponent
@initialize: ->
@addEventListeners()
@addEventListeners: ->
@userDetailsTooltip()
@respondentsTable()
#Enables search through users table
enableSearch()
@userDetailsTooltip: ->
tooltipClass = '.information-tooltip'
$(document).on('click', "#{tooltipClass}-trigger", (ev) ->
ev.preventDefault()
$this = $(@)
if ($this.find('.fa-align-left').length)
$("#{tooltipClass}-trigger").not(@).siblings(tooltipClass).hide()
$("#{tooltipClass}-trigger").not(@).html('<i class="fa fa-align-left"></i> details')
$this.html('<i class="fa fa-close"></i> close')
$this.siblings(tooltipClass).show()
else
$this.html('<i class="fa fa-align-left"></i> details')
$this.siblings(tooltipClass).hide()
)
@respondentsTable: ->
$('.delegate-box').on('click', ->
$('.respondents-list').slideToggle()
)
$(document).ready -> UsersComponent.initialize()
| window.UsersComponent = class UsersComponent
@initialize: ->
@addEventListeners()
@addEventListeners: ->
@userDetailsTooltip()
@respondentsTable()
#Enables search through users table
enableSearch()
@userDetailsTooltip: ->
tooltipClass = '.information-tooltip'
$(document).on('click', "#{tooltipClass}-trigger", (ev) ->
ev.preventDefault()
$this = $(@)
if ($this.find('.fa-align-left').length)
$("#{tooltipClass}-trigger").not(@).siblings(tooltipClass).hide()
$("#{tooltipClass}-trigger").not(@).html('<i class="fa fa-align-left"></i> details')
$this.html('<i class="fa fa-close"></i> close')
$this.siblings(tooltipClass).show()
else
$this.html('<i class="fa fa-align-left"></i> details')
$this.siblings(tooltipClass).hide()
)
@respondentsTable: ->
$('.delegate-box').on('click', ->
if $(@).attr('checked')
$('.respondents-list').slideDown()
else
$('.respondents-list').slideUp()
)
$(document).ready -> UsersComponent.initialize()
| Fix checkbox to slide correctly only when ticked | Fix checkbox to slide correctly only when ticked
| CoffeeScript | bsd-3-clause | unepwcmc/ORS,unepwcmc/ORS,unepwcmc/ORS,unepwcmc/ORS,unepwcmc/ORS |
93331a516ad18bcb878ce62c001e95dd9fbea14f | test/util/data-gen.coffee | test/util/data-gen.coffee | "use strict"
ObjectID = require('mongodb').ObjectID
Moniker = require('moniker')
rand = (min, max) -> Math.floor (Math.random() * (max - min + 1) + min)
lisence = [
"CC BY-NC-ND 3.0 NO"
"CC BY-NC 3.0 NO"
"CC BY-ND 3.0 NO"
"CC BY 3.0 NO"
]
provider = [
"DNT"
"NRK"
"TURAPP"
]
tags = [
'Sted'
'Hytte'
]
module.exports = (num) ->
now = new Date().getTime()
past = now - 100000000000
num = num or 100
ret = []
for i in [1..num]
d1 = rand(past, now)
d2 = rand(d1, now)
ret.push
_id: new ObjectID()
opprettet: new Date(d1).toISOString()
endret: new Date(d2).toISOString()
tilbyder: provider[rand(0, provider.length-1)]
lisens: lisence[rand(0, lisence.length-1)]
navn: Moniker.choose()
tags: [tags[rand(0, tags.length-1)]]
privat:
foo: Moniker.choose()
bar: Moniker.choose()
ret
| "use strict"
ObjectID = require('mongodb').ObjectID
Moniker = require('moniker')
rand = (min, max) -> Math.floor (Math.random() * (max - min + 1) + min)
lisence = [
"CC BY-NC-ND 3.0 NO"
"CC BY-NC 3.0 NO"
"CC BY-ND 3.0 NO"
"CC BY 3.0 NO"
]
provider = [
"DNT"
"NRK"
"TURAPP"
]
statuses = [
"Offentlig"
"Privat"
"Kladd"
"Slettet"
]
tags = [
'Sted'
'Hytte'
]
module.exports = (num) ->
now = new Date().getTime()
past = now - 100000000000
num = num or 100
ret = []
for i in [1..num]
d1 = rand(past, now)
d2 = rand(d1, now)
ret.push
_id: new ObjectID()
opprettet: new Date(d1).toISOString()
endret: new Date(d2).toISOString()
tilbyder: provider[rand(0, provider.length-1)]
lisens: lisence[rand(0, lisence.length-1)]
status: statuses[rand(0, statuses.length-1)]
navn: Moniker.choose()
tags: [tags[rand(0, tags.length-1)]]
privat:
foo: Moniker.choose()
bar: Moniker.choose()
ret
| Add support for document status in data gen | Add support for document status in data gen
| CoffeeScript | mit | Turbasen/Turbasen,Turistforeningen/Turbasen |
42ed7ea5e34b501e8225dd5cd4f0e84dedc24b1e | core/app/backbone/collections/ndp_evidence_collection.coffee | core/app/backbone/collections/ndp_evidence_collection.coffee | class window.NDPEvidenceCollection extends Backbone.Collection
initialize: (models, options) ->
@on 'change', @sort, @
@fact = options.fact
constructor: (models, options) ->
super
unless models and models.length > 0
@reset [
new OpinionatersEvidence {type: 'believe'}, collection: this
new OpinionatersEvidence {type: 'disbelieve'}, collection: this
new OpinionatersEvidence {type: 'doubt'}, collection: this
]
comparator: (item) -> - item.get('impact')
url: ->
'/facts/#{@fact.id}/interactors'
| class window.NDPEvidenceCollection extends Backbone.Collection
initialize: (models, options) ->
@on 'change', @sort, @
@fact = options.fact
constructor: (models, options) ->
super
unless models and models.length > 0
@reset [
new OpinionatersEvidence {type: 'believe'}, collection: this
new OpinionatersEvidence {type: 'disbelieve'}, collection: this
new OpinionatersEvidence {type: 'doubt'}, collection: this
]
comparator: (item) -> - item.get('impact')
| Revert "Added url for NDPEvidenceCollection" | Revert "Added url for NDPEvidenceCollection"
This reverts commit 4cbcb9b3947112bc980da95cc7078bbae0291882.
| CoffeeScript | mit | daukantas/factlink-core,Factlink/factlink-core,daukantas/factlink-core,Factlink/factlink-core,daukantas/factlink-core,daukantas/factlink-core,Factlink/factlink-core,Factlink/factlink-core |
71793054d87e5d6abcfb336f0751a6a1f8b3b215 | lib/tab-view.coffee | lib/tab-view.coffee | {$, View} = require 'atom'
path = require 'path'
module.exports =
class TabView extends View
@content: ->
@li class: 'tab sortable', =>
@div class: 'title', outlet: 'title'
@div class: 'close-icon'
initialize: (@item, @pane) ->
@item.on? 'title-changed', =>
@updateTitle()
@updateTooltip()
@item.on? 'modified-status-changed', =>
@updateModifiedStatus()
@updateTitle()
@updateModifiedStatus()
@updateTooltip()
updateTooltip: ->
@destroyTooltip()
if itemPath = @item.getPath?()
@setTooltip
title: itemPath
delay:
show: 2000
hide: 100
placement: 'bottom'
beforeRemove: ->
@destroyTooltip()
updateTitle: ->
return if @updatingTitle
@updatingTitle = true
title = @item.getTitle()
useLongTitle = false
for tab in @getSiblingTabs()
if tab.item.getTitle() is title
tab.updateTitle()
useLongTitle = true
title = @item.getLongTitle?() ? title if useLongTitle
@title.text(title)
@updatingTitle = false
getSiblingTabs: ->
@siblings('.tab').views()
updateModifiedStatus: ->
if @item.isModified?()
@addClass('modified') unless @isModified
@isModified = true
else
@removeClass('modified') if @isModified
@isModified = false
| {$, View} = require 'atom'
_ = require 'underscore-plus'
path = require 'path'
module.exports =
class TabView extends View
@content: ->
@li class: 'tab sortable', =>
@div class: 'title', outlet: 'title'
@div class: 'close-icon'
initialize: (@item, @pane) ->
@item.on? 'title-changed', =>
@updateTitle()
@updateTooltip()
@item.on? 'modified-status-changed', =>
@updateModifiedStatus()
@updateTitle()
@updateModifiedStatus()
@updateTooltip()
updateTooltip: ->
@destroyTooltip()
if itemPath = @item.getPath?()
@setTooltip
title: _.escape(itemPath)
delay:
show: 2000
hide: 100
placement: 'bottom'
beforeRemove: ->
@destroyTooltip()
updateTitle: ->
return if @updatingTitle
@updatingTitle = true
title = @item.getTitle()
useLongTitle = false
for tab in @getSiblingTabs()
if tab.item.getTitle() is title
tab.updateTitle()
useLongTitle = true
title = @item.getLongTitle?() ? title if useLongTitle
@title.text(title)
@updatingTitle = false
getSiblingTabs: ->
@siblings('.tab').views()
updateModifiedStatus: ->
if @item.isModified?()
@addClass('modified') unless @isModified
@isModified = true
else
@removeClass('modified') if @isModified
@isModified = false
| Use _.escape to escape tooltip titles | Use _.escape to escape tooltip titles | CoffeeScript | mit | atom/tabs,harai/tabs,pombredanne/tabs,acontreras89/tabs |
5c53dc9b12ccb40aa87e81a1877b5511174a4458 | roles/fedora_laptop/files/atom/config.cson | roles/fedora_laptop/files/atom/config.cson | "*":
"activate-power-mode":
autoToggle: false
comboMode:
enabled: false
plugins:
playAudio: true
screenShake: true
"autocomplete-plus":
confirmCompletion: "enter"
useCoreMovementCommands: false
"autocomplete-python-jedi":
fuzzyMatcher: false
useSnippets: "required"
core:
audioBeep: false
automaticallyUpdate: false
closeDeletedFileTabs: true
disabledPackages: [
"exception-reporting"
"markdown-preview"
]
telemetryConsent: "limited"
editor:
invisibles: {}
showIndentGuide: true
"git-plus":
experimental:
stageFilesBeta: false
general: {}
linter: {}
"linter-ui-default": {}
"tree-view": {}
"vim-mode-plus": {}
welcome:
showOnStartup: false
| "*":
"activate-power-mode":
autoToggle: false
comboMode:
enabled: false
plugins:
playAudio: true
screenShake: true
"autocomplete-plus":
confirmCompletion: "enter"
useCoreMovementCommands: false
"autocomplete-python-jedi":
fuzzyMatcher: false
useSnippets: "required"
core:
audioBeep: false
automaticallyUpdate: false
closeDeletedFileTabs: true
disabledPackages: [
"exception-reporting"
"markdown-preview"
]
telemetryConsent: "limited"
editor:
invisibles: {}
showIndentGuide: true
softWrap: false
softWrapAtPreferredLineLength: false
"git-plus":
experimental:
stageFilesBeta: false
general: {}
linter: {}
"linter-ui-default": {}
"tree-view": {}
"vim-mode-plus": {}
welcome:
showOnStartup: false
".asciidoc.source":
editor:
softWrap: true
softWrapAtPreferredLineLength: true
".md.text":
editor:
softWrap: true
softWrapAtPreferredLineLength: true
".gfm.source":
editor:
softWrap: true
softWrapAtPreferredLineLength: true
".plain.text":
editor:
softWrap: true
softWrapAtPreferredLineLength: true
| Enable soft wrap in Atom for text files. | Enable soft wrap in Atom for text files.
Markdown reference:
https://discuss.atom.io/t/soft-wrap-support-but-only-for-markdown/46374/2
| CoffeeScript | mit | ghyde/my-ansible-playbooks |
a7d4fc22c7281e6e93c93fc1d37c9effb426c6e8 | algo/binary-search.coffee | algo/binary-search.coffee |
{ isListAscending } = require './is-list-ascending.coffee'
_binarySearch = (sortedList, needle, start, end)->
return -1 if end < start
mid = Math.floor (start + ((end - start) / 2))
return mid if sortedList[mid] is needle
if sortedList[mid] > needle
return _binarySearch sortedList, needle, start, mid - 1
else
return _binarySearch sortedList, needle, mid + 1, end
@binarySearch = (sortedList, needle)->
throw new Error 'Unsorted List' unless isListAscending sortedList
return _binarySearch sortedList, needle, 0, sortedList.length-1
|
{ isListAscending } = require './is-list-ascending.coffee'
_binarySearch = (sortedList, needle)->
return -1 if sortedList.length is 0
mid = Math.floor (sortedList.length / 2)
return mid if sortedList[mid] is needle
if sortedList[mid] > needle
return _binarySearch sortedList[0..mid - 1], needle
else
res = _binarySearch sortedList[mid+1..sortedList.length], needle
return (if res is -1 then -1 else res + mid + 1)
@binarySearch = (sortedList, needle)->
throw new Error 'Unsorted List' unless isListAscending sortedList
return _binarySearch sortedList, needle
| Revert "Revert "CHECKPOINT re-implemented binarySearch using slices"" | Revert "Revert "CHECKPOINT re-implemented binarySearch using slices""
This reverts commit 71ac993cfc9b521cbb2492d2ce31943d08bb84ab.
| CoffeeScript | mit | iShafayet/algorithms-in-coffeescript |
7d1a6093190f9ff554e1b46760135cdaa748e3ff | components/modalize/view.coffee | components/modalize/view.coffee | _ = require 'underscore'
Backbone = require 'backbone'
template = require './templates/index.coffee'
Scrollbar = require '../scrollbar/index.coffee'
module.exports = class Modalize extends Backbone.View
className: 'modalize'
defaults: dimensions: width: '400px'
events:
'click .js-modalize-backdrop': 'maybeClose'
'click .js-modalize-close': 'close'
initialize: (options = {}) ->
{ @subView, @dimensions } = _.defaults options, @defaults
@scrollbar = new Scrollbar
state: (state, callback = $.noop) ->
_.defer =>
@$el
.attr 'data-state', state
.one $.support.transition.end, callback
.emulateTransitionEnd 250
render: ->
unless @__rendered__
@$el.html template()
@__rendered__ = true
@postRender()
this
postRender: ->
unless @__postRendered__
@$('.js-modalize-dialog').css @dimensions
@$('.js-modalize-body').html @subView.render().$el
@scrollbar.disable()
@state 'open'
@__postRendered__ = true
else
@subView.render().$el
maybeClose: (e) ->
@close() if $(e.target).hasClass('js-modalize-backdrop')
close: (callback) ->
@scrollbar.reenable()
@state 'close', =>
@subView?.remove?()
@remove()
callback?()
| _ = require 'underscore'
Backbone = require 'backbone'
template = require './templates/index.coffee'
Scrollbar = require '../scrollbar/index.coffee'
module.exports = class Modalize extends Backbone.View
className: 'modalize'
defaults: dimensions: width: '400px'
events:
'click .js-modalize-backdrop': 'maybeClose'
'click .js-modalize-close': 'close'
initialize: (options = {}) ->
{ @subView, @dimensions } = _.defaults options, @defaults
@scrollbar = new Scrollbar
$(window).on 'keyup.modalize', @escape
state: (state, callback = $.noop) ->
_.defer =>
@$el
.attr 'data-state', state
.one $.support.transition.end, callback
.emulateTransitionEnd 250
render: ->
unless @__rendered__
@$el.html template()
@__rendered__ = true
@postRender()
this
postRender: ->
unless @__postRendered__
@$('.js-modalize-dialog').css @dimensions
@$('.js-modalize-body').html @subView.render().$el
@scrollbar.disable()
@state 'open'
@__postRendered__ = true
else
@subView.render().$el
escape: (e) =>
@close() if e.which is 27
maybeClose: (e) ->
@close() if $(e.target).hasClass('js-modalize-backdrop')
close: (callback) ->
$(window).off 'keyup.modalize'
@scrollbar.reenable()
@state 'close', =>
@subView?.remove?()
@remove()
callback?()
| Support ESC key for closing modalize modals | Support ESC key for closing modalize modals
| CoffeeScript | mit | artsy/force,artsy/force,kanaabe/force,yuki24/force,TribeMedia/force-public,erikdstock/force,izakp/force,eessex/force,damassi/force,artsy/force-public,joeyAghion/force,dblock/force,erikdstock/force,damassi/force,izakp/force,oxaudo/force,xtina-starr/force,kanaabe/force,anandaroop/force,eessex/force,izakp/force,eessex/force,mzikherman/force,joeyAghion/force,oxaudo/force,TribeMedia/force-public,artsy/force,anandaroop/force,cavvia/force-1,xtina-starr/force,cavvia/force-1,kanaabe/force,damassi/force,joeyAghion/force,erikdstock/force,cavvia/force-1,dblock/force,xtina-starr/force,artsy/force,oxaudo/force,yuki24/force,mzikherman/force,kanaabe/force,joeyAghion/force,anandaroop/force,yuki24/force,mzikherman/force,anandaroop/force,cavvia/force-1,eessex/force,damassi/force,mzikherman/force,artsy/force-public,kanaabe/force,oxaudo/force,xtina-starr/force,erikdstock/force,dblock/force,izakp/force,yuki24/force |
0688ddf083fb43edd71fca483fabf6a2eff053d2 | exports/atom.coffee | exports/atom.coffee | {Point, Range} = require 'text-buffer'
module.exports =
_: require 'underscore-plus'
BufferedNodeProcess: require '../src/buffered-node-process'
BufferedProcess: require '../src/buffered-process'
fs: require 'fs-plus'
Git: require '../src/git'
Point: Point
Range: Range
# The following classes can't be used from a Task handler and should therefore
# only be exported when not running as a child node process
unless process.env.ATOM_SHELL_INTERNAL_RUN_AS_NODE
{$, $$, $$$, View} = require '../src/space-pen-extensions'
module.exports.$ = $
module.exports.$$ = $$
module.exports.$$$ = $$$
module.exports.EditorView = require '../src/editor-view'
module.exports.ScrollView = require '../src/scroll-view'
module.exports.SelectListView = require '../src/select-list-view'
module.exports.Task = require '../src/task'
module.exports.View = View
module.exports.WorkspaceView = require '../src/workspace-view'
| {Point, Range} = require 'text-buffer'
module.exports =
BufferedNodeProcess: require '../src/buffered-node-process'
BufferedProcess: require '../src/buffered-process'
Git: require '../src/git'
Point: Point
Range: Range
# The following classes can't be used from a Task handler and should therefore
# only be exported when not running as a child node process
unless process.env.ATOM_SHELL_INTERNAL_RUN_AS_NODE
{$, $$, $$$, View} = require '../src/space-pen-extensions'
module.exports.$ = $
module.exports.$$ = $$
module.exports.$$$ = $$$
module.exports.EditorView = require '../src/editor-view'
module.exports.ScrollView = require '../src/scroll-view'
module.exports.SelectListView = require '../src/select-list-view'
module.exports.Task = require '../src/task'
module.exports.View = View
module.exports.WorkspaceView = require '../src/workspace-view'
| Remove _ and fs from exports | Remove _ and fs from exports
| CoffeeScript | mit | ralphtheninja/atom,decaffeinate-examples/atom,bcoe/atom,nvoron23/atom,johnrizzo1/atom,hagb4rd/atom,Hasimir/atom,ezeoleaf/atom,vcarrera/atom,phord/atom,Jdesk/atom,charleswhchan/atom,dannyflax/atom,gisenberg/atom,codex8/atom,jlord/atom,ali/atom,Arcanemagus/atom,vinodpanicker/atom,mnquintana/atom,ironbox360/atom,kittens/atom,omarhuanca/atom,tjkr/atom,bolinfest/atom,russlescai/atom,florianb/atom,Jonekee/atom,Andrey-Pavlov/atom,ppamorim/atom,Jonekee/atom,ezeoleaf/atom,xream/atom,sekcheong/atom,helber/atom,AlbertoBarrago/atom,jjz/atom,woss/atom,beni55/atom,Ju2ender/atom,russlescai/atom,mnquintana/atom,panuchart/atom,xream/atom,fredericksilva/atom,oggy/atom,davideg/atom,fedorov/atom,einarmagnus/atom,helber/atom,scv119/atom,targeter21/atom,lovesnow/atom,mnquintana/atom,basarat/atom,jlord/atom,g2p/atom,Rodjana/atom,stinsonga/atom,daxlab/atom,transcranial/atom,davideg/atom,ironbox360/atom,qiujuer/atom,dijs/atom,Austen-G/BlockBuilder,niklabh/atom,dsandstrom/atom,mertkahyaoglu/atom,vinodpanicker/atom,john-kelly/atom,vjeux/atom,prembasumatary/atom,AlisaKiatkongkumthon/atom,sebmck/atom,Locke23rus/atom,russlescai/atom,pombredanne/atom,john-kelly/atom,ilovezy/atom,matthewclendening/atom,svanharmelen/atom,Rychard/atom,bj7/atom,phord/atom,mostafaeweda/atom,0x73/atom,kjav/atom,qskycolor/atom,alexandergmann/atom,toqz/atom,alexandergmann/atom,qskycolor/atom,AlexxNica/atom,bcoe/atom,mdumrauf/atom,bradgearon/atom,KENJU/atom,yamhon/atom,brumm/atom,Andrey-Pavlov/atom,ardeshirj/atom,hellendag/atom,matthewclendening/atom,basarat/atom,jeremyramin/atom,jordanbtucker/atom,rxkit/atom,decaffeinate-examples/atom,palita01/atom,Shekharrajak/atom,execjosh/atom,yomybaby/atom,KENJU/atom,splodingsocks/atom,lpommers/atom,kjav/atom,me6iaton/atom,panuchart/atom,vinodpanicker/atom,qiujuer/atom,amine7536/atom,anuwat121/atom,mdumrauf/atom,001szymon/atom,abcP9110/atom,sillvan/atom,abcP9110/atom,yalexx/atom,execjosh/atom,GHackAnonymous/atom,rmartin/atom,lovesnow/atom,chfritz/atom,fscherwi/atom,RuiDGoncalves/atom,dsandstrom/atom,sillvan/atom,brumm/atom,basarat/atom,lisonma/atom,gontadu/atom,yomybaby/atom,kittens/atom,crazyquark/atom,synaptek/atom,burodepeper/atom,fredericksilva/atom,hpham04/atom,Neron-X5/atom,ObviouslyGreen/atom,dsandstrom/atom,bsmr-x-script/atom,targeter21/atom,fang-yufeng/atom,Jdesk/atom,mostafaeweda/atom,ali/atom,champagnez/atom,Galactix/atom,jlord/atom,MjAbuz/atom,AlbertoBarrago/atom,bryonwinger/atom,ironbox360/atom,jtrose2/atom,Klozz/atom,amine7536/atom,githubteacher/atom,Jandersolutions/atom,kittens/atom,svanharmelen/atom,toqz/atom,hpham04/atom,FIT-CSE2410-A-Bombs/atom,erikhakansson/atom,g2p/atom,h0dgep0dge/atom,rmartin/atom,targeter21/atom,kandros/atom,ivoadf/atom,ilovezy/atom,oggy/atom,kdheepak89/atom,acontreras89/atom,davideg/atom,synaptek/atom,mertkahyaoglu/atom,anuwat121/atom,efatsi/atom,qskycolor/atom,decaffeinate-examples/atom,001szymon/atom,dijs/atom,jtrose2/atom,Sangaroonaom/atom,gontadu/atom,brettle/atom,omarhuanca/atom,panuchart/atom,liuxiong332/atom,Jdesk/atom,me-benni/atom,MjAbuz/atom,FIT-CSE2410-A-Bombs/atom,abcP9110/atom,transcranial/atom,Mokolea/atom,BogusCurry/atom,NunoEdgarGub1/atom,codex8/atom,dannyflax/atom,ivoadf/atom,hagb4rd/atom,efatsi/atom,elkingtonmcb/atom,kaicataldo/atom,johnrizzo1/atom,kc8wxm/atom,vjeux/atom,vinodpanicker/atom,mostafaeweda/atom,hpham04/atom,kaicataldo/atom,brumm/atom,scv119/atom,cyzn/atom,crazyquark/atom,rlugojr/atom,pkdevbox/atom,andrewleverette/atom,champagnez/atom,Jandersoft/atom,jjz/atom,Galactix/atom,ardeshirj/atom,kjav/atom,tony612/atom,yomybaby/atom,PKRoma/atom,harshdattani/atom,constanzaurzua/atom,YunchengLiao/atom,abe33/atom,amine7536/atom,ilovezy/atom,woss/atom,fedorov/atom,Rodjana/atom,palita01/atom,Rodjana/atom,deepfox/atom,NunoEdgarGub1/atom,Austen-G/BlockBuilder,yangchenghu/atom,medovob/atom,rlugojr/atom,champagnez/atom,NunoEdgarGub1/atom,kdheepak89/atom,erikhakansson/atom,Rychard/atom,phord/atom,darwin/atom,ezeoleaf/atom,kjav/atom,ReddTea/atom,gisenberg/atom,jlord/atom,davideg/atom,AlisaKiatkongkumthon/atom,nucked/atom,kandros/atom,Abdillah/atom,dkfiresky/atom,boomwaiza/atom,omarhuanca/atom,Huaraz2/atom,lisonma/atom,folpindo/atom,ObviouslyGreen/atom,dannyflax/atom,rmartin/atom,florianb/atom,tony612/atom,pkdevbox/atom,ykeisuke/atom,crazyquark/atom,constanzaurzua/atom,DiogoXRP/atom,batjko/atom,Huaraz2/atom,batjko/atom,gisenberg/atom,fang-yufeng/atom,john-kelly/atom,Jandersoft/atom,G-Baby/atom,mertkahyaoglu/atom,targeter21/atom,fang-yufeng/atom,stinsonga/atom,Shekharrajak/atom,jacekkopecky/atom,Locke23rus/atom,daxlab/atom,burodepeper/atom,sillvan/atom,liuxiong332/atom,me-benni/atom,RobinTec/atom,pengshp/atom,nvoron23/atom,githubteacher/atom,bsmr-x-script/atom,acontreras89/atom,cyzn/atom,yomybaby/atom,tanin47/atom,Jandersoft/atom,gisenberg/atom,mertkahyaoglu/atom,G-Baby/atom,vcarrera/atom,sebmck/atom,AlexxNica/atom,Shekharrajak/atom,mertkahyaoglu/atom,bencolon/atom,Andrey-Pavlov/atom,Shekharrajak/atom,mostafaeweda/atom,SlimeQ/atom,sxgao3001/atom,RobinTec/atom,chengky/atom,bcoe/atom,pombredanne/atom,SlimeQ/atom,sotayamashita/atom,ilovezy/atom,fredericksilva/atom,liuxiong332/atom,Austen-G/BlockBuilder,PKRoma/atom,kaicataldo/atom,devmario/atom,johnrizzo1/atom,scippio/atom,rjattrill/atom,ReddTea/atom,Hasimir/atom,seedtigo/atom,yomybaby/atom,liuxiong332/atom,sebmck/atom,fedorov/atom,atom/atom,rsvip/aTom,rmartin/atom,ppamorim/atom,GHackAnonymous/atom,gabrielPeart/atom,niklabh/atom,tjkr/atom,n-riesco/atom,rjattrill/atom,lovesnow/atom,bradgearon/atom,Galactix/atom,tony612/atom,ezeoleaf/atom,Hasimir/atom,vhutheesing/atom,jlord/atom,pombredanne/atom,Klozz/atom,Arcanemagus/atom,seedtigo/atom,nvoron23/atom,andrewleverette/atom,basarat/atom,devoncarew/atom,amine7536/atom,kjav/atom,FoldingText/atom,jjz/atom,alfredxing/atom,ykeisuke/atom,FoldingText/atom,KENJU/atom,chengky/atom,Ingramz/atom,GHackAnonymous/atom,stinsonga/atom,tanin47/atom,YunchengLiao/atom,codex8/atom,liuxiong332/atom,ivoadf/atom,batjko/atom,pengshp/atom,me6iaton/atom,johnhaley81/atom,vcarrera/atom,Rychard/atom,bryonwinger/atom,0x73/atom,vjeux/atom,medovob/atom,devoncarew/atom,qiujuer/atom,dannyflax/atom,Sangaroonaom/atom,Ju2ender/atom,hharchani/atom,yalexx/atom,prembasumatary/atom,elkingtonmcb/atom,sotayamashita/atom,stinsonga/atom,h0dgep0dge/atom,russlescai/atom,constanzaurzua/atom,originye/atom,qiujuer/atom,qskycolor/atom,hakatashi/atom,ali/atom,liuderchi/atom,dkfiresky/atom,sxgao3001/atom,rookie125/atom,bradgearon/atom,constanzaurzua/atom,kc8wxm/atom,hakatashi/atom,sxgao3001/atom,Abdillah/atom,me6iaton/atom,originye/atom,Jdesk/atom,kevinrenaers/atom,kdheepak89/atom,YunchengLiao/atom,devoncarew/atom,batjko/atom,tmunro/atom,hellendag/atom,ashneo76/atom,jacekkopecky/atom,folpindo/atom,synaptek/atom,rsvip/aTom,devmario/atom,sekcheong/atom,bryonwinger/atom,Andrey-Pavlov/atom,Austen-G/BlockBuilder,Ingramz/atom,crazyquark/atom,Abdillah/atom,fang-yufeng/atom,ppamorim/atom,tony612/atom,ppamorim/atom,jacekkopecky/atom,isghe/atom,sillvan/atom,Ju2ender/atom,Abdillah/atom,xream/atom,matthewclendening/atom,charleswhchan/atom,hharchani/atom,hharchani/atom,scv119/atom,sillvan/atom,einarmagnus/atom,Arcanemagus/atom,chengky/atom,mrodalgaard/atom,Ju2ender/atom,execjosh/atom,GHackAnonymous/atom,abe33/atom,atom/atom,omarhuanca/atom,wiggzz/atom,Dennis1978/atom,charleswhchan/atom,dannyflax/atom,BogusCurry/atom,Austen-G/BlockBuilder,johnhaley81/atom,dijs/atom,codex8/atom,einarmagnus/atom,Galactix/atom,liuderchi/atom,deoxilix/atom,FoldingText/atom,bcoe/atom,liuderchi/atom,rsvip/aTom,einarmagnus/atom,scv119/atom,0x73/atom,Neron-X5/atom,Jandersoft/atom,pombredanne/atom,batjko/atom,Ingramz/atom,ardeshirj/atom,vjeux/atom,ilovezy/atom,charleswhchan/atom,dsandstrom/atom,me6iaton/atom,AdrianVovk/substance-ide,stuartquin/atom,fscherwi/atom,scippio/atom,jacekkopecky/atom,CraZySacX/atom,vcarrera/atom,gzzhanghao/atom,0x73/atom,lovesnow/atom,Galactix/atom,pkdevbox/atom,liuderchi/atom,decaffeinate-examples/atom,andrewleverette/atom,RobinTec/atom,harshdattani/atom,KENJU/atom,rmartin/atom,gontadu/atom,Dennis1978/atom,jordanbtucker/atom,scippio/atom,PKRoma/atom,001szymon/atom,githubteacher/atom,boomwaiza/atom,Austen-G/BlockBuilder,fredericksilva/atom,vjeux/atom,erikhakansson/atom,ObviouslyGreen/atom,omarhuanca/atom,n-riesco/atom,rlugojr/atom,Sangaroonaom/atom,florianb/atom,Mokolea/atom,tony612/atom,efatsi/atom,prembasumatary/atom,Andrey-Pavlov/atom,devoncarew/atom,MjAbuz/atom,Abdillah/atom,jacekkopecky/atom,paulcbetts/atom,tisu2tisu/atom,boomwaiza/atom,SlimeQ/atom,NunoEdgarGub1/atom,cyzn/atom,YunchengLiao/atom,acontreras89/atom,Dennis1978/atom,rxkit/atom,codex8/atom,nrodriguez13/atom,stuartquin/atom,SlimeQ/atom,rsvip/aTom,mrodalgaard/atom,chfritz/atom,hpham04/atom,abe33/atom,paulcbetts/atom,lpommers/atom,bcoe/atom,johnhaley81/atom,AlisaKiatkongkumthon/atom,seedtigo/atom,vinodpanicker/atom,gzzhanghao/atom,chengky/atom,AlbertoBarrago/atom,mnquintana/atom,n-riesco/atom,fedorov/atom,jeremyramin/atom,brettle/atom,acontreras89/atom,splodingsocks/atom,palita01/atom,chfritz/atom,jjz/atom,nrodriguez13/atom,rjattrill/atom,medovob/atom,n-riesco/atom,paulcbetts/atom,Ju2ender/atom,ralphtheninja/atom,fang-yufeng/atom,Klozz/atom,ReddTea/atom,lisonma/atom,bolinfest/atom,bryonwinger/atom,folpindo/atom,BogusCurry/atom,lisonma/atom,yangchenghu/atom,kc8wxm/atom,harshdattani/atom,oggy/atom,RobinTec/atom,sotayamashita/atom,mnquintana/atom,jtrose2/atom,sebmck/atom,kandros/atom,tmunro/atom,amine7536/atom,tisu2tisu/atom,t9md/atom,rsvip/aTom,fscherwi/atom,G-Baby/atom,ali/atom,einarmagnus/atom,hharchani/atom,rjattrill/atom,MjAbuz/atom,dkfiresky/atom,pombredanne/atom,h0dgep0dge/atom,burodepeper/atom,anuwat121/atom,nucked/atom,originye/atom,lovesnow/atom,g2p/atom,toqz/atom,fedorov/atom,ali/atom,ashneo76/atom,devmario/atom,AdrianVovk/substance-ide,hpham04/atom,yangchenghu/atom,charleswhchan/atom,acontreras89/atom,targeter21/atom,alexandergmann/atom,basarat/atom,Huaraz2/atom,isghe/atom,hakatashi/atom,kdheepak89/atom,brettle/atom,yalexx/atom,n-riesco/atom,john-kelly/atom,YunchengLiao/atom,nucked/atom,FoldingText/atom,synaptek/atom,vhutheesing/atom,ykeisuke/atom,vhutheesing/atom,gabrielPeart/atom,GHackAnonymous/atom,helber/atom,Jandersolutions/atom,davideg/atom,deepfox/atom,CraZySacX/atom,fredericksilva/atom,Jandersoft/atom,russlescai/atom,sekcheong/atom,bencolon/atom,basarat/atom,t9md/atom,wiggzz/atom,DiogoXRP/atom,DiogoXRP/atom,MjAbuz/atom,kc8wxm/atom,rookie125/atom,dkfiresky/atom,Locke23rus/atom,kc8wxm/atom,kevinrenaers/atom,SlimeQ/atom,woss/atom,splodingsocks/atom,gabrielPeart/atom,lisonma/atom,crazyquark/atom,john-kelly/atom,transcranial/atom,daxlab/atom,florianb/atom,jtrose2/atom,me6iaton/atom,deepfox/atom,svanharmelen/atom,Mokolea/atom,devmario/atom,Jonekee/atom,devmario/atom,deoxilix/atom,prembasumatary/atom,hellendag/atom,avdg/atom,vcarrera/atom,dkfiresky/atom,beni55/atom,abcP9110/atom,FIT-CSE2410-A-Bombs/atom,nvoron23/atom,bj7/atom,florianb/atom,darwin/atom,bencolon/atom,FoldingText/atom,NunoEdgarGub1/atom,toqz/atom,yalexx/atom,AdrianVovk/substance-ide,Shekharrajak/atom,mdumrauf/atom,woss/atom,isghe/atom,sekcheong/atom,Neron-X5/atom,jjz/atom,Neron-X5/atom,hakatashi/atom,oggy/atom,devoncarew/atom,gzzhanghao/atom,pengshp/atom,me-benni/atom,deepfox/atom,matthewclendening/atom,abcP9110/atom,mostafaeweda/atom,bsmr-x-script/atom,tisu2tisu/atom,kdheepak89/atom,mrodalgaard/atom,nrodriguez13/atom,ReddTea/atom,oggy/atom,jacekkopecky/atom,sxgao3001/atom,kittens/atom,prembasumatary/atom,paulcbetts/atom,sxgao3001/atom,lpommers/atom,nvoron23/atom,splodingsocks/atom,qskycolor/atom,yamhon/atom,niklabh/atom,hagb4rd/atom,sebmck/atom,ReddTea/atom,darwin/atom,Hasimir/atom,gisenberg/atom,AlexxNica/atom,kevinrenaers/atom,tjkr/atom,avdg/atom,RobinTec/atom,constanzaurzua/atom,ashneo76/atom,stuartquin/atom,Jandersolutions/atom,alfredxing/atom,KENJU/atom,Neron-X5/atom,jtrose2/atom,h0dgep0dge/atom,rookie125/atom,Jdesk/atom,wiggzz/atom,RuiDGoncalves/atom,chengky/atom,ralphtheninja/atom,jeremyramin/atom,bj7/atom,yamhon/atom,RuiDGoncalves/atom,dannyflax/atom,tanin47/atom,yalexx/atom,isghe/atom,woss/atom,bolinfest/atom,elkingtonmcb/atom,t9md/atom,CraZySacX/atom,kittens/atom,qiujuer/atom,FoldingText/atom,deoxilix/atom,ppamorim/atom,toqz/atom,Hasimir/atom,Jandersolutions/atom,Jandersolutions/atom,dsandstrom/atom,hagb4rd/atom,isghe/atom,deepfox/atom,synaptek/atom,alfredxing/atom,hagb4rd/atom,atom/atom,beni55/atom,matthewclendening/atom,hharchani/atom,jordanbtucker/atom,sekcheong/atom,rxkit/atom,tmunro/atom,avdg/atom |
a197a6d3b0c75de92fb4e888d4b3b82f77877736 | src/scripts/loader.coffee | src/scripts/loader.coffee | define (require) ->
$ = require('jquery')
Backbone = require('backbone')
router = require('cs!router')
analytics = require('cs!helpers/handlers/analytics') # Setup Analytics Handler
# The root URI prefixed on all non-external AJAX and Backbone URIs
root = '/'
init = (options = {}) ->
# Append /test to the root if the app is in test mode
if options.test
root += 'test/'
external = new RegExp('^((f|ht)tps?:)?//')
# Catch internal application links and let Backbone handle the routing
$(document).on 'click', 'a:not([data-bypass])', (e) ->
href = $(this).attr('href')
# Only handle links intended to be processed by Backbone
if e.isDefaultPrevented() or href.charAt(0) is '#' or /^mailto:.+/.test(href) then return
e.preventDefault()
if external.test(href)
window.open(href, '_blank')
else
router.navigate(href, {trigger: true})
Backbone.history.start
pushState: true
root: root
# Prefix all non-external AJAX requests with the root URI
$.ajaxPrefilter (options, originalOptions, jqXHR) ->
if not external.test(options.url)
options.url = root + options.url
return
return {init: init}
| define (require) ->
$ = require('jquery')
Backbone = require('backbone')
router = require('cs!router')
analytics = require('cs!helpers/handlers/analytics') # Setup Analytics Handler
# The root URI prefixed on all non-external AJAX and Backbone URIs
root = '/'
init = (options = {}) ->
# Append /test to the root if the app is in test mode
if options.test
root += 'test/'
external = new RegExp('^((f|ht)tps?:)?//')
# Catch internal application links and let Backbone handle the routing
$(document).on 'click', 'a:not([data-bypass])', (e) ->
href = $(this).attr('href')
# Only handle links intended to be processed by Backbone
if e.isDefaultPrevented() or href.charAt(0) is '#' or /^mailto:.+/.test(href) then return
e.preventDefault()
if external.test(href)
window.open(href, '_blank')
else
router.navigate(href, {trigger: true})
Backbone.history.start
pushState: true
root: root
# Force Backbone to register the full path including the query in its history
if location.search
router.navigate(location.pathname + location.search, {replace: true})
# Prefix all non-external AJAX requests with the root URI
$.ajaxPrefilter (options, originalOptions, jqXHR) ->
if not external.test(options.url)
options.url = root + options.url
return
return {init: init}
| Include query strings in backbone history | Include query strings in backbone history
| CoffeeScript | agpl-3.0 | katalysteducation/webview,dak/webview,dak/webview,dak/webview,Connexions/webview,Connexions/webview,katalysteducation/webview,Connexions/webview,katalysteducation/webview,katalysteducation/webview,Connexions/webview,carolinelane10/webview |
4fc91d05e0f59d56e1d7ac295e3c519b3dd9c664 | app/assets/javascripts/stores/notification_store.coffee | app/assets/javascripts/stores/notification_store.coffee | # Requirements
#----------------------------------------
McFly = require 'mcfly'
Flux = new McFly()
# Data
#----------------------------------------
_notifications = []
# Private Methods
#----------------------------------------
addNotification = (notification) ->
_notifications.push(notification)
NotificationStore.emitChange()
removeNotification = (notification) ->
_.pull(_notifications, notification)
NotificationStore.emitChange()
# Store
#----------------------------------------
NotificationStore = Flux.createStore
getNotifications: ->
return _notifications
, (payload) ->
switch(payload.actionType)
when 'REMOVE_NOTIFICATION'
removeNotification(payload.notification)
when 'API_FAIL'
data = payload.data
notification = {}
notification.closable = true
notification.type = "error"
if data.responseJSON and data.responseJSON.error
notification.message = data.responseJSON.error
else
notification.message = data.statusText
addNotification(notification)
break
return true
# Exports
#----------------------------------------
module.exports = NotificationStore
| # Requirements
#----------------------------------------
McFly = require 'mcfly'
Flux = new McFly()
# Data
#----------------------------------------
_notifications = []
# Private Methods
#----------------------------------------
addNotification = (notification) ->
_notifications.push(notification)
NotificationStore.emitChange()
removeNotification = (notification) ->
_.pull(_notifications, notification)
NotificationStore.emitChange()
# Store
#----------------------------------------
NotificationStore = Flux.createStore
getNotifications: ->
return _notifications
, (payload) ->
switch(payload.actionType)
when 'REMOVE_NOTIFICATION'
removeNotification(payload.notification)
break
when 'ADD_NOTIFICATION'
addNotification(payload.notification)
break
when 'API_FAIL'
data = payload.data
notification = {}
notification.closable = true
notification.type = "error"
if data.responseJSON and data.responseJSON.error
notification.message = data.responseJSON.error
else
notification.message = data.statusText
addNotification(notification)
break
return true
# Exports
#----------------------------------------
module.exports = NotificationStore
| Update notification store to handle notification action | Update notification store to handle notification action
| CoffeeScript | mit | MusikAnimal/WikiEduDashboard,sejalkhatri/WikiEduDashboard,KarmaHater/WikiEduDashboard,alpha721/WikiEduDashboard,feelfreelinux/WikiEduDashboard,adamwight/WikiEduDashboard,MusikAnimal/WikiEduDashboard,MusikAnimal/WikiEduDashboard,alpha721/WikiEduDashboard,feelfreelinux/WikiEduDashboard,KarmaHater/WikiEduDashboard,majakomel/WikiEduDashboard,sejalkhatri/WikiEduDashboard,KarmaHater/WikiEduDashboard,MusikAnimal/WikiEduDashboard,sejalkhatri/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,sejalkhatri/WikiEduDashboard,Wowu/WikiEduDashboard,Wowu/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,feelfreelinux/WikiEduDashboard,adamwight/WikiEduDashboard,majakomel/WikiEduDashboard,feelfreelinux/WikiEduDashboard,Wowu/WikiEduDashboard,alpha721/WikiEduDashboard,sejalkhatri/WikiEduDashboard,KarmaHater/WikiEduDashboard,adamwight/WikiEduDashboard,Wowu/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,majakomel/WikiEduDashboard,majakomel/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,alpha721/WikiEduDashboard |
ff713f2cd29ad26424995fa31bb1c1e0b0a5e34e | config/social/jkn2-reddit.coffee | config/social/jkn2-reddit.coffee |
configs = []
configs.push
name: "Reddit Comments"
comment:
"""
We select comments, but not responses. This avoids the need to "j" through endless lists of drivel.
"""
regexps: "^https?://[a-z]+\\.reddit\\.com/.*/comments/"
selectors: [
"div#siteTable div.usertext-body"
"div.commentarea > div.sitetable > div.comment"
]
activators: "a[href^='http']:not(.author):not(.bylink)"
configs.push
name: "Reddit"
regexps: "^https?://[a-z]+\\.reddit\\.com/?"
selectors: [
# "div.entry > p.title > a"
"//div[@id='siteTable']/div"
]
activators: "div.entry > p.title > a"
require("../../common.js").Common.mkConfigs configs, name: "Reddit"
|
configs = []
# configs.push
# name: "Reddit Comments"
# comment:
# """
# We select comments, but not responses. This avoids the need to "j" through endless lists of drivel.
# """
# regexps: "^https?://[a-z]+\\.reddit\\.com/.*/comments/"
# selectors: [
# "div#siteTable div.usertext-body"
# "div.commentarea > div.sitetable > div.comment"
# ]
# activators: "a[href^='http']:not(.author):not(.bylink)"
#
# configs.push
# name: "Reddit"
# regexps: "^https?://[a-z]+\\.reddit\\.com/?"
# selectors: [
# # "div.entry > p.title > a"
# "//div[@id='siteTable']/div"
# ]
# activators: "div.entry > p.title > a"
# require("../../common.js").Common.mkConfigs configs, name: "Reddit"
| Disable Reddit (using RES instead). | Disable Reddit (using RES instead).
| CoffeeScript | mit | smblott-github/jk-navigator-too |
a021704f37ef8c01a477f4f9460952f59d524886 | packages/rocketchat-highlight/highlight.coffee | packages/rocketchat-highlight/highlight.coffee | ###
# Highlight is a named function that will highlight ``` messages
# @param {Object} message - The message object
###
class Highlight
# If message starts with ```, replace it for text formatting
constructor: (message) ->
if _.trim message.html
# Separate text in code blocks and non code blocks
msgParts = message.html.split(/(```.*\n[\s\S]*?\n```)/)
for part, index in msgParts
# Verify if this part is code
codeMatch = part.match(/```(.*)\n([\s\S]*?)\n```/)
if codeMatch?
# Process highlight if this part is code
lang = codeMatch[1]
code = _.unescapeHTML codeMatch[2]
if lang not in hljs.listLanguages()
result = hljs.highlightAuto code
else
result = hljs.highlight lang, code
msgParts[index] = "<pre><code class='hljs " + result.language + "'><span class='copyonly'>```<br></span>" + result.value + "<span class='copyonly'><br>```</span></code></pre>"
else
# Escape html and fix line breaks for non code blocks
msgParts[index] = part
# Re-mount message
message.html = msgParts.join('')
return message
RocketChat.callbacks.add 'renderMessage', Highlight, RocketChat.callbacks.priority.HIGH
| ###
# Highlight is a named function that will highlight ``` messages
# @param {Object} message - The message object
###
class Highlight
constructor: (message) ->
if _.trim message.html
# Count occurencies of ```
count = (message.html.match(/```/g) || []).length
if count
# Check if we need to add a final ```
if (count % 2 > 0)
console.log "Even"
message.html = message.html + "\n```"
message.msg = message.msg + "\n```"
# Separate text in code blocks and non code blocks
msgParts = message.html.split(/(```\w*[\n\ ]?[\s\S]*?```+?)/)
for part, index in msgParts
# Verify if this part is code
codeMatch = part.match(/```(\w*)[\n\ ]?([\s\S]*?)```+?/)
if codeMatch?
# Process highlight if this part is code
lang = codeMatch[1]
code = _.unescapeHTML codeMatch[2]
if lang not in hljs.listLanguages()
result = hljs.highlightAuto code
else
result = hljs.highlight lang, code
msgParts[index] = "<pre><code class='hljs " + result.language + "'><span class='copyonly'>```<br></span>" + result.value + "<span class='copyonly'><br>```</span></code></pre>"
else
msgParts[index] = part
# Re-mount message
message.html = msgParts.join('')
return message
RocketChat.callbacks.add 'renderMessage', Highlight, RocketChat.callbacks.priority.HIGH
| Make the pre-formatted code regular expression a lot more permissive | Make the pre-formatted code regular expression a lot more permissive
| CoffeeScript | mit | fatihwk/Rocket.Chat,pitamar/Rocket.Chat,pachox/Rocket.Chat,capensisma/Rocket.Chat,thebakeryio/Rocket.Chat,tntobias/Rocket.Chat,tntobias/Rocket.Chat,kkochubey1/Rocket.Chat,Gudii/Rocket.Chat,timkinnane/Rocket.Chat,fduraibi/Rocket.Chat,Flitterkill/Rocket.Chat,haosdent/Rocket.Chat,tzellman/Rocket.Chat,mitar/Rocket.Chat,soonahn/Rocket.Chat,thebakeryio/Rocket.Chat,ziedmahdi/Rocket.Chat,osxi/Rocket.Chat,Kiran-Rao/Rocket.Chat,fduraibi/Rocket.Chat,florinnichifiriuc/Rocket.Chat,Jandersoft/Rocket.Chat,abduljanjua/TheHub,timkinnane/Rocket.Chat,karlprieb/Rocket.Chat,Deepakkothandan/Rocket.Chat,pachox/Rocket.Chat,lukaroski/traden,LearnersGuild/echo-chat,tntobias/Rocket.Chat,jonathanhartman/Rocket.Chat,intelradoux/Rocket.Chat,rasata/Rocket.Chat,haoyixin/Rocket.Chat,4thParty/Rocket.Chat,pkgodara/Rocket.Chat,leohmoraes/Rocket.Chat,JamesHGreen/Rocket.Chat,nishimaki10/Rocket.Chat,thunderrabbit/Rocket.Chat,mccambridge/Rocket.Chat,nabiltntn/Rocket.Chat,ut7/Rocket.Chat,umeshrs/rocket-chat,himeshp/Rocket.Chat,LeonardOliveros/Rocket.Chat,ederribeiro/Rocket.Chat,madmanteam/Rocket.Chat,mrsimpson/Rocket.Chat,wtsarchive/Rocket.Chat,erikmaarten/Rocket.Chat,qnib/Rocket.Chat,ggazzo/Rocket.Chat,flaviogrossi/Rocket.Chat,gitaboard/Rocket.Chat,MiHuevos/Rocket.Chat,rasata/Rocket.Chat,lukaroski/traden,warcode/Rocket.Chat,lonbaker/Rocket.Chat,tradetiger/Rocket.Chat,jeanmatheussouto/Rocket.Chat,jonathanhartman/Rocket.Chat,lihuanghai/Rocket.Chat,OtkurBiz/Rocket.Chat,xasx/Rocket.Chat,princesust/Rocket.Chat,qnib/Rocket.Chat,amaapp/ama,ut7/Rocket.Chat,jonathanhartman/Rocket.Chat,himeshp/Rocket.Chat,LeonardOliveros/Rocket.Chat,j-ew-s/Rocket.Chat,4thParty/Rocket.Chat,haosdent/Rocket.Chat,matthewshirley/Rocket.Chat,steedos/chat,phlkchan/Rocket.Chat,karlprieb/Rocket.Chat,umeshrs/rocket-chat-integration,Maysora/Rocket.Chat,litewhatever/Rocket.Chat,fonsich/Rocket.Chat,ggazzo/Rocket.Chat,anhld/Rocket.Chat,arvi/Rocket.Chat,callmekatootie/Rocket.Chat,lucasgolino/Rocket.Chat,JamesHGreen/Rocket_API,tradetiger/Rocket.Chat,jessedhillon/Rocket.Chat,mwharrison/Rocket.Chat,LearnersGuild/Rocket.Chat,intelradoux/Rocket.Chat,Dianoga/Rocket.Chat,JisuPark/Rocket.Chat,matthewshirley/Rocket.Chat,jhou2/Rocket.Chat,atyenoria/Rocket.Chat,BorntraegerMarc/Rocket.Chat,LeonardOliveros/Rocket.Chat,Ninotna/Rocket.Chat,callmekatootie/Rocket.Chat,Sing-Li/Rocket.Chat,bopjesvla/chatmafia,jeanmatheussouto/Rocket.Chat,igorstajic/Rocket.Chat,HeapCity/Heap.City,flaviogrossi/Rocket.Chat,greatdinosaur/Rocket.Chat,ut7/Rocket.Chat,wangleihd/Rocket.Chat,wicked539/Rocket.Chat,JamesHGreen/Rocket_API,nrhubbar/Rocket.Chat,alexbrazier/Rocket.Chat,alenodari/Rocket.Chat,yuyixg/Rocket.Chat,ZBoxApp/Rocket.Chat,jadeqwang/Rocket.Chat,nishimaki10/Rocket.Chat,gitaboard/Rocket.Chat,bt/Rocket.Chat,gitaboard/Rocket.Chat,pitamar/Rocket.Chat,subesokun/Rocket.Chat,slava-sh/Rocket.Chat,litewhatever/Rocket.Chat,cdwv/Rocket.Chat,mhurwi/Rocket.Chat,mwharrison/Rocket.Chat,acaronmd/Rocket.Chat,HeapCity/Heap.City,fduraibi/Rocket.Chat,Gromby/Rocket.Chat,nabiltntn/Rocket.Chat,Jandersoft/Rocket.Chat,psadaic/Rocket.Chat,cnash/Rocket.Chat,thunderrabbit/Rocket.Chat,bopjesvla/chatmafia,ederribeiro/Rocket.Chat,callblueday/Rocket.Chat,fatihwk/Rocket.Chat,abhishekshukla0302/trico,yuyixg/Rocket.Chat,inoxth/Rocket.Chat,ealbers/Rocket.Chat,subesokun/Rocket.Chat,Gudii/Rocket.Chat,katopz/Rocket.Chat,mwharrison/Rocket.Chat,janmaghuyop/Rocket.Chat,bopjesvla/chatmafia,sargentsurg/Rocket.Chat,galrotem1993/Rocket.Chat,biomassives/Rocket.Chat,litewhatever/Rocket.Chat,klatys/Rocket.Chat,jeann2013/Rocket.Chat,JamesHGreen/Rocket_API,Abdelhamidhenni/Rocket.Chat,trt15-ssci-organization/Rocket.Chat,tlongren/Rocket.Chat,rasata/Rocket.Chat,amaapp/ama,mrinaldhar/Rocket.Chat,icaromh/Rocket.Chat,sscpac/chat-locker,snaiperskaya96/Rocket.Chat,nabiltntn/Rocket.Chat,BorntraegerMarc/Rocket.Chat,Deepakkothandan/Rocket.Chat,mitar/Rocket.Chat,webcoding/Rocket.Chat,lukaroski/traden,greatdinosaur/Rocket.Chat,andela-cnnadi/Rocket.Chat,Deepakkothandan/Rocket.Chat,katopz/Rocket.Chat,Jandersolutions/Rocket.Chat,sunhaolin/Rocket.Chat,AimenJoe/Rocket.Chat,Achaikos/Rocket.Chat,phlkchan/Rocket.Chat,capensisma/Rocket.Chat,karlprieb/Rocket.Chat,danielbressan/Rocket.Chat,williamfortunademoraes/Rocket.Chat,slava-sh/Rocket.Chat,philosowaffle/rpi-Rocket.Chat,acidicX/Rocket.Chat,atyenoria/Rocket.Chat,BorntraegerMarc/Rocket.Chat,acaronmd/Rocket.Chat,inoio/Rocket.Chat,princesust/Rocket.Chat,himeshp/Rocket.Chat,Gyubin/Rocket.Chat,apnero/tactixteam,ndarilek/Rocket.Chat,mrinaldhar/Rocket.Chat,trt15-ssci-organization/Rocket.Chat,liuliming2008/Rocket.Chat,celloudiallo/Rocket.Chat,TribeMedia/Rocket.Chat,dmitrijs-balcers/Rocket.Chat,Gromby/Rocket.Chat,jadeqwang/Rocket.Chat,uniteddiversity/Rocket.Chat,igorstajic/Rocket.Chat,leohmoraes/Rocket.Chat,kkochubey1/Rocket.Chat,osxi/Rocket.Chat,JamesHGreen/Rocket.Chat,k0nsl/Rocket.Chat,qnib/Rocket.Chat,k0nsl/Rocket.Chat,callblueday/Rocket.Chat,steedos/chat,philosowaffle/rpi-Rocket.Chat,mitar/Rocket.Chat,karlprieb/Rocket.Chat,florinnichifiriuc/Rocket.Chat,adamteece/Rocket.Chat,philosowaffle/rpi-Rocket.Chat,lucasgolino/Rocket.Chat,princesust/Rocket.Chat,galrotem1993/Rocket.Chat,ludiculous/Rocket.Chat,haoyixin/Rocket.Chat,Gromby/Rocket.Chat,Sing-Li/Rocket.Chat,mrinaldhar/Rocket.Chat,ndarilek/Rocket.Chat,KyawNaingTun/Rocket.Chat,Flitterkill/Rocket.Chat,ahmadassaf/Rocket.Chat,jyx140521/Rocket.Chat,christmo/Rocket.Chat,PavelVanecek/Rocket.Chat,revspringjake/Rocket.Chat,mrsimpson/Rocket.Chat,flaviogrossi/Rocket.Chat,litewhatever/Rocket.Chat,Jandersolutions/Rocket.Chat,nrhubbar/Rocket.Chat,amaapp/ama,Achaikos/Rocket.Chat,christmo/Rocket.Chat,mhurwi/Rocket.Chat,callmekatootie/Rocket.Chat,inoxth/Rocket.Chat,thebakeryio/Rocket.Chat,mrsimpson/Rocket.Chat,mohamedhagag/Rocket.Chat,adamteece/Rocket.Chat,mhurwi/Rocket.Chat,TribeMedia/Rocket.Chat,jonathanhartman/Rocket.Chat,wicked539/Rocket.Chat,ludiculous/Rocket.Chat,osxi/Rocket.Chat,mrinaldhar/Rocket.Chat,mrsimpson/Rocket.Chat,wangleihd/Rocket.Chat,AlecTroemel/Rocket.Chat,jbsavoy18/rocketchat-1,greatdinosaur/Rocket.Chat,lihuanghai/Rocket.Chat,warcode/Rocket.Chat,berndsi/Rocket.Chat,Movile/Rocket.Chat,org100h1/Rocket.Panda,xasx/Rocket.Chat,lonbaker/Rocket.Chat,haosdent/Rocket.Chat,ggazzo/Rocket.Chat,LearnersGuild/Rocket.Chat,umeshrs/rocket-chat,erikmaarten/Rocket.Chat,acidicX/Rocket.Chat,ahmadassaf/Rocket.Chat,Deepakkothandan/Rocket.Chat,cdwv/Rocket.Chat,TribeMedia/Rocket.Chat,ziedmahdi/Rocket.Chat,janmaghuyop/Rocket.Chat,inoxth/Rocket.Chat,atyenoria/Rocket.Chat,parkmap/Rocket.Chat,jhou2/Rocket.Chat,JisuPark/Rocket.Chat,jeann2013/Rocket.Chat,wolfika/Rocket.Chat,4thParty/Rocket.Chat,abhishekshukla0302/trico,marzieh312/Rocket.Chat,Dianoga/Rocket.Chat,intelradoux/Rocket.Chat,LearnersGuild/echo-chat,acaronmd/Rocket.Chat,abduljanjua/TheHub,VoiSmart/Rocket.Chat,igorstajic/Rocket.Chat,AlecTroemel/Rocket.Chat,Gudii/Rocket.Chat,revspringjake/Rocket.Chat,anhld/Rocket.Chat,lihuanghai/Rocket.Chat,Dianoga/Rocket.Chat,sunhaolin/Rocket.Chat,parkmap/Rocket.Chat,ludiculous/Rocket.Chat,marzieh312/Rocket.Chat,Dianoga/Rocket.Chat,uniteddiversity/Rocket.Chat,celloudiallo/Rocket.Chat,jessedhillon/Rocket.Chat,org100h1/Rocket.Panda,ziedmahdi/Rocket.Chat,xboston/Rocket.Chat,jbsavoy18/rocketchat-1,Movile/Rocket.Chat,LearnersGuild/echo-chat,alexbrazier/Rocket.Chat,soonahn/Rocket.Chat,nathantreid/Rocket.Chat,ahmadassaf/Rocket.Chat,ndarilek/Rocket.Chat,jadeqwang/Rocket.Chat,ImpressiveSetOfIntelligentStudents/chat,liuliming2008/Rocket.Chat,liemqv/Rocket.Chat,subesokun/Rocket.Chat,hazio/Rocket.Chat,marzieh312/Rocket.Chat,k0nsl/Rocket.Chat,Maysora/Rocket.Chat,sikofitt/Rocket.Chat,freakynit/Rocket.Chat,psadaic/Rocket.Chat,klatys/Rocket.Chat,liuliming2008/Rocket.Chat,acidicX/Rocket.Chat,jyx140521/Rocket.Chat,LeonardOliveros/Rocket.Chat,abhishekshukla0302/trico,cnash/Rocket.Chat,LearnersGuild/Rocket.Chat,jbsavoy18/rocketchat-1,webcoding/Rocket.Chat,jeann2013/Rocket.Chat,andela-cnnadi/Rocket.Chat,katopz/Rocket.Chat,AlecTroemel/Rocket.Chat,williamfortunademoraes/Rocket.Chat,wicked539/Rocket.Chat,inoxth/Rocket.Chat,ealbers/Rocket.Chat,AimenJoe/Rocket.Chat,sikofitt/Rocket.Chat,qnib/Rocket.Chat,mhurwi/Rocket.Chat,soonahn/Rocket.Chat,lucasgolino/Rocket.Chat,JisuPark/Rocket.Chat,ImpressiveSetOfIntelligentStudents/chat,jyx140521/Rocket.Chat,christmo/Rocket.Chat,snaiperskaya96/Rocket.Chat,alexbrazier/Rocket.Chat,Gyubin/Rocket.Chat,wangleihd/Rocket.Chat,ZBoxApp/Rocket.Chat,mitar/Rocket.Chat,galrotem1993/Rocket.Chat,Codebrahma/Rocket.Chat,Abdelhamidhenni/Rocket.Chat,cnash/Rocket.Chat,warcode/Rocket.Chat,ggazzo/Rocket.Chat,jessedhillon/Rocket.Chat,yuyixg/Rocket.Chat,xasx/Rocket.Chat,haoyixin/Rocket.Chat,lukaroski/traden,KyawNaingTun/Rocket.Chat,fonsich/Rocket.Chat,linnovate/hi,Codebrahma/Rocket.Chat,BHWD/noouchat,pkgodara/Rocket.Chat,nathantreid/Rocket.Chat,xboston/Rocket.Chat,thswave/Rocket.Chat,matthewshirley/Rocket.Chat,Gudii/Rocket.Chat,BHWD/noouchat,alenodari/Rocket.Chat,glnarayanan/Rocket.Chat,trt15-ssci-organization/Rocket.Chat,mccambridge/Rocket.Chat,glnarayanan/Rocket.Chat,acidsound/Rocket.Chat,umeshrs/rocket-chat-integration,mccambridge/Rocket.Chat,wolfika/Rocket.Chat,ealbers/Rocket.Chat,yuyixg/Rocket.Chat,mccambridge/Rocket.Chat,wolfika/Rocket.Chat,linnovate/hi,ImpressiveSetOfIntelligentStudents/chat,xboston/Rocket.Chat,parkmap/Rocket.Chat,hazio/Rocket.Chat,Abdelhamidhenni/Rocket.Chat,Ninotna/Rocket.Chat,ndarilek/Rocket.Chat,freakynit/Rocket.Chat,nishimaki10/Rocket.Chat,marzieh312/Rocket.Chat,amaapp/ama,xasx/Rocket.Chat,bt/Rocket.Chat,ImpressiveSetOfIntelligentStudents/chat,pachox/Rocket.Chat,janmaghuyop/Rocket.Chat,KyawNaingTun/Rocket.Chat,j-ew-s/Rocket.Chat,wtsarchive/Rocket.Chat,HeapCity/Heap.City,madmanteam/Rocket.Chat,icaromh/Rocket.Chat,4thParty/Rocket.Chat,org100h1/Rocket.Panda,fonsich/Rocket.Chat,Achaikos/Rocket.Chat,NMandapaty/Rocket.Chat,steedos/chat,soonahn/Rocket.Chat,jeanmatheussouto/Rocket.Chat,wtsarchive/Rocket.Chat,tlongren/Rocket.Chat,tntobias/Rocket.Chat,revspringjake/Rocket.Chat,madmanteam/Rocket.Chat,tlongren/Rocket.Chat,ederribeiro/Rocket.Chat,fduraibi/Rocket.Chat,danielbressan/Rocket.Chat,NMandapaty/Rocket.Chat,ut7/Rocket.Chat,j-ew-s/Rocket.Chat,kkochubey1/Rocket.Chat,haoyixin/Rocket.Chat,PavelVanecek/Rocket.Chat,thswave/Rocket.Chat,Maysora/Rocket.Chat,I-am-Gabi/Rocket.Chat,sargentsurg/Rocket.Chat,I-am-Gabi/Rocket.Chat,tradetiger/Rocket.Chat,trt15-ssci-organization/Rocket.Chat,apnero/tactixteam,NMandapaty/Rocket.Chat,abhishekshukla0302/trico,thswave/Rocket.Chat,acidsound/Rocket.Chat,Flitterkill/Rocket.Chat,PavelVanecek/Rocket.Chat,Flitterkill/Rocket.Chat,timkinnane/Rocket.Chat,igorstajic/Rocket.Chat,sscpac/chat-locker,coreyaus/Rocket.Chat,biomassives/Rocket.Chat,matthewshirley/Rocket.Chat,ZBoxApp/Rocket.Chat,pkgodara/Rocket.Chat,nrhubbar/Rocket.Chat,acaronmd/Rocket.Chat,mwharrison/Rocket.Chat,ahmadassaf/Rocket.Chat,Jandersolutions/Rocket.Chat,capensisma/Rocket.Chat,tlongren/Rocket.Chat,andela-cnnadi/Rocket.Chat,uniteddiversity/Rocket.Chat,LearnersGuild/Rocket.Chat,hazio/Rocket.Chat,dmitrijs-balcers/Rocket.Chat,AimenJoe/Rocket.Chat,fatihwk/Rocket.Chat,org100h1/Rocket.Panda,ziedmahdi/Rocket.Chat,anhld/Rocket.Chat,celloudiallo/Rocket.Chat,danielbressan/Rocket.Chat,tzellman/Rocket.Chat,PavelVanecek/Rocket.Chat,nishimaki10/Rocket.Chat,glnarayanan/Rocket.Chat,leohmoraes/Rocket.Chat,klatys/Rocket.Chat,liemqv/Rocket.Chat,dmitrijs-balcers/Rocket.Chat,alenodari/Rocket.Chat,Jandersoft/Rocket.Chat,coreyaus/Rocket.Chat,Gyubin/Rocket.Chat,JamesHGreen/Rocket.Chat,snaiperskaya96/Rocket.Chat,slava-sh/Rocket.Chat,lonbaker/Rocket.Chat,arvi/Rocket.Chat,cdwv/Rocket.Chat,I-am-Gabi/Rocket.Chat,BorntraegerMarc/Rocket.Chat,webcoding/Rocket.Chat,wtsarchive/Rocket.Chat,fatihwk/Rocket.Chat,Movile/Rocket.Chat,xboston/Rocket.Chat,cdwv/Rocket.Chat,alexbrazier/Rocket.Chat,callblueday/Rocket.Chat,TribeMedia/Rocket.Chat,Kiran-Rao/Rocket.Chat,MiHuevos/Rocket.Chat,MiHuevos/Rocket.Chat,subesokun/Rocket.Chat,Codebrahma/Rocket.Chat,sargentsurg/Rocket.Chat,williamfortunademoraes/Rocket.Chat,AlecTroemel/Rocket.Chat,klatys/Rocket.Chat,flaviogrossi/Rocket.Chat,liemqv/Rocket.Chat,timkinnane/Rocket.Chat,apnero/tactixteam,nathantreid/Rocket.Chat,wicked539/Rocket.Chat,mohamedhagag/Rocket.Chat,adamteece/Rocket.Chat,OtkurBiz/Rocket.Chat,sscpac/chat-locker,k0nsl/Rocket.Chat,liuliming2008/Rocket.Chat,acidsound/Rocket.Chat,VoiSmart/Rocket.Chat,jhou2/Rocket.Chat,tzellman/Rocket.Chat,Gyubin/Rocket.Chat,Sing-Li/Rocket.Chat,biomassives/Rocket.Chat,bt/Rocket.Chat,pkgodara/Rocket.Chat,steedos/chat,LearnersGuild/echo-chat,inoio/Rocket.Chat,intelradoux/Rocket.Chat,Kiran-Rao/Rocket.Chat,bt/Rocket.Chat,OtkurBiz/Rocket.Chat,freakynit/Rocket.Chat,snaiperskaya96/Rocket.Chat,erikmaarten/Rocket.Chat,JamesHGreen/Rocket_API,abduljanjua/TheHub,jbsavoy18/rocketchat-1,Achaikos/Rocket.Chat,inoio/Rocket.Chat,Ninotna/Rocket.Chat,ealbers/Rocket.Chat,sikofitt/Rocket.Chat,AimenJoe/Rocket.Chat,NMandapaty/Rocket.Chat,icaromh/Rocket.Chat,pitamar/Rocket.Chat,JamesHGreen/Rocket.Chat,Movile/Rocket.Chat,Kiran-Rao/Rocket.Chat,BHWD/noouchat,VoiSmart/Rocket.Chat,thunderrabbit/Rocket.Chat,galrotem1993/Rocket.Chat,Sing-Li/Rocket.Chat,cnash/Rocket.Chat,pachox/Rocket.Chat,umeshrs/rocket-chat,coreyaus/Rocket.Chat,sunhaolin/Rocket.Chat,abduljanjua/TheHub,phlkchan/Rocket.Chat,berndsi/Rocket.Chat,OtkurBiz/Rocket.Chat,umeshrs/rocket-chat-integration,mohamedhagag/Rocket.Chat,florinnichifiriuc/Rocket.Chat,pitamar/Rocket.Chat,berndsi/Rocket.Chat,arvi/Rocket.Chat,danielbressan/Rocket.Chat,psadaic/Rocket.Chat |
ab4b426200c9dfde650e781f7fb883a294b4b2de | lib/command-palette-view.coffee | lib/command-palette-view.coffee | {$$} = require 'space-pen'
SelectList = require 'select-list'
$ = require 'jquery'
_ = require 'underscore'
module.exports =
class CommandPaletteView extends SelectList
@activate: ->
new CommandPaletteView
@viewClass: ->
"#{super} command-palette overlay from-top"
filterKey: 'eventDescription'
keyBindings: null
initialize: ->
super
rootView.command 'command-palette:toggle', => @toggle()
toggle: ->
if @hasParent()
@cancel()
else
@attach()
attach: ->
super
if @previouslyFocusedElement[0]
@eventElement = @previouslyFocusedElement
else
@eventElement = rootView
@keyBindings = _.losslessInvert(keymap.bindingsForElement(@eventElement))
events = []
for eventName, eventDescription of _.extend($(window).events(), @eventElement.events())
events.push({eventName, eventDescription}) if eventDescription
events = _.sortBy events, (e) -> e.eventDescription
@setArray(events)
@appendTo(rootView)
@miniEditor.focus()
itemForElement: ({eventName, eventDescription}) ->
keyBindings = @keyBindings
$$ ->
@li class: 'event', 'data-event-name': eventName, =>
@span eventDescription, title: eventName
@div class: 'right', =>
for binding in keyBindings[eventName] ? []
@kbd binding, class: 'key-binding'
confirmed: ({eventName}) ->
@cancel()
@eventElement.trigger(eventName)
| {$$} = require 'space-pen'
SelectList = require 'select-list'
$ = require 'jquery'
_ = require 'underscore'
module.exports =
class CommandPaletteView extends SelectList
@activate: ->
new CommandPaletteView
@viewClass: ->
"#{super} command-palette overlay from-top"
filterKey: 'eventDescription'
keyBindings: null
initialize: ->
super
rootView.command 'command-palette:toggle', => @toggle()
toggle: ->
if @hasParent()
@cancel()
else
@attach()
attach: ->
super
if @previouslyFocusedElement[0]
@eventElement = @previouslyFocusedElement
else
@eventElement = rootView
@keyBindings = _.losslessInvert(keymap.bindingsForElement(@eventElement))
events = []
for eventName, eventDescription of _.extend($(window).events(), @eventElement.events())
events.push({eventName, eventDescription}) if eventDescription
events = _.sortBy events, (e) -> e.eventDescription
@setArray(events)
@appendTo(rootView)
@miniEditor.focus()
itemForElement: ({eventName, eventDescription}) ->
keyBindings = @keyBindings
$$ ->
@li class: 'event', 'data-event-name': eventName, =>
@span eventDescription, title: eventName
@div class: 'pull-right', =>
for binding in keyBindings[eventName] ? []
@kbd binding, class: 'key-binding'
confirmed: ({eventName}) ->
@cancel()
@eventElement.trigger(eventName)
| Update for the new theme | Update for the new theme
| CoffeeScript | mit | atom/command-palette |
0ea643f25c80f8b8eade56fa28ba4d0ede7c41ea | lib/assets/javascripts/services/entity_search.js.coffee | lib/assets/javascripts/services/entity_search.js.coffee | class EntitySearchService
constructor: (@options = {}) ->
@client = new Marbles.HTTP.Client(middleware: [Marbles.HTTP.Middleware.SerializeJSON])
# options:
# - success: fn
# - error: fn
# - complete: fn
search: (query, options = {}) =>
@client.get @options.api_root, { q: query }, options
_.extend EntitySearchService::, Marbles.Events
_.extend EntitySearchService::, Marbles.Accessors
if (api_root = TentStatus.config.entity_search_api_root)
TentStatus.services ?= {}
TentStatus.services.entity_search = new EntitySearchService(api_root: api_root)
| class EntitySearchService
constructor: (@options = {}) ->
@client = new Marbles.HTTP.Client(middleware: [Marbles.HTTP.Middleware.SerializeJSON])
# callback can either be a function or an object:
# - success: fn
# - error: fn
# - complete: fn
search: (query, callback) =>
@client.get(url: @options.api_root, params: { q: query }, callback: callback)
_.extend EntitySearchService::, Marbles.Events
_.extend EntitySearchService::, Marbles.Accessors
if (api_root = TentStatus.config.entity_search_api_root)
TentStatus.services ?= {}
TentStatus.services.entity_search = new EntitySearchService(api_root: api_root)
| Update entity search service to use latest Marbles.HTTP.Client | Update entity search service to use latest Marbles.HTTP.Client
| CoffeeScript | bsd-3-clause | tent/tent-status,tent/tent-status |
04df516d1d47171ce10d7b840af40f5fa50dc4d1 | spec/skr/models/SoLineSpec.coffee | spec/skr/models/SoLineSpec.coffee | describe "Skr.Models.SoLine", ->
it "can be instantiated", ->
model = new Skr.Models.SoLine()
expect(model).toEqual(jasmine.any(Skr.Models.SoLine))
| describe "Skr.Models.SoLine", ->
it "can sets properties from the uom", ->
model = new Skr.Models.SoLine()
model.uom = new Skr.Models.Uom(size: 10, code: 'CS')
expect(model.uom_size).toEqual(10)
expect(model.uom_code).toEqual('CS')
| Test that UOM setting propogates | Test that UOM setting propogates
| CoffeeScript | agpl-3.0 | argosity/stockor,argosity/stockor,argosity/stockor,argosity/stockor |
49a7d14eb7311d11bbce277034b092d0d3fa4bcc | lib/content._coffee | lib/content._coffee | config = require '../config'
crypto = require 'crypto'
redis = require 'redis'
# Redis
client = redis.createClient()
# Keys
HASH_ALGORITHM = 'sha256'
HASH_ENCODING = 'hex'
NEXT_ID_KEY = 'content:next.id'
getIdKey = (id) ->
"content:id:#{id}"
getURLKey = (url) ->
hash = crypto.createHash HASH_ALGORITHM
hash.update url
digest = hash.digest HASH_ENCODING
"content:url:#{digest}"
# Public API
module.exports = class Content
constructor: (@id, url) ->
@urls =
source: url
view: "#{config.BASE_URL}/#{@id}"
@type = 'dzi'
@getById: (id, _) ->
key = getIdKey id
result = client.get key, _
JSON.parse result
@getByURL: (url, _) ->
id = client.get getURLKey(url), _
if not id?
return null
@getById id, _
@fromURL: (url, _) ->
nextId = client.incr NEXT_ID_KEY, _
content = new Content nextId, url
id = content.id
idKey = getIdKey id
value = JSON.stringify content
urlKey = getURLKey url
client.mset idKey, value,
urlKey, id,
_
content
@getOrCreate: (url, _) ->
content = @getByURL url, _
return content if content?
@fromURL url, _
| config = require '../config'
crypto = require 'crypto'
redis = require 'redis'
# Redis
client = redis.createClient()
# Keys
HASH_ALGORITHM = 'sha256'
HASH_ENCODING = 'hex'
NEXT_ID_KEY = 'content:next.id'
getIdKey = (id) ->
"content:id:#{id}"
getURLKey = (url) ->
hash = crypto.createHash HASH_ALGORITHM
hash.update url
digest = hash.digest HASH_ENCODING
"content:url:#{digest}"
# Public API
module.exports = class Content
constructor: (@id, url) ->
@self = "#{config.BASE_URL}/content/#{@id}"
@urls =
source: url
view: "#{config.BASE_URL}/#{@id}"
@type = 'dzi'
@getById: (id, _) ->
key = getIdKey id
result = client.get key, _
JSON.parse result
@getByURL: (url, _) ->
id = client.get getURLKey(url), _
if not id?
return null
@getById id, _
@fromURL: (url, _) ->
nextId = client.incr NEXT_ID_KEY, _
content = new Content nextId, url
id = content.id
idKey = getIdKey id
value = JSON.stringify content
urlKey = getURLKey url
client.mset idKey, value,
urlKey, id,
_
content
@getOrCreate: (url, _) ->
content = @getByURL url, _
return content if content?
@fromURL url, _
| Add `self` URL to `Content` | Add `self` URL to `Content`
| CoffeeScript | mit | zoomhub/zoomhub,zoomhub/zoomhub,zoomhub/zoomhub,zoomhub/zoomhub |
2677e887e931cf34732d0ce5fb7fd08442574713 | app/scripts/services/domains.coffee | app/scripts/services/domains.coffee | 'use strict'
class DomainsFactory
constructor: (@restangular) ->
getDomains: ->
@restangular.all('domains-details').getList()
getDomainPageCount: (domain) ->
@restangular.one('domains', domain.name).one('page-count').get()
getDomainReviewCount: (domain) ->
@restangular.one('domains', domain.name).one('review-count').get()
getDomainViolationCount: (domain) ->
@restangular.one('domains', domain.name).one('violation-count').get()
getDomainErrorPercentage: (domain) ->
@restangular.one('domains', domain.name).one('error-percentage').get()
getDomainResponseTimeAvg: (domain) ->
@restangular.one('domains', domain.name).one('response-time-avg').get()
getDomainReviews: (domainName, params) ->
@restangular.one('domains', domainName).one('reviews').get(params)
getDomainGroupedViolations: (domainName) ->
@restangular.one('domains', domainName).one('violations').get()
getDomainMostCommonViolations: (domainName, key_category_id) ->
@restangular.one('domains', domainName).one('violations', key_category_id).get()
getDomainData: (domainName) ->
@restangular.one('domains', domainName).get()
postChangeDomainStatus: (domainName) ->
@restangular.one('domains', domainName).post('change-status')
angular.module('holmesApp')
.factory 'DomainsFcty', (Restangular) ->
return new DomainsFactory(Restangular)
| 'use strict'
class DomainsFactory
constructor: (@restangular) ->
getDomains: ->
@restangular.all('domains-details').getList()
getDomainReviews: (domainName, params) ->
@restangular.one('domains', domainName).one('reviews').get(params)
getDomainGroupedViolations: (domainName) ->
@restangular.one('domains', domainName).one('violations').get()
getDomainMostCommonViolations: (domainName, key_category_id) ->
@restangular.one('domains', domainName).one('violations', key_category_id).get()
getDomainData: (domainName) ->
@restangular.one('domains', domainName).get()
postChangeDomainStatus: (domainName) ->
@restangular.one('domains', domainName).post('change-status')
angular.module('holmesApp')
.factory 'DomainsFcty', (Restangular) ->
return new DomainsFactory(Restangular)
| Remove unused fetchers, getDomains does it all | Remove unused fetchers, getDomains does it all
| CoffeeScript | mit | holmes-app/holmes-web,holmes-app/holmes-web,holmes-app/holmes-web |
92b29d765ba46e0d0e2f07138779b2ad5bd45023 | vendor/assets/javascripts/gmaps4rails/yandex/objects/map.coffee | vendor/assets/javascripts/gmaps4rails/yandex/objects/map.coffee | class @Gmaps4Rails.Yandex.Map extends Gmaps4Rails.Common
@include Gmaps4Rails.Interfaces.Map
@include Gmaps4Rails.Map
@include Gmaps4Rails.Yandex.Shared
@include Gmaps4Rails.Configuration
CONF:
disableDefaultUI: false
disableDoubleClickZoom: false
type: "ROADMAP" # HYBRID, ROADMAP, SATELLITE, TERRAIN
mapTypeControl: null
constructor:(map_options, controller) ->
@controller = controller
defaultOptions = @setConf()
@options = @mergeObjects map_options, defaultOptions
yandexOptions =
center: @createLatLng(@options.center_latitude, @options.center_longitude)
zoom: @options.zoom
behaviors: @options.behaviors
mergedYandexOptions = @mergeObjects map_options.raw, yandexOptions
@serviceObject = new ymaps.Map(@options.id, mergedYandexOptions)
extendBoundsWithMarkers : (marker)->
@controller.getMapObject().setBounds(@controller.getMapObject().geoObjects.getBounds());
extendBoundsWithPolyline: (polyline)->
extendBoundsWithPolygon: (polygon)->
extendBoundsWithCircle: (circle)->
extendBound: (bound)->
fitBounds: ->
@serviceObject.zoomToExtent(@boundsObject, true)
adaptToBounds: ->
@fitBounds()
centerMapOnUser : (position)->
@serviceObject.setCenter position
| class @Gmaps4Rails.Yandex.Map extends Gmaps4Rails.Common
@include Gmaps4Rails.Interfaces.Map
@include Gmaps4Rails.Map
@include Gmaps4Rails.Yandex.Shared
@include Gmaps4Rails.Configuration
CONF:
disableDefaultUI: false
disableDoubleClickZoom: false
type: "ROADMAP" # HYBRID, ROADMAP, SATELLITE, TERRAIN
mapTypeControl: null
constructor:(map_options, controller) ->
@controller = controller
defaultOptions = @setConf()
@options = @mergeObjects map_options, defaultOptions
yandexOptions =
center: @createLatLng(@options.center_latitude, @options.center_longitude)
zoom: @options.zoom
behaviors: @options.behaviors
mergedYandexOptions = @mergeObjects map_options.raw, yandexOptions
@serviceObject = new ymaps.Map(@options.id, mergedYandexOptions)
extendBoundsWithMarkers : ->
@boundsObject = @serviceObject.geoObjects.getBounds();
extendBoundsWithPolyline: (polyline)->
extendBoundsWithPolygon: (polygon)->
extendBoundsWithCircle: (circle)->
extendBound: (bound)->
fitBounds: ->
@serviceObject.setBounds(@boundsObject)
adaptToBounds: ->
@fitBounds()
centerMapOnUser : (position)->
@serviceObject.setCenter position
| Set and fit Yandex Map bounds | Set and fit Yandex Map bounds
| CoffeeScript | mit | apneadiving/Google-Maps-for-Rails,apneadiving/Google-Maps-for-Rails,ekdin/Google-Maps-for-Rails,michael-gabenna/Google-Maps-for-Rails,ipmobiletech/Google-Maps-for-Rails,ipmobiletech/Google-Maps-for-Rails,michael-gabenna/Google-Maps-for-Rails,oelmekki/Google-Maps-for-Rails,ekdin/Google-Maps-for-Rails,oelmekki/Google-Maps-for-Rails |
2f869c3b74db464e3d31ae517e10cbecbb9e376d | packages/rocketchat-oembed/client/oembedUrlWidget.coffee | packages/rocketchat-oembed/client/oembedUrlWidget.coffee | getTitle = (self) ->
if not self.meta?
return
return self.meta.ogTitle or self.meta.twitterTitle or self.meta.title or self.meta.pageTitle
getDescription = (self) ->
if not self.meta?
return
description = self.meta.ogDescription or self.meta.twitterDescription or self.meta.description
if not description?
return
return _.unescape description.replace /(^[“\s]*)|([”\s]*$)/g, ''
Template.oembedUrlWidget.helpers
description: ->
description = getDescription this
return new Handlebars.SafeString description if _.isString description
title: ->
title = getTitle this
return new Handlebars.SafeString title if _.isString title
target: ->
if not this.parsedUrl?.host || !document?.location?.host || this.parsedUrl.host isnt document.location.host
return '_blank'
image: ->
if not this.meta?
return
decodedOgImage = @meta.ogImage?.replace?(/&/g, '&')
return decodedOgImage or this.meta.twitterImage
show: ->
return getDescription(this)? or getTitle(this)?
collapsed: ->
if this.collapsed?
return this.collapsed
else
return Meteor.user()?.settings?.preferences?.collapseMediaByDefault is true
| getTitle = (self) ->
if not self.meta?
return
return self.meta.ogTitle or self.meta.twitterTitle or self.meta.title or self.meta.pageTitle
getDescription = (self) ->
if not self.meta?
return
description = self.meta.ogDescription or self.meta.twitterDescription or self.meta.description
if not description?
return
return _.unescape description.replace /(^[“\s]*)|([”\s]*$)/g, ''
Template.oembedUrlWidget.helpers
description: ->
description = getDescription this
return Blaze._escape(description) if _.isString description
title: ->
title = getTitle this
return Blaze._escape(title) if _.isString title
target: ->
if not this.parsedUrl?.host || !document?.location?.host || this.parsedUrl.host isnt document.location.host
return '_blank'
image: ->
if not this.meta?
return
decodedOgImage = @meta.ogImage?.replace?(/&/g, '&')
return decodedOgImage or this.meta.twitterImage
show: ->
return getDescription(this)? or getTitle(this)?
collapsed: ->
if this.collapsed?
return this.collapsed
else
return Meteor.user()?.settings?.preferences?.collapseMediaByDefault is true
| Fix XSS error in OEmbed | Fix XSS error in OEmbed
| CoffeeScript | mit | JamesHGreen/Rocket.Chat,LearnersGuild/Rocket.Chat,Movile/Rocket.Chat,4thParty/Rocket.Chat,wtsarchive/Rocket.Chat,4thParty/Rocket.Chat,pachox/Rocket.Chat,pachox/Rocket.Chat,wtsarchive/Rocket.Chat,danielbressan/Rocket.Chat,karlprieb/Rocket.Chat,igorstajic/Rocket.Chat,OtkurBiz/Rocket.Chat,flaviogrossi/Rocket.Chat,pitamar/Rocket.Chat,Gudii/Rocket.Chat,subesokun/Rocket.Chat,NMandapaty/Rocket.Chat,4thParty/Rocket.Chat,abduljanjua/TheHub,ealbers/Rocket.Chat,Kiran-Rao/Rocket.Chat,inoxth/Rocket.Chat,flaviogrossi/Rocket.Chat,nishimaki10/Rocket.Chat,Kiran-Rao/Rocket.Chat,LearnersGuild/Rocket.Chat,ealbers/Rocket.Chat,matthewshirley/Rocket.Chat,igorstajic/Rocket.Chat,AimenJoe/Rocket.Chat,Sing-Li/Rocket.Chat,igorstajic/Rocket.Chat,VoiSmart/Rocket.Chat,galrotem1993/Rocket.Chat,flaviogrossi/Rocket.Chat,pkgodara/Rocket.Chat,fatihwk/Rocket.Chat,JamesHGreen/Rocket_API,mrinaldhar/Rocket.Chat,cnash/Rocket.Chat,inoio/Rocket.Chat,mccambridge/Rocket.Chat,fatihwk/Rocket.Chat,galrotem1993/Rocket.Chat,BorntraegerMarc/Rocket.Chat,jbsavoy18/rocketchat-1,tntobias/Rocket.Chat,snaiperskaya96/Rocket.Chat,karlprieb/Rocket.Chat,trt15-ssci-organization/Rocket.Chat,Movile/Rocket.Chat,inoxth/Rocket.Chat,ziedmahdi/Rocket.Chat,AlecTroemel/Rocket.Chat,yuyixg/Rocket.Chat,Gyubin/Rocket.Chat,VoiSmart/Rocket.Chat,JamesHGreen/Rocket_API,Gyubin/Rocket.Chat,nishimaki10/Rocket.Chat,mrinaldhar/Rocket.Chat,marzieh312/Rocket.Chat,wtsarchive/Rocket.Chat,matthewshirley/Rocket.Chat,Sing-Li/Rocket.Chat,cnash/Rocket.Chat,xasx/Rocket.Chat,pitamar/Rocket.Chat,snaiperskaya96/Rocket.Chat,ahmadassaf/Rocket.Chat,Gyubin/Rocket.Chat,k0nsl/Rocket.Chat,danielbressan/Rocket.Chat,intelradoux/Rocket.Chat,matthewshirley/Rocket.Chat,karlprieb/Rocket.Chat,xasx/Rocket.Chat,ahmadassaf/Rocket.Chat,wicked539/Rocket.Chat,pitamar/Rocket.Chat,Gyubin/Rocket.Chat,Achaikos/Rocket.Chat,Gudii/Rocket.Chat,fatihwk/Rocket.Chat,jbsavoy18/rocketchat-1,alexbrazier/Rocket.Chat,OtkurBiz/Rocket.Chat,JamesHGreen/Rocket.Chat,AlecTroemel/Rocket.Chat,AimenJoe/Rocket.Chat,wicked539/Rocket.Chat,Kiran-Rao/Rocket.Chat,flaviogrossi/Rocket.Chat,JamesHGreen/Rocket.Chat,yuyixg/Rocket.Chat,ziedmahdi/Rocket.Chat,marzieh312/Rocket.Chat,ahmadassaf/Rocket.Chat,yuyixg/Rocket.Chat,AlecTroemel/Rocket.Chat,BorntraegerMarc/Rocket.Chat,subesokun/Rocket.Chat,danielbressan/Rocket.Chat,mrsimpson/Rocket.Chat,k0nsl/Rocket.Chat,Sing-Li/Rocket.Chat,OtkurBiz/Rocket.Chat,inoio/Rocket.Chat,LearnersGuild/Rocket.Chat,ggazzo/Rocket.Chat,k0nsl/Rocket.Chat,Sing-Li/Rocket.Chat,VoiSmart/Rocket.Chat,pachox/Rocket.Chat,tntobias/Rocket.Chat,timkinnane/Rocket.Chat,mwharrison/Rocket.Chat,xasx/Rocket.Chat,Gudii/Rocket.Chat,k0nsl/Rocket.Chat,mccambridge/Rocket.Chat,ealbers/Rocket.Chat,mrsimpson/Rocket.Chat,timkinnane/Rocket.Chat,mwharrison/Rocket.Chat,LearnersGuild/echo-chat,NMandapaty/Rocket.Chat,timkinnane/Rocket.Chat,tntobias/Rocket.Chat,intelradoux/Rocket.Chat,trt15-ssci-organization/Rocket.Chat,pachox/Rocket.Chat,OtkurBiz/Rocket.Chat,snaiperskaya96/Rocket.Chat,mwharrison/Rocket.Chat,matthewshirley/Rocket.Chat,trt15-ssci-organization/Rocket.Chat,wicked539/Rocket.Chat,galrotem1993/Rocket.Chat,wicked539/Rocket.Chat,wtsarchive/Rocket.Chat,Achaikos/Rocket.Chat,NMandapaty/Rocket.Chat,Gudii/Rocket.Chat,subesokun/Rocket.Chat,mrsimpson/Rocket.Chat,snaiperskaya96/Rocket.Chat,JamesHGreen/Rocket_API,pkgodara/Rocket.Chat,ziedmahdi/Rocket.Chat,LearnersGuild/echo-chat,jbsavoy18/rocketchat-1,inoxth/Rocket.Chat,ealbers/Rocket.Chat,AimenJoe/Rocket.Chat,karlprieb/Rocket.Chat,abduljanjua/TheHub,NMandapaty/Rocket.Chat,alexbrazier/Rocket.Chat,yuyixg/Rocket.Chat,BorntraegerMarc/Rocket.Chat,inoio/Rocket.Chat,intelradoux/Rocket.Chat,ggazzo/Rocket.Chat,mrinaldhar/Rocket.Chat,nishimaki10/Rocket.Chat,LearnersGuild/Rocket.Chat,igorstajic/Rocket.Chat,4thParty/Rocket.Chat,jbsavoy18/rocketchat-1,ziedmahdi/Rocket.Chat,tntobias/Rocket.Chat,LearnersGuild/echo-chat,inoxth/Rocket.Chat,cnash/Rocket.Chat,nishimaki10/Rocket.Chat,ggazzo/Rocket.Chat,pkgodara/Rocket.Chat,cnash/Rocket.Chat,mwharrison/Rocket.Chat,ahmadassaf/Rocket.Chat,timkinnane/Rocket.Chat,Movile/Rocket.Chat,Achaikos/Rocket.Chat,alexbrazier/Rocket.Chat,Kiran-Rao/Rocket.Chat,Movile/Rocket.Chat,danielbressan/Rocket.Chat,intelradoux/Rocket.Chat,JamesHGreen/Rocket_API,BorntraegerMarc/Rocket.Chat,mccambridge/Rocket.Chat,subesokun/Rocket.Chat,mrsimpson/Rocket.Chat,JamesHGreen/Rocket.Chat,mccambridge/Rocket.Chat,abduljanjua/TheHub,pkgodara/Rocket.Chat,AlecTroemel/Rocket.Chat,LearnersGuild/echo-chat,galrotem1993/Rocket.Chat,ggazzo/Rocket.Chat,marzieh312/Rocket.Chat,abduljanjua/TheHub,AimenJoe/Rocket.Chat,mrinaldhar/Rocket.Chat,xasx/Rocket.Chat,marzieh312/Rocket.Chat,fatihwk/Rocket.Chat,Achaikos/Rocket.Chat,pitamar/Rocket.Chat,trt15-ssci-organization/Rocket.Chat,alexbrazier/Rocket.Chat |
32a748f04e565a217a32a33cdf5332aed233b4e4 | impls/browser/index.coffee | impls/browser/index.coffee | 'use strict'
[utils, Model] = ['utils', 'model'].map require
exports.Request = require('./request.coffee')()
exports.Response = require('./response.coffee')()
exports.init = ->
# Send internal request to change the page based on the URI
changePage = (uri) =>
# change browser URI in the history
history.pushState null, '', uri
# send internal request
uid = utils.uid()
res = @onRequest
uid: uid
method: @constructor.GET
uri: uri.slice 1
data: null
# don't refresh page on click anchor
document.addEventListener 'click', (e) ->
{target} = e
# consider only anchors
# omit anchors with the `target` attribute
return if target.nodeName isnt 'A' or target.getAttribute('target')
# avoid browser to refresh page
e.preventDefault()
# change page to the anchor pathname
changePage target.pathname
# change page to the current one
changePage location.pathname
exports.sendRequest = (opts, callback) ->
xhr = new XMLHttpRequest
xhr.open opts.method, opts.url, true
xhr.setRequestHeader 'X-Expected-Type', Model.OBJECT
xhr.onload = ->
response = utils.tryFunc JSON.parse, null, [xhr.response], xhr.response
callback xhr.status, response
xhr.send() | 'use strict'
[utils, Model] = ['utils', 'model'].map require
exports.Request = require('./request.coffee')()
exports.Response = require('./response.coffee')()
exports.init = ->
# Send internal request to change the page based on the URI
changePage = (uri) =>
# change browser URI in the history
history.pushState null, '', uri
# send internal request
uid = utils.uid()
res = @onRequest
uid: uid
method: @constructor.GET
uri: uri.slice 1
data: null
# don't refresh page on click anchor
document.addEventListener 'click', (e) ->
{target} = e
# consider only anchors
# omit anchors with the `target` attribute
return if target.nodeName isnt 'A' or target.getAttribute('target')
# avoid browser to refresh page
e.preventDefault()
# change page to the anchor pathname
changePage target.pathname
# change page to the current one
changePage location.pathname
exports.sendRequest = (opts, callback) ->
xhr = new XMLHttpRequest
xhr.open opts.method, opts.url, true
xhr.setRequestHeader 'X-Expected-Type', Model.OBJECT
xhr.responseType = 'json'
xhr.onload = ->
response = xhr.response
if typeof response is 'string'
response = utils.tryFunc JSON.parse, null, [response], response
callback xhr.status, response
xhr.send() | Support for JSON reponse in browser impl added | Support for JSON reponse in browser impl added
| CoffeeScript | apache-2.0 | Neft-io/neft,Neft-io/neft,Neft-io/neft,Neft-io/neft,Neft-io/neft,Neft-io/neft |
5337b6aacb95b45484bf2a83cbf4fcb3e741e7f5 | app/assets/javascripts/store.js.coffee | app/assets/javascripts/store.js.coffee | # http://emberjs.com/guides/models/using-the-store/
ETahi.Store = DS.Store.extend
# Override the default adapter with the `DS.ActiveModelAdapter` which
# is built to work nicely with the ActiveModel::Serializers gem.
adapter: '-active-model'
push: (type, data, _partial) ->
oldType = type
dataType = data.type
modelType = oldType
if dataType and (@modelFor(oldType) != @modelFor(dataType)) # is this a subclass?
modelType = dataType
if oldRecord = @getById(oldType, data.id)
@dematerializeRecord(oldRecord)
@_super @modelFor(modelType), data, _partial
| # http://emberjs.com/guides/models/using-the-store/
ETahi.Store = DS.Store.extend
# Override the default adapter with the `DS.ActiveModelAdapter` which
# is built to work nicely with the ActiveModel::Serializers gem.
adapter: '-active-model'
push: (type, data, _partial) ->
oldType = type
dataType = data.type
modelType = oldType
if dataType and (@modelFor(oldType) != @modelFor(dataType)) # is this a subclass?
modelType = dataType
if oldRecord = @getById(oldType, data.id)
@dematerializeRecord(oldRecord)
@_super @modelFor(modelType), data, _partial
# find any task in the store even when subclassed
findTask: (id) ->
matchingTask = _(@typeMaps).detect (tm) ->
tm.type.toString().match(/Task$/) and tm.idToRecord[id]
if matchingTask
matchingTask.idToRecord[id]
| Add findTask method to store. | Add findTask method to store.
| CoffeeScript | mit | johan--/tahi,johan--/tahi,johan--/tahi,johan--/tahi |
75818d40f27cbab71e1d0e5caa13ead61990c582 | spec/coffeescripts/models/transactions/month_spec.coffee | spec/coffeescripts/models/transactions/month_spec.coffee | describe 'LedgerWeb.Models.Transactions.Month', ->
it 'populates transactions attribute as transactions collection', ->
month = new LedgerWeb.Models.Transactions.Month
month: '2013/12'
transactions: [payee: 'my payee']
(expect month.get('transactions') instanceof LedgerWeb.Collections.Transactions).toBeTruthy()
it 'parses the date strings into javascript dates', ->
month = new LedgerWeb.Models.Transactions.Month
month: '2013/12'
beginning = month.get('beginning')
(expect beginning instanceof Date).toBeTruthy()
(expect beginning.getDate()).toEqual(1)
(expect beginning.getMonth()).toEqual(11)
(expect beginning.getFullYear()).toEqual(2013)
| describe 'LedgerWeb.Models.Transactions.Month', ->
it 'populates transactions attribute as transactions collection', ->
month = new LedgerWeb.Models.Transactions.Month
month: '2013/12'
transactions: [payee: 'my payee', date: '2013/12/01']
(expect month.get('transactions') instanceof LedgerWeb.Collections.Transactions).toBeTruthy()
it 'parses the date strings into javascript dates', ->
month = new LedgerWeb.Models.Transactions.Month
month: '2013/12'
beginning = month.get('beginning')
(expect beginning instanceof Date).toBeTruthy()
(expect beginning.getDate()).toEqual(1)
(expect beginning.getMonth()).toEqual(11)
(expect beginning.getFullYear()).toEqual(2013)
| Add mandatory transaction date to spec data | Add mandatory transaction date to spec data
| CoffeeScript | mit | leoc/ledger-web |
c18248beaa45903ed2b03c63725ce0392cc33b7e | src/local_modules/typescript.iced | src/local_modules/typescript.iced | # build task for tsc
task 'build', 'build:typescript', (done)->
count = 0
typescriptProjects()
.pipe foreach (each,next) ->
count++
execute "#{basefolder}/node_modules/.bin/tsc --project #{folder each.path}", (code,stdout,stderr) ->
echo stdout.replace("src/next-gen","#{basefolder}/src/next-gen")
count--
if count is 0
done()
next null
return null
Import
install_package: (from,to,done)->
return setTimeout (->
install_package from, to, done
), 500 if global.ts_ready > 0
Fail "Directory '#{from}' doesn't exist'" if !test "-d", from
mkdir -p, to if !test "-d", to
# create an empty package.json
"{ }" .to "#{to}/package.json"
# install the autorest typescript code into the target folder
execute "npm install #{from}", {cwd : to }, (c,o,e)->
done();
task 'install', 'install:typescript', (done)->
count = 0
typescriptProjects()
.pipe foreach (each,next) ->
count++
execute "npm install", {cwd: folder each.path}, (code,stdout,stderr) ->
count--
if count is 0
done()
next null
return null
| # build task for tsc
task 'build', 'build:typescript', (done)->
count = 0
typescriptProjects()
.pipe foreach (each,next) ->
count++
execute "#{basefolder}/node_modules/.bin/tsc --project #{folder each.path}", (code,stdout,stderr) ->
echo stdout.replace("src/next-gen","#{basefolder}/src/next-gen")
count--
if count is 0
done()
next null
return null
Import
install_package: (from,to,done)->
return setTimeout (->
install_package from, to, done
), 500 if global.ts_ready > 0
Fail "Directory '#{from}' doesn't exist'" if !test "-d", from
mkdir '-p', to if !test "-d", to
# create an empty package.json
"{ }" .to "#{to}/package.json"
# install the autorest typescript code into the target folder
execute "npm install #{from}", {cwd : to }, (c,o,e)->
done();
task 'install', 'install:typescript', (done)->
count = 0
typescriptProjects()
.pipe foreach (each,next) ->
count++
execute "npm install", {cwd: folder each.path}, (code,stdout,stderr) ->
count--
if count is 0
done()
next null
return null
| Fix dumb break in script | Fix dumb break in script | CoffeeScript | mit | ljhljh235/AutoRest,veronicagg/autorest,hovsepm/AutoRest,brjohnstmsft/autorest,veronicagg/autorest,sergey-shandar/autorest,vishrutshah/autorest,amarzavery/AutoRest,amarzavery/AutoRest,anudeepsharma/autorest,balajikris/autorest,jianghaolu/AutoRest,Azure/autorest,dsgouda/autorest,lmazuel/autorest,annatisch/autorest,veronicagg/autorest,jhendrixMSFT/autorest,ljhljh235/AutoRest,sergey-shandar/autorest,devigned/autorest,annatisch/autorest,jhancock93/autorest,balajikris/autorest,annatisch/autorest,hovsepm/AutoRest,jhancock93/autorest,veronicagg/autorest,jhendrixMSFT/autorest,sergey-shandar/autorest,olydis/autorest,amarzavery/AutoRest,jhancock93/autorest,jhancock93/autorest,anudeepsharma/autorest,ljhljh235/AutoRest,devigned/autorest,anudeepsharma/autorest,ljhljh235/AutoRest,ljhljh235/AutoRest,anudeepsharma/autorest,fearthecowboy/autorest,amarzavery/AutoRest,vishrutshah/autorest,jianghaolu/AutoRest,veronicagg/autorest,jhancock93/autorest,lmazuel/autorest,ljhljh235/AutoRest,jhancock93/autorest,vishrutshah/autorest,dsgouda/autorest,devigned/autorest,sergey-shandar/autorest,dsgouda/autorest,balajikris/autorest,devigned/autorest,anudeepsharma/autorest,jianghaolu/AutoRest,anudeepsharma/autorest,vishrutshah/autorest,devigned/autorest,amarzavery/AutoRest,hovsepm/AutoRest,balajikris/autorest,vishrutshah/autorest,dsgouda/autorest,lmazuel/autorest,vishrutshah/autorest,lmazuel/autorest,sergey-shandar/autorest,dsgouda/autorest,ljhljh235/AutoRest,dsgouda/autorest,sergey-shandar/autorest,anudeepsharma/autorest,jianghaolu/AutoRest,annatisch/autorest,lmazuel/autorest,balajikris/autorest,Azure/autorest,hovsepm/AutoRest,hovsepm/AutoRest,lmazuel/autorest,jianghaolu/AutoRest,dsgouda/autorest,Azure/autorest,Azure/autorest,olydis/autorest,dsgouda/autorest,balajikris/autorest,balajikris/autorest,hovsepm/AutoRest,jhancock93/autorest,hovsepm/AutoRest,veronicagg/autorest,jhendrixMSFT/autorest,lmazuel/autorest,annatisch/autorest,annatisch/autorest,lmazuel/autorest,jhendrixMSFT/autorest,veronicagg/autorest,sergey-shandar/autorest,devigned/autorest,veronicagg/autorest,annatisch/autorest,jianghaolu/AutoRest,jianghaolu/AutoRest,sergey-shandar/autorest,vishrutshah/autorest,jianghaolu/AutoRest,anudeepsharma/autorest,vishrutshah/autorest,hovsepm/AutoRest,amarzavery/AutoRest,brjohnstmsft/autorest,dsgouda/autorest,annatisch/autorest,jianghaolu/AutoRest,devigned/autorest,annatisch/autorest,amarzavery/AutoRest,balajikris/autorest,amarzavery/AutoRest,anudeepsharma/autorest,veronicagg/autorest,ljhljh235/AutoRest,sergey-shandar/autorest,fearthecowboy/autorest,balajikris/autorest,vishrutshah/autorest,jhancock93/autorest,lmazuel/autorest,hovsepm/AutoRest,amarzavery/AutoRest,devigned/autorest,jhancock93/autorest,devigned/autorest |
dc5b40c2e33a2ff3ae1ac1be0abc2adef294dcf9 | features/support/test_system.coffee | features/support/test_system.coffee | Qjs = require '../../lib/qjs'
TestSystem = Qjs.parse """
# Nil & others
Any = .
Nil = .( v | v === null )
# Booleans
True = .( b | b === true )
False = .( b | b === false )
Boolean = .Boolean
# Numerics
Numeric = .Number
Integer = .Number( i | noDot: i.toString().indexOf('.') == -1 )
# String
String = .String
# Dates and Time
Date = .Date <iso8601> .String \( n | Date(n) )
\( d | d.getTime() )
"""
module.exports = TestSystem
| Qjs = require '../../lib/qjs'
TestSystem = Qjs.parse """
# Nil & others
Any = .
Nil = .( v | v === null )
# Booleans
True = .( b | b === true )
False = .( b | b === false )
Boolean = .Boolean
# Numerics
Numeric = .Number
Integer = .Number( i | noDot: i.toString().indexOf('.') == -1 )
# String
String = .String
# Dates and Time
Date = .Date <iso8601> .String \\( n | Date(n) )
\\( d | d.getTime() )
"""
module.exports = TestSystem
| Fix escaping in test system. | Fix escaping in test system.
| CoffeeScript | mit | llambeau/finitio.js,llambeau/finitio.js |
7618d3161387af054bf6a22dbd5aa0fe02626c82 | main.coffee | main.coffee | fs = require 'fs'
exports.initialize = (args) ->
configName = if args.length isnt 0 then args[0] else 'main'
configPath = "#{__dirname}/users/#{configName}.json"
fs.exists configPath, (exists) ->
if not exists
console.log "Config #{configName} doesn't exists."
return
params = require configPath
params.appID = '4027411'
params.appSecret = 'MDn6yOgRLmkWBbm1PTFL'
params.dlPath = if params.dlPath is null then "#{__dirname}/cache" else params.dlPath
vkAuth = require('./lib/vkAuth')(params)
musicParser = require('./lib/musicParser')(params)
vkAuth.initialize (token) ->
if token is null then throw "Can't authorize on vk.com server. Aborted."
musicParser.getCollectionFromServer token, (music) ->
musicParser.downloadCollection() | fs = require 'fs'
exports.initialize = (args) ->
configName = if args.length isnt 0 then args[0] else 'main'
configPath = "#{__dirname}/users/#{configName}.json"
fs.exists configPath, (exists) ->
if not exists
console.log "Config #{configName} doesn't exists."
return
params = require configPath
params.appID = '4027411'
params.appSecret = 'MDn6yOgRLmkWBbm1PTFL'
params.dlPath = if isnt params.dlPath then process.cwd() else params.dlPath
vkAuth = require('./lib/vkAuth')(params)
musicParser = require('./lib/musicParser')(params)
vkAuth.initialize (token) ->
if token is null then throw "Can't authorize on vk.com server. Aborted."
musicParser.getCollectionFromServer token, (music) ->
musicParser.downloadCollection()
| Set current cwd folder for download by default | Set current cwd folder for download by default | CoffeeScript | mit | MaxSvargal/node-vk-music-sync |
ae0e512a10690367ff21b3e53b4d8d6e2271e837 | packages/rocketchat-lib/server/methods/sendMessage.coffee | packages/rocketchat-lib/server/methods/sendMessage.coffee | Meteor.methods
sendMessage: (message) ->
if message.msg?.length > RocketChat.settings.get('Message_MaxAllowedSize')
throw new Meteor.Error('error-message-size-exceeded', 'Message size exceeds Message_MaxAllowedSize', { method: 'sendMessage' })
if not Meteor.userId()
throw new Meteor.Error('error-invalid-user', "Invalid user", { method: 'sendMessage' })
user = RocketChat.models.Users.findOneById Meteor.userId(), fields: username: 1
room = Meteor.call 'canAccessRoom', message.rid, user._id
if not room
return false
if user.username in (room.muted or [])
RocketChat.Notifications.notifyUser Meteor.userId(), 'message', {
_id: Random.id()
rid: room._id
ts: new Date
msg: TAPi18n.__('You_have_been_muted', {}, user.language);
}
return false
RocketChat.sendMessage user, message, room
# Limit a user to sending 5 msgs/second
# DDPRateLimiter.addRule
# type: 'method'
# name: 'sendMessage'
# userId: (userId) ->
# return RocketChat.models.Users.findOneById(userId)?.username isnt RocketChat.settings.get('InternalHubot_Username')
# , 5, 1000
| Meteor.methods
sendMessage: (message) ->
if message.msg?.length > RocketChat.settings.get('Message_MaxAllowedSize')
throw new Meteor.Error('error-message-size-exceeded', 'Message size exceeds Message_MaxAllowedSize', { method: 'sendMessage' })
if not Meteor.userId()
throw new Meteor.Error('error-invalid-user', "Invalid user", { method: 'sendMessage' })
user = RocketChat.models.Users.findOneById Meteor.userId(), fields: username: 1, name: 1
room = Meteor.call 'canAccessRoom', message.rid, user._id
if not room
return false
if user.username in (room.muted or [])
RocketChat.Notifications.notifyUser Meteor.userId(), 'message', {
_id: Random.id()
rid: room._id
ts: new Date
msg: TAPi18n.__('You_have_been_muted', {}, user.language);
}
return false
message.alias = message.alias or user.name
RocketChat.sendMessage user, message, room
# Limit a user to sending 5 msgs/second
# DDPRateLimiter.addRule
# type: 'method'
# name: 'sendMessage'
# userId: (userId) ->
# return RocketChat.models.Users.findOneById(userId)?.username isnt RocketChat.settings.get('InternalHubot_Username')
# , 5, 1000
| Set user's realname to alias if not set already | Set user's realname to alias if not set already
| CoffeeScript | mit | ealbers/Rocket.Chat,LearnersGuild/Rocket.Chat,ealbers/Rocket.Chat,k0nsl/Rocket.Chat,xasx/Rocket.Chat,danielbressan/Rocket.Chat,4thParty/Rocket.Chat,mrsimpson/Rocket.Chat,pitamar/Rocket.Chat,karlprieb/Rocket.Chat,timkinnane/Rocket.Chat,pitamar/Rocket.Chat,Achaikos/Rocket.Chat,Gyubin/Rocket.Chat,subesokun/Rocket.Chat,LearnersGuild/Rocket.Chat,wicked539/Rocket.Chat,LearnersGuild/echo-chat,fatihwk/Rocket.Chat,Sing-Li/Rocket.Chat,timkinnane/Rocket.Chat,intelradoux/Rocket.Chat,AimenJoe/Rocket.Chat,cnash/Rocket.Chat,ggazzo/Rocket.Chat,pkgodara/Rocket.Chat,AlecTroemel/Rocket.Chat,mrinaldhar/Rocket.Chat,Gyubin/Rocket.Chat,wicked539/Rocket.Chat,timkinnane/Rocket.Chat,AlecTroemel/Rocket.Chat,tntobias/Rocket.Chat,pitamar/Rocket.Chat,NMandapaty/Rocket.Chat,pkgodara/Rocket.Chat,trt15-ssci-organization/Rocket.Chat,ahmadassaf/Rocket.Chat,xasx/Rocket.Chat,pachox/Rocket.Chat,alexbrazier/Rocket.Chat,alexbrazier/Rocket.Chat,wtsarchive/Rocket.Chat,cnash/Rocket.Chat,mrsimpson/Rocket.Chat,trt15-ssci-organization/Rocket.Chat,mwharrison/Rocket.Chat,mrsimpson/Rocket.Chat,JamesHGreen/Rocket.Chat,igorstajic/Rocket.Chat,fatihwk/Rocket.Chat,marzieh312/Rocket.Chat,nishimaki10/Rocket.Chat,subesokun/Rocket.Chat,VoiSmart/Rocket.Chat,BorntraegerMarc/Rocket.Chat,cnash/Rocket.Chat,alexbrazier/Rocket.Chat,subesokun/Rocket.Chat,trt15-ssci-organization/Rocket.Chat,snaiperskaya96/Rocket.Chat,4thParty/Rocket.Chat,nishimaki10/Rocket.Chat,matthewshirley/Rocket.Chat,snaiperskaya96/Rocket.Chat,mccambridge/Rocket.Chat,abduljanjua/TheHub,pachox/Rocket.Chat,galrotem1993/Rocket.Chat,pkgodara/Rocket.Chat,wtsarchive/Rocket.Chat,matthewshirley/Rocket.Chat,Gyubin/Rocket.Chat,flaviogrossi/Rocket.Chat,Gudii/Rocket.Chat,Movile/Rocket.Chat,inoxth/Rocket.Chat,mccambridge/Rocket.Chat,AlecTroemel/Rocket.Chat,4thParty/Rocket.Chat,karlprieb/Rocket.Chat,abduljanjua/TheHub,BorntraegerMarc/Rocket.Chat,xasx/Rocket.Chat,4thParty/Rocket.Chat,wicked539/Rocket.Chat,ggazzo/Rocket.Chat,OtkurBiz/Rocket.Chat,galrotem1993/Rocket.Chat,mrsimpson/Rocket.Chat,danielbressan/Rocket.Chat,Achaikos/Rocket.Chat,JamesHGreen/Rocket_API,Gudii/Rocket.Chat,Sing-Li/Rocket.Chat,LearnersGuild/Rocket.Chat,AlecTroemel/Rocket.Chat,LearnersGuild/echo-chat,cnash/Rocket.Chat,inoxth/Rocket.Chat,tntobias/Rocket.Chat,mwharrison/Rocket.Chat,flaviogrossi/Rocket.Chat,galrotem1993/Rocket.Chat,pkgodara/Rocket.Chat,BorntraegerMarc/Rocket.Chat,pachox/Rocket.Chat,ggazzo/Rocket.Chat,Movile/Rocket.Chat,Gudii/Rocket.Chat,yuyixg/Rocket.Chat,VoiSmart/Rocket.Chat,inoio/Rocket.Chat,Gudii/Rocket.Chat,JamesHGreen/Rocket_API,AimenJoe/Rocket.Chat,NMandapaty/Rocket.Chat,ealbers/Rocket.Chat,matthewshirley/Rocket.Chat,wicked539/Rocket.Chat,jbsavoy18/rocketchat-1,yuyixg/Rocket.Chat,ziedmahdi/Rocket.Chat,jbsavoy18/rocketchat-1,JamesHGreen/Rocket.Chat,pachox/Rocket.Chat,marzieh312/Rocket.Chat,Kiran-Rao/Rocket.Chat,AimenJoe/Rocket.Chat,nishimaki10/Rocket.Chat,marzieh312/Rocket.Chat,Movile/Rocket.Chat,danielbressan/Rocket.Chat,Movile/Rocket.Chat,LearnersGuild/echo-chat,jbsavoy18/rocketchat-1,inoio/Rocket.Chat,mrinaldhar/Rocket.Chat,OtkurBiz/Rocket.Chat,tntobias/Rocket.Chat,snaiperskaya96/Rocket.Chat,VoiSmart/Rocket.Chat,Gyubin/Rocket.Chat,inoxth/Rocket.Chat,intelradoux/Rocket.Chat,Sing-Li/Rocket.Chat,JamesHGreen/Rocket_API,igorstajic/Rocket.Chat,marzieh312/Rocket.Chat,inoxth/Rocket.Chat,wtsarchive/Rocket.Chat,NMandapaty/Rocket.Chat,LearnersGuild/echo-chat,yuyixg/Rocket.Chat,ggazzo/Rocket.Chat,mwharrison/Rocket.Chat,JamesHGreen/Rocket.Chat,timkinnane/Rocket.Chat,OtkurBiz/Rocket.Chat,k0nsl/Rocket.Chat,intelradoux/Rocket.Chat,karlprieb/Rocket.Chat,nishimaki10/Rocket.Chat,mwharrison/Rocket.Chat,trt15-ssci-organization/Rocket.Chat,flaviogrossi/Rocket.Chat,intelradoux/Rocket.Chat,ahmadassaf/Rocket.Chat,alexbrazier/Rocket.Chat,Achaikos/Rocket.Chat,wtsarchive/Rocket.Chat,xasx/Rocket.Chat,matthewshirley/Rocket.Chat,galrotem1993/Rocket.Chat,k0nsl/Rocket.Chat,jbsavoy18/rocketchat-1,igorstajic/Rocket.Chat,Kiran-Rao/Rocket.Chat,ahmadassaf/Rocket.Chat,igorstajic/Rocket.Chat,yuyixg/Rocket.Chat,flaviogrossi/Rocket.Chat,OtkurBiz/Rocket.Chat,ziedmahdi/Rocket.Chat,mccambridge/Rocket.Chat,fatihwk/Rocket.Chat,ahmadassaf/Rocket.Chat,inoio/Rocket.Chat,NMandapaty/Rocket.Chat,karlprieb/Rocket.Chat,Sing-Li/Rocket.Chat,AimenJoe/Rocket.Chat,mrinaldhar/Rocket.Chat,mrinaldhar/Rocket.Chat,BorntraegerMarc/Rocket.Chat,abduljanjua/TheHub,fatihwk/Rocket.Chat,ealbers/Rocket.Chat,mccambridge/Rocket.Chat,JamesHGreen/Rocket_API,abduljanjua/TheHub,danielbressan/Rocket.Chat,Kiran-Rao/Rocket.Chat,snaiperskaya96/Rocket.Chat,k0nsl/Rocket.Chat,tntobias/Rocket.Chat,ziedmahdi/Rocket.Chat,LearnersGuild/Rocket.Chat,ziedmahdi/Rocket.Chat,Kiran-Rao/Rocket.Chat,Achaikos/Rocket.Chat,subesokun/Rocket.Chat,JamesHGreen/Rocket.Chat,pitamar/Rocket.Chat |
1454b5658d791ee802dc3caa6ccbb6dc757fc86f | app/assets/javascripts/todo_lists.js.coffee | app/assets/javascripts/todo_lists.js.coffee | # Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
OUT.registerCreatedHandler "todo_list", (selector) ->
$(selector).find("a.new").click()
$ ->
# Remove links to todo-list from todo-lists in content area
$('.content h2 a[rel="todo-list"]').each ->
$(this).replaceWith $(this).html()
# TODO: doesnot work with live added data
OUT.contentItems.highlightQueryIn ".content-items .content-item-todo-list h2, .content-items .todo-title", (chain) ->
matched_lists = $(".content-items .content-item-todo-list h2 span.highlight").parents('.content-item-todo-list')
matched_lists.find('.content-item').show()
$(window).load ->
$('.content-todo-list.sortable').sortable
connectWith: ".content-todo-list.sortable"
| # Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
OUT.registerCreatedHandler "todo_list", (selector) ->
$(selector).find("a.new").click()
# TODO: doesnot work when user clicks on "cancel" (triggers :show action, no update)
OUT.registerUpdatedHandler "todo_list", (selector) ->
OUT.todo_lists.flattenTitleLinks(selector)
OUT.todo_lists =
# Remove links to todo-list from todo-lists in content area
flattenTitleLinks: (root = '.content') ->
$(root).find('h2 a[rel="todo-list"]').each ->
$(this).replaceWith $(this).html()
$ ->
OUT.todo_lists.flattenTitleLinks()
OUT.contentItems.highlightQueryIn ".content-items .content-item-todo-list h2, .content-items .todo-title", (chain) ->
matched_lists = $(".content-items .content-item-todo-list h2 span.highlight").parents('.content-item-todo-list')
matched_lists.find('.content-item').show()
$(window).load ->
$('.content-todo-list.sortable').sortable
connectWith: ".content-todo-list.sortable"
| Move flattening title links for todo_lists in to own function; register updated handler | Move flattening title links for todo_lists in to own function; register updated handler
| CoffeeScript | mit | rrrene/outline,rrrene/outline |
b518b8d631592db807006c9942bc301b5375db73 | scripts/phabricator.coffee | scripts/phabricator.coffee | # Description:
# Shows a link to phabricator tasks and issues mentioned in comments
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# D#### - show a link to phabricator review
# T#### - show a link to phabricator task
#
# Author:
# tzjames
module.exports = (robot) ->
robot.hear /\b((D|T)\d+)\b/i, (msg) ->
if robot.fromSelf msg
return
robot.fancyMessage({
msg: "http://phabricator.khanacademy.org/" + msg.match[1],
room: msg.envelope.room,
from: "Phabot Rabbit",
message_format: "text"
});
| # Description:
# Shows a link to phabricator tasks and issues mentioned in comments
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# D#### - show a link to phabricator review
# T#### - show a link to phabricator task
#
# Author:
# tzjames
module.exports = (robot) ->
# We check for whitespace rather than a word boundary beforehand to make sure
# we don't match links, as / is considered a word boundary.
robot.hear /(^|\s)((D|T)\d+)\b/i, (msg) ->
if robot.fromSelf msg
return
robot.fancyMessage({
msg: "http://phabricator.khanacademy.org/" + msg.match[2],
room: msg.envelope.room,
from: "Phabot Rabbit",
message_format: "text"
});
| Make sure links aren't caught by Phabot Rabbit | Make sure links aren't caught by Phabot Rabbit
Test Plan:
set /bin/secrets to only be in jamestest room
bin/culturecow
type
D1234
check out D1234
http://phabricator.khanacademy.org/D1234
aD1
Make sure the frist two are responded to, but the last two aren't
Reviewers: csilvers
Reviewed By: csilvers
Differential Revision: http://phabricator.khanacademy.org/D14305
| CoffeeScript | mit | Khan/culture-cow,Khan/culture-cow |
51e0bc5bc8f88bf84dba709a13000b0043bea29b | lib/package-updates-status-view.coffee | lib/package-updates-status-view.coffee | _ = require 'underscore-plus'
{View} = require 'atom'
module.exports =
class PackageUpdatesStatusView extends View
@content: ->
@div class: 'inline-block text text-info', =>
@span class: 'icon icon-package'
@span outlet: 'countLabel', class: 'available-updates-status'
initialize: (statusBar, packages) ->
@countLabel.text(packages.length)
statusBar.appendRight(this)
@setTooltip("#{_.pluralize(packages.length, 'package update')} available")
@subscribe this, 'click', =>
@trigger('settings-view:install-packages')
@destroyTooltip()
@remove()
| _ = require 'underscore-plus'
{View} = require 'atom'
module.exports =
class PackageUpdatesStatusView extends View
@content: ->
@div class: 'inline-block text text-info', =>
@span class: 'icon icon-package'
@span outlet: 'countLabel', class: 'available-updates-status'
initialize: (statusBar, packages) ->
@countLabel.text(packages.length)
@setTooltip("#{_.pluralize(packages.length, 'package update')} available")
statusBar.appendRight(this)
@subscribe this, 'click', =>
@trigger('settings-view:install-packages')
@destroyTooltip()
@remove()
| Append after at end of initialize | Append after at end of initialize
| CoffeeScript | mit | atom/settings-view |
5ed018419c1026e67dd3b8a7868c9fd206c636ae | src/adapters/shell.coffee | src/adapters/shell.coffee | Readline = require 'readline'
Robot = require '../robot'
Adapter = require '../adapter'
class Shell extends Adapter
constructor: (robot) ->
super robot
@repl = null
send: (user, strings...) ->
console.log str for str in strings
@repl.prompt()
reply: (user, strings...) ->
@send user, strings...
run: ->
stdin = process.openStdin()
stdout = process.stdout
process.on "uncaughtException", (err) =>
@robot.logger.error "#{err}"
if Readline.createInterface.length > 3
@repl = Readline.createInterface stdin, null
stdin.on "data", (buffer) =>
@repl.write buffer
else
@repl = Readline.createInterface stdin, stdout, null
@repl.on "attemptClose", =>
@repl.close()
@repl.on "close", =>
process.stdout.write "\n"
stdin.destroy()
process.exit 0
@repl.on "line", (buffer) =>
user = @userForId '1', name: "Shell"
@receive new Robot.TextMessage user, buffer
@repl.prompt()
@repl.setPrompt "#{@robot.name}> "
@repl.prompt()
exports.use = (robot) ->
new Shell robot
| Readline = require 'readline'
Robot = require '../robot'
Adapter = require '../adapter'
class Shell extends Adapter
send: (user, strings...) ->
unless process.platform is "win32"
console.log "\033[01;32m#{str}\033[0m" for str in strings
else
console.log "#{str}" for str in strings
@repl.prompt()
reply: (user, strings...) ->
@send user, strings...
run: ->
stdin = process.openStdin()
stdout = process.stdout
process.on "uncaughtException", (err) =>
@robot.logger.error "#{err}"
@repl = Readline.createInterface stdin, stdout, null
@repl.on "close", =>
stdin.destroy()
process.exit 0
@repl.on "line", (buffer) =>
@repl.close() if buffer.toLowerCase() is "exit"
@repl.prompt()
user = @userForId '1', name: "Shell"
@receive new Robot.TextMessage user, buffer
@repl.setPrompt "#{@robot.name}> "
@repl.prompt()
exports.use = (robot) ->
new Shell robot
| Update repl prompt to work with async requests | Update repl prompt to work with async requests
| CoffeeScript | mit | gojee/gojee-hubot-deprecated,gojee/gojee-hubot-deprecated,gojee/gojee-hubot-deprecated |
ec141137cc8d0c3376d0f3dbef20e3260755e3ff | atom/atom.symlink/keymap.cson | atom/atom.symlink/keymap.cson | 'atom-text-editor':
'ctrl-i': 'editor:auto-indent'
'atom-text-editor':
'alt-s': 'editor:split-selection-into-lines'
| 'atom-text-editor':
'ctrl-i': 'editor:auto-indent'
'atom-text-editor':
'ctrl-k p': 'git-plus:push'
| Add push keybinding for atom | Add push keybinding for atom
| CoffeeScript | mit | abcsds/dotfiles,abcsds/dotfiles |
403892ceed361b3951f056e4791e194b2d3e7665 | keymaps/keybinding-resolver.cson | keymaps/keybinding-resolver.cson | '.workspace .platform-darwin':
'cmd-.': 'key-binding-resolver:toggle'
'.workspace .platform-win32':
'ctrl-.': 'key-binding-resolver:toggle'
| '.workspace .platform-darwin':
'cmd-.': 'key-binding-resolver:toggle'
'.workspace .platform-win32':
'ctrl-.': 'key-binding-resolver:toggle'
'.workspace .platform-linux':
'ctrl-.': 'key-binding-resolver:toggle'
| Add ctrl-. keybinding on Linux | :penguin: Add ctrl-. keybinding on Linux
| CoffeeScript | mit | atom/keybinding-resolver |
a075dc60397d2588045352f667d0811f3401c854 | spec/templates/methods/prototypical_methods.coffee | spec/templates/methods/prototypical_methods.coffee | # Public: Here's a class.
class Foo
# Here's a method, baz.
baz: () -> 'baz'
# Here is a method on Foo, called bar.
Foo::bar = () -> 'bar'
| # Public: Here's a class.
class Foo
# Here's a method, baz.
baz: () -> 'baz'
# Public: Here is a method on Foo, called bar.
Foo::bar = () -> 'bar'
| Set this method to public | Set this method to public
| CoffeeScript | mit | gjtorikian/biscotto,paulcbetts/biscotto,gjtorikian/biscotto,paulcbetts/biscotto,atom/donna,atom/donna |
449749de80d3ee6b8b70eae33c05021a88dc5b47 | assets/logic/router.coffee | assets/logic/router.coffee | # Setup router
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use VueRouter
###
Routing paths
`/` - (home) app index
`/:location` - (location) weather detail for a specific location
###
routes = [
{
name: 'home'
path: '/'
component: require '../components/home'
children: [
{
name: 'location'
path: ':slug'
component: require '../components/weather/index'
props: true
}
]
}
]
export default new VueRouter routes: routes, mode: 'history'
| # Setup router
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use VueRouter
###
Routing paths
`/` - (home) app index
`/:location` - (location) weather detail for a specific location
###
routes = [
{
name: 'home'
path: '/'
component: require '../components/home'
children: [
{
name: 'location'
path: ':slug'
component: require '../components/weather/index'
props: true
}
]
}
]
export default new VueRouter routes: routes
| Revert "trying history mode for gh-pages" | Revert "trying history mode for gh-pages"
This reverts commit dfcd5df36658335555caeebcae785bdc120fd976.
| CoffeeScript | mit | thelucre/weather,thelucre/weather |
f9c02e1410a076f0f295ece833cdd01d72d6f9b3 | keymaps/project-manager.cson | keymaps/project-manager.cson | # Keybindings require three things to be fully defined: A selector that is
# matched against the focused element, the keystroke and the command to
# execute.
#
# Below is a basic keybinding which registers on all platforms by applying to
# the root workspace element.
# For more detailed documentation see
# https://atom.io/docs/latest/advanced/keymaps
'.workspace':
'ctrl-cmd-p': 'project-manager:toggle'
| '.platform-darwin':
'ctrl-cmd-p': 'project-manager:toggle'
'.platform-win32':
'ctrl-alt-p': 'project-manager:toggle'
'.platform-linux':
'ctrl-alt-p': 'project-manager:toggle' | Add keybindings for windows and linux | Add keybindings for windows and linux
| CoffeeScript | mit | UltCombo/atom-project-manager,douggr/atom-project-manager,danielbrodin/atom-project-manager |
98facf9ecc75d8f5d6aabcf434ab929160637c3f | app/assets/javascripts/controllers/transactions-controller.js.coffee | app/assets/javascripts/controllers/transactions-controller.js.coffee | App.TransactionsController = Em.ArrayController.extend App.PagingMixin,
needs: ['categories']
perPage: 100
itemController: 'transaction'
init: ->
@_super()
dropped: ->
category = @get('controllers.categories.dragSource')
selections = @get('model').filterProperty 'selected'
promise = App.Matcher.bulkSave category, selections
my = @
promise.then ->
category.reload()
my.get('controllers.categories.unassigned').reload()
| App.TransactionsController = Em.ArrayController.extend App.PagingMixin,
needs: ['categories']
perPage: 100
itemController: 'transaction'
sortProperties: ['posted_at']
sortAscending: false
init: ->
@_super()
actions:
sort: (field) ->
@setProperties
sortProperties: [field]
dropped: ->
category = @get('controllers.categories.dragSource')
selections = @get('model').filterProperty 'selected'
promise = App.Matcher.bulkSave category, selections
my = @
promise.then ->
category.reload()
my.get('controllers.categories.unassigned').reload()
| Add preliminary sorting functionality to transactions controller | Add preliminary sorting functionality to transactions controller | CoffeeScript | mit | artzte/itcostus,artzte/itcostus |
8aff38dfe99c6a502bc4af582cf0e299a54968bd | app/assets/javascripts/neighborly/devise/registrations/new.js.coffee | app/assets/javascripts/neighborly/devise/registrations/new.js.coffee | Neighborly.Devise ?= {}
Neighborly.Devise.Registrations ?= {}
Neighborly.Devise.Registrations.New =
init: ->
$('#show_password').change ->
$input = $('#show_password')
$password = $('#user_password')
if $input.is(':checked')
$password.prop 'type', 'text'
else
$password.prop 'type', 'password'
| Neighborly.Devise ?= {}
Neighborly.Devise.Registrations ?= {}
Neighborly.Devise.Registrations.New =
init: ->
$('#show_password').change ->
$password = $('#user_password')
if $('#show_password').is(':checked')
$password.prop 'type', 'text'
else
$password.prop 'type', 'password'
| Refactor the if conditional on show password JS | Refactor the if conditional on show password JS
| CoffeeScript | mit | jinutm/silverme,MicroPasts/micropasts-crowdfunding,raksonibs/raimcrowd,jinutm/silverpro,MicroPasts/micropasts-crowdfunding,jinutm/silverpro,jinutm/silveralms.com,jinutm/silverme,jinutm/silverprod,gustavoguichard/neighborly,gustavoguichard/neighborly,raksonibs/raimcrowd,jinutm/silveralms.com,MicroPasts/micropasts-crowdfunding,jinutm/silverpro,raksonibs/raimcrowd,jinutm/silveralms.com,MicroPasts/micropasts-crowdfunding,jinutm/silverprod,raksonibs/raimcrowd,jinutm/silverme,gustavoguichard/neighborly,jinutm/silverprod |
d7d9d6c4439f038d91341988aba39a187f8397db | scripts/models/content/inherits/base.coffee | scripts/models/content/inherits/base.coffee | define [
'underscore'
'backbone'
], (_, Backbone) ->
return Backbone.Model.extend
url: () -> return "/api/content/#{ @id }"
mediaType: 'application/vnd.org.cnx.module'
toJSON: () ->
json = Backbone.Model::toJSON.apply(@, arguments)
json.mediaType = @mediaType
json.id = @id or @cid
json.loaded = @loaded
return json
getTitle: (container) ->
if @unique
title = @get('title')
else
title = container?.getTitle?(@) or @get('title')
return title
setTitle: (container, title) ->
if @unique
@set('title', title)
else
container.setTitle?(@, title) or @set('title', title)
| define [
'underscore'
'backbone'
], (_, Backbone) ->
return Backbone.Model.extend
url: () -> return "/api/content/#{ @id }"
mediaType: 'application/vnd.org.cnx.module'
toJSON: () ->
json = Backbone.Model::toJSON.apply(@, arguments)
json.mediaType = @mediaType
json.id = @id or @cid
json.loaded = @loaded
return json
getTitle: (container) ->
if @unique
title = @get('title')
else
title = container?.getTitle?(@) or @get('title')
return title
setTitle: (container, title) ->
if @unique
@set('title', title)
else
container?.setTitle?(@, title) or @set('title', title)
| Allow non-unique media to have their title changed globally | Allow non-unique media to have their title changed globally
| CoffeeScript | agpl-3.0 | oerpub/bookish,oerpub/github-bookeditor,oerpub/github-bookeditor,oerpub/bookish,oerpub/github-bookeditor |
933f941e8f2b4ca1d656275bf201065d2c64592e | atom/packages.cson | atom/packages.cson | packages: [
"autocomplete-emojis"
"busy-signal"
"editorconfig"
"file-icons"
"highlight-selected"
"intentions"
"linter"
"linter-coffeelint"
"linter-csslint"
"linter-eslint"
"linter-flake8"
"linter-htmlhint"
"linter-js-yaml"
"linter-jsonlint"
"linter-less"
"linter-php"
"linter-scss-lint"
"linter-shellcheck"
"linter-ui-default"
"linter-write-good"
"linter-xmllint"
"minimap"
"omni-ruler"
"package-sync"
"pigments"
"platformio-ide-terminal"
"pretty-json"
"sort-lines"
]
| packages: [
"autocomplete-emojis"
"busy-signal"
"editorconfig"
"file-icons"
"highlight-selected"
"intentions"
"linter"
"linter-coffeelint"
"linter-csslint"
"linter-eslint"
"linter-flake8"
"linter-htmlhint"
"linter-js-yaml"
"linter-jsonlint"
"linter-less"
"linter-php"
"linter-scss-lint"
"linter-shellcheck"
"linter-ui-default"
"linter-write-good"
"linter-xmllint"
"minimap"
"omni-ruler"
"package-sync"
"permanent-delete"
"pigments"
"platformio-ide-terminal"
"pretty-json"
"sort-lines"
]
| Add "permanent-delete" package to Atom | Add "permanent-delete" package to Atom
Because Atom can't delete a file without OS trash. :(
| CoffeeScript | mit | jmlntw/dotfiles,jmlntw/dotfiles |
d79509f1f43b36898161fee7bd1647294ab12073 | server/middleware/contact.coffee | server/middleware/contact.coffee | sendwithus = require '../sendwithus'
utils = require '../lib/utils'
errors = require '../commons/errors'
wrap = require 'co-express'
database = require '../commons/database'
parse = require '../commons/parse'
module.exports =
sendParentSignupInstructions: wrap (req, res, next) ->
context =
email_id: sendwithus.templates.coppa_deny_parent_signup
recipient:
address: req.body.parentEmail
if /@codecombat.com/.test(context.recipient.address) or not _.string.trim context.recipient.address
console.error "Somehow sent an email with bogus recipient? #{context.recipient.address}"
return next(new errors.InternalServerError("Error sending email. Need a valid recipient."))
sendwithus.api.send context, (err, result) ->
if err
return next(new errors.InternalServerError("Error sending email. Check that it's valid and try again."))
else
res.status(200).send()
| sendwithus = require '../sendwithus'
utils = require '../lib/utils'
errors = require '../commons/errors'
wrap = require 'co-express'
database = require '../commons/database'
parse = require '../commons/parse'
module.exports =
sendParentSignupInstructions: wrap (req, res, next) ->
context =
email_id: sendwithus.templates.coppa_deny_parent_signup
recipient:
address: req.body.parentEmail
if /@codecombat.com/.test(context.recipient.address) or not _.str.trim context.recipient.address
console.error "Somehow sent an email with bogus recipient? #{context.recipient.address}"
return next(new errors.InternalServerError("Error sending email. Need a valid recipient."))
sendwithus.api.send context, (err, result) ->
if err
return next(new errors.InternalServerError("Error sending email. Check that it's valid and try again."))
else
res.status(200).send()
| Fix _.string to _.str on recent server trim check | Fix _.string to _.str on recent server trim check
| CoffeeScript | mit | kidaa/codecombat,javatlacati/codecombat,kidaa/codecombat,javatlacati/codecombat,codecombat/codecombat,jeremiahyan/codecombat,jeremiahyan/codecombat,kidaa/codecombat,javatlacati/codecombat,jeremiahyan/codecombat,codecombat/codecombat,javatlacati/codecombat,javatlacati/codecombat,codecombat/codecombat,codecombat/codecombat,codecombat/codecombat,jeremiahyan/codecombat,kidaa/codecombat |
a3383f11a127cd8862459fea5866f13952ac5da1 | app/coffee/DraftModeManager.coffee | app/coffee/DraftModeManager.coffee | fs = require "fs"
logger = require "logger-sharelatex"
module.exports = DraftModeManager =
injectDraftMode: (filename, callback = (error) ->) ->
fs.readFile filename, "utf8", (error, content) ->
return callback(error) if error?
modified_content = DraftModeManager._injectDraftOption content
logger.log {
content: content.slice(0,1024), # \documentclass is normally v near the top
modified_content: modified_content.slice(0,1024),
filename
}, "injected draft class"
fs.writeFile filename, modified_content, callback
_injectDraftOption: (content) ->
content
# With existing options (must be first, otherwise both are applied)
.replace(/\\documentclass\[/, "\\documentclass[draft,")
# Without existing options
.replace(/\\documentclass\{/, "\\documentclass[draft]{") | fs = require "fs"
logger = require "logger-sharelatex"
module.exports = DraftModeManager =
injectDraftMode: (filename, callback = (error) ->) ->
fs.readFile filename, "utf8", (error, content) ->
return callback(error) if error?
modified_content = DraftModeManager._injectDraftOption content
logger.log {
content: content.slice(0,1024), # \documentclass is normally v near the top
modified_content: modified_content.slice(0,1024),
filename
}, "injected draft class"
fs.writeFile filename, modified_content, callback
_injectDraftOption: (content) ->
content
# With existing options (must be first, otherwise both are applied)
.replace(/\\documentclass\[/g, "\\documentclass[draft,")
# Without existing options
.replace(/\\documentclass\{/g, "\\documentclass[draft]{") | Make draft mode regex global | Make draft mode regex global
| CoffeeScript | agpl-3.0 | EDP-Sciences/clsi-sharelatex,sharelatex/clsi-sharelatex,sharelatex/clsi-sharelatex |
08bd35718df3400f69ce716691fcce3126d88358 | app.coffee | app.coffee | express = require 'express'
mongoose = require 'mongoose'
ext_type = require 'connect-ext-type'
{ createServer } = require 'http'
{ join } = require 'path'
module.exports = express().configure ->
@set 'port', process.env.PORT or 8070
@set 'view engine', 'jade'
@set 'views', join __dirname, 'views'
@locals
url: process.env.URL or "http://localhost:#{@settings.port}/"
pubkey_address: process.env.PUBKEY_ADDRESS
@db = mongoose.connect process.env.MONGO_URI or 'mongodb://localhost/'
@models = require('./models')(@db)
@use express.favicon()
@use express.logger 'dev'
@use express.bodyParser()
@use express.methodOverride()
@use ext_type '.json': 'application/json', '.txt': 'text/plain'
server = createServer this
require('./websocket').call(this, server)
require('./assets').call(this) if (@settings.env is 'development') or process.env.SERVE_ASSETS
# assets are pre-compiled and served by nginx on production
@use '/u', require('./user')(this)
server.listen @settings.port, => console.log "Listening on #{@settings.port}"
| express = require 'express'
mongoose = require 'mongoose'
ext_type = require 'connect-ext-type'
{ createServer } = require 'http'
{ join } = require 'path'
module.exports = express().configure ->
@set 'port', process.env.PORT or 8070
@set 'view engine', 'jade'
@set 'views', join __dirname, 'views'
@locals
url: process.env.URL or "http://localhost:#{@settings.port}/"
pubkey_address: process.env.PUBKEY_ADDRESS
pretty: @settings.env is 'development'
@db = mongoose.connect process.env.MONGO_URI or 'mongodb://localhost/'
@models = require('./models')(@db)
@use express.favicon()
@use express.logger 'dev'
@use express.bodyParser()
@use express.methodOverride()
@use ext_type '.json': 'application/json', '.txt': 'text/plain'
server = createServer this
require('./websocket').call(this, server)
require('./assets').call(this) if (@settings.env is 'development') or process.env.SERVE_ASSETS
# assets are pre-compiled and served by nginx on production
@use '/u', require('./user')(this)
server.listen @settings.port, => console.log "Listening on #{@settings.port}"
| Enable pretty HTML on development | Enable pretty HTML on development
| CoffeeScript | agpl-3.0 | shesek/bitrated,shesek/bitrated |
bcd7e62324594866a6bcb7c08b2d8a9a22c2122d | shared/specs/components/change-student-id-form.spec.coffee | shared/specs/components/change-student-id-form.spec.coffee | {Testing, expect, sinon, _, ReactTestUtils} = require 'shared/specs/helpers'
{ChangeStudentIdForm} = require 'shared'
describe 'ChangeStudentIdForm Component', ->
beforeEach ->
@props =
onCancel: sinon.spy()
onSubmit: sinon.spy()
label: 'a test label'
saveButtonLabel: 'this is save btn'
title: 'this is title'
it 'renders values from props', ->
Testing.renderComponent( ChangeStudentIdForm, props: @props ).then ({dom}) =>
expect(dom.querySelector('h3').textContent).to.equal(@props.title)
expect(dom.querySelector('.control-label').textContent).to.equal(@props.label)
expect(dom.querySelector('.btn').textContent).to.equal(@props.saveButtonLabel)
it 'calls onSubmit when save button is clicked', ->
Testing.renderComponent( ChangeStudentIdForm, props: @props ).then ({dom}) =>
expect(@props.onSubmit).not.to.have.been.called
dom.querySelector('input').value = 'test value'
Testing.actions.click(dom.querySelector('.btn'))
expect(@props.onSubmit).to.have.been.called
it 'calls onCancel when cancel button is clicked', ->
Testing.renderComponent( ChangeStudentIdForm, props: @props ).then ({dom}) =>
expect(@props.onCancel).not.to.have.been.called
Testing.actions.click(dom.querySelector('.cancel a'))
expect(@props.onCancel).to.have.been.called
| {Testing, expect, sinon, _, ReactTestUtils} = require 'shared/specs/helpers'
{ChangeStudentIdForm} = require 'shared'
describe 'ChangeStudentIdForm Component', ->
beforeEach ->
@props =
onCancel: sinon.spy()
onSubmit: sinon.spy()
label: 'a test label'
saveButtonLabel: 'this is save btn'
title: 'this is title'
it 'renders values from props', ->
Testing.renderComponent( ChangeStudentIdForm, props: @props ).then ({dom}) =>
expect(dom.querySelector('.title').textContent).to.equal(@props.title)
expect(dom.querySelector('.control-label').textContent).to.equal(@props.label)
expect(dom.querySelector('.btn').textContent).to.equal(@props.saveButtonLabel)
it 'calls onSubmit when save button is clicked', ->
Testing.renderComponent( ChangeStudentIdForm, props: @props ).then ({dom}) =>
expect(@props.onSubmit).not.to.have.been.called
dom.querySelector('input').value = 'test value'
Testing.actions.click(dom.querySelector('.btn'))
expect(@props.onSubmit).to.have.been.called
it 'calls onCancel when cancel button is clicked', ->
Testing.renderComponent( ChangeStudentIdForm, props: @props ).then ({dom}) =>
expect(@props.onCancel).not.to.have.been.called
Testing.actions.click(dom.querySelector('.cancel a'))
expect(@props.onCancel).to.have.been.called
| Use class instead of element | Use class instead of element
| CoffeeScript | agpl-3.0 | openstax/tutor-js,openstax/tutor-js,openstax/tutor-js,openstax/tutor-js,openstax/tutor-js |
d360b1c24a130a6d2644002e0eaa491689a01825 | app/pages/lab/science-case.cjsx | app/pages/lab/science-case.cjsx | React = require 'react'
AutoSave = require '../../components/auto-save'
handleInputChange = require '../../lib/handle-input-change'
module.exports = React.createClass
displayName: 'EditProjectScienceCase'
getDefaultProps: ->
project: {}
render: ->
<div>
<p className="form-help">This page is for you to describe your research motivations and goals to the volunteers. Feel free to add detail, but try to avoid jargon. This page renders markdown, so you can format it and add images via the Media Library and links. The site will show your team members with their profile pictures and roles to the side of the text.</p>
<p>
<AutoSave resource={@props.project}>
<span className="form-label">Science case</span>
<br />
<textarea className="standard-input full" name="science_case" value={@props.project.science_case} rows="20" onChange={handleInputChange.bind @props.project} />
</AutoSave>
</p>
</div>
| React = require 'react'
AutoSave = require '../../components/auto-save'
handleInputChange = require '../../lib/handle-input-change'
PromiseRenderer = require '../../components/promise-renderer'
apiClient = require '../../api/client'
module.exports = React.createClass
displayName: 'EditProjectScienceCase'
getDefaultProps: ->
project: {}
fetchOrCreate: ->
new Promise (resolve, reject) =>
@props.project.get('pages', url_key: 'science_case').then ([scienceCase]) =>
if scienceCase?
resolve(scienceCase)
else
params = project_pages: { url_key: "science_case", title: "Science", language: @props.project.primary_langauge }
apiClient.post(@props.project._getURL("project_pages"), params).then ([scienceCase]) =>
resolve(scienceCase)
render: ->
<div>
<p className="form-help">This page is for you to describe your research motivations and goals to the volunteers. Feel free to add detail, but try to avoid jargon. This page renders markdown, so you can format it and add images via the Media Library and links. The site will show your team members with their profile pictures and roles to the side of the text.</p>
<p>
<PromiseRenderer promise={@fetchOrCreate()}>{ (scienceCase) ->
<AutoSave resource={scienceCase}>
<span className="form-label">Science case</span>
<br />
<textarea className="standard-input full" name="science_case" value={@props.project.science_case} rows="20" onChange={handleInputChange.bind @props.project} />
</AutoSave>
}</PromiseRenderer>
</p>
</div>
| Update project lab to use new pages resource | Update project lab to use new pages resource
| CoffeeScript | apache-2.0 | zooniverse/Panoptes-Front-End,camallen/Panoptes-Front-End,jelliotartz/Panoptes-Front-End,edpaget/Panoptes-Front-End,CKrawczyk/Panoptes-Front-End,parrish/Panoptes-Front-End,alexbfree/Panoptes-Front-End,mrniaboc/Panoptes-Front-End,mrniaboc/Panoptes-Front-End,CKrawczyk/Panoptes-Front-End,amyrebecca/Panoptes-Front-End,fmnhExhibits/Panoptes-Front-End,edpaget/Panoptes-Front-End,camallen/Panoptes-Front-End,jelliotartz/Panoptes-Front-End,parrish/Panoptes-Front-End,amyrebecca/Panoptes-Front-End,CKrawczyk/Panoptes-Front-End,edpaget/Panoptes-Front-End,tfmorris/Panoptes-Front-End,aliburchard/Panoptes-Front-End,mrniaboc/Panoptes-Front-End,amyrebecca/Panoptes-Front-End,camallen/Panoptes-Front-End,jelliotartz/Panoptes-Front-End,parrish/Panoptes-Front-End,fmnhExhibits/Panoptes-Front-End,alexbfree/Panoptes-Front-End,aliburchard/Panoptes-Front-End,tfmorris/Panoptes-Front-End,fmnhExhibits/Panoptes-Front-End,alexbfree/Panoptes-Front-End |
40891e60400467d152763187243210f0378c200a | core/app/backbone/views/messages/conversation_item_view.coffee | core/app/backbone/views/messages/conversation_item_view.coffee | class window.ConversationItemView extends Backbone.Marionette.ItemView
tagName: 'li'
className: 'clearfix'
template: 'conversations/item'
events:
'click' : 'wholeElementClick'
templateHelpers: =>
url: @model.url()
wholeElementClick: (e) ->
url = @model.url()
e.preventDefault()
e.stopImmediatePropagation()
Backbone.history.navigate url, true
| class window.ConversationItemView extends Backbone.Marionette.ItemView
tagName: 'li'
className: 'clearfix'
template: 'conversations/item'
events:
'click' : 'wholeElementClick'
'click .user-profile-link' : 'userProfileLinkClick'
templateHelpers: =>
url: @model.url()
wholeElementClick: (e) ->
url = @model.url()
e.preventDefault()
e.stopImmediatePropagation()
Backbone.history.navigate url, true
userProfileLinkClick: (e) ->
console.info ('click"')
e.preventDefault()
e.stopImmediatePropagation()
Backbone.history.navigate @model.get('last_message').sender.username, true
| Allow backbone navigation from conversation index to user profile, in stead of letting the click be handled by the wholeElementClick | Allow backbone navigation from conversation index to user profile, in stead of letting the click be handled by the wholeElementClick
| CoffeeScript | mit | Factlink/factlink-core,daukantas/factlink-core,daukantas/factlink-core,daukantas/factlink-core,Factlink/factlink-core,Factlink/factlink-core,Factlink/factlink-core,daukantas/factlink-core |
40caa9666754f61d493a65cdbd73ddd9fde9510c | trinary/trinary_test.spec.coffee | trinary/trinary_test.spec.coffee | Trinary = require './example'
describe 'Trinary', ->
it '1 is decimal 1', ->
expect(1).toEqual new Trinary('1').toDecimal()
xit '2 is decimal 2', ->
expect(2).toEqual new Trinary('2').toDecimal()
xit '10 is decimal 3', ->
expect(3).toEqual new Trinary('10').toDecimal()
xit '11 is decimal 4', ->
expect(4).toEqual new Trinary('11').toDecimal()
xit '100 is decimal 9', ->
expect(9).toEqual new Trinary('100').toDecimal()
xit '112 is decimal 14', ->
expect(14).toEqual new Trinary('112').toDecimal()
xit '222 is 26', ->
expect(26).toEqual new Trinary('222').toDecimal()
xit '1122000120 is 32091', ->
expect(32091).toEqual new Trinary('1122000120').toDecimal()
xit 'invalid trinary is decimal 0', ->
expect(0).toEqual new Trinary('carrot').toDecimal()
| Trinary = require './example'
describe 'Trinary', ->
it '1 is decimal 1', ->
expect(new Trinary('1').toDecimal()).toEqual 1
xit '2 is decimal 2', ->
expect(new Trinary('2').toDecimal()).toEqual 2
xit '10 is decimal 3', ->
expect(new Trinary('10').toDecimal()).toEqual 3
xit '11 is decimal 4', ->
expect(new Trinary('11').toDecimal()).toEqual 4
xit '100 is decimal 9', ->
expect(new Trinary('100').toDecimal()).toEqual 9
xit '112 is decimal 14', ->
expect(new Trinary('112').toDecimal()).toEqual 14
xit '222 is 26', ->
expect(new Trinary('222').toDecimal()).toEqual 26
xit '1122000120 is 32091', ->
expect(new Trinary('1122000120').toDecimal()).toEqual 32091
xit 'invalid trinary is decimal 0', ->
expect(new Trinary('carrot').toDecimal()).toEqual 0
| Reorder expectations in trinary test suite | Reorder expectations in trinary test suite
This matches the jasmine conventions, and makes error messages less
confusing.
| CoffeeScript | mit | exercism/xcoffeescript |
3b97d6d0082279787f5125ef7e177cc701acaf7a | app/assets/javascripts/eventplug/app/events/_form.js.coffee | app/assets/javascripts/eventplug/app/events/_form.js.coffee | $ ->
if isOnPage 'eventplug-events', 'edit' or isOnPage 'eventplug-events', 'new'
$("#event_date").datepicker()
opts =
button: false
editor = new EpicEditor(opts).load()
editor.on 'save', ->
$('#event_description').val(editor.exportFile())
| $ ->
if isOnPage('eventplug-events', 'new') or isOnPage('eventplug-events', 'edit')
$("#event_date").datepicker()
opts =
button: false
editor = new EpicEditor(opts).load()
editor.on 'save', ->
$('#event_description').val(editor.exportFile())
| Correct coffeescript syntax for events | Correct coffeescript syntax for events
| CoffeeScript | mit | mconf/mweb_events,mconf/mweb_events,mconf/mweb_events |
cd61feae1f8e45f7ace5c988078d3638a5349c9b | lib/index.coffee | lib/index.coffee |
isObject = require 'is-object'
isFunction = require 'is-function'
###
when passed an object, returns an array of its keys.
when passed an array, returns an array of its indexes.
arrayify({a: 'aa', b: 'bb', c: 'cc'})
-> ['a', 'b', 'c']
arrayify(['one', 'two', 'three'])
-> [1, 2, 3]
###
arrayify = (obj) ->
(key for key of obj)
find = (haystack, needle, memo = []) ->
# isObject returns true from both objects and arrays
if needle and isObject(haystack)
if needle of haystack
memo.push haystack[needle]
for key in arrayify(haystack)
val = haystack[key]
if isFunction(needle)
needle(key, val)
if isObject(val)
find(val, needle, memo)
return memo
module.exports = (obj, key) ->
find obj, key
|
isFunction = require 'is-function'
isObjectOrArray = require 'is-object'
isArray = require 'is-array'
###
when passed an object, returns an array of its keys.
when passed an array, returns an array of its indexes.
arrayify({a: 'aa', b: 'bb', c: 'cc'})
-> ['a', 'b', 'c']
arrayify(['one', 'two', 'three'])
-> [1, 2, 3]
###
arrayify = (obj) ->
(key for key of obj)
find = (haystack, needle, memo = []) ->
if needle and isObjectOrArray(haystack)
if needle of haystack
memo.push haystack[needle]
for key in arrayify(haystack)
val = haystack[key]
if isFunction(needle)
needle(key, val)
if isObjectOrArray(val)
find(val, needle, memo)
return memo
module.exports = (obj, key) ->
find obj, key
| Change name of function isObject to isObejctOrArray | Change name of function isObject to isObejctOrArray
Makes the flow more clear. Also added isArray function which returnes
true only if passed an Array
| CoffeeScript | mit | simon-johansson/keyfinder |
3fc29b56c86e86b05c4b35426e1e0129cbbed720 | jigs/grid/jig.coffee | jigs/grid/jig.coffee | button = require '../../button'
grid = require '../../grid'
parser = require 'stout-client/parser'
window.onload = ->
parser.parse().then ->
grid = $stout.get('#basic-grid')
$stout.get('#btn-add').click = ->
randomSize = -> Math.max 5, Math.ceil(Math.random() * 8)
i = 2
while i--
height = randomSize()
width = randomSize()
grid.context.createItem {height, width}
| button = require '../../button'
grid = require '../../grid'
parser = require 'stout-client/parser'
window.onload = ->
parser.parse().then ->
grid = $stout.get('#basic-grid')
$stout.get('#btn-add').click = ->
randomSize = -> Math.max 1, Math.ceil(Math.random() * 3)
i = 2
while i--
height = randomSize()
width = randomSize()
item = grid.context.createItem {height, width}
image = Math.ceil(Math.round(Math.random() * 1000))
item.root.style.backgroundImage = "url('https://unsplash.it/800?image=#{image}')"
#item.click = -> @remove()
$stout.get('#btn-clear').click = ->
grid.context.destroyGridItems()
| Integrate grid clearing and add random background image. | Integrate grid clearing and add random background image.
| CoffeeScript | agpl-3.0 | JoshuaToenyes/stout-ui,JoshuaToenyes/stout-ui,JoshuaToenyes/stout-ui |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.