Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Fix spelling misstake in test case | assert = require 'assert'
request = require 'supertest'
req = request require '../src/server'
describe '/CloudHealthCheck', ->
it 'should return 200 for OPTIONS request', (done) ->
req.options '/CloudHealthCheck'
.expect 200
.end done
it 'shoudl return 200 for GET request', (done) ->
req.get... | assert = require 'assert'
request = require 'supertest'
req = request require '../src/server'
describe '/CloudHealthCheck', ->
it 'should return 200 for OPTIONS request', (done) ->
req.options '/CloudHealthCheck'
.expect 200
.end done
it 'should return 200 for GET request', (done) ->
req.get... |
Use default configuration if no project config is available | fs = require 'fs'
path = require 'path'
module.exports =
class ProjectConfig
data: {}
disposables: []
constructor: ->
@load(atom.project.getPaths())
@disposables.push(atom.project.onDidChangePaths(@load))
load: (paths) ->
for dir in paths
if @isDirectory(dir)
... | fs = require 'fs'
path = require 'path'
$ = require('jquery')
defaultConfig = {
"server": "http://localhost:8080/exist",
"user": "guest",
"password": "guest",
"root": "/db"
}
module.exports =
class ProjectConfig
data: {}
disposables: []
constructor: ->
@load(atom.project.getPaths... |
Update timeout to 5 seconds | chai = require('chai')
sinon = require('sinon')
sinonChai = require('sinon-chai')
chai.use(sinonChai)
isFunction = require('lodash/isFunction')
global.enzyme = require 'enzyme'
chaiEnzyme = require('chai-enzyme')
chai.use(chaiEnzyme())
global.Promise = require.requireActual('es6-promise')
# https://github.com/facebo... | chai = require('chai')
sinon = require('sinon')
sinonChai = require('sinon-chai')
chai.use(sinonChai)
isFunction = require('lodash/isFunction')
global.enzyme = require 'enzyme'
chaiEnzyme = require('chai-enzyme')
chai.use(chaiEnzyme())
global.Promise = require.requireActual('es6-promise')
# https://github.com/facebo... |
Set start day for lic87 | export startDayForWeeks =
"lic40": "2019-09-04"
"lic87": "2019-09-02"
"zaoch": "2019-09-01"
"stud": "2019-09-02"
"notnnov": "2019-09-02"
"graduated": "2019-09-02"
"unknown": "2019-09-02"
export WEEK_ACTIVITY_EXP = 0.55
export LEVEL_RATING_EXP = 2.5
export ACTIVITY_THRESHOLD = 0.1
export MSE... | export startDayForWeeks =
"lic40": "2019-09-04"
"lic87": "2019-08-31"
"zaoch": "2019-09-01"
"stud": "2019-09-02"
"notnnov": "2019-09-02"
"graduated": "2019-09-02"
"unknown": "2019-09-02"
export WEEK_ACTIVITY_EXP = 0.55
export LEVEL_RATING_EXP = 2.5
export ACTIVITY_THRESHOLD = 0.1
export MSE... |
Check if view is available | {View} = require 'atom'
module.exports =
class PdfStatusBarView extends View
@content: ->
@div class: 'status-image inline-block', =>
@span class: 'pdf-status', outlet: 'pdfStatus'
initialize: (@statusBar) ->
@attach()
@subscribe atom.workspaceView, 'pane-container:active-pane-item-changed', =>... | {View} = require 'atom'
module.exports =
class PdfStatusBarView extends View
@content: ->
@div class: 'status-image inline-block', =>
@span class: 'pdf-status', outlet: 'pdfStatus'
initialize: (@statusBar) ->
@attach()
@subscribe atom.workspaceView, 'pane-container:active-pane-item-changed', =>... |
Watch CoffeeScript files, not compiled JS files | module.exports = (grunt) ->
# Project configuration.
grunt.initConfig
coffee:
default:
files: [
expand: true # Enable dynamic expansion.
cwd: 'src/' # Src matches are relative to this path.
src: ['**/*.coffee'] # Actual pattern(s) to match.
... | module.exports = (grunt) ->
# Project configuration.
grunt.initConfig
coffee:
default:
files: [
expand: true # Enable dynamic expansion.
cwd: 'src/' # Src matches are relative to this path.
src: ['**/*.coffee'] # Actual pattern(s) to match.
... |
Add { as alignable character (disabled by default) | module.exports =
selector: ['.source.css.scss', '.source.sass']
id: 'aligner-scss' # package name
config:
':-alignment':
title: 'Padding for :'
description: 'Pad left or right of the character'
type: 'string'
default: 'right'
':-leftSpace':
title: 'Left space for :'
des... | module.exports =
selector: ['.source.css.scss', '.source.sass']
id: 'aligner-scss' # package name
config:
':-enabled':
title: 'Enable aligning :'
type: 'boolean'
default: true
':-alignment':
title: 'Padding for :'
description: 'Pad left or right of the character'
type: ... |
Save the syntax validation setting in the onboarding view. | define [
"base"
], (App) ->
App.controller "FeatureOnboardingController", ($scope, settings) ->
$scope.isFeatureSettingDefined = window.userSettings.syntaxValidation?;
$scope.innerStep = 1
$scope.turnCodeCheckOn = () ->
settings.saveProjectSettings({ syntaxValidation: true })
navToInnerStep2()
$sc... | define [
"base"
], (App) ->
App.controller "FeatureOnboardingController", ($scope, settings) ->
$scope.isFeatureSettingDefined = window.userSettings.syntaxValidation?;
$scope.innerStep = 1
$scope.turnCodeCheckOn = () ->
settings.saveSettings({ syntaxValidation: true })
navToInnerStep2()
$scope.tur... |
Add editor.nonWordCharacters to editor config panel | ConfigPanel = require 'config-panel'
module.exports =
class EditorConfigPanel extends ConfigPanel
@content: ->
@div class: 'config-panel', =>
@div class: 'row', =>
@label for: 'editor.fontSize', "Font Size:"
@input id: 'editor.fontSize', type: 'int', size: 2
@div class: 'row', =>
... | ConfigPanel = require 'config-panel'
module.exports =
class EditorConfigPanel extends ConfigPanel
@content: ->
@div class: 'config-panel', =>
@div class: 'row', =>
@label for: 'editor.fontSize', "Font Size:"
@input id: 'editor.fontSize', type: 'int', size: 2
@div class: 'row', =>
... |
Add support for firefox by getting rid of new implementation of ellipse method on canvas context | session = require '../session'
utils = require '../utils'
rectangle = (width, height) ->
utils.startShape()
x = session.pos.x * session.ratio
y = session.pos.y * session.ratio
width *= session.ratio
height *= session.ratio
session.ctx.rect x, y, width, height
utils.endShape()
square = (... | session = require '../session'
utils = require '../utils'
rectangle = (width, height) ->
utils.startShape()
x = session.pos.x * session.ratio
y = session.pos.y * session.ratio
width *= session.ratio
height *= session.ratio
session.ctx.rect x, y, width, height
utils.endShape()
square = (... |
Create choice and get-by-competitionId routes | {models, Resource, filters} = require '../resource_helper'
ChoiceResource = new Resource
resourceNameMany: 'choices'
resourceNameOne: 'choice'
model: models.choice
module.exports = ChoiceResource | {models, Resource, filters} = require '../resource_helper'
crud = require 'bloops/crud'
errors = require 'bloops/errors'
ChoiceResource = new Resource
resourceNameMany: 'choices'
resourceNameOne: 'choice'
model: models.choice
getEndpoints: -> [
'show'
'update'
'destroy'
'patch'
'index'
... |
Revert "Take 1 ms off the fromTime operator" | Rx = require 'rx/index.js'
R = require 'ramda'
Rx.Observable.fromTime = (timesAndValues, scheduler) ->
timers = R.keys(timesAndValues)
.map (relativeTime) -> [parseInt(relativeTime), timesAndValues[relativeTime]]
.map ([time, value]) ->
# 1 is substracted at the moment to not distract users
# wit... | Rx = require 'rx/index.js'
R = require 'ramda'
Rx.Observable.fromTime = (timesAndValues, scheduler) ->
timers = R.keys(timesAndValues)
.map (relativeTime) -> [parseInt(relativeTime), timesAndValues[relativeTime]]
.map ([time, value]) ->
Rx.Observable.timer(time, scheduler).map R.I(value)
Rx.Observab... |
Simplify Grunt CoffeeScript compile syntax | module.exports = (grunt) ->
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.initConfig
coffee:
compile:
files:
'lib/shuss-cli.js': 'src/shuss-cli.coffee'
'lib/shuss-config.js': 'src/shuss-config.coffee'
'lib/shuss-logger.js': 'src/shuss-logger.coffee'
'lib/... | module.exports = (grunt) ->
grunt.loadNpmTasks 'grunt-contrib-coffee'
grunt.initConfig
coffee:
compile:
expand: true
flatten: true
cwd: 'src/'
src: ['*.coffee']
dest: 'lib/'
ext: '.js'
grunt.registerTask 'default', ['coffee:compile']
|
Add correct function call on load | window.Binco.Select2 =
load: (selector) ->
selector = if typeof selector == 'undefined' then '.select2-rails' else selector
$(selector).select2()
$(document).ready window.Binco.Select2
$(document).on 'page:load', window.Binco.Select2
| window.Binco.Select2 =
load: (selector) ->
selector = if typeof selector == 'undefined' then '.select2-rails' else selector
$(selector).select2()
$(document).ready window.Binco.Select2.load
$(document).on 'page:load', window.Binco.Select2.load
|
Improve querystring serializer to detect numbers, nulls, undefined and booleans | Qs = require('qs');
module.exports =
encode : (data)->
Qs.stringify(data)
decode : (search)->
return Qs.parse(window.location.search.slice(1)) unless search
Qs.parse(search)
| Qs = require('qs');
keywords =
true: true
false: false
null: null
undefined: undefined
decoder = (value) ->
return parseFloat(value) if (/^(\d+|\d*\.\d+)$/.test(value))
return keywords[value] if (value of keywords)
return value
module.exports =
encode : (data)->
Qs.stringify(data)... |
Add file-icons package to Atom | packages: [
"auto-indent"
"emmet"
"expand-region"
"git-diff-popup"
"git-plus"
"git-time-machine"
"language-javascript-jsx"
"linter"
"linter-eslint"
"linter-rubocop"
"linter-sass-lint"
"list-edit"
"markdown-scroll-sync"
"merge-conflicts"
"package-sync"
"project-manager"
"rails-open-rspe... | packages: [
"auto-indent"
"emmet"
"expand-region"
"file-icons"
"git-diff-popup"
"git-plus"
"git-time-machine"
"language-javascript-jsx"
"linter"
"linter-eslint"
"linter-rubocop"
"linter-sass-lint"
"list-edit"
"markdown-scroll-sync"
"merge-conflicts"
"package-sync"
"project-manager"
"... |
Use 'uncaught-error' event from atom | {_} = require 'atom'
Guid = require 'guid'
Reporter = require './reporter'
module.exports =
activate: ->
atom.config.set('exception-reporting.userId', Guid.raw()) unless atom.config.get('exception-reporting.userId')
atom.on 'error.exception-reporting', (message, url, line) ->
Reporter.send(message, ur... | {_} = require 'atom'
Guid = require 'guid'
Reporter = require './reporter'
module.exports =
activate: ->
atom.config.set('exception-reporting.userId', Guid.raw()) unless atom.config.get('exception-reporting.userId')
atom.on 'uncaught-error.exception', (message, url, line) ->
Reporter.send(message, url... |
Change sunset hours for atom | "*":
core:
disabledPackages: [
"wrap-guide"
"activate-power-mode"
]
themes: [
"one-light-ui"
"one-light-syntax"
]
editor: {}
"exception-reporting":
userId: "79967b20-c933-87c9-85b8-ea6b20c3a648"
"linter-puppet-lint":
oldVersion: false
skip140Chars: true
sk... | "*":
core:
disabledPackages: [
"wrap-guide"
"activate-power-mode"
]
editor: {}
"exception-reporting":
userId: "79967b20-c933-87c9-85b8-ea6b20c3a648"
"linter-puppet-lint":
oldVersion: false
skip140Chars: true
skip80Chars: true
minimap:
plugins:
cursorline: true
... |
Change dictionary url to Daum | $ ->
$input = $('input')
$button = $('button')
$dicIframe = $('.dic')
$imagesIframe = $('.images')
search = ->
query = $input.val()
return if query is ''
dicUrlPrefix = 'http://endic.naver.com/search.nhn?sLn=en&searchOption=all&query='
imagesUrlPrefix = 'http://images.search.yahoo.com/search/... | $ ->
$input = $('input')
$button = $('button')
$dicIframe = $('.dic')
$imagesIframe = $('.images')
search = ->
query = $input.val()
return if query is ''
dicUrlPrefix = 'http://dic.daum.net/search.do?dic=eng&q='
imagesUrlPrefix = 'http://images.search.yahoo.com/search/images?p='
$dicIfram... |
Refactor CardQuestionView to use new Command/Aggregate structure | eventric = require 'eventric'
ReadAggregateEntity = eventric 'ReadAggregateEntity'
class ReadAggregateRoot extends ReadAggregateEntity
module.exports = ReadAggregateRoot | _ = require 'underscore'
Backbone = require 'backbone'
eventric = require 'eventric'
ReadAggregateEntity = eventric 'ReadAggregateEntity'
class ReadAggregateRoot extends ReadAggregateEntity
_.extend @prototype, Backbone.Events
module.exports = ReadAggregateRoot |
Modify the speakers page to include only accepted speakers | class @SpeakersController extends RouteController
waitOn: -> Meteor.subscribe('speakers')
after: -> document.title = "Speakers | Reversim Summit 2014"
tempalte: 'speakers'
data: ->
page: 'speakers'
speakers: User.allSpeakers() | class @SpeakersController extends RouteController
waitOn: -> Meteor.subscribe('proposals')
after: -> document.title = "Speakers | Reversim Summit 2014"
tempalte: 'speakers'
data: ->
page: 'speakers'
speakers: User.allSpeakers() |
Add model time entry test for duration | TimeEntry = require '../../models/time_entry'
should = require 'should'
makeT = (offset = 10) ->
t = new TimeEntry
start: new Date() - 5
end: new Date() - offset
message: 'message goes here'
userId: 'someuserID'
projectId: 'someprojectID'
describe 'TimeEntry Model', ->
it 'should be able to cr... | TimeEntry = require '../../models/time_entry'
should = require 'should'
makeT = (offset = 10) ->
t = new TimeEntry
start: new Date() - 5
end: new Date() - offset
message: 'message goes here'
userId: 'someuserID'
projectId: 'someprojectID'
describe 'TimeEntry Model', ->
it 'should be able to cr... |
Use ISO format for calendar events to avoid problems with TZ | $(document).on 'page:change', ->
container = $('#events-calendar')
eventUpdate = (event)->
url = "/events/#{event.id}"
data =
start_time: event.start.toJSON()
end_time: event.end.toJSON()
$.ajax "/events/#{event.id}",
type: 'PATCH'
dataType: 'json'
data: { event: data... | $(document).on 'page:change', ->
container = $('#events-calendar')
eventUpdate = (event)->
url = "/events/#{event.id}"
data =
start_time: event.start.toISOString()
end_time: event.end.toISOString()
$.ajax "/events/#{event.id}",
type: 'PATCH'
dataType: 'json'
data: { e... |
Move some methods to a lower point. Handle history creation. | define ['lodash'], (L) -> Array '$rootScope', '$scope', '$http', (root, scope, http) ->
root.startingPoints = []
http.get("/tools", {params: {capabilities: "initial"}})
.then ({data}) -> root.startingPoints = data
scope.expandTool = (tool) ->
for other in scope.startingPoints when other isnt tool
... | define ['lodash'], (L) -> Array '$rootScope', '$scope', '$http', 'Histories', (root, scope, http, Histories) ->
root.startingPoints = []
http.get("/tools", {params: {capabilities: "initial"}})
.then ({data}) -> root.startingPoints = data
scope.expandTool = (tool) ->
for other in scope.startingPoints ... |
Add support for --- keyword (transition) | 'scopeName': 'source.vp'
'name': 'Valkyrie Profile'
'fileTypes': ['vp']
'patterns': [
{
'match': '^[^\t]*$',
'name': 'entity name function vp'
},
{
'match': '^\t{2}.*$'
'name': 'constant language vp'
}
]
| 'scopeName': 'source.vp'
'name': 'Valkyrie Profile'
'fileTypes': ['vp']
'patterns': [
{
'match': '^---$'
'name': 'keyword language vp'
},
{
'match': '^[^\t]*$',
'name': 'entity name function vp'
},
{
'match': '^\t{2}.*$'
'name': 'constant language vp'
}
]
|
Rename filePath local var to uri because that's more accurate | {_, Document} = require 'atom'
SettingsView = null
settingsView = null
configUri = 'atom://config'
createSettingsView = (state) ->
SettingsView ?= require './settings-view'
unless state instanceof Document
state = _.extend({deserializer: deserializer.name, version: deserializer.version}, state)
state = a... | {_, Document} = require 'atom'
SettingsView = null
settingsView = null
configUri = 'atom://config'
createSettingsView = (state) ->
SettingsView ?= require './settings-view'
unless state instanceof Document
state = _.extend({deserializer: deserializer.name, version: deserializer.version}, state)
state = a... |
Remove duplicate nulling out of view | _ = require 'underscore'
module.exports =
projectPaths: null
fuzzyFinderView: null
activate: (state) ->
rootView.command 'fuzzy-finder:toggle-file-finder', =>
@createView().toggleFileFinder()
rootView.command 'fuzzy-finder:toggle-buffer-finder', =>
@createView().toggleBufferFinder()
root... | _ = require 'underscore'
module.exports =
projectPaths: null
fuzzyFinderView: null
activate: (state) ->
rootView.command 'fuzzy-finder:toggle-file-finder', =>
@createView().toggleFileFinder()
rootView.command 'fuzzy-finder:toggle-buffer-finder', =>
@createView().toggleBufferFinder()
root... |
Add commented out docker config | Path = require "path"
module.exports =
# Options are passed to Sequelize.
# See http://sequelizejs.com/documentation#usage-options for details
mysql:
clsi:
database: "clsi"
username: "clsi"
password: null
dialect: "sqlite"
storage: Path.resolve(__dirname + "/../db.sqlite")
path:
compilesDir: ... | Path = require "path"
module.exports =
# Options are passed to Sequelize.
# See http://sequelizejs.com/documentation#usage-options for details
mysql:
clsi:
database: "clsi"
username: "clsi"
password: null
dialect: "sqlite"
storage: Path.resolve(__dirname + "/../db.sqlite")
path:
compilesDir: ... |
Add snippet for Mocha test statement | # Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#... | # Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#... |
Initialize answers 'after-insert' callback to keep answers order | App.Answers =
nestedAnswers: ->
$('.nested-answers').on 'cocoon:after-insert', (e, insertedItem) ->
nestedAnswersCount = $("input[type='hidden'][name$='[given_order]']").size()
$(insertedItem).find("input[type='hidden'][name$='[given_order]']").val(nestedAnswersCount)
initialize: ->
App.Answer... | App.Answers =
initializeAnswers: (answers) ->
$(answers).on 'cocoon:after-insert', (e, new_answer) ->
given_order = App.Answers.maxGivenOrder(answers) + 1
$(new_answer).find("[name$='[given_order]']").val(given_order)
maxGivenOrder: (answers) ->
max_order = 0
$(answers).find("[name$='[give... |
Use boolean synonyms off and yes to make model human readable. | module.exports =
# Turn off migrations.
migrate: 'safe'
# Turn off auto fields.
autoCreatedAt: false
autoUpdatedAt: false
autoPK: false
# Validation rules.
attributes:
user_id:
type: 'string'
hexadecimal: true
required: true
email:
type: 'string'
email: true
... | module.exports =
# Turn off migrations.
migrate: 'safe'
# Turn off auto fields.
autoCreatedAt: off
autoUpdatedAt: off
autoPK: off
# Validation rules.
attributes:
user_id:
type: 'string'
hexadecimal: yes
required: yes
email:
type: 'string'
email: yes
required... |
Update example with help text | Listnr = @Listnr
createEl = (tag) ->
document.createElement(tag)
div = createEl('div')
div.innerHTML = """
<dl>
<dt>Context:</dt>
<dd id="context"></dd>
<dt>Action:</dt>
<dd id="action"></dd>
</dl>
"""
document.body.appendChild(div)
listnr = new Listnr()
setContext = (ctx) ->
document
.g... | Listnr = @Listnr
createEl = (tag) ->
document.createElement(tag)
div = createEl('div')
div.innerHTML = """
<dl>
<dt>Context:</dt>
<dd id="context"></dd>
<dt>Action:</dt>
<dd id="action"></dd>
</dl>
<pre id="help">
</pre>
"""
document.body.appendChild(div)
listnr = new Listnr()
setContext =... |
Fix `injectHints` might return undefined markers | { Marker } = require 'marker'
{ interfaces: Ci } = Components
HTMLDocument = Ci.nsIDOMHTMLDocument
XULDocument = Ci.nsIDOMXULDocument
CONTAINER_ID = 'VimFxHintMarkerContainer'
createHintsContainer = (document) ->
container = document.createElement('div')
container.id = CONTAINER_ID
container.className = 'V... | { Marker } = require 'marker'
{ interfaces: Ci } = Components
HTMLDocument = Ci.nsIDOMHTMLDocument
XULDocument = Ci.nsIDOMXULDocument
CONTAINER_ID = 'VimFxHintMarkerContainer'
createHintsContainer = (document) ->
container = document.createElement('div')
container.id = CONTAINER_ID
container.className = 'V... |
Make split view class optional in layout builder. | class WorkspaceLayoutBuilder extends KDSplitComboView
init: ->
@splitViews = {}
{direction, sizes, views, cssClass, splitName} = @getOption 'layoutOptions'
@baseSplitName = splitName
splitOptions = {
type : direction
viewsConfig : views
sizes
cssClass
}
@a... | class WorkspaceLayoutBuilder extends KDSplitComboView
init: ->
@splitViews = {}
{direction, sizes, views, cssClass, splitName} = @getOption 'layoutOptions'
@baseSplitName = splitName
splitOptions = {
type : direction
viewsConfig : views
sizes
cssClass
}
@a... |
Apply line styles on display-updated. | {View, $} = require 'atom'
module.exports =
class SideView extends View
@content: (side) ->
@div class: "side #{side.klass()} ui-site-#{side.site()}", =>
@div class: 'controls', =>
@label class: 'text-highlight', side.ref
@span class: 'text-subtle', "// #{side.description()}"
@butto... | {View, $} = require 'atom'
module.exports =
class SideView extends View
@content: (side) ->
@div class: "side #{side.klass()} ui-site-#{side.site()}", =>
@div class: 'controls', =>
@label class: 'text-highlight', side.ref
@span class: 'text-subtle', "// #{side.description()}"
@butto... |
Use the sarcoma test fixture. | _ = require 'lodash'
expect = require('./helpers/expect')()
Page = require('./helpers/page')()
class ImageDetailPage extends Page
displayPanel: ->
this.select('qi-series-image')
describe 'E2E Testing Image Detail', ->
page = null
beforeEach ->
page = new ImageDetailPage '/quip/breast/subject/1/sessio... | _ = require 'lodash'
expect = require('./helpers/expect')()
Page = require('./helpers/page')()
class ImageDetailPage extends Page
displayPanel: ->
this.select('qi-series-image')
describe 'E2E Testing Image Detail', ->
page = null
beforeEach ->
page = new ImageDetailPage '/quip/sarcoma/subject/1/sessi... |
Add hash to view all link to jump user down to gallery section | { timespanInWords } = require '../../components/util/date_helpers.coffee'
module.exports =
viewAllUrl: (module) ->
if module.key is 'related_artists'
return module.context.artist.href
return module.context.href if module.context
urls =
active_bids: false
followed_artists: '/works-for-... | { timespanInWords } = require '../../components/util/date_helpers.coffee'
module.exports =
viewAllUrl: (module) ->
if module.key is 'related_artists'
return module.context.artist.href
return module.context.href if module.context
urls =
active_bids: false
followed_artists: '/works-for-... |
Fix target and add class when block has fetched | Backbone = require 'backbone'
Block = require '../../models/block.coffee'
ConnectView = require '../connect/client/connect_view.coffee'
analytics = require '../../lib/analytics.coffee'
mediator = require '../../lib/mediator.coffee'
BlockCollectionConnectIntegrationView = require '../connect_v2/integration/block_collect... | Backbone = require 'backbone'
Block = require '../../models/block.coffee'
ConnectView = require '../connect/client/connect_view.coffee'
analytics = require '../../lib/analytics.coffee'
mediator = require '../../lib/mediator.coffee'
BlockCollectionConnectIntegrationView = require '../connect_v2/integration/block_collect... |
Use a default text title | jQuery ->
updateToc = =>
$(".toc").find("li").each ->
if $(@).find("a")[0].href == window.location.href
$(@).addClass("active")
else
$(@).removeClass("active")
$(".part").each ->
if ($(@).attr("id") || "") == window.location.hash.substring(1)
$(@).s... | jQuery ->
updateToc = =>
$(".toc").find("li").each ->
if $(@).find("a")[0].href == window.location.href
$(@).addClass("active")
else
$(@).removeClass("active")
$(".part").each ->
if ($(@).attr("id") || "") == window.location.hash.substring(1)
$(@).s... |
Add trigger event to parent view on show | define (require) ->
BaseView = require('cs!helpers/backbone/views/base')
template = require('hbs!helpers/backbone/views/attached/tooltip/tooltip-template')
require('less!helpers/backbone/views/attached/tooltip/tooltip')
return class Tooltip extends BaseView
containerTemplate: template
type: 'tooltip'
... | define (require) ->
BaseView = require('cs!helpers/backbone/views/base')
template = require('hbs!helpers/backbone/views/attached/tooltip/tooltip-template')
require('less!helpers/backbone/views/attached/tooltip/tooltip')
return class Tooltip extends BaseView
containerTemplate: template
type: 'tooltip'
... |
Add response time global setting option to file | define (require) ->
$ = require('jquery')
require('mockjax')
# GET
$.mockjax (settings) ->
# settings.url == '/contents/<uuid>'
service = settings.url.match(/\/contents\/(.*)$/)
if service
return {proxy: 'data/' + service[1] + '.json'}
$.mockjax (settings) ->
# settings.url == '/sear... | define (require) ->
$ = require('jquery')
require('mockjax')
$.mockjaxSettings.responseTime = 500 # Set the mock latency for all requests
# GET
$.mockjax (settings) ->
# settings.url == '/contents/<uuid>'
service = settings.url.match(/\/contents\/(.*)$/)
if service
return {proxy: 'data/'... |
Fix usage of SMTPTesting through CLI | smtp = require 'simplesmtp'
module.exports = SMTPTesting = {}
SMTPTesting.mailStore = []
SMTPTesting.lastConnection = {}
queueID = 0
# to be overidden
SMTPTesting.onSecondMessage = (env, callback) ->
callback null
SMTPTesting.init = (port, done) ->
smtpServer = smtp.createServer
debug: false
... | smtp = require 'simplesmtp'
module.exports = SMTPTesting = {}
SMTPTesting.mailStore = []
SMTPTesting.lastConnection = {}
queueID = 0
# to be overidden
SMTPTesting.onSecondMessage = (env, callback) ->
callback null
SMTPTesting.init = (port, done) ->
smtpServer = smtp.createServer
debug: false
... |
Rename 'get' function to 'fetch' for consistency | http = require '../../lib/http'
schedule = require '../../data/schedule'
exports.register = (server, baseRoute) ->
http.get server, "#{baseRoute}/schedule", get
get = ->
# TODO: get from Google API profile call
googleId = 'foo'
schedule.fetch(googleId)
.then (schedule) ->
userDisplayName: 'Joe User... | http = require '../../lib/http'
schedule = require '../../data/schedule'
exports.register = (server, baseRoute) ->
http.get server, "#{baseRoute}/schedule", fetch
fetch = ->
# TODO: get from Google API profile call
googleId = 'foo'
schedule.fetch(googleId)
.then (schedule) ->
userDisplayName: 'Joe ... |
Use haskell package as actual package | AtomStackIdeView = require './stack-ide-atom-view'
{CompositeDisposable} = require 'atom'
haskell = require('./haskell/generated/haskell')
p = haskell.getPackage()
console.log p
module.exports = AtomStackIde =
atomStackIdeView: null
modalPanel: null
subscriptions: null
activate: (state) ->
@atomStackIdeV... | AtomStackIdeView = require './stack-ide-atom-view'
{CompositeDisposable} = require 'atom'
haskell = require('./haskell/generated/haskell')
module.exports = haskell.getPackage()
###
module.exports = AtomStackIde =
atomStackIdeView: null
modalPanel: null
subscriptions: null
activate: (state) ->
@atomStack... |
Add submenu to context menu + Rename menu items | # See https://atom.io/docs/latest/hacking-atom-package-word-count#menus for more details
# TODO: Do we really want these in the context menu? Might be too much clutter.
'context-menu':
'atom-text-editor': [
{
'label': 'Select List Element'
'command': 'list-edit:select'
}
{
'label': 'Cut ... | # See https://atom.io/docs/latest/hacking-atom-package-word-count#menus for more details
# TODO: Do we really want these in the context menu? Might be too much clutter.
'context-menu':
'atom-text-editor': [
label: 'List edit'
submenu: [
{
'label': 'Select'
'command': 'list-edit:select'
... |
Support adding collaborator via email | #
# Collection for a channel's collaborators
#
Base = require "./base.coffee"
sd = require("sharify").data
User = require "../models/user.coffee"
mediator = require '../lib/mediator.coffee'
module.exports = class Collaborators extends Base
model: User
url: -> "#{sd.API_URL}/channels/#{@channel_slug}/collaborato... | #
# Collection for a channel's collaborators
#
Base = require "./base.coffee"
sd = require("sharify").data
User = require "../models/user.coffee"
mediator = require '../lib/mediator.coffee'
module.exports = class Collaborators extends Base
model: User
url: -> "#{sd.API_URL}/channels/#{@channel_slug}/collaborato... |
Fix up things for kevin | _ = require 'underscore-plus'
spacePen = require 'space-pen'
ConfigObserver = require './config-observer'
{Subscriber} = require 'emissary'
_.extend spacePen.View.prototype, ConfigObserver
Subscriber.includeInto(spacePen.View)
jQuery = spacePen.jQuery
originalCleanData = jQuery.cleanData
jQuery.cleanData = (elements)... | _ = require 'underscore-plus'
spacePen = require 'space-pen'
ConfigObserver = require './config-observer'
{Subscriber} = require 'emissary'
_.extend spacePen.View.prototype, ConfigObserver
Subscriber.includeInto(spacePen.View)
jQuery = spacePen.jQuery
originalCleanData = jQuery.cleanData
jQuery.cleanData = (elements)... |
Remove change-room x, we are not using it | {div, span, header, i} = React.DOM
{form, input, label} = React.DOM
{ul, li} = React.DOM
user = React.createClass
render: ->
li className: 'user',
div className: 'user-name',
@props.nick
usersList = React.createClass
render: ->
users = @props.users.map (u) ->
user(u)
ul className: ... | {div, span, header, i} = React.DOM
{form, input, label} = React.DOM
{ul, li} = React.DOM
user = React.createClass
render: ->
li className: 'user',
div className: 'user-name',
@props.nick
usersList = React.createClass
render: ->
users = @props.users.map (u) ->
user(u)
ul className: ... |
Hide ignore names by default | "*":
core:
autoHideMenuBar: true
disabledPackages: [
"vim-mode"
]
editor:
fontSize: 10
invisibles: {}
scrollPastEnd: true
showIndentGuide: true
"exception-reporting":
userId: "d066aaa4-63cd-1f08-a0e5-c8efdcf5268d"
"git-plus": {}
"markdown-preview":
useGitHubStyle: tru... | "*":
core:
autoHideMenuBar: true
disabledPackages: [
"vim-mode"
]
editor:
fontSize: 10
invisibles: {}
scrollPastEnd: true
showIndentGuide: true
"exception-reporting":
userId: "d066aaa4-63cd-1f08-a0e5-c8efdcf5268d"
"git-plus": {}
"markdown-preview":
useGitHubStyle: tru... |
Disable `save` on preview pane | {TextEditor} = require 'atom'
util = require './util'
pluginManager = require './plugin-manager'
module.exports =
class CoffeeCompileEditor extends TextEditor
constructor: ({@sourceEditor}) ->
super
if atom.config.get('coffee-compile.compileOnSave') and not
atom.config.get('coffee-compile.compileOnS... | {TextEditor} = require 'atom'
util = require './util'
pluginManager = require './plugin-manager'
module.exports =
class CoffeeCompileEditor extends TextEditor
constructor: ({@sourceEditor}) ->
super
if atom.config.get('coffee-compile.compileOnSave') and not
atom.config.get('coffee-compile.compileOnS... |
Move opener registration into a nextTick. | {CompositeDisposable} = require 'atom'
HistoryView = null
ChangesView = null
HISTORY_URI = 'atom://git-experiment/view-history'
CHANGES_URI = 'atom://git-experiment/view-changes'
module.exports = GitExperiment =
subscriptions: null
activate: (state) ->
# Events subscribed to in atom's system can be easily cl... | {CompositeDisposable} = require 'atom'
HistoryView = null
ChangesView = null
HISTORY_URI = 'atom://git-experiment/view-history'
CHANGES_URI = 'atom://git-experiment/view-changes'
module.exports = GitExperiment =
subscriptions: null
activate: (state) ->
# Events subscribed to in atom's system can be easily cl... |
Add label to jitsi integration success | ready = ->
# Jitsi Meet integration
if $('body').hasClass('c-discourse a-embed') > 0
$('#launch-jitsi').click ->
room = 'Fablabs.io-' + Math.random().toString(36).substr(2, 8)
domain = 'meet.jit.si'
jitsiUrl = "http://"+domain+"/"+room
$("#jitsi-url").replaceWith 'Invite other users fro... | ready = ->
# Jitsi Meet integration
if $('body').hasClass('c-discourse a-embed') > 0
$('#launch-jitsi').click ->
room = 'Fablabs.io-' + Math.random().toString(36).substr(2, 8)
domain = 'meet.jit.si'
jitsiUrl = "http://"+domain+"/"+room
$("#jitsi-url").replaceWith '<span class="label lab... |
Fix missing minimap version check in plugin activation | MinimapFindAndReplaceBinding = require './minimap-find-and-replace-binding'
module.exports =
binding: null
activate: (state) ->
findPackage = atom.packages.getLoadedPackage('find-and-replace')
minimapPackage = atom.packages.getLoadedPackage('minimap')
return @deactivate() unless findPackage? and minim... | MinimapFindAndReplaceBinding = require './minimap-find-and-replace-binding'
module.exports =
binding: null
activate: (state) ->
findPackage = atom.packages.getLoadedPackage('find-and-replace')
minimapPackage = atom.packages.getLoadedPackage('minimap')
return @deactivate() unless findPackage? and minim... |
Add options: max line length, ignore error codes | linterPath = atom.packages.getLoadedPackage("linter").path
Linter = require "#{linterPath}/lib/linter"
class LinterFlake8 extends Linter
@syntax: ['source.python']
cmd: 'flake8'
executablePath: null
linterName: 'flake8'
# A regex pattern used to extract information from the executable's output.
regex:... | linterPath = atom.packages.getLoadedPackage("linter").path
Linter = require "#{linterPath}/lib/linter"
class LinterFlake8 extends Linter
@syntax: ['source.python']
cmd: 'flake8'
executablePath: null
linterName: 'flake8'
# A regex pattern used to extract information from the executable's output.
regex:... |
Support dashes in the github username | # Github Credentials allows you to map your user against your GitHub user.
# This is specifically in order to work with apps that have GitHub Oauth users.
#
# who do you know - List all the users with github logins tracked by Hubot
# i am `maddox` - map your user to the github login `maddox`
# who am i - reveal your ma... | # Github Credentials allows you to map your user against your GitHub user.
# This is specifically in order to work with apps that have GitHub Oauth users.
#
# who do you know - List all the users with github logins tracked by Hubot
# i am `maddox` - map your user to the github login `maddox`
# who am i - reveal your ma... |
Fix deprecated ac+ blacklist option | BufferController = require './buffer-controller'
{Emitter} = require 'atom'
module.exports =
class AutocompleteProvider
selector: '.source.haskell'
blacklist: '.source.haskell .comment'
inclusionPriority: 1
excludeLowerPriority: false
info:
moduleList: []
langOpts: []
ghcFlags: []
emitter: null... | BufferController = require './buffer-controller'
{Emitter} = require 'atom'
module.exports =
class AutocompleteProvider
selector: '.source.haskell'
disableForSelector: '.source.haskell .comment'
inclusionPriority: 1
excludeLowerPriority: false
info:
moduleList: []
langOpts: []
ghcFlags: []
emit... |
Fix replacing spaces in app names | # This script teaches Hubot to answer questions like "Who owns Collections Publisher?"
# and "Who owns publishing-api?"
module.exports = (robot) ->
robot.hear /who owns (.*)\?/i, (res) ->
# Best guess of the intended application.
application = res.match[1].replace(' ', '-').toLowerCase()
robot.http("http... | # This script teaches Hubot to answer questions like "Who owns Collections Publisher?"
# and "Who owns publishing-api?"
module.exports = (robot) ->
robot.hear /who owns (.*)\?/i, (res) ->
# Best guess of the intended application.
application = res.match[1].replace(/ /g, '-').toLowerCase()
console.log("Fet... |
Remove droppable attribute and override already defined method about this | kd = require 'kd'
KDTabHandleView = kd.TabHandleView
module.exports = class IDETabHandleView extends KDTabHandleView
constructor: (options = {}, data) ->
options.droppable ?= yes
options.bind = 'dragstart'
super options, data
dragStart: (event) ->
## workaround for FF and ... | kd = require 'kd'
KDTabHandleView = kd.TabHandleView
module.exports = class IDETabHandleView extends KDTabHandleView
constructor: (options = {}, data) ->
options.draggable ?= yes
options.bind = 'dragstart'
super options, data
setDraggable: ->
@setAttribute 'draggable', yes... |
Fix options not working from Atom UI and config file | "use strict"
Beautifier = require('./beautifier')
prettier = require("prettier")
module.exports = class Prettier extends Beautifier
name: "Prettier"
link: "https://github.com/prettier/prettier"
options: {
_:
tabWidth: "indent_size"
useTabs: ["indent_with_tabs", "indent_char", (indent_with_tabs, ... | "use strict"
Beautifier = require('./beautifier')
prettier = require("prettier")
module.exports = class Prettier extends Beautifier
name: "Prettier"
link: "https://github.com/prettier/prettier"
options: {
_:
tabWidth: "indent_size"
useTabs: ["indent_with_tabs", "indent_char", (indent_with_tabs, ... |
Fix a duplicate variable issue | Path = require 'path'
{CompositeDisposable, Emitter} = require 'atom'
{LinterTrace, LinterMessage, LinterError, LinterWarning} = require './messages'
EditorLinter = require './editor-linter'
class Linter
constructor: ->
@Emitter = new Emitter
@Subscriptions = new CompositeDisposable
@EditorLinters = ne... | Path = require 'path'
{CompositeDisposable, Emitter} = require 'atom'
{LinterTrace, LinterMessage, LinterError, LinterWarning} = require './messages'
EditorLinter = require './editor-linter'
class Linter
constructor: ->
@Emitter = new Emitter
@Subscriptions = new CompositeDisposable
@EditorLinters = ne... |
Fix for position buttons panel | angular.module('loomioApp').directive 'positionButtonsPanel', ->
scope: {proposal: '='}
restrict: 'E'
templateUrl: 'generated/components/thread_page/position_buttons_panel/position_buttons_panel.html'
replace: true
controller: ($scope, ModalService, VoteForm, CurrentUser, Records) ->
$scope.showPositionB... | angular.module('loomioApp').directive 'positionButtonsPanel', ->
scope: {proposal: '='}
restrict: 'E'
templateUrl: 'generated/components/thread_page/position_buttons_panel/position_buttons_panel.html'
replace: true
controller: ($scope, ModalService, VoteForm, CurrentUser, Records, AbilityService) ->
$sco... |
Fix toggling hooks on profile page | Travis.AccountController = Ember.ObjectController.extend
allHooks: []
needs: ['currentUser']
userBinding: 'controllers.currentUser'
init: ->
@_super.apply this, arguments
self = this
Travis.on("user:synced", (->
self.reloadHooks()
))
toggle: (hook) ->
hook.toggle()
reloadHooks:... | Travis.AccountController = Ember.ObjectController.extend
allHooks: []
needs: ['currentUser']
userBinding: 'controllers.currentUser'
init: ->
@_super.apply this, arguments
self = this
Travis.on("user:synced", (->
self.reloadHooks()
))
actions:
sync: ->
@get('user').sync()
... |
Allow language-coffee-script without a license for now |
module.exports = (grunt) ->
grunt.registerTask 'check-licenses', 'Report the licenses of all dependencies', ->
legalEagle = require 'legal-eagle'
{size, keys} = require 'underscore-plus'
done = @async()
options =
path: process.cwd()
omitPermissive: true
overrides: require './licens... |
module.exports = (grunt) ->
grunt.registerTask 'check-licenses', 'Report the licenses of all dependencies', ->
legalEagle = require 'legal-eagle'
{size, keys} = require 'underscore-plus'
done = @async()
options =
path: process.cwd()
omitPermissive: true
overrides: require './licens... |
Add API key to the Organization model | mongoose = require 'mongoose'
timestamps = require 'mongoose-timestamps'
Schema = mongoose.Schema
db = mongoose.createConnection "mongodb://localhost:27017/badges-#{process.env.NODE_ENV}"
OrganizationSchema = new Schema
name: String
origin: String
org: String
contact: String
created_at: Date
updated_at: Da... | mongoose = require 'mongoose'
timestamps = require 'mongoose-timestamps'
Schema = mongoose.Schema
db = mongoose.createConnection "mongodb://localhost:27017/badges-#{process.env.NODE_ENV}"
OrganizationSchema = new Schema
name: String
origin: String
org: String
api_key: String
contact: String
created_at: Dat... |
Use text instead of html | $ = jQuery
export default class Notice
constructor: ->
$ @initialize
hide: =>
$('#notice-container').hide()
initialize: =>
msg = Cookies.get 'notice'
return unless msg? && msg != ''
@show msg, true
Cookies.remove 'notice'
# If initial is true, this is a notice set by the notice... | $ = jQuery
export default class Notice
constructor: ->
$ @initialize
hide: =>
$('#notice-container').hide()
initialize: =>
msg = Cookies.get 'notice'
return unless msg? && msg != ''
@show msg, true
Cookies.remove 'notice'
# If initial is true, this is a notice set by the notice... |
Use the explicit setup step | StepView = require './step.coffee'
Form = require '../../form/index.coffee'
Feedback = require '../../../models/feedback.coffee'
Representatives = require '../../../collections/representatives.coffee'
template = -> require('../templates/specialist.jade') arguments...
module.exports = class Specialist extends StepView
... | StepView = require './step.coffee'
Form = require '../../form/index.coffee'
Feedback = require '../../../models/feedback.coffee'
Representatives = require '../../../collections/representatives.coffee'
template = -> require('../templates/specialist.jade') arguments...
module.exports = class Specialist extends StepView
... |
Set the type inside the directive. | '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... | '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... |
Remove unused "native" toolbar element attribute | {cloneFragment, triggerEvent} = Trix
Trix.registerElement "trix-toolbar",
defaultCSS: """
%t {
white-space: collapse;
}
%t .dialog {
display: none;
}
%t .dialog.active {
display: block;
}
%t .dialog input.validate:invalid {
background-color: #ffdddd;
}
... | {cloneFragment, triggerEvent} = Trix
Trix.registerElement "trix-toolbar",
defaultCSS: """
%t {
white-space: collapse;
}
%t .dialog {
display: none;
}
%t .dialog.active {
display: block;
}
%t .dialog input.validate:invalid {
background-color: #ffdddd;
}
... |
Use an insanely complicated regex to test for a semantic version | should = require 'should'
Impromptu = require '../src/impromptu'
describe 'Impromptu', ->
it 'should exist', ->
should.exist Impromptu
it 'should use semantic versions', ->
/^\d+\.\d+\.\d+(\D|$)/.test(Impromptu.VERSION).should.be.true
describe 'Impromptu.Error', ->
it 'should have a message', ->
e... | should = require 'should'
Impromptu = require '../src/impromptu'
describe 'Impromptu', ->
it 'should exist', ->
should.exist Impromptu
it 'should use semantic versions', ->
# https://github.com/coolaj86/semver-utils/blob/v1.0.1/semver-utils.js
regex = /^((\d+)\.(\d+)\.(\d+))(?:-([\dA-Za-z\-]+(?:\.[\d... |
Check rate limit and warn user if about to be exceeded | noflo = require 'noflo'
exports.getComponent = ->
c = new noflo.Component
c.description = 'Get user token from action'
c.icon = 'key'
c.inPorts.add 'in',
datatype: 'object'
c.outPorts.add 'token',
datatype: 'string'
c.outPorts.add 'out',
datatype: 'object'
c.outPorts.add 'error',
datatype... | noflo = require 'noflo'
octo = require 'octo'
exports.getComponent = ->
c = new noflo.Component
c.description = 'Get user token from action'
c.icon = 'key'
c.inPorts.add 'in',
datatype: 'object'
c.outPorts.add 'token',
datatype: 'string'
c.outPorts.add 'out',
datatype: 'object'
c.outPorts.add... |
Change imported name from "math" to "bokeh_math" to make it more obvious this is not related to the core JS "Math" facility. | _ = require "underscore"
Transform = require "./transform"
p = require "../../core/properties"
math = require "../../core/util/math"
class Jitter extends Transform.Model
initialize: (attrs, options) ->
super(attrs, options)
@define {
mean: [ p.Number, 0 ]
width: [ p.Number, 1... | _ = require "underscore"
Transform = require "./transform"
p = require "../../core/properties"
bokeh_math = require "../../core/util/math"
class Jitter extends Transform.Model
initialize: (attrs, options) ->
super(attrs, options)
@define {
mean: [ p.Number, 0 ]
width: [ p.Num... |
Add default page legth to 25 for datatable for readability | $(document).on "page:change", ->
$(".data-table").each ->
table = $(@)
return if $.fn.dataTable.isDataTable(table)
options =
responsive: true
order: [[0, "desc"]]
ascColumn = table.find("th.sort-asc").index()
descColumn = table.find("th.sort-desc").index()
if (ascColumn >= 0)
... | $(document).on "page:change", ->
$(".data-table").each ->
table = $(@)
return if $.fn.dataTable.isDataTable(table)
options =
responsive: true
order: [[0, "desc"]]
pageLength: 25
ascColumn = table.find("th.sort-asc").index()
descColumn = table.find("th.sort-desc").index()
... |
Work on RequireJS Jasmine test. | describe "RequireJS", ->
beforeEach ->
@addMatchers requirejsTobeUndefined: ->
typeof requirejs is "undefined"
it "check that the RequireJS object is present in the global namespace", ->
expect(RequireJS).toEqual jasmine.any(Object)
expect(window.RequireJS).toEqual jasmine.any(Object)
it "che... | describe "RequireJS", ->
beforeEach ->
@addMatchers
requirejsTobeUndefined: ->
typeof requirejs is "undefined"
requireTobeUndefined: ->
typeof require is "undefined"
defineTobeUndefined: ->
typeof define is "undefined"
it "check that the RequireJS object is present ... |
Add uploaded marker to map | do ->
mapOptions =
center: new (google.maps.LatLng)(43.8321591, 4.3428536)
mapTypeId: google.maps.MapTypeId.ROADMAP
streetViewControl: false
scrollwheel: false
navigationControl: false
mapTypeControl: false
scaleControl: false
draggable: false
zoomControlOptions: style: google.maps.ZoomControlStyle.... | do ->
mapOptions =
center: new (google.maps.LatLng)(43.8321591, 4.3428536)
mapTypeId: google.maps.MapTypeId.ROADMAP
streetViewControl: false
scrollwheel: false
navigationControl: false
mapTypeControl: false
scaleControl: false
draggable: false
zoomControlOptions: style: google.maps.ZoomControlStyle.... |
Clear selection every time you change of folder. | angular.module('fileManager').
factory('Selection', ()->
return class Selection
@_files: {}
@number: 0
@add: (file)->
if not @hasFile(file)
@_files[file._id] = file
@number++
@remove: (file)->
if @hasFile(file)
delete @_files[file._id]
@number--
@clea... | angular.module('fileManager').
factory('Selection', ($rootScope)->
class Selection
@_files: {}
@number: 0
@add: (file)->
if not @hasFile(file)
@_files[file._id] = file
@number++
@remove: (file)->
if @hasFile(file)
delete @_files[file._id]
@number--
@c... |
Add spec for copying keybinding | path = require 'path'
KeybindingPanel = require '../lib/keybinding-panel'
describe "KeybindingPanel", ->
panel = null
describe "loads and displays core key bindings", ->
beforeEach ->
expect(atom.keymap).toBeDefined()
spyOn(atom.keymap, 'getKeyBindings').andReturn [
source: "#{atom.getLoad... | path = require 'path'
KeybindingPanel = require '../lib/keybinding-panel'
describe "KeybindingPanel", ->
panel = null
beforeEach ->
expect(atom.keymap).toBeDefined()
spyOn(atom.keymap, 'getKeyBindings').andReturn [
source: "#{atom.getLoadSettings().resourcePath}#{path.sep}keymaps", keystroke: 'ctrl-... |
Add location and player classes | jQuery(document).ready ->
class photographyGame
constructor: (@debug, @map) ->
init: () ->
return
| jQuery(document).ready ->
class photographyGame
constructor: (@debug, @map) ->
init: () ->
class location
constructor: (@position, @name, @icon) ->
@marker
addTo: (map) ->
if @icon
marker = new google.maps.Marker({
position: @position,
map: map,
i... |
Check if package can be upgraded using the latest version | _ = require 'underscore-plus'
{View} = require 'atom'
# Menu item view for an installed package
module.exports =
class PackageMenuView extends View
@content: ->
@li =>
@a outlet: 'link', class: 'icon', =>
@span outlet: 'nameLabel'
@span outlet: 'packageAuthorLabel', class: 'package-author'
... | _ = require 'underscore-plus'
{View} = require 'atom'
# Menu item view for an installed package
module.exports =
class PackageMenuView extends View
@content: ->
@li =>
@a outlet: 'link', class: 'icon', =>
@span outlet: 'nameLabel'
@span outlet: 'packageAuthorLabel', class: 'package-author'
... |
Fix test related to relations. | require './setup'
Song = null
Album = null
spy = null
describe 'has one change', ->
beforeEach ->
Song = Ento()
.use(Ento.relations)
.attr('id')
.attr('title')
Album = Ento()
.use(Ento.relations)
.attr('id')
.hasOne('song', Song, as: 'album')
describe 'propagate chang... | require './setup'
Song = null
Album = null
spy = null
describe 'has one change', ->
beforeEach ->
Song = Ento()
.use(Ento.relations)
.attr('id')
.attr('title')
Album = Ento()
.use(Ento.relations)
.attr('id')
.hasOne('song', Song, as: 'album')
describe 'propagate chang... |
Change semantics of node() a little to allow for string path or multiple arguments | module.exports = class Organization
constructor: (org, @api) ->
@orgName = if typeof org is "object" then org.name else org
node: (path, cb) ->
@api.get @apiPath(path), {}, cb
apiPath: (path) ->
path = path.path || path.name if typeof path is "object"
"/#{encodeURIComponent(@orgName)}/#{path}" | module.exports = class Organization
constructor: (org, @api) ->
@orgName = if typeof org is "object" then org.name else org
node: (path..., cb) ->
@api.get @apiPath(path), {}, cb
apiPath: (path) ->
compiledPath = []
for p in path
p = p.path || p.name if typeof p is "object"
compiledP... |
Use router Link to prevent full page reload | React = require 'react'
BS = require 'react-bootstrap'
_ = require 'underscore'
{History, Link} = require 'react-router'
{TransitionActions, TransitionStore} = require '../../flux/transition'
BackButton = React.createClass
displayName: 'BackButton'
propTypes:
fallbackLink: React.PropTypes.shape(
to: Re... | React = require 'react'
BS = require 'react-bootstrap'
_ = require 'underscore'
{History, Link} = require 'react-router'
{TransitionActions, TransitionStore} = require '../../flux/transition'
BackButton = React.createClass
displayName: 'BackButton'
propTypes:
bsStyle: React.PropTypes.string
fallbackLink:... |
Support events on nest temp and humidity |
NestNode = require('./NestNode')
module.exports = class NestThermostatNode extends NestNode
aspects:
"temperature-sensor": {}
"humidity-sensor": {}
"temperature-set-point":
commands:
"set-target": (node, temp) -> node.adapter.setTemperature(node.id, temp)
events:
"target-chan... |
NestNode = require('./NestNode')
module.exports = class NestThermostatNode extends NestNode
aspects:
"temperature-sensor":
events:
changed: (prev, cur) -> prev.value != cur.value
"humidity-sensor":
events:
changed: (prev, cur) -> prev.value != cur.value
"temperature-set-point... |
Add .md extension to generated license | fs = require 'fs'
path = require 'path'
module.exports = (grunt) ->
grunt.registerTask 'generate-license', 'Generate the license, including the licenses of all dependencies', (mode) ->
legalEagle = require 'legal-eagle'
done = @async()
options =
path: process.cwd()
overrides: require './lice... | fs = require 'fs'
path = require 'path'
module.exports = (grunt) ->
grunt.registerTask 'generate-license', 'Generate the license, including the licenses of all dependencies', (mode) ->
legalEagle = require 'legal-eagle'
done = @async()
options =
path: process.cwd()
overrides: require './lice... |
Change optional require format to make webpack happier |
tryRequire = (dep) ->
try
require dep
catch
undefined
@window ||= {}
Q = @window.Q
_ = @window._
Q ||= tryRequire 'q'
_ ||= tryRequire 'lodash/dist/lodash.underscore'
_ ||= tryRequire 'underscore'
utils = require('./yayson/utils')(_, Q)
Adapter = require('./yayson/adapter')
adapters = require('./yayso... | @window ||= {}
Q = @window.Q
_ = @window._
Q ||= (try require? 'q')
_ ||= (try require? 'lodash/dist/lodash.underscore')
_ ||= (try require? 'underscore')
utils = require('./yayson/utils')(_, Q)
Adapter = require('./yayson/adapter')
adapters = require('./yayson/adapters')
presenterFactory = require('./yayson/presen... |
Add figcaptions to image attachments | #= require trix/views/attachment_view
#= require trix/models/image_attachment
{defer, makeElement, measureElement} = Trix
class Trix.ImageAttachmentView extends Trix.AttachmentView
getPreloadOperation: ->
if @attachment.preloadOperation?.hasSucceeded()
@attachment.preloadOperation
else if @attachment.... | #= require trix/views/attachment_view
#= require trix/models/image_attachment
{defer, makeElement, measureElement} = Trix
class Trix.ImageAttachmentView extends Trix.AttachmentView
getPreloadOperation: ->
if @attachment.preloadOperation?.hasSucceeded()
@attachment.preloadOperation
else if @attachment.... |
Clean the custom exception module. | #global $, _
((NS) ->
"use strict"
# Filename: helpers/error_helper.js */
NS = NS or {}
isInBrowser = typeof module is 'undefined' and typeof window isnt 'undefined'
# Exception class
###
* Creates a new CustomException.
* @class Exception class.
###
class CustomException
# @constructor
c... | #global $, _
"use strict"
# Filename: helpers/error_helper.js */
# Exception class
###
* Creates a new CustomException.
* @class Exception class.
###
class CustomException
# @constructor
constructor:(@name, @message,@options) ->
@log()
#Log the content of the exception.
log: ->
... |
Change $.andSelf() to $.addBack(), which is now preferred. | ###
A text region that can be clicked to edit its contents.
###
class window.EditableText extends Editable
inherited:
editClass: "TextBox"
# True if the pressing Escape in edit mode cancels edit mode.
# The default is true.
cancelOnEscape: Control.property( null, true )
editing: ( editing ) ->
re... | ###
A text region that can be clicked to edit its contents.
###
class window.EditableText extends Editable
inherited:
editClass: "TextBox"
# True if the pressing Escape in edit mode cancels edit mode.
# The default is true.
cancelOnEscape: Control.property( null, true )
editing: ( editing ) ->
re... |
Work on RequireJS Jasmine test. | describe "RequireJS", ->
it "check that the RequireJS object is present in the global namespace", ->
expect(RequireJS).toEqual jasmine.any(Object)
expect(window.RequireJS).toEqual jasmine.any(Object)
it "check that requirejs(), require(), and define() are not in the global namespace", ->
... | describe "RequireJS", ->
beforeEach ->
@addMatchers requirejsTobeUndefined: ->
typeof requirejs is "undefined"
it "check that the RequireJS object is present in the global namespace", ->
expect(RequireJS).toEqual jasmine.any(Object)
expect(window.RequireJS).toEqual jasmine.any(Object)
it "che... |
Set heartbeat pulse to 90 seconds | ETahi.HeartbeatService = Em.Object.extend
interval: 10 * 1000
intervalId: null
resource: null
url: null
init: ->
resource = @get('resource')
throw new Error("need to specify resource") unless resource
@set('url', "#{resource.path()}/heartbeat")
start: ->
@heartbeat() # immediate heartbeat
... | ETahi.HeartbeatService = Em.Object.extend
interval: 90 * 1000
intervalId: null
resource: null
url: null
init: ->
resource = @get('resource')
throw new Error("need to specify resource") unless resource
@set('url', "#{resource.path()}/heartbeat")
start: ->
@heartbeat() # immediate heartbeat
... |
Remove unused "options" object from Calendar JS | class @Calendar
options =
month: "short"
day: "numeric"
year: "numeric"
constructor: (timestamps, starting_year, starting_month, calendar_activities_path) ->
cal = new CalHeatMap()
cal.init
itemName: ["contribution"]
data: timestamps
start: new Date(starting_year, starting_mon... | class @Calendar
constructor: (timestamps, starting_year, starting_month, calendar_activities_path) ->
cal = new CalHeatMap()
cal.init
itemName: ["contribution"]
data: timestamps
start: new Date(starting_year, starting_month)
domainLabelFormat: "%b"
id: "cal-heatmap"
domain:... |
Set a defaultLabel if it exists | class Skr.Components.CustomerFinder extends Lanes.React.Component
propTypes:
model: Lanes.PropTypes.Model.isRequired
commands: React.PropTypes.object
autoFocus: React.PropTypes.bool
name: React.PropTypes.string
selectField: React.PropTypes.bool
getDefaul... | class Skr.Components.CustomerFinder extends Lanes.React.Component
propTypes:
model: Lanes.PropTypes.Model.isRequired
commands: React.PropTypes.object
autoFocus: React.PropTypes.bool
name: React.PropTypes.string
selectField: React.PropTypes.bool
getDefaul... |
Disable animations on new game | class window.BoardView extends Backbone.View
el: $('.board__tiles')
initialize: ->
@listenTo @collection, 'reset', @render
@collection.view = @
@collection.shuffle()
render: =>
els = []
@$el.html('')
@collection.each (tile) ->
view = new TileView( model: tile )... | class window.BoardView extends Backbone.View
el: $('.board__tiles')
initialize: ->
@listenTo @collection, 'reset', @render
@collection.shuffle()
@collection.view = @
render: =>
$.fx.off = yes
els = []
@$el.html('')
@collection.each (tile) ->
view = new Ti... |
Add facebook annotation to submitted classifications | window.zooniverse ?= {}
EventEmitter = window.zooniverse?.EventEmitter or require 'zooniverse/lib/event-emitter'
$ = window.jQuery
class Api extends EventEmitter
@current: null
project: '.'
headers: {}
constructor: ({@project, @host, loadTimeout} = {}) ->
super
@select()
request: (type, url, dat... | window.zooniverse ?= {}
EventEmitter = window.zooniverse?.EventEmitter or require 'zooniverse/lib/event-emitter'
$ = window.jQuery
class Api extends EventEmitter
@current: null
project: '.'
headers: {}
constructor: ({@project, @host, loadTimeout} = {}) ->
super
@select()
request: (type, url, dat... |
Fix typo to show configured tabs by router. | kd = require 'kd'
AdminIntegrationsListView = require './adminintegrationslistview'
AdminConfiguredIntegrationsListView = require './adminconfiguredintegrationslistview'
module.exports = class AdminMembersView extends kd.View
constructor: (options = {}, data) ->
options.cssClass = 'integ... | kd = require 'kd'
AdminIntegrationsListView = require './adminintegrationslistview'
AdminConfiguredIntegrationsListView = require './adminconfiguredintegrationslistview'
module.exports = class AdminMembersView extends kd.View
constructor: (options = {}, data) ->
options.cssClass = 'integ... |
Make `Config.findConfig` to be a static. | _ = require('underscore')
fs = require('fs')
class Config
constructor: () ->
filePath = @findConfig()
data = @parse(filePath)
@validate(data)
return Object.freeze(data)
findConfig: () ->
if(process.env.HUBOT_PULSAR_CONFIG)
return process.env.HUBOT_PULSAR_CONFIG
hubotConfPath = './pul... | _ = require('underscore')
fs = require('fs')
class Config
constructor: () ->
filePath = Config.findConfig()
data = @parse(filePath)
@validate(data)
return Object.freeze(data)
parse: (filePath) ->
content = fs.readFileSync(filePath, {encoding: 'utf8'})
return JSON.parse(content)
validate... |
Add link to GNU Groff mirror in project listing | [
{
title: "@Atom Theme"
paths: [
"/Users/johngardner/Labs/Atom-PhoenixTheme"
]
devMode: true
}
{
title: ".files"
paths: [
"/Users/johngardner/.files"
]
devMode: true
}
{
title: "language-roff"
paths: [
"/Users/johngardner/Labs/language-roff"
]
devMode: true
}
{
title: "file-ic... | [
{
title: "@Atom Theme"
paths: [
"/Users/johngardner/Labs/Atom-PhoenixTheme"
]
devMode: true
}
{
title: ".files"
paths: [
"/Users/johngardner/.files"
]
devMode: true
}
{
title: "language-roff"
paths: [
"/Users/johngardner/Labs/language-roff"
]
devMode: true
}
{
title: "file-ic... |
Fix Typo in Choice EDSL | angular.module 'qbn.edsl', ['qbn.quality', 'qbn.storylet', 'qbn.choice']
.factory 'qbnEdsl', (qualities, storylets, frontalChoices, choiceFactory) ->
api =
quality: (id, name, description, args = {}) ->
{defaultValue, defaultProgress, maxProgress, hasProgress, progressEscalation,
visible} =... | angular.module 'qbn.edsl', ['qbn.quality', 'qbn.storylet', 'qbn.choice']
.factory 'qbnEdsl', (qualities, storylets, frontalChoices, choiceFactory) ->
api =
quality: (id, name, description, args = {}) ->
{defaultValue, defaultProgress, maxProgress, hasProgress, progressEscalation,
visible} =... |
Switch that dropdown icon when we toggle things. | # Toggle the administration system.
($ document).keypress (e) ->
($ '.administration').toggleClass 'visible' if (e.keyCode || e.which) == 96
# "Hero" image fade-in.
window.onload = ->
($ '.hero-image img').animate({opacity: 1}, 300)
# Search field highlighting.
($ document).ready ->
($ '#id_q').focus ->
($ ... | # Toggle the administration system.
($ document).keypress (e) ->
($ '.administration').toggleClass 'visible' if (e.keyCode || e.which) == 96
# "Hero" image fade-in.
window.onload = ->
($ '.hero-image img').animate({opacity: 1}, 300)
# Search field highlighting.
($ document).ready ->
($ '#id_q').focus ->
($ ... |
Set DNT setting on middleware | #
# Inject common project-wide [view locals](http://expressjs.com/api.html#app.locals).
#
# uuid = require 'node-uuid'
{ parse, format } = require 'url'
_ = require 'underscore'
{ NODE_ENV } = require '../../config'
module.exports = (req, res, next) ->
res.locals.sd.CURRENT_PATH = parse(req.url).pathname
res.loca... | #
# Inject common project-wide [view locals](http://expressjs.com/api.html#app.locals).
#
# uuid = require 'node-uuid'
{ parse, format } = require 'url'
_ = require 'underscore'
{ NODE_ENV } = require '../../config'
module.exports = (req, res, next) ->
res.locals.sd.CURRENT_PATH = parse(req.url).pathname
res.loca... |
Comment makes less sense now | fs = require 'fs'
path = require 'path'
chalk = require 'chalk'
request = require 'request'
restapi = require './restapi'
validator = require './validator'
bundle = require './bundle'
module.exports = (dir, options, callback) ->
console.log chalk.yellow 'Validating gadget'
apiUrl = options.apiUrl + '/gadgets'
v... | fs = require 'fs'
path = require 'path'
chalk = require 'chalk'
request = require 'request'
restapi = require './restapi'
validator = require './validator'
bundle = require './bundle'
module.exports = (dir, options, callback) ->
console.log chalk.yellow 'Validating gadget'
apiUrl = options.apiUrl + '/gadgets'
v... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.