Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Fix exit code on error as in felixrabe/gulp-setup | coffee = require 'gulp-coffee'
gulp = require 'gulp'
gutil = require 'gulp-util'
mocha = require 'gulp-mocha'
rimraf = require 'rimraf'
handleError = (err) ->
gutil.log err
@emit 'end'
gulp.task 'clean', (done) ->
rimraf './lib', done
gulp.task 'build', ['clean'], ->
gulp.src './lib-src/**/*.coffee'
.pip... | coffee = require 'gulp-coffee'
gulp = require 'gulp'
gutil = require 'gulp-util'
mocha = require 'gulp-mocha'
rimraf = require 'rimraf'
errorOccurred = no
process.once 'exit', (code) ->
if errorOccurred and code == 0
process.exit 1
handleError = (err) ->
errorOccurred = yes
gutil.log err
@emit 'end'
gulp... |
Tidy up the PathNode compile method a bit | AST = { }
class AST.Template
constructor : ( @nodes ) ->
compile : ( context ) -> ( node.compile context for node in @nodes ).join ''
class AST.ContentNode
constructor : ( @content ) ->
compile : ( context ) -> @content
class AST.MemberNode
constructor : ( @path ) ->
compile : ( context ) -> context[ ... | AST = { }
class AST.Template
constructor : ( @nodes ) ->
compile : ( context ) -> ( node.compile context for node in @nodes ).join ''
class AST.ContentNode
constructor : ( @content ) ->
compile : ( context ) -> @content
class AST.MemberNode
constructor : ( @path ) ->
compile : ( context ) -> context[ ... |
Fix typo in uuid generation | fs = require 'fs'
uuid = require 'node-uuid'
config =
schemaPrefix: do -> 'urn:schemas-upnp-org'
versions: do ->
schema: do -> '1.0'
upnp: do -> '1.0'
devices: do ->
MediaServer: do ->
version: do -> 1
services: do -> [ 'ConnectionManager', 'ContentDirectory'... | fs = require 'fs'
uuid = require 'node-uuid'
config =
schemaPrefix: do -> 'urn:schemas-upnp-org'
versions: do ->
schema: do -> '1.0'
upnp: do -> '1.0'
devices: do ->
MediaServer: do ->
version: do -> 1
services: do -> [ 'ConnectionManager', 'ContentDirectory'... |
Make source maps work in Sentry. | module.exports = (grunt, options) ->
return {
options:
baseUrl: '<%= build %>/js'
exclude: ['coffee-script']
stubModules: ['cs/cs']
mainConfigFile: '<%= build %>/js/app/config.js'
optimize: 'uglify2'
generateSourceMaps: true
preserveLicenseComments: false
findNested... | module.exports = (grunt, options) ->
return {
options:
baseUrl: '<%= build %>/js'
exclude: ['coffee-script']
stubModules: ['cs/cs']
mainConfigFile: '<%= build %>/js/app/config.js'
optimize: 'uglify2'
optimizeAllPluginResources: true
generateSourceMaps: true
preserve... |
Set the queue object to a top level property of the batch instance | # # Kissmetrics Batch
class BatchKissmetricsClient
@HOST: 'api.kissmetrics.com'
@HTTP_METHOD: 'POST'
constructor: (@options) ->
@_validate_queue @options.queue
add: (timestamp, data) ->
data.timestamp = timestamp
@_transformData data
@queue.add data
get: ->
@queue.get()
process: ->... | # # Kissmetrics Batch
class BatchKissmetricsClient
@HOST: 'api.kissmetrics.com'
@HTTP_METHOD: 'POST'
constructor: (@options) ->
@queue = options.queue
@_validate_queue @queue
add: (timestamp, data) ->
data.timestamp = timestamp
@_transformData data
@queue.add data
get: ->
@queue.g... |
Update SockJS-client to 0.3.4 stable | module.exports = [
# the bongo api (or an empty file, depending on the config)
"../../.build/api.js",
"../../.build/logging-api.js",
# --- Bongo Client ---
"sockjs-0.3-patched.js",
"broker.js",
"bongo.js",
]
| module.exports = [
# the bongo api (or an empty file, depending on the config)
"../../.build/api.js",
"../../.build/logging-api.js",
# --- Bongo Client ---
# "sockjs-0.3-patched.js",
"sockjs-0.3.4.js",
"broker.js",
"bongo.js",
]
|
Add the toolbar to the menu | # See https://atom.io/docs/latest/creating-a-package#menus for more details
'menu': [
{
'label': 'Packages'
'submenu': [
'label': 'Jekyll'
'submenu': [
{ 'label': 'Manage Jekyll', 'command': 'jekyll:manage'},
{ 'label': 'New Post', 'command': 'jekyll:new-post' },
{ 'label':... | # See https://atom.io/docs/latest/creating-a-package#menus for more details
'menu': [
{
'label': 'Packages'
'submenu': [
'label': 'Jekyll'
'submenu': [
{ 'label': 'Manage Jekyll', 'command': 'jekyll:manage'},
{ 'label': 'Open Toolbar', 'command': 'jekyll:toolbar'},
{ 'label... |
Switch data over to use new variation class | $ ->
variations = [
participants: 100
conversions: 45
,
participants: 100
conversions: 50
]
calculator = new App.Calculator variations
calculator.renderGraph() | $ ->
data = [
name: 'Original'
participants: 100
conversions: 45
color: '#00aa00'
,
name: 'Variation'
participants: 100
conversions: 50
color: 'blue'
]
variations = []
variations.push new App.Variation item.name, item.color, item.participants, item.conversions for item in data
calculato... |
Refactor using Reflux sugar functions | 'use strict'
toggleGem = Reflux.createAction()
module.exports =
toggleGem: toggleGem
| 'use strict'
actions = Reflux.createActions [
'toggleGem'
]
module.exports = actions
|
Restructure logo JS to use `setInterval` | NProgress.configure(showSpinner: false)
delay = 150
defaultClass = 'tanuki-shape'
pieces = [
'path#tanuki-right-cheek',
'path#tanuki-right-eye, path#tanuki-right-ear',
'path#tanuki-nose',
'path#tanuki-left-eye, path#tanuki-left-ear',
'path#tanuki-left-cheek',
]
firstPiece = pieces[0]
timeout = null
clearHig... | NProgress.configure(showSpinner: false)
defaultClass = 'tanuki-shape'
pieces = [
'path#tanuki-right-cheek',
'path#tanuki-right-eye, path#tanuki-right-ear',
'path#tanuki-nose',
'path#tanuki-left-eye, path#tanuki-left-ear',
'path#tanuki-left-cheek',
]
pieceIndex = 0
firstPiece = pieces[0]
currentTimer = null
... |
Decrease the logo sweep delay | NProgress.configure(showSpinner: false)
defaultClass = 'tanuki-shape'
pieces = [
'path#tanuki-right-cheek',
'path#tanuki-right-eye, path#tanuki-right-ear',
'path#tanuki-nose',
'path#tanuki-left-eye, path#tanuki-left-ear',
'path#tanuki-left-cheek',
]
firstPiece = pieces[0]
timeout = null
clearHighlights = ->... | NProgress.configure(showSpinner: false)
delay = 150
defaultClass = 'tanuki-shape'
pieces = [
'path#tanuki-right-cheek',
'path#tanuki-right-eye, path#tanuki-right-ear',
'path#tanuki-nose',
'path#tanuki-left-eye, path#tanuki-left-ear',
'path#tanuki-left-cheek',
]
firstPiece = pieces[0]
timeout = null
clearHig... |
Choose a random workflow and subject | React = require 'react'
apiClient = require '../api/client'
PromiseRenderer = require '../components/promise-renderer'
Classifier = require '../classifier/classifier'
module.exports = React.createClass
displayName: 'ClassifyPage'
render: ->
workflow = @props.project.attr('workflows').then ([workflow]) =>
... | React = require 'react'
apiClient = require '../api/client'
PromiseRenderer = require '../components/promise-renderer'
Classifier = require '../classifier/classifier'
module.exports = React.createClass
displayName: 'ClassifyPage'
render: ->
workflow = @props.project.attr('workflows').then (workflows) ->
... |
Remove ctor handled in superclass | SymbolsView = require './symbols-view'
TagGenerator = require './tag-generator'
module.exports =
class FileView extends SymbolsView
constructor: (@stack) ->
super
initialize: ->
super
@cachedTags = {}
@subscribe atom.project.eachBuffer (buffer) =>
@subscribe buffer, 'reloaded saved destroye... | SymbolsView = require './symbols-view'
TagGenerator = require './tag-generator'
module.exports =
class FileView extends SymbolsView
initialize: ->
super
@cachedTags = {}
@subscribe atom.project.eachBuffer (buffer) =>
@subscribe buffer, 'reloaded saved destroyed path-changed', =>
delete @c... |
Fix on preventDefault method call | Meteor.subscribe 'authors';
Meteor.subscribe 'Posts';
Meteor.subscribe 'Comments';
Template['posts'].helpers
'posts': -> Posts.find({}, sort: {createdAt: -1})
Template.post.helpers
'comments': -> Comments.find({post_id: @post._id})
# Template['posts'].events
Template['new-post'].events
'submit .new-post': (e)... | Meteor.subscribe 'authors';
Meteor.subscribe 'Posts';
Meteor.subscribe 'Comments';
Template['posts'].helpers
'posts': -> Posts.find({}, sort: {createdAt: -1})
Template.post.helpers
'comments': -> Comments.find({post_id: @post._id})
# Template['posts'].events
Template['new-post'].events
'submit .new-post': (e)... |
Use method to check root path | Dialog = require './dialog'
Project = require './project'
projects = require './projects'
path = require 'path'
changeCase = require 'change-case'
module.exports =
class SaveDialog extends Dialog
filePath: null
constructor: () ->
firstPath = atom.project.getPaths()[0]
title = path.basename(firstPath)
... | Dialog = require './dialog'
Project = require './project'
projects = require './projects'
path = require 'path'
changeCase = require 'change-case'
module.exports =
class SaveDialog extends Dialog
filePath: null
constructor: () ->
firstPath = atom.project.getPaths()[0]
title = path.basename(firstPath)
... |
Include metadata for repos on homepage |
# Argumenta instance
argumenta = require '../app/argumenta'
# Site index
exports.index = (req, res) ->
argumenta.users.latest {limit: 10}, (err, users) ->
argumenta.repos.latest {limit: 20}, (err, repos) ->
res.reply 'index',
latest_users: users
latest_repos: repos
|
# Argumenta instance
argumenta = require '../app/argumenta'
# Site index
exports.index = (req, res) ->
argumenta.users.latest {limit: 10}, (err, users) ->
argumenta.repos.latest {limit: 20, metadata: true}, (err, repos) ->
res.reply 'index',
latest_users: users
latest_repos: repos
|
Fix quitAndInstall when there is no window. | AutoUpdater = process.atomBinding('auto_updater').AutoUpdater
EventEmitter = require('events').EventEmitter
AutoUpdater::__proto__ = EventEmitter.prototype
autoUpdater = new AutoUpdater
autoUpdater.on 'update-downloaded-raw', (args...) ->
args[3] = new Date(args[3]) # releaseDate
@emit 'update-downloaded', args.... | AutoUpdater = process.atomBinding('auto_updater').AutoUpdater
EventEmitter = require('events').EventEmitter
AutoUpdater::__proto__ = EventEmitter.prototype
autoUpdater = new AutoUpdater
autoUpdater.on 'update-downloaded-raw', (args...) ->
args[3] = new Date(args[3]) # releaseDate
@emit 'update-downloaded', args.... |
Write a test for expand-abbreviation | Emmet = require '../lib/emmet'
describe "Emmet", ->
it "has one valid test", ->
true
| Emmet = require 'emmet/lib/emmet'
RootView = require 'root-view'
Buffer = require 'text-buffer'
Editor = require 'editor'
describe "Emmet", ->
[buffer, editor, editSession] = []
keymap = null
beforeEach ->
window.rootView = new RootView
rootView.open('sample.js')
editor = rootView.getActiveView()
... |
Add more control on return | params = (options) ->
url: "https://stream.twitter.com/1.1/statuses/filter.json"
oauth: options.oauth
form:
include_entities: true
track: options.words.join ','
request = require 'request'
makeRequest = (validate, beautify, fn) ->
req = request.post params, (error, response, body) ->
fn error, fal... | params = (options) ->
url: "https://stream.twitter.com/1.1/statuses/filter.json"
oauth: options.oauth
form:
include_entities: true
track: options.words.join ','
request = require 'request'
makeRequest = (validate, beautify, fn) ->
stream = request.post params, (error, response, body) ->
fn error, ... |
Add method to generate UUID from javascript | # Tool to query and render GUID conversions via REST API
delay = (ms, func) -> setTimeout func, ms
class window.GuidTool
# Initialize on page load
@init: =>
$('#guid').select()
delay 2000, =>
$('.nav, #footer').fadeIn()
$('#submit').click (event) =>
event.prev... | # Tool to query and render GUID conversions via REST API
delay = (ms, func) -> setTimeout func, ms
class window.GuidTool
# Initialize on page load
@init: =>
$('#guid').select()
delay 2000, =>
$('.nav, #footer').fadeIn()
$('#submit').click (event) =>
event.prev... |
Add indirection so that correct next is called. | _ = require 'underscore'
exports.throttle = (getIdentifier, timeout = 1000) ->
cache = {}
throttleInner = (req, resp, next) ->
identifier = getIdentifier(arguments)
unless identifier of cache
cache[identifier] = _.throttle(next, timeout, {trailing: false})
cache[identifier]()
return t... | _ = require 'underscore'
callNext = (next) ->
next()
exports.throttle = (getIdentifier, timeout = 1000) ->
cache = {}
throttleInner = (req, resp, next) ->
identifier = getIdentifier(arguments)
unless identifier of cache
cache[identifier] = _.throttle(callNext, timeout, {trailing: false})
... |
Remove common chunks plugin when testing | webpackConfig = require('./webpack.config.coffee')
webpackConfig.entry = {}
module.exports = (config) ->
config.set
frameworks: ['jasmine']
browsers: ['Chrome']
files: [
'./spec/**/*.coffee'
]
preprocessors:
'./spec/helpers/**/*': ['webpack']
'./spec/**/*': ['webpack']
w... | webpackConfig = require('./webpack.config.coffee')
webpackConfig.entry = {}
webpackConfig.plugins = []
module.exports = (config) ->
config.set
frameworks: ['jasmine']
browsers: ['Chrome']
files: [
'./spec/**/*.coffee'
]
preprocessors:
'./spec/helpers/**/*': ['webpack']
'./spe... |
Watch & Serve by Default | gulp = require 'gulp'
del = require 'del'
haml = require 'gulp-haml'
sourcemaps = require 'gulp-sourcemaps'
coffee = require 'gulp-coffee'
serve = require './serve.coffee'
bower = require 'main-bower-files'
SRC = 'src'
DEST = 'out'
HAML_PATH = "#{SRC}/haml/**/*.haml"
COFFEE_PATH = "#{S... | gulp = require 'gulp'
del = require 'del'
haml = require 'gulp-haml'
sourcemaps = require 'gulp-sourcemaps'
coffee = require 'gulp-coffee'
serve = require './serve.coffee'
bower = require 'main-bower-files'
SRC = 'src'
DEST = 'out'
HAML_PATH = "#{SRC}/haml/**/*.haml"
COFFEE_PATH = "#{S... |
Remove opinion about element display style | ".text.html":
"polymer element":
"prefix": "pe"
"body": """
<link rel="import" href="${1:../bower_components}/polymer/polymer.html">
<dom-module id="$2">
<style>
:host {
display: block;
}
</style>
<template>
$4
</template>
</dom-module>
... | ".text.html":
"polymer element":
"prefix": "pe"
"body": """
<link rel="import" href="${1:../bower_components}/polymer/polymer.html">
<dom-module id="$2">
<style>
:host {
$5
}
</style>
<template>
$4
</template>
<script>
Polymer({
... |
Store data in context instead of dimensions | request = require 'request'
module.exports =
class Reporter
constructor: ->
@request = request
send: (eventType, data) ->
params =
timestamp: new Date().getTime() / 1000
dimensions: data
requestOptions =
method: 'POST'
url: "https://collector.githubapp.com/... | request = require 'request'
module.exports =
class Reporter
constructor: ->
@request = request
send: (eventType, data) ->
params =
timestamp: new Date().getTime() / 1000
context: data
requestOptions =
method: 'POST'
url: "https://collector.githubapp.com/ato... |
Rename plain object member variable from "root" to "instance" in order to not conflict with DDD terminology | class Aggregate
constructor: (@_context, @_eventric, @_name, Root) ->
@_domainEvents = []
if !Root
@root = {}
else
@root = new Root
@root.$emitDomainEvent = @emitDomainEvent
emitDomainEvent: (domainEventName, domainEventPayload) =>
DomainEventClass = @_context.getDomainEvent dom... | class Aggregate
constructor: (@_context, @_eventric, @_name, AggregateClass) ->
@_domainEvents = []
@instance = new AggregateClass
@instance.$emitDomainEvent = @emitDomainEvent
emitDomainEvent: (domainEventName, domainEventPayload) =>
DomainEventClass = @_context.getDomainEvent domainEventName
... |
Fix I18n error when ID not defined in messages.json | I18n = (args...) ->
m = chrome.i18n.getMessage(args...)
return escapeHtml(m) if m != ""
m = id.replace(/(.)([A-Z][a-z])/g, (m, p1, p2) -> "#{p1} #{p2.toLowerCase()}")
m = m.replace(/_/g, ' ')
escapeHtml(m)
$(->
pat = /__MSG_([A-Za-z0-9]+)__/
$("a,button").each((i, v) ->
e = $(v)
title = e.attr?("... | I18n = (args...) ->
m = chrome.i18n.getMessage(args...)
return escapeHtml(m) if m != ""
m = args[0].replace(/(.)([A-Z][a-z])/g, (m, p1, p2) -> "#{p1} #{p2.toLowerCase()}")
m = m.replace(/_/g, ' ')
escapeHtml(m)
$(->
pat = /__MSG_([A-Za-z0-9]+)__/
$("a,button").each((i, v) ->
e = $(v)
title = e.at... |
Remove local Component class. Refactor. |
class Component
constructor: ->
update: ->
stringify: ->
JSON.stringify(@spec)
class $blab.Table extends Component
constructor: (@spec, sheet) ->
randPos = (range, offset)->
"#{Math.round((Math.random()*range+offset)*100)}%"
@spec.x ?= randPos(0.8, ... | class $blab.Table extends $blab.Component
constructor: (@spec, sheet, file) ->
@sheet = sheet[@spec.id]
container = $("##{@spec.containerId}")
container.append("<div id='Table-#{@spec.id}' class='hot'></div>")
hot = $("#Table-#{@spec.id}")
hot.css("position", "absolut... |
Put a 2-second delay before websocket connecting | angular.module 'ws.helper', []
.factory 'WebSocketOptions', ->
options = {}
return options
.factory 'UserWebSocket', [
'$timeout'
'WebSocketOptions'
($timeout, options) ->
class UserWebSocket
constructor: (url) ->
@url = url
@handlers = {}
@connect(... | angular.module 'ws.helper', []
.factory 'WebSocketOptions', ->
options = {}
return options
.factory 'UserWebSocket', [
'$timeout'
'WebSocketOptions'
($timeout, options) ->
class UserWebSocket
constructor: (url) ->
@url = url
@handlers = {}
$timeout ... |
Add some documentatio and blank QueryDefaults object in Adapter | # Your Adapter should define:
# * QueryDefaults - an object of defaults to send as query parameters
class Embeditor.Adapter
className: "Adapter"
constructor: (@element, @options={}) ->
@adapter = Embeditor.Adapters[@className]
@href = @element.attr('href')
@dataOptions... | # Your Adapter SHOULD define:
# * @QueryDefaults - The default parameters if no others are passed in.
class Embeditor.Adapter
className: "Adapter"
@QueryDefaults = {}
constructor: (@element, @options={}) ->
@adapter = Embeditor.Adapters[@className]
@href = @element.attr('... |
Fix being able to uninstall package | HighlightedAreaView = require './highlighted-area-view'
module.exports =
activate: (state) ->
@areas = []
atom.workspaceView.eachEditorView (editorView) =>
area = new HighlightedAreaView(editorView)
area.attach()
@areas.push = area
deactivate: =>
for area in @areas
area.destroy... | HighlightedAreaView = require './highlighted-area-view'
areas = []
module.exports =
activate: (state) ->
atom.workspaceView.eachEditorView (editorView) ->
area = new HighlightedAreaView(editorView)
area.attach()
areas.push = area
deactivate: ->
for area in areas
area.destroy()
|
Use pane:item-added instead of editor:attached | Guid = require 'guid'
Reporter = require './reporter'
module.exports =
activate: ({sessionLength}) ->
atom.config.set('metrics.userId', Guid.raw()) unless atom.config.get('metrics.userId')
@sessionStart = Date.now()
Reporter.sendEvent('ended', sessionLength) if sessionLength
Reporter.sendEvent('star... | Guid = require 'guid'
Reporter = require './reporter'
module.exports =
activate: ({sessionLength}) ->
atom.config.set('metrics.userId', Guid.raw()) unless atom.config.get('metrics.userId')
@sessionStart = Date.now()
Reporter.sendEvent('ended', sessionLength) if sessionLength
Reporter.sendEvent('star... |
Fix log of language validation | flat = (obj, newObj = {}, path = '') ->
for key, value of obj
if _.isObject value
flat value, newObj, key + '.'
else
newObj[path + key] = value
return newObj
Meteor.startup ->
l = {}
errors = []
for lang, value of TAPi18next.options.resStore
l[lang] = flat value
for lang, value of l
for subLang... | flat = (obj, newObj = {}, path = '') ->
for key, value of obj
if _.isObject value
flat value, newObj, key + '.'
else
newObj[path + key] = value
return newObj
Meteor.startup ->
l = {}
errors = []
for lang, value of TAPi18next.options.resStore
l[lang] = flat value
for lang, value of l
for subLang... |
Add urlRoot parameter to Visualization model in order to update model parameters via api | class Visualization extends Backbone.Model
paramRoot: 'visualization'
defaults:
parameters: null
module.exports = Visualization | class Visualization extends Backbone.Model
paramRoot: 'visualization'
urlRoot: '/api/visualizations'
defaults:
parameters: null
module.exports = Visualization |
Disable bet buttons when you don't have that much to bet | Spine = require('spine')
class Actions extends Spine.Controller
elements:
'.deal': 'deal_button'
'.continue': 'continue_button'
'.surrender': 'surrender_button'
'.bet': 'bet_buttons'
'.action': 'action_buttons'
events:
'click .deal': 'deal'
constructor: ->
super
@html require('... | Spine = require('spine')
Player = require('models/player')
$ = Spine.$
class Actions extends Spine.Controller
elements:
'.deal': 'deal_button'
'.continue': 'continue_button'
'.surrender': 'surrender_button'
'.bet': 'bet_buttons'
'.action': 'action_buttons'
events:
'click .deal': 'deal'
... |
Replace .editor -> atom-text-editor in keymap | '.platform-darwin .editor':
'cmd-r': 'symbols-view:toggle-file-symbols'
'cmd-alt-down': 'symbols-view:go-to-declaration'
'cmd-alt-up': 'symbols-view:return-from-declaration'
'.platform-win32 .editor':
'ctrl-r': 'symbols-view:toggle-file-symbols'
'.platform-linux .editor':
'ctrl-r': 'symbols-view:toggle-file... | '.platform-darwin atom-text-editor':
'cmd-r': 'symbols-view:toggle-file-symbols'
'cmd-alt-down': 'symbols-view:go-to-declaration'
'cmd-alt-up': 'symbols-view:return-from-declaration'
'.platform-win32 atom-text-editor':
'ctrl-r': 'symbols-view:toggle-file-symbols'
'.platform-linux atom-text-editor':
'ctrl-r'... |
Revert "use script elem instead of eval" | $ = window.$ = require("jquery")
Bacon = window.Bacon = require("baconjs")
_ = require("lodash")
$.fn.asEventStream = Bacon.$.asEventStream
examples = require("./examples.coffee")
$code = $("#code #editor")
$run = $(".run")
runBus = new Bacon.Bus()
codeMirror = CodeMirror.fromTextArea $code.get(0), {
lineNumbers: ... | $ = window.$ = require("jquery")
Bacon = window.Bacon = require("baconjs")
_ = require("lodash")
$.fn.asEventStream = Bacon.$.asEventStream
examples = require("./examples.coffee")
$code = $("#code #editor")
$run = $(".run")
runBus = new Bacon.Bus()
codeMirror = CodeMirror.fromTextArea $code.get(0), {
lineNumbers: ... |
Fix logic bug with fetchDone state | View = require './view'
RequestTasks = require '../collections/RequestTasks'
class RequestView extends View
template: require './templates/request'
initialize: =>
@request = app.allRequests[@options.requestId]
@requestTasks = new RequestTasks [], requestId: @options.requestId
@reque... | View = require './view'
RequestTasks = require '../collections/RequestTasks'
class RequestView extends View
template: require './templates/request'
initialize: =>
@request = app.allRequests[@options.requestId]
@requestTasks = new RequestTasks [], requestId: @options.requestId
@reque... |
Fix reference to backbone history | window.app = _.extend {}, Backbone.Events,
Models: {}
Collections: {}
Views: {}
Routers: {}
init: ->
@auth()
auth: ->
new this.Views.Authenticate()
ready: ->
$('#app').show()
@repositories = new this.Collections.Repositories()
@notifications = new this.Collections.Notifications()
... | window.app = _.extend {}, Backbone.Events,
Models: {}
Collections: {}
Views: {}
Routers: {}
init: ->
@auth()
auth: ->
new this.Views.Authenticate()
ready: ->
$('#app').show()
@repositories = new this.Collections.Repositories()
@notifications = new this.Collections.Notifications()
... |
Add compile task as prereq of tintan:build | files = '
fastdev
compile
'.trim().split(/[^a-zA-Z\/\.]+/).map (s)-> './'+s
module.exports = (tintan)->
require(file) tintan for file in files
namespace 'tintan', ->
task 'build', ->
console.log 'building '
| files = '
fastdev
compile
'.trim().split(/[^a-zA-Z\/\.]+/).map (s)-> './'+s
module.exports = (tintan)->
require(file) tintan for file in files
namespace 'tintan', ->
task 'build', ['^compile'], ->
console.log 'done'.green + ' building ' + tintan.constructor.appXML.name()
|
Fix silly 'this' context error. | {exec} = require 'child_process'
path = require 'path'
fs = require 'fs'
REFRESH_RATE = 500 # in msecs
RUN_PATH = path.join __dirname, "run_test.coffee"
seen = {} # cache of file names
shouldRun = true # if a change in file was detected
canRun = true # if tests are... | {exec} = require 'child_process'
path = require 'path'
fs = require 'fs'
REFRESH_RATE = 500 # in msecs
RUN_PATH = path.join __dirname, "run_test.coffee"
seen = {} # cache of file names
shouldRun = true # if a change in file was detected
canRun = true # if tests are... |
Clean all the data of deploy job when `removeDeploy`. | _ = require('underscore')
class DeployMonitor
timeout = 10000
constructor: ()->
@_deploy = null
@_chat = null
@_currentTimeout = 0
setDeploy: (deploy, chat)->
@_deploy = deploy
@_chat = chat
@_deploy.on('change', ()=>
@_resetTimeoutMonitor()
@_timeoutMonitor()
)
@_d... | _ = require('underscore')
class DeployMonitor
timeout = 10000
constructor: ()->
@_deploy = null
@_chat = null
@_currentTimeout = 0
setDeploy: (deploy, chat)->
@_deploy = deploy
@_chat = chat
@_deploy.on('change', ()=>
@_resetTimeoutMonitor()
@_timeoutMonitor()
)
@_d... |
Convert to using editable view | define (require) ->
_ = require('underscore')
BaseView = require('cs!helpers/backbone/views/base')
BookPopoverView = require('cs!./popovers/book/book')
template = require('hbs!./header-template')
require('less!./header')
return class MediaHeaderView extends BaseView
template: template
templateHelpe... | define (require) ->
_ = require('underscore')
EditableView = require('cs!helpers/backbone/views/editable')
BookPopoverView = require('cs!./popovers/book/book')
template = require('hbs!./header-template')
require('less!./header')
return class MediaHeaderView extends EditableView
template: template
t... |
Add keybindings for deletion commands | # 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://ato... | # 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://ato... |
Replace guid package call with node-uuid call | crypto = require 'crypto'
Reporter = require './reporter'
module.exports =
activate: ({sessionLength}) ->
if atom.config.get('metrics.userId')
@begin(sessionLength)
else
@getUserId (userId) -> atom.config.set('metrics.userId', userId)
@begin(sessionLength)
serialize: ->
sessionLength... | crypto = require 'crypto'
Reporter = require './reporter'
module.exports =
activate: ({sessionLength}) ->
if atom.config.get('metrics.userId')
@begin(sessionLength)
else
@getUserId (userId) -> atom.config.set('metrics.userId', userId)
@begin(sessionLength)
serialize: ->
sessionLength... |
Make search better by ignoring word order | Spine = require('spine')
class window.Task extends Spine.Model
# Set model properties
@configure 'Task',
'name',
'date',
'notes',
'completed',
'priority',
'list'
@extend @Local
@active: (list) =>
@select (task) ->
!task.completed and (if list then (task.list is list) else y... | Spine = require('spine')
class window.Task extends Spine.Model
# Set model properties
@configure 'Task',
'name',
'date',
'notes',
'completed',
'priority',
'list'
@extend @Local
@active: (list) =>
@select (task) ->
!task.completed and (if list then (task.list is list) else y... |
Make whitelisted grammars a config setting | url = require 'url'
fs = require 'fs-plus'
MarkdownPreviewView = require './markdown-preview-view'
module.exports =
activate: ->
atom.workspaceView.command 'markdown-preview:show', =>
@show()
atom.workspace.registerOpener (uriToOpen) ->
{protocol, host, pathname} = url.parse(uriToOpen)
pa... | url = require 'url'
fs = require 'fs-plus'
MarkdownPreviewView = require './markdown-preview-view'
module.exports =
configDefaults:
grammars: [
'source.gfm'
'text.plain'
'text.plain.null-grammar'
]
activate: ->
atom.workspaceView.command 'markdown-preview:show', =>
@show()
... |
Fix deprecation of editor class in keymap. | '.platform-darwin, .platform-darwin .simple-flake8 .editor':
'cmd-shift-8': 'simple-flake8:toggle'
'.platform-win32, .platform-win32 .simple-flake8 .editor':
'ctrl-shift-8': 'simple-flake8:toggle'
'.platform-linux, .platform-linux .simple-flake8 .editor':
'ctrl-shift-8': 'simple-flake8:toggle'
| '.platform-darwin atom-text-editor, .platform-darwin .simple-flake8':
'cmd-shift-8': 'simple-flake8:toggle'
'.platform-win32 atom-text-editor, .platform-win32 .simple-flake8':
'ctrl-shift-8': 'simple-flake8:toggle'
'.platform-linux atom-text-editor, .platform-linux .simple-flake8':
'ctrl-shift-8': 'simple-flake... |
Send metrics only for problems, not for tables | import {GROUPS} from '../../client/lib/informaticsGroups'
import {START_SUBMITS_DATE} from '../api/dashboard'
import send from '../metrics/graphite'
import Result from "../models/result"
export default sendMetrics = () ->
queries =
ok: {ok: 1, lastSubmitTime: {$gt: START_SUBMITS_DATE}},
ps: {ps: 1... | import {GROUPS} from '../../client/lib/informaticsGroups'
import {START_SUBMITS_DATE} from '../api/dashboard'
import send from '../metrics/graphite'
import Result from "../models/result"
export default sendMetrics = () ->
queries =
ok: {ok: 1, lastSubmitTime: {$gt: START_SUBMITS_DATE}},
ps: {ps: 1... |
Remove ugly yellow color from verbose log messages | ### logger.coffee ###
colors = require 'colors'
winston = require 'winston'
util = require 'util'
class cli extends winston.Transport
name: 'cli'
constructor: (options) ->
super(options)
@quiet = options.quiet or false
log: (level, msg, meta, callback) ->
if level == 'error'
process.stderr.... | ### logger.coffee ###
colors = require 'colors'
winston = require 'winston'
util = require 'util'
class cli extends winston.Transport
name: 'cli'
constructor: (options) ->
super(options)
@quiet = options.quiet or false
log: (level, msg, meta, callback) ->
if level == 'error'
process.stderr.... |
Add error class first for toasts | window.Toast = {}
toastQueue = []
showing = false
Toast.processToast = () ->
if toastQueue.length > 0
toast = toastQueue.shift()
$("#toasts").find(':first-child').remove()
if $(toast).data("toast-type") == "error"
Toast.toastError $(toast).text()
else
Toast.toastMessage $(toast).text()
T... | window.Toast = {}
toastQueue = []
showing = false
Toast.processToast = () ->
if toastQueue.length > 0
toast = toastQueue.shift()
$("#toasts").find(':first-child').remove()
if $(toast).data("toast-type") == "error"
Toast.toastError $(toast).text()
else
Toast.toastMessage $(toast).text()
T... |
Fix wrong key being used |
config = require './config'
updateRoleStats = (cfg, stats) ->
if stats.average
delete cfg.p if cfg.p
cfg.process = stats.average
delete cfg.stddev if cfg.stddev # no longer valid
if stats.stddev
cfg.stddev = stats.stddev
updateStats = (cfg, stats) ->
for rolename, rolestats of stats
rolecon... |
config = require './config'
updateRoleStats = (cfg, stats) ->
if stats.average
delete cfg.p if cfg.p
cfg.processing = stats.average
delete cfg.stddev if cfg.stddev # no longer valid
if stats.stddev
cfg.stddev = stats.stddev
updateStats = (cfg, stats) ->
for rolename, rolestats of stats
role... |
Use long opts for clarity | fs = require 'fs'
path = require 'path'
async = require 'async'
module.exports = (grunt) ->
{spawn} = require('./task-helpers')(grunt)
grunt.registerTask 'run-specs', 'Run the specs', ->
passed = true
done = @async()
atomPath = path.resolve('atom.sh')
apmPath = path.resolve('node_modules/.bin/apm... | fs = require 'fs'
path = require 'path'
async = require 'async'
module.exports = (grunt) ->
{spawn} = require('./task-helpers')(grunt)
grunt.registerTask 'run-specs', 'Run the specs', ->
passed = true
done = @async()
atomPath = path.resolve('atom.sh')
apmPath = path.resolve('node_modules/.bin/apm... |
Add catch all error handling in case of AJAX fail response | Promise = require 'bluebird-q'
{ API_URL } = require('sharify').data
{ track } = require '../../../../lib/analytics.coffee'
Serializer = require '../../../../components/form/serializer.coffee'
module.exports = ($el) ->
$form = $el.find '.js-form'
$submit = $el.find '.js-submit'
$errors = $el.find '.js-errors'
... | Promise = require 'bluebird-q'
{ API_URL } = require('sharify').data
{ track } = require '../../../../lib/analytics.coffee'
Serializer = require '../../../../components/form/serializer.coffee'
module.exports = ($el) ->
$form = $el.find '.js-form'
$submit = $el.find '.js-submit'
$errors = $el.find '.js-errors'
... |
Add GridFS as default avatar storage | uploadPath = "/var/www/rocket.chat/uploads"
store = new FS.Store.FileSystem "avatars",
path: uploadPath
fileKeyMaker: (fileObj) ->
filename = fileObj.name()
filenameInStore = fileObj.name({store: 'avatars'})
return filenameInStore || filename
@Avatars = new FS.Collection "avatars",
stores: [store]
@Avatars... | storeType = 'GridFS'
if Meteor.settings?.public?.avatarStore?.type?
storeType = Meteor.settings.public.avatarStore.type
store = undefined
beforeWrite = (fileObj) ->
fileObj._setInfo 'avatars', 'storeType', storeType, true
if storeType is 'FileSystem'
path = "~/uploads"
if Meteor.settings?.public?.avatarStore?.pa... |
Fix missing label reference to input field | core = require './core'
Input = require './Input'
{p, span, label} = require './DOM'
ActivityIndicator = require './ActivityIndicator'
Form =
Input: core.createComponent 'rui.Form.Input',
getInitialState: ->
uniqueId: core.uniqueId()
render: ->
p className: 'rui-form-p', [
label htmlFor... | core = require './core'
Input = require './Input'
{p, span, label} = require './DOM'
ActivityIndicator = require './ActivityIndicator'
Form =
Input: core.createComponent 'rui.Form.Input',
getInitialState: ->
uniqueId: core.uniqueId()
render: ->
p className: 'rui-form-p', [
label htmlFor... |
Extend clinical for breast tumors. | `import Pathology from "./pathology.data.coffee"`
###*
* The clinical Encounter REST data object extension utility.
*
* @module clinical
* @class ClinicalEncounter
* @static
###
ClinicalEncounter =
###*
* @method extend
* @param encounter the clinical encounter
* @param subject the parent subject REST ... | `import Pathology from "./pathology.data.coffee"`
`import Breast from "./breast.coffee"`
###*
* The clinical Encounter REST data object extension utility.
*
* @module clinical
* @class ClinicalEncounter
* @static
###
ClinicalEncounter =
###*
* @method extend
* @param encounter the clinical encounter
* ... |
Fix scheduled task property changes | Tasks = require './Tasks'
TaskScheduled = require '../models/TaskScheduled'
class TasksScheduled extends Tasks
model: TaskScheduled
url: "#{ env.SINGULARITY_BASE }/#{ constants.apiBase }/tasks/scheduled"
parse: (tasks) ->
_.each tasks, (task, i) =>
task.JSONString = utils.stringJSON ... | Tasks = require './Tasks'
TaskScheduled = require '../models/TaskScheduled'
class TasksScheduled extends Tasks
model: TaskScheduled
url: "#{ env.SINGULARITY_BASE }/#{ constants.apiBase }/tasks/scheduled"
parse: (tasks) ->
_.each tasks, (task, i) =>
task.JSONString = utils.stringJSON ... |
Make report page fetch page association | Report = require('../models/report.coffee').model
exports.index = (req, res) ->
Report.find (err, reports) ->
if !err?
res.render "reports/index",
reportsJSON: JSON.stringify(reports)
title: "Report show page"
exports.show = (req, res) ->
reportId = req.params.id
Report.findOne(report... | Report = require('../models/report.coffee').model
exports.index = (req, res) ->
Report.find (err, reports) ->
if !err?
res.render "reports/index",
reportsJSON: JSON.stringify(reports)
title: "Report show page"
exports.show = (req, res) ->
reportId = req.params.id
Report.findOne(report... |
Update test suite, now it works properly | require('../src/jquery.turbolinks.coffee')
chai = require('chai')
sinon = require('sinon')
sinonChai = require('sinon-chai')
jQuery = require('jquery')
chai.should()
chai.use(sinonChai)
describe 'jQuery Turbolinks', ->
it '''
should trigger callbacks passed to
`jQuery()` and `jQuery.read... | jsdom = require('jsdom').jsdom
global.document = jsdom()
global.window = document.createWindow()
require('../src/jquery.turbolinks.coffee')
chai = require('chai')
sinon = require('sinon')
sinonChai = require('sinon-chai')
$ = require('jquery')
chai.should()
chai.use(sinonChai)
describe '$ Turbol... |
Delete gen/ during clean task | module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
coffee:
glob_to_multiple:
expand: true
cwd: 'src'
src: ['*.coffee']
dest: 'lib'
ext: '.js'
coffeelint:
options:
no_empty_param_list:
level: 'error'
... | module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
coffee:
glob_to_multiple:
expand: true
cwd: 'src'
src: ['*.coffee']
dest: 'lib'
ext: '.js'
coffeelint:
options:
no_empty_param_list:
level: 'error'
... |
Fix for when the array is empty | do ($$ = Quo) ->
VENDORS = [ "-webkit-", "-moz-", "-ms-", "-o-", "" ]
$$.fn.addClass = (name) ->
@each ->
unless _existsClass(name, @className)
@className += " " + name
@className = @className.trim()
$$.fn.removeClass = (name) ->
@each ->
... | do ($$ = Quo) ->
VENDORS = [ "-webkit-", "-moz-", "-ms-", "-o-", "" ]
$$.fn.addClass = (name) ->
@each ->
unless _existsClass(name, @className)
@className += " " + name
@className = @className.trim()
$$.fn.removeClass = (name) ->
@each ->
... |
Call queue.done() in the request callback | # # Kissmetrics Batch
class BatchKissmetricsClient
@HOST: 'api.kissmetrics.com'
@HTTP_METHOD: 'POST'
@API_VERSION: 'v1'
@process: (queue, apiKey, apiSecret, productGUID) =>
http = require 'http'
urlPath = "#{@API_VERSION}/products/#{productGUID}/tracking/e"
baseUrl = "http://#{@HOST}/#{urlPat... | # # Kissmetrics Batch
class BatchKissmetricsClient
@HOST: 'api.kissmetrics.com'
@HTTP_METHOD: 'POST'
@API_VERSION: 'v1'
@process: (queue, apiKey, apiSecret, productGUID) =>
http = require 'http'
urlPath = "#{@API_VERSION}/products/#{productGUID}/tracking/e"
baseUrl = "http://#{@HOST}/#{urlPat... |
Fix deprecations in git init command | git = require '../git'
ProjectsListView = require '../views/projects-list-view'
StatusView = require '../views/status-view'
gitInit = ->
currentFile = atom.workspace.getActiveTextEditor()?.getPath()
if not currentFile and atom.project.getPaths().length > 1
promise = new ProjectsListView().result.then (path) ->... | git = require '../git'
ProjectsListView = require '../views/projects-list-view'
StatusView = require '../views/status-view'
gitInit = ->
currentFile = atom.workspace.getActiveTextEditor()?.getPath()
if not currentFile and atom.project.getPaths().length > 1
promise = new ProjectsListView().result.then (path) ->... |
Use convention for 'private' functions | class Algorhythmic
max: 10
compute: (array) ->
array
.map(@getCharInt)
.reduce((previousInt, currentInt) =>
(previousInt + currentInt) % @max
, 0) + 1
getCharInt: (char) -> parseInt char.charCodeAt(0) or 0
convert: (string) ->
str = string.replace(/\.(png|jpg|gif|)$/g, "")
strin... | class Algorhythmic
max: 10
convert: (string) ->
str = string.replace(/\.(png|jpg|gif|)$/g, "")
stringArray = str.split('')
return @_compute(stringArray)
_compute: (array) ->
array
.map(@_getCharInt)
.reduce((previousInt, currentInt) =>
(previousInt + currentInt) % @max
, 0) + 1... |
Change sample Github user to 'trabian' from 'trabianmatt' | class Repo extends Backbone.Model
class RepoCollection extends Backbone.Collection
model: Repo
url: 'https://api.github.com/users/trabianmatt/repos'
module.exports = { Repo, RepoCollection }
| class Repo extends Backbone.Model
class RepoCollection extends Backbone.Collection
model: Repo
url: 'https://api.github.com/users/trabian/repos'
module.exports = { Repo, RepoCollection }
|
Fix a critical bug in self service | {Disposable} = require('atom')
module.exports =
instance: null
config:
lintOnFly:
title: 'Lint on fly'
description: 'Lint files while typing, without the need to save them'
type: 'boolean'
default: true
showErrorPanel:
title: 'Show Error Panel at the bottom'
type: 'boolea... | {Disposable} = require('atom')
module.exports =
instance: null
config:
lintOnFly:
title: 'Lint on fly'
description: 'Lint files while typing, without the need to save them'
type: 'boolean'
default: true
showErrorPanel:
title: 'Show Error Panel at the bottom'
type: 'boolea... |
Set the alt attribute on the image as well. | class CMSimple.Panels.ImageLibrary.Selection extends Spine.Controller
constructor: ->
super
@bindEvents()
set: (img)->
if @selectedImage
@selectedImage.attr('src', img.src)
snippet = Mercury.Snippet.find @selectedImage.parents('[data-snippet]').data('snippet')
snippet.options.snippet... | class CMSimple.Panels.ImageLibrary.Selection extends Spine.Controller
constructor: ->
super
@bindEvents()
set: (img)->
if @selectedImage
@selectedImage.attr('src', img.src)
@selectedImage.attr('alt', img.alt)
snippet = Mercury.Snippet.find @selectedImage.parents('[data-snippet]').dat... |
Add 'Close All Tabs' to File menu | 'context-menu':
'.tab': [
{label: 'Close Tab', command: 'tabs:close-tab'}
{label: 'Close Other Tabs', command: 'tabs:close-other-tabs'}
{label: 'Close Tabs to the Right', command: 'tabs:close-tabs-to-right'}
{label: 'Close Saved Tabs', command: 'tabs:close-saved-tabs'}
{label: 'Close All Tabs', co... | menu: [
{
label: 'File'
submenu: [
{label: 'Close All Tabs', command: 'tabs:close-all-tabs'}
]
}
]
'context-menu':
'.tab': [
{label: 'Close Tab', command: 'tabs:close-tab'}
{label: 'Close Other Tabs', command: 'tabs:close-other-tabs'}
{label: 'Close Tabs to the Right', command: 'tab... |
Change default project path for atom | '*':
'editor':
'fontFamily': 'PragmataPro'
'showInvisibles': true
'showIndentGuide': true
'invisibles': {}
'core':
'disabledPackages': [
'autocomplete'
'spell-check'
]
'themes': [
'solarized-dark-ui'
'solarized-dark-syntax'
]
'projectHome': '/Users/edgard/... | '*':
'editor':
'fontFamily': 'PragmataPro'
'showInvisibles': true
'showIndentGuide': true
'invisibles': {}
'core':
'disabledPackages': [
'autocomplete'
'spell-check'
]
'themes': [
'solarized-dark-ui'
'solarized-dark-syntax'
]
'projectHome': '/home/edgard/D... |
Add support for time data types | class PgHoffTypes
@Type:
'timestamp with time zone':
format: (value) -> return new Date(value).toLocaleString(atom.config.get('pg-hoff.locale'))
'timestamp':
format: (value) -> return new Date(value).toLocaleString(atom.config.get('pg-hoff.locale'))
'j... | timestamp =
format: (value) -> new Date(value).toLocaleString(atom.config.get('pg-hoff.locale'))
time =
format: (value) -> new Date('2000-01-01 ' + value).toLocaleTimeString(atom.config.get('pg-hoff.locale'))
class PgHoffTypes
@Type:
'timestamp with time zone': timestamp
'timestamp without t... |
Load and merge defaults if available | fs = require "fs"
path = require "path"
env = (process.env.NODE_ENV or "development").toLowerCase()
if process.env.SHARELATEX_CONFIG?
possibleConfigFiles = [process.env.SHARELATEX_CONFIG]
else
possibleConfigFiles = [
process.cwd() + "/config/settings.#{env}.coffee"
path.normalize(__dirname + "/../../config/setti... | fs = require "fs"
path = require "path"
env = (process.env.NODE_ENV or "development").toLowerCase()
merge = (settings, defaults) ->
for key, value of settings
if typeof(value) == "object"
defaults[key] = merge(settings[key], defaults[key] or {})
else
defaults[key] = value
return defaults
defaultSettingsPa... |
Add to unique unit tests | QUnit.test "test unique", (assert) ->
input = [5, 6, 7, 5, 5, 6, 7]
output = unique(input)
expected = [5, 6, 7]
assert.deepEqual( output , expected)
| QUnit.test "test unique", (assert) ->
input = [5, 6, 7, 5, 5, 6, 7]
output = unique(input)
expected = [5, 6, 7]
assert.deepEqual(output , expected, "plain")
input = [5, 6, null, 7, 5, 5, 6, 7]
output = unique(input)
assert.deepEqual(output, expected, "with null")
input = [5]
outpu... |
Remove unneeded subscription at the wish page (if the data already exists) | class @WishController extends RouteController
waitOn: ->
[Meteor.subscribe('wish', @params.id), subscriptionHandles['users']]
tempalte: 'wish'
renderTemplates:
'nav': to: 'nav'
notFoundTemplate: 'notFound'
data: ->
wish = Wishes.findOne({_id: @params.id})
if not wish then return null
... | class @WishController extends RouteController
waitOn: ->
subs = [subscriptionHandles.users]
if not Wishes.findOne({_id: @params.id})
s = Meteor.subscribe('wish', @params.id)
s.stop = ->
subs.push(s)
subs
tempalte: 'wish'
renderTemplates:
'nav': to: 'nav'
notFoundTemplate: '... |
Raise error on failed action in flow. | module.exports = ->
@logger = require './logger'
@visit = (path) =>
@driver.get "#{@host}#{path}"
_Before = @Before
_After = @After
@_inFlow = (code, callback) ->
$.createFlow (flow) =>
flow.execute => code.call(@)
.then _.partial(callback, null), callback
@Before = (code) ->
_Bef... | module.exports = ->
@logger = require './logger'
@visit = (path) =>
@driver.get "#{@host}#{path}"
_Before = @Before
_After = @After
@_inFlow = (code, callback) ->
$.createFlow (flow) =>
flow.execute => code.call(@)
.then _.partial(callback, null),
(err) -> throw err
@Before = (c... |
Use alt instead of ctrl | '.workspace':
'ctrl-g o': 'github:open'
'ctrl-g b': 'github:blame'
'ctrl-g h': 'github:history'
'ctrl-g c': 'github:copy-url'
| '.workspace':
'alt-g o': 'github:open'
'alt-g b': 'github:blame'
'alt-g h': 'github:history'
'alt-g c': 'github:copy-url'
|
Add proxy settings for nightmare. | chai = require 'chai'
chai.should()
chai.use require 'chai-as-promised'
require 'postmortem/register'
Nightmare = require 'joseph/nightmare'
before ->
browser = Nightmare show: process.env.VERBOSE is 'true'
yield browser.goto 'http://localhost:3333/'
global.browser = browser
after ->
yield browser.end()
| chai = require 'chai'
chai.should()
chai.use require 'chai-as-promised'
require 'postmortem/register'
Nightmare = require 'joseph/nightmare'
before ->
browser = Nightmare
show: process.env.VERBOSE is 'true'
# switches:
# 'proxy-server': 'http://localhost:4010'
# 'ignore-certificate... |
Enable to lint no-extension file | 'use strict'
gulp = require 'gulp'
$ = (require 'gulp-load-plugins') lazy: false
paths =
jshint: [
'./bin/*.js'
]
coffeelint: [
'./gulpfile.coffee'
'./test/*.coffee'
]
watch: [
'./gulpfile.coffee'
'./bin/**/*.js'
'./test/**/*.coffee'
]
tests: [
'./test/**/*.coffee'
]
gulp.... | 'use strict'
gulp = require 'gulp'
$ = (require 'gulp-load-plugins') lazy: false
paths =
jshint: [
'./bin/*'
]
coffeelint: [
'./gulpfile.coffee'
'./test/*.coffee'
]
watch: [
'./gulpfile.coffee'
'./bin/**/*.js'
'./test/**/*.coffee'
]
tests: [
'./test/**/*.coffee'
]
gulp.tas... |
Use path.join instead of path.resolve | # Start the crash reporter before anything else.
require('crash-reporter').start(productName: 'Atom', companyName: 'GitHub')
path = require 'path'
try
require '../src/window'
Atom = require '../src/atom'
window.atom = Atom.loadOrCreate('spec')
# Show window synchronously so a focusout doesn't fire on input e... | # Start the crash reporter before anything else.
require('crash-reporter').start(productName: 'Atom', companyName: 'GitHub')
path = require 'path'
try
require '../src/window'
Atom = require '../src/atom'
window.atom = Atom.loadOrCreate('spec')
# Show window synchronously so a focusout doesn't fire on input e... |
Fix tests in IE 11 | {pressKey, test, testGroup, typeCharacters} = Trix.TestHelpers
testOptions =
template: "editor_empty"
setup: ->
addEventListener("keydown", cancel, true)
addEventListener "trix-before-initialize", handler = ({target}) ->
removeEventListener("trix-before-initialize", handler)
target.addEventList... | {pressKey, test, testGroup, typeCharacters} = Trix.TestHelpers
testOptions =
template: "editor_empty"
setup: ->
addEventListener("keydown", cancel, true)
addEventListener "trix-before-initialize", handler = ({target}) ->
removeEventListener("trix-before-initialize", handler)
target.addEventList... |
Select by user.id, not the whole user object | keysSchema = mongoose.Schema
user:
type: mongoose.Schema.ObjectId
ref: "User"
identifier: String
key: String
created_at:
type: Date
default: Date.now
updated_at:
type: Date
default: Date.now
keysSchema.static "getUserKeyWithIdentifier", (user, ident, cb) ->
this.find
user: user
identifier: ident... | keysSchema = mongoose.Schema
user:
type: mongoose.Schema.ObjectId
ref: "User"
identifier: String
key: String
created_at:
type: Date
default: Date.now
updated_at:
type: Date
default: Date.now
keysSchema.static "getUserKeyWithIdentifier", (user, ident, cb) ->
this.find
user: user.id
identifier: id... |
Fix default path to powershell. | # from atom/terminal to reduce cpu usage
pty = require 'ptyw.js'
module.exports = (ptyCwd, sh, cols, rows, args) ->
callback = @async()
if sh
shell = sh
else
shell = process.env.SHELL
if not shell
# Try to salvage some sort of shell to execute. Horrible code below.
path = requi... | # from atom/terminal to reduce cpu usage
pty = require 'ptyw.js'
module.exports = (ptyCwd, sh, cols, rows, args) ->
callback = @async()
if sh
shell = sh
else
shell = process.env.SHELL
if not shell
# Try to salvage some sort of shell to execute. Horrible code below.
path = requi... |
Add a minimap class to the decoration scope | {View} = require 'atom'
module.exports =
class MinimapSelectionView extends View
decorations: []
@content: ->
@div class: 'minimap-selection'
initialize: (@minimapView) ->
@subscribe @minimapView.editorView, "selection:changed", @handleSelection
@subscribe @minimapView.editorView, "cursor-added", @ha... | {View} = require 'atom'
module.exports =
class MinimapSelectionView extends View
decorations: []
@content: ->
@div class: 'minimap-selection'
initialize: (@minimapView) ->
@subscribe @minimapView.editorView, "selection:changed", @handleSelection
@subscribe @minimapView.editorView, "cursor-added", @ha... |
Update grammar to take Windows into account | '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'
}
]
|
Set a default for Connection's config.options.default . | 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.d... | 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.d... |
Exclude deprecated APIs when running specs | require 'coffee-cache'
jasmine.getEnv().addEqualityTester(require('underscore-plus').isEqual)
| require 'coffee-cache'
jasmine.getEnv().addEqualityTester(require('underscore-plus').isEqual)
require('grim').includeDeprecatedAPIs = false
|
Remove a FIXME that got fixed with data beta3. | 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... | AllAboard.SlidesRoute = Em.Route.extend
model: ->
@modelFor("board").get("slides")
afterModel: (slides) ->
if slides.get("length") > 0
@transitionTo("slide", @modelFor("board"), slides.get("firstObject"))
|
Use .jshintrc file instead of brunch jshint plugin configurations. | 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
glo... | 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
|
Fix bug (with my understanding of CoffeeScript) | # 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
|
Send entire payload to Sidekiq | 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.trigge... | 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.trigge... |
Refactor checkout button to remove one-click-logic (checkout ctrl already doest it) | '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.allowOneCl... | '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")
|
Remove quick-test-or-trial, it's not used. | # 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.", "... | # 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_r... |
Add Grunt task alias test | 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']
grun... | 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']
grun... |
Make sure there are suggestions | 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... | 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... |
Add (unimplemented) options to template command | #! /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: 'C... |
Improve guard against opening multiple web sockets | # 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: ->
i... | # 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: =>
i... |
Remove event junk from the obj selection | {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={}) ->
... | {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.... |
Handle <enter> for creating channels | 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'
initializ... | 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 .... |
Apply workaround for clearing of focus upon loading of window | # 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... | # 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... |
Fix DND, simple is better | 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
v... | 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
v... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.