Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Check if originalEvent is defined | Template.displayIcon.userIconUrl = ->
# TODO: We should specify default URL to the image of an avatar which is generated from name initials
"https://secure.gravatar.com/avatar/#{ Meteor.person()?.gravatarHash }?s=25"
Template._loginButtonsLoggedInDropdownActions.personSlug = ->
Meteor.person()?.slug
# To close ... | Template.displayIcon.userIconUrl = ->
# TODO: We should specify default URL to the image of an avatar which is generated from name initials
"https://secure.gravatar.com/avatar/#{ Meteor.person()?.gravatarHash }?s=25"
Template._loginButtonsLoggedInDropdownActions.personSlug = ->
Meteor.person()?.slug
# To close ... |
Use new status bar tile API | _ = require 'underscore-plus'
{View} = require 'atom-space-pen-views'
module.exports =
class IncompatiblePackagesStatusView extends View
@content: ->
@div class: 'incompatible-packages-status inline-block text text-error', =>
@span class: 'icon icon-bug'
@span outlet: 'countLabel', class: 'incompatib... | _ = require 'underscore-plus'
{View} = require 'atom-space-pen-views'
module.exports =
class IncompatiblePackagesStatusView extends View
@content: ->
@div class: 'incompatible-packages-status inline-block text text-error', =>
@span class: 'icon icon-bug'
@span outlet: 'countLabel', class: 'incompatib... |
Delete length validation for password | # modules
Sequelize = require 'sequelize'
db = require './db'
Team = require './team'
# custom validation constraints
checkUnique = (value, next) ->
User.find
where: $or:
nickname: value
email: value
.then (user) ->
if user then return next 'Ce nom d\'utilisateu... | # modules
Sequelize = require 'sequelize'
db = require './db'
Team = require './team'
# custom validation constraints
checkUnique = (value, next) ->
User.find
where: $or:
nickname: value
email: value
.then (user) ->
if user then return next 'Ce nom d\'utilisateu... |
Set label height to Ti.UI.SIZE | label = (fontSize, options = {}) ->
options.font = _.extend {}, options.font or {},
fontSize: fontSize
_.extend {}, options,
height: Ti.UI.SIZE
width: Ti.UI.FILL
color: '#333'
bottom: options.font.fontSize * 0.5 # Similar to bottom margin of 0.5em
heading = (fontSize) ->
label fontSize,
... | label = (fontSize, options = {}) ->
options.font = _.extend {}, options.font or {},
fontSize: fontSize
_.extend {}, options,
height: Ti.UI.SIZE
width: Ti.UI.FILL
color: '#333'
bottom: options.font.fontSize * 0.5 # Similar to bottom margin of 0.5em
heading = (fontSize) ->
label fontSize,
... |
Make tile path work in GH | # handle background tiles
backgroundTile = undefined
tileImg = new Image()
tileImg.onload = ->
backgroundTile = cq().context.createPattern(tileImg,'repeat')
tileImg.src = '/img/tile.png'
drawBackgroundTiles = (ctx) ->
if backgroundTile?
ctx
.rect(0,0, ctx.canvas.width,ctx.canvas.height)
.fillStyle(backg... | # handle background tiles
backgroundTile = undefined
tileImg = new Image()
tileImg.onload = ->
backgroundTile = cq().context.createPattern(tileImg,'repeat')
tileImg.src = './img/tile.png'
drawBackgroundTiles = (ctx) ->
if backgroundTile?
ctx
.rect(0,0, ctx.canvas.width,ctx.canvas.height)
.fillStyle(back... |
Add bootstrap modal and transition dependencies | define (require) ->
$ = require('jquery')
BaseView = require('cs!helpers/backbone/views/base')
template = require('hbs!./legacy-template')
require('less!./legacy')
return class LegacyModal extends BaseView
template: template
events:
'submit': 'onSubmit'
onSubmit: (e) ->
e.preventDef... | define (require) ->
$ = require('jquery')
BaseView = require('cs!helpers/backbone/views/base')
template = require('hbs!./legacy-template')
require('less!./legacy')
require('bootstrapTransition')
require('bootstrapModal')
return class LegacyModal extends BaseView
template: template
events:
... |
Use `machine.getName()` instead of `machine.label` | class NavigationMachineItem extends JView
{Running, Stopped} = Machine.State
stateClasses = ''
stateClasses += "#{state.toLowerCase()} " for state in Object.keys Machine.State
constructor:(options = {}, data)->
machine = data
@alias = machine.label
path = K... | class NavigationMachineItem extends JView
{Running, Stopped} = Machine.State
stateClasses = ''
stateClasses += "#{state.toLowerCase()} " for state in Object.keys Machine.State
constructor:(options = {}, data)->
machine = data
@alias = machine.getName()
path ... |
Change first names to slack handles | module.exports = (robot) ->
names = ['Dana', 'Freia', 'Jhishan', 'Kyle', 'Brenton', 'Terri', 'Abhi', 'Drew']
robot.hear /Resume queen, who is next\?/i, (res) ->
res.send res.random names
| module.exports = (robot) ->
names = ['Dana', 'Freia', 'Jhishan', 'Kyle', 'Brenton', 'Terri', 'Abhi', 'Drew']
names = ['@danagilliann', '@flobot', '@jhishan', '@kwhughes', '@brentdur', '@terriburns', '@abhiagarwal', '@nydrewreynolds']
robot.hear /Resume queen, who is next\?/i, (res) ->
res.send res.random name... |
Update ArgumentVotes when the argument changes | class window.ArgumentVotes extends Backbone.Model
defaults:
believes: 0
disbelieves: 0
isNew: -> @_argument.isNew()
initialize: (attributes, options) ->
@_argument = options.argument
url: ->
@_argument.url() + '/opinion'
setCurrentUserOpinion: (newOpinion) ->
previousOpinion = @get('cu... | class window.ArgumentVotes extends Backbone.Model
defaults:
believes: 0
disbelieves: 0
isNew: -> @_argument.isNew()
initialize: (attributes, options) ->
@_argument = options.argument
@_argument.on 'change:argument_votes', =>
@set @_argument.get('argument_votes')
url: ->
@_argument.... |
Add in /status end point | Settings = require "settings-sharelatex"
logger = require "logger-sharelatex"
logger.initialize("track-changes")
HttpController = require "./app/js/HttpController"
express = require "express"
app = express()
app.use express.logger()
app.post "/doc/:doc_id/flush", HttpController.flushUpdatesWithLock
app.use (error, ... | Settings = require "settings-sharelatex"
logger = require "logger-sharelatex"
logger.initialize("track-changes")
HttpController = require "./app/js/HttpController"
express = require "express"
app = express()
app.use express.logger()
app.post "/doc/:doc_id/flush", HttpController.flushUpdatesWithLock
app.get "/status... |
Enable popovers in content editor | define [
'jquery'
'underscore'
'backbone'
'marionette'
'cs!views/workspace/content/aloha-edit'
'hbs!templates/workspace/content/content-edit'
], ($, _, Backbone, Marionette, AlohaEditView, contentEditTemplate) ->
# Edit Content Body
# -------
return AlohaEditView.extend
# **NOTE:** This template ... | define [
'jquery'
'underscore'
'backbone'
'marionette'
'cs!views/workspace/content/aloha-edit'
'hbs!templates/workspace/content/content-edit'
'bootstrapPopover'
], ($, _, Backbone, Marionette, AlohaEditView, contentEditTemplate) ->
# Edit Content Body
# -------
return AlohaEditView.extend
# **N... |
Add comment to temporary bugfix. | App.Followable =
initialize: ->
$('.followable-content a[data-toggle]').on 'click', (event) ->
event.preventDefault()
update: (followable_id, button) ->
$("#" + followable_id + " .js-follow").html(button)
initialize_modules()
| App.Followable =
initialize: ->
$('.followable-content a[data-toggle]').on 'click', (event) ->
event.preventDefault()
update: (followable_id, button) ->
$("#" + followable_id + " .js-follow").html(button)
# Temporary line. Waiting for issue resolution: https://github.com/consul/consul/issues/173... |
Fix name of helper in error message | isActive = (type, inverse = false) ->
name = 'is'
name = name + 'Not' if inverse
name = name + _.capitalize type
(view) ->
unless view instanceof Spacebars.kw
throw new Error "#{name} options must be key value pair such " +
"as {{#{name} regex='route/path'}}. You passed: " +
"#{JSON.s... | isActive = (type, inverse = false) ->
name = 'is'
name = name + 'Not' if inverse
name = name + 'Active' + _.capitalize type
(view) ->
unless view instanceof Spacebars.kw
throw new Error "#{name} options must be key value pair such " +
"as {{#{name} regex='route/path'}}. You passed: " +
... |
Add hashbang option to pathFor | # check for subscriptions to be ready
subsReady = (subs...) ->
return FlowRouter.subsReady() if subs.length is 1
subs = subs.slice(0, subs.length - 1)
_.reduce subs, (memo, sub) ->
memo and FlowRouter.subsReady(sub)
, true
# return path
pathFor = (path, view) ->
throw new Error('no path defined') unless ... | # check for subscriptions to be ready
subsReady = (subs...) ->
return FlowRouter.subsReady() if subs.length is 1
subs = subs.slice(0, subs.length - 1)
_.reduce subs, (memo, sub) ->
memo and FlowRouter.subsReady(sub)
, true
# return path
pathFor = (path, view) ->
throw new Error('no path defined') unless ... |
Clear errors when re-running a scenario. | # reference "_namespace.coffee"
# reference "PartViewModel.coffee"
{ PartViewModel } = @witness.ui
@witness.ui.ScenarioViewModel = class ScenarioViewModel
constructor: (@scenario) ->
{ @path, @url } = @scenario.parentSpecification.parentFile
@parts = (new PartViewModel part for part in [].concat @scena... | # reference "_namespace.coffee"
# reference "PartViewModel.coffee"
{ PartViewModel } = @witness.ui
@witness.ui.ScenarioViewModel = class ScenarioViewModel
constructor: (@scenario) ->
{ @path, @url } = @scenario.parentSpecification.parentFile
@parts = (new PartViewModel part for part in [].concat @scena... |
Use the atom-text-editor tag instead of the editor class. | # 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://at... | # 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://at... |
Change api_url to reflect Gist raw file URI change | # Description:
# Generate code names for things
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot codename - Generates a few potential codenames for you
#
# Author:
# Scott J Roberts - @sroberts
api_url = "https://gist.github.com"
request_url = api_url + "/sroberts/6529712/raw/1e979071... | # Description:
# Generate code names for things
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot codename - Generates a few potential codenames for you
#
# Author:
# Scott J Roberts - @sroberts
api_url = "https://gist.githubusercontent.com"
request_url = api_url + "/sroberts/6529712/r... |
Allow to mark interrest in doing subjects | Template.CalendarItem.helpers
style: ->
user = Meteor.user()
styles = []
itemStatus = user?.grade?[@gradeItem._id]
itemStatus ?= 'pending'
switch itemStatus
when 'done'
styles.push 'color: lightgray'
when 'doing'
styles.push 'color: orange'
return styles.join '; '
canMarkInterrest: ->
... | Template.CalendarItem.helpers
style: ->
user = Meteor.user()
styles = []
itemStatus = user?.grade?[@gradeItem._id]
itemStatus ?= 'pending'
switch itemStatus
when 'done'
styles.push 'color: lightgray'
when 'doing'
styles.push 'color: orange'
return styles.join '; '
canMarkInterrest: ->
... |
Use the value as parameter when the myName field does not exist | unless EditableForm
EditableForm = $.fn.editableform.Constructor
EditableForm.prototype.saveWithUrlHook = (value) ->
originalUrl = @options.url
model = @options.model
nestedName = @options.nested
nestedId = @options.nid
nestedLocale = @options.locale
@options.url = (param... | unless EditableForm
EditableForm = $.fn.editableform.Constructor
EditableForm.prototype.saveWithUrlHook = (value) ->
originalUrl = @options.url
model = @options.model
nestedName = @options.nested
nestedId = @options.nid
nestedLocale = @options.locale
@options.url = (param... |
Fix incorrect reporting of current subject | class Subjects
queue: []
api: null
query:
sort: 'queued'
page_size: "30"
constructor: (@api, @project, @subject_set_id)->
@query.workflow_id = @project?.links.workflows[0]
@query.subject_set_id = @subject_set_id
update: (opts) ->
@[opt] = value for opt, value of opts
@query.workf... | class Subjects
queue: []
api: null
current: null
query:
sort: 'queued'
page_size: "30"
constructor: (@api, @project, @subject_set_id)->
@query.workflow_id = @project?.links.workflows[0]
@query.subject_set_id = @subject_set_id
update: (opts) ->
@[opt] = value for opt, value of opts
... |
Remove asynchronous working if transitions are disabled |
class UIDemo.Views.TransitionView extends Backbone.View
transitionRemoveClass: (className, $el = @$el) ->
p = @_transitionPromise($el)
@_delay(=> $el.removeClass className).then -> p
transitionAddClass: (className, $el = @$el) ->
p = @_transitionPromise($el)
@_delay(=> $el.addClass className).the... |
class UIDemo.Views.TransitionView extends Backbone.View
transitionRemoveClass: (className, $el = @$el) ->
p = @_transitionPromise($el)
@_delay(=> $el.removeClass className).then -> p
transitionAddClass: (className, $el = @$el) ->
p = @_transitionPromise($el)
@_delay(=> $el.addClass className).the... |
Set the value of the overlay on initialition | define ['jquery'], ($) ->
class SelectGroup
constructor: (@parent = null, @callback = false) ->
@selectParent = (if @parent != null then $(@parent) else $('.js-select-group'))
@addHandlers()
addHandlers: ->
@selectParent.on 'focus', '.js-select', (e) =>
@getOverlay(e.target).addCl... | define ['jquery'], ($) ->
class SelectGroup
constructor: (@parent = null, @callback = false) ->
@selectParent = (if @parent != null then $(@parent) else $('.js-select-group'))
@selectParent.find('.js-select').each (eltIndex) =>
@setOverlay(@selectParent[eltIndex])
@addHandlers()
a... |
Use reactor directly inside of action | kd = require 'kd'
actions = require './actiontypes'
fetchAccount = require 'app/util/fetchAccount'
dispatch = (args...) -> kd.singletons.reactor.dispatch args...
###*
* Load account with given id.
*
* @param {string} id
###
loadAccount = (id) ->
origin = generateOrigin id
dispatch actions.LOA... | kd = require 'kd'
actions = require './actiontypes'
fetchAccount = require 'app/util/fetchAccount'
###*
* Load account with given id.
*
* @param {string} id
###
loadAccount = (id) ->
origin = generateOrigin id
{ reactor } = kd.singletons
reactor.dispatch actions.LOAD_USER_BEGIN, { id, origi... |
Fix error with FindResultsView attachment and update on react editor | _ = require 'underscore-plus'
{EditorView, View} = require 'atom'
MarkerView = require './marker-view'
module.exports =
class FindResultsView extends View
@content: ->
@div class: 'search-results'
initialize: (@findModel) ->
@markerViews = {}
@subscribe @findModel, 'updated', (args...) => @markersUpd... | _ = require 'underscore-plus'
{EditorView, View} = require 'atom'
MarkerView = require './marker-view'
# TODO: remove this when marker views are in core. Hopefully soon.
module.exports =
class FindResultsView extends View
@content: ->
@div class: 'search-results'
initialize: (@findModel) ->
@markerViews... |
Add git-blame to Atom package list | packages: [
"advanced-open-file"
"atom-alignment"
"atom-beautify"
"atom-transpose"
"change-case"
"color-picker"
"docblockr"
"editorconfig"
"emmet"
"expand-region"
"language-apache"
"language-applescript"
"language-awk"
"language-babel"
"language-diff"
"language-env"
"language-gitattrib... | packages: [
"advanced-open-file"
"atom-alignment"
"atom-beautify"
"atom-transpose"
"change-case"
"color-picker"
"docblockr"
"editorconfig"
"emmet"
"expand-region"
"git-blame"
"language-apache"
"language-applescript"
"language-awk"
"language-babel"
"language-diff"
"language-env"
"lang... |
Add slugified title as class name to context menu items. | KDView = require './../../core/view.coffee'
JTreeItemView = require './../tree/treeitemview.coffee'
module.exports = class JContextMenuItem extends JTreeItemView
constructor:(options = {}, data = {})->
options.type = "contextitem"
options.cssClass or= "default"
super options, data
@u... | KDView = require './../../core/view.coffee'
JTreeItemView = require './../tree/treeitemview.coffee'
module.exports = class JContextMenuItem extends JTreeItemView
constructor:(options = {}, data = {})->
options.type = "contextitem"
options.cssClass or= "default #{KD.utils.slugify data.title}"
... |
Fix ObjectID hex string validation | "use strict"
ObjectID = require('mongodb').ObjectID
exports.param = (req, res, next, id) ->
return res.json 400, error: 'Invalid ObjectID' if not /[a-f0-9]{24}/.test id
req.id = ObjectID.createFromHexString id
next()
exports.options = (req, res, next) ->
res.setHeader 'Access-Control-Allow-Methods', 'GET, PU... | "use strict"
ObjectID = require('mongodb').ObjectID
exports.param = (req, res, next, id) ->
return res.json 400, error: 'Invalid ObjectID' if not /^[a-f0-9]{24}$/.test id
req.id = ObjectID.createFromHexString id
next()
exports.options = (req, res, next) ->
res.setHeader 'Access-Control-Allow-Methods', 'GET, ... |
Remove specific CSS classes for slides and slide-pack | hl = require 'highlight.js'
mousetrap = require 'mousetrap'
$ = require 'zeptojs'
processor = require './slide-pack-processor'
ui = require './slide-pack-ui'
executeHooks = ->
if f = window._slide_pack_process_slides
f $('.slide')
$('[data-slide-pack]').each ->
slides = processor.process $(@).html()
$art... | hl = require 'highlight.js'
mousetrap = require 'mousetrap'
$ = require 'zeptojs'
processor = require './slide-pack-processor'
ui = require './slide-pack-ui'
executeHooks = ->
if f = window._slide_pack_process_slides
f $('.slide')
$('[data-slide-pack]').each ->
$slidePack = $(@)
slides = processor.process... |
Use WritableTrackingBuffer to simplify the creation of AllHeaders. | # s2.2.5.3
# For now, only the "Transaction Descriptor" header (s2.2.5.3.2) is supported.
TYPE =
QUERY_NOTIFICATIONS: 1
TXN_DESCRIPTOR: 2
TRACE_ACTIVITY: 3
TXNDESCRIPTOR_HEADER_DATA_LEN = 4 + 8
TXNDESCRIPTOR_HEADER_LEN = 4 + 2 + TXNDESCRIPTOR_HEADER_DATA_LEN
module.exports = (txnDescriptor, outstandingRequest... | # s2.2.5.3
# For now, only the "Transaction Descriptor" header (s2.2.5.3.2) is supported.
WritableTrackingBuffer = require('../lib/tracking-buffer/tracking-buffer').WritableTrackingBuffer
TYPE =
QUERY_NOTIFICATIONS: 1
TXN_DESCRIPTOR: 2
TRACE_ACTIVITY: 3
TXNDESCRIPTOR_HEADER_DATA_LEN = 4 + 8
TXNDESCRIPTOR_HEAD... |
Use a JSON column for metadata | Settings = require "settings-sharelatex"
logger = require "logger-sharelatex"
_ = require "underscore"
if !Settings.analytics?.postgres?
module.exports =
recordEvent: (user_id, event, metadata, callback = () ->) ->
logger.log {user_id, event, metadata}, "no event tracking configured, logging event"
callback()... | Settings = require "settings-sharelatex"
logger = require "logger-sharelatex"
_ = require "underscore"
if !Settings.analytics?.postgres?
module.exports =
recordEvent: (user_id, event, metadata, callback = () ->) ->
logger.log {user_id, event, metadata}, "no event tracking configured, logging event"
callback()... |
Make BufferedNodeProcess adapt to changes of atom-shell v0.4.4. | BufferedProcess = require 'buffered-process'
path = require 'path'
# Private: Like BufferedProcess, but accepts a node script instead of an
# executable, on Unix which allows running scripts and executables, this seems
# unnecessary, but on Windows we have to separate scripts from executables since
# it doesn't suppor... | BufferedProcess = require 'buffered-process'
path = require 'path'
# Private: Like BufferedProcess, but accepts a node script instead of an
# executable, on Unix which allows running scripts and executables, this seems
# unnecessary, but on Windows we have to separate scripts from executables since
# it doesn't suppor... |
Use provided middleware in resources by default | ExpressHttpResource = require 'bloops/adapters/express_resource'
MongooseAdapter = require 'bloops/adapters/mongoose_adapter'
models = require('./db').models
filters = require 'bloops/filters'
cors = require 'cors'
class BaseResource extends ExpressHttpResource
adapter: MongooseAdapter
context:
models: models... | ExpressHttpResource = require 'bloops/adapters/express_resource'
MongooseAdapter = require 'bloops/adapters/mongoose_adapter'
models = require('./db').models
filters = require 'bloops/filters'
cors = require 'cors'
class BaseResource extends ExpressHttpResource
adapter: MongooseAdapter
context:
models: models... |
Add comment for later menu entries | require 'semantic-ui-css/components/icon.css'
require 'semantic-ui-css/components/menu.css'
require 'semantic-ui-css/components/sidebar.css'
require '../../css/menu.css'
api = require '../backend.coffee'
React = require 'react'
module.exports = React.createClass
displayName: 'MainMenu'
render: ->
act... | require 'semantic-ui-css/components/icon.css'
require 'semantic-ui-css/components/menu.css'
require 'semantic-ui-css/components/sidebar.css'
require '../../css/menu.css'
api = require '../backend.coffee'
React = require 'react'
module.exports = React.createClass
displayName: 'MainMenu'
render: ->
act... |
Change from simple helper to block to allow track render | if Package.templating?
Template = Package.templating.Template
Blaze = Package.blaze.Blaze
Blaze.toHTMLWithDataNonReactive = (content, data) ->
makeCursorReactive = (obj) ->
if obj instanceof Meteor.Collection.Cursor
obj._depend
added: true
removed: true
changed: true
makeCursorReactive da... | if Package.templating?
Template = Package.templating.Template
Blaze = Package.blaze.Blaze
HTML = Package.htmljs.HTML
Blaze.toHTMLWithDataNonReactive = (content, data) ->
makeCursorReactive = (obj) ->
if obj instanceof Meteor.Collection.Cursor
obj._depend
added: true
removed: true
changed: t... |
Rename filename to snake case | Ripper = require './ripper'
NotificationView = require './notification-view'
{ packages: packageManager } = atom
module.exports =
activate: ->
return if 'refactor' in packageManager.getAvailablePackageNames() and
!packageManager.isPackageDisabled 'refactor'
new NotificationView
deactivate: -... | Ripper = require './ripper'
NotificationView = require './notification_view'
{ packages: packageManager } = atom
module.exports =
activate: ->
return if 'refactor' in packageManager.getAvailablePackageNames() and
!packageManager.isPackageDisabled 'refactor'
new NotificationView
deactivate: -... |
Add an alignment on columns in demo table |
module.exports =
activate: (state) ->
atom.workspaceView.command 'table-edit:demo', ->
Table = require './table'
TableView = require './table-view'
table = new Table
table.addColumn 'key'
table.addColumn 'value'
table.addColumn 'foo'
for i in [0...100]
table.a... |
module.exports =
activate: (state) ->
atom.workspaceView.command 'table-edit:demo', ->
Table = require './table'
TableView = require './table-view'
table = new Table
table.addColumn 'key'
table.addColumn 'value', align: 'right'
table.addColumn 'foo', align: 'right'
fo... |
Add the appropriate line class. | {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... |
Set unsubmitted for error case of editlinks. | 'use strict'
app.directive 'volumeEditLinksForm', [
'pageService',
(page) ->
restrict: 'E',
templateUrl: 'volume/editLinks.html',
link: ($scope) ->
volume = $scope.volume
form = $scope.volumeEditLinksForm
form.data = _.map volume.links, (ref) ->
head: ref.head
url: re... | 'use strict'
app.directive 'volumeEditLinksForm', [
'pageService',
(page) ->
restrict: 'E',
templateUrl: 'volume/editLinks.html',
link: ($scope) ->
volume = $scope.volume
form = $scope.volumeEditLinksForm
form.data = _.map volume.links, (ref) ->
head: ref.head
url: re... |
Merge updatePosition function into Initialize | # Source: https://github.com/lukehoban/atom-ide-flow/blob/master/lib/tooltip-view.coffee
{$, View} = require 'atom'
module.exports = (Main)->
class TooltipView extends View
@content: ->
@div class: 'ide-hack-tooltip'
initialize: (@rect, @LeMessage) ->
@append LeMessage
$(document.body).app... | # Source: https://github.com/lukehoban/atom-ide-flow/blob/master/lib/tooltip-view.coffee
{$, View} = require 'atom'
module.exports = (Main)->
class TooltipView extends View
@content: ->
@div class: 'ide-hack-tooltip'
initialize: (rect, @LeMessage) ->
@append LeMessage
$(document.body).appe... |
Add description for command line options. | Validator = require('../main').Validator
fs = require 'fs'
argv = require('optimist')
.usage('Usage: $0 --projectKey key --clientId id --clientSecret secret --csv file')
.demand(['projectKey', 'clientId', 'clientSecret', 'csv'])
.argv
timeout = argv.timeout
timeout or= 60000
options =
config:
project_key:... | Validator = require('../main').Validator
fs = require 'fs'
argv = require('optimist')
.usage('Usage: $0 --projectKey key --clientId id --clientSecret secret --csv file')
.describe('projectKey', 'your SPHERE.IO project-key')
.describe('clientId', 'your OAuth client id for the SPHERE.IO API')
.describe('clientSec... |
Make sure code is url decoded before encoding it to avoid double encoding | define [
"jquery"
"backbone"
"app"
"lib/extension"
"lib/fuzzy-match"
], (
$
Backbone
App
Extension
FuzzyMatch
) ->
class Command extends Backbone.Model
match: null
getTemplateData: ->
$.extend {}, @toJSON(), match: @match
createMatch: (search) ->
@match = new FuzzyMatch @... | define [
"jquery"
"backbone"
"app"
"lib/extension"
"lib/fuzzy-match"
], (
$
Backbone
App
Extension
FuzzyMatch
) ->
class Command extends Backbone.Model
match: null
getTemplateData: ->
$.extend {}, @toJSON(), match: @match
createMatch: (search) ->
@match = new FuzzyMatch @... |
Add clarifying comments to model. | a = DS.attr
ETahi.Paper = DS.Model.extend
assignees: DS.hasMany('user')
editors: DS.hasMany('user')
reviewers: DS.hasMany('user')
editor: Ember.computed.alias('editors.firstObject')
collaborations: DS.hasMany('collaboration')
collaborators: (->
@get('collaborations').mapBy('user')
).property('collabo... | a = DS.attr
ETahi.Paper = DS.Model.extend
assignees: DS.hasMany('user') # these are admins that have been assigned to the paper.
editors: DS.hasMany('user') # these are editors that have been assigned to the paper.
reviewers: DS.hasMany('user') # these are reviewers that have been assigned to the paper.
editor:... |
Fix Missing Default Param 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} =... |
Fix point tool controls offset when scaling image. | BasePoint = require 'zooniverse-readymade/lib/drawing-tools/point'
ToolControls = require './tool-controls'
class Pinpoint extends BasePoint
@Controls: ToolControls
constructor: ->
super
@disc.attr 'class', 'pinpoint'
rescale: (scale) ->
super
coords: (e) ->
@markingSurface.screenPixelTo... | BasePoint = require 'zooniverse-readymade/lib/drawing-tools/point'
ToolControls = require './tool-controls'
class Pinpoint extends BasePoint
@Controls: ToolControls
constructor: ->
super
@disc.attr 'class', 'pinpoint'
rescale: (scale) ->
super
coords: (e) ->
@markingSurface.screenPixelTo... |
Fix days of week formatting (1 -> 01) | # Description:
# Make hubot list what tasty treats are available at Kerb Kings Cross (eat.st)
#
# Dependencies:
#
# Configuration:
# None
#
# Commands:
# hubot what's on kerb
jsdom = require "jsdom"
module.exports = (robot) ->
robot.respond /what\'s on kerb/i, (msg) ->
url = "http://www.kerbfood.com/kings... | # Description:
# Make hubot list what tasty treats are available at Kerb Kings Cross (eat.st)
#
# Dependencies:
#
# Configuration:
# None
#
# Commands:
# hubot what's on kerb
jsdom = require "jsdom"
module.exports = (robot) ->
robot.respond /what\'s on kerb/i, (msg) ->
url = "http://www.kerbfood.com/kings... |
Fix for broken chat channel stuff. | builder = require('xmlbuilder')
class ChatChannel
constructor: (@reflector) ->
sendMessage: (player, message) ->
xml = builder.create('root')
.ele('chat', { from : player.name, message : message })
.toString({ pretty: false })
console.log(xml)
@reflector.sendAll "<chat from='#{player.nam... | # builder = require('xmlbuilder')
class ChatChannel
constructor: (@reflector) ->
sendMessage: (player, message) ->
return
xml = builder.create('root')
.ele('chat', { from : player.name, message : message })
.toString({ pretty: false })
console.log(xml)
@reflector.sendAll "<chat from... |
Set timer based on time, not setInterval calls | class Timer
constructor: (@id, @elapsed) ->
@seconds = 0
@minutes = 0
@hours = 0
@interval = undefined
if @elapsed
time = parseSeconds(@elapsed)
@seconds = time.seconds
@minutes = time.minutes
@hours = time.hours
parseSeconds = (seconds) ->
hours = Math.floor(second... | class Timer
constructor: (@id, @elapsed) ->
@seconds = 0
@minutes = 0
@hours = 0
@startTime = null
@interval = undefined
if @elapsed
time = parseSeconds(@elapsed)
@seconds = time.seconds
@minutes = time.minutes
@hours = time.hours
parseSeconds = (seconds) ->
hou... |
Fix adding of unread astericks | scrollHandler = ->
url = $(".actvty-pagination .next_page a").attr("href")
if url and $(window).scrollTop() > $(document).height() - $(window).height() - 300
$(".actvty-pagination").text "Nicht so schnell..."
showSpinner()
$.getScript url
return
if $(".actvty-pagination").length
$(window).scroll(sc... | scrollHandler = ->
url = $(".actvty-pagination .next_page a").attr("href")
if url and $(window).scrollTop() > $(document).height() - $(window).height() - 300
$(".actvty-pagination").text "Nicht so schnell..."
showSpinner()
$.getScript url
return
if $(".actvty-pagination").length
$(window).scroll(sc... |
Switch to interval rate limiting | debug = require('debug')('meshblu:getThrottles')
Limitus = require 'limitus'
limiter = new Limitus()
config = require '../config'
config.rateLimits ?= {};
windowRate = 1000
createThrottle = (name, rate) ->
debug 'createThrottle', name, rate
limiter.rule name, max: rate, interval: windowRate
rateLimit: (id="", ... | debug = require('debug')('meshblu:getThrottles')
Limitus = require 'limitus'
limiter = new Limitus()
config = require '../config'
config.rateLimits ?= {};
windowRate = 1000
createThrottle = (name, rate) ->
debug 'createThrottle', name, rate
limiter.rule name, max: rate, interval: windowRate, mode: 'interval'
r... |
Remove failing test since Travis works. | # spec/javascripts/foobar_spec.js.coffee
describe "foobar", ->
it 'works', -> expect(1 + 1).toEqual(2);
describe "wanted failure", ->
it 'fails', -> expect(1 + 1).toEqual(42);
| # spec/javascripts/foobar_spec.js.coffee
describe "foobar", ->
it 'works', -> expect(1 + 1).toEqual(2);
|
Use paddingTop/Left, as this also works in firefox | FactlinkJailRoot.contentBox = (element) ->
$element = $(element)
offset = $element.offset()
top: offset.top + parseInt window.getComputedStyle(element)['padding-top']
left: offset.left + parseInt window.getComputedStyle(element)['padding-left']
width: $element.width()
height: $element.height()
| FactlinkJailRoot.contentBox = (element) ->
$element = $(element)
offset = $element.offset()
top: offset.top + parseInt window.getComputedStyle(element).paddingTop
left: offset.left + parseInt window.getComputedStyle(element).paddingLeft
width: $element.width()
height: $element.height()
|
Check for can_index on the user, not the connection | Q = require 'bluebird-q'
Channel = require "../../models/channel"
Block = require "../../models/block"
Comments = require "../../collections/comments"
User = require "../../models/user"
markdown = require '../../lib/markdown'
sd = require("sharify").data
_ = require 'underscore'
@block = (req, res, next) ->
block = ... | Q = require 'bluebird-q'
Channel = require "../../models/channel"
Block = require "../../models/block"
Comments = require "../../collections/comments"
User = require "../../models/user"
markdown = require '../../lib/markdown'
sd = require("sharify").data
_ = require 'underscore'
@block = (req, res, next) ->
block = ... |
Print version on ‘brave-mouse -v’ | parser = require 'nomnom'
braveMouse = require '../brave-mouse'
module.exports = (argv) ->
parser
.script 'brave-mouse'
.parse argv.slice 2
| parser = require 'nomnom'
braveMouse = require '../brave-mouse'
braveMousePackageJson = require '../../package.json'
module.exports = (argv) ->
opts = parser
.script 'brave-mouse'
.options
version:
abbr: 'v'
flag: true
help: 'Print brave-mouse’s version'
.parse argv.slice 2
if opts.version
return c... |
Revert "Revert "Add jQuery notify back in"" | # This is a manifest file that'll be compiled into application.js, which will include all the files
# listed below.
#
# Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
# or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
#
... | # This is a manifest file that'll be compiled into application.js, which will include all the files
# listed below.
#
# Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
# or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
#
... |
Add support for tracking multiple GA accounts | define (require) ->
Backbone = require('backbone')
settings = require('settings')
# Class to handle loading analytics scripts and wrapping
# handlers around them so that modules don't have to
# interact with global variables directly
return new class AnalyticsHandler
constructor: () ->
# Setup te... | define (require) ->
Backbone = require('backbone')
settings = require('settings')
# Class to handle loading analytics scripts and wrapping
# handlers around them so that modules don't have to
# interact with global variables directly
return new class AnalyticsHandler
constructor: () ->
# Setup te... |
Allow for turning off autofocusing; use defer option | _ = require 'underscore'
Backbone = require 'backbone'
form = require '../../form/utilities.coffee'
module.exports = class StepView extends Backbone.View
__events__: null
events: ->
_.extend @__events__,
'click .js-nevermind': 'dismiss'
initialize: ({ @user, @inquiry, @artwork, @state }) ->
@__se... | _ = require 'underscore'
Backbone = require 'backbone'
form = require '../../form/utilities.coffee'
module.exports = class StepView extends Backbone.View
__events__: null
events: ->
_.extend @__events__,
'click .js-nevermind': 'dismiss'
initialize: ({ @user, @inquiry, @artwork, @state }) ->
@__se... |
Use createSpinner on journal index. | ETahi.JournalIndexView = Ember.View.extend
toggleSpinner: (->
if @get('controller.epubCoverUploading')
@spinnerDiv = @$('#epub-cover-spinner')[0]
@spinner ||= new Spinner(color: "#aaa").spin(@spinnerDiv)
$(@spinnerDiv).show()
else
$(@spinnerDiv).hide()
).observes('controller.epubCove... | ETahi.JournalIndexView = Ember.View.extend ETahi.SpinnerMixin,
toggleSpinner: (->
@createSpinner('controller.epubCoverUploading', '#epub-cover-spinner', color: '#aaa')
).observes('controller.epubCoverUploading').on('didInsertElement')
|
Add an error handler for testing | # Description
# Trys to crash Hubot on purpose
#
# Commands:
# hubot boom [other text]- try to crash Hubot
# hubot boom emit with msg - try to crash Hubot by emitting an error with a msg
# hubot boom emit without msg - try to crash Hubot by emitting an error without a msg
boomError = (boom, string) ->
new Er... | # Description
# Trys to crash Hubot on purpose
#
# Commands:
# hubot boom [other text]- try to crash Hubot
# hubot boom emit with msg - try to crash Hubot by emitting an error with a msg
# hubot boom emit without msg - try to crash Hubot by emitting an error without a msg
boomError = (boom, string) ->
new Er... |
Read action from correct location | noflo = require 'noflo'
debugAction = require('debug') 'noflo-ui:action'
debugActionFull = require('debug') 'noflo-ui:action:full'
sendEvent = (label, action = 'click', category = 'menu') ->
return unless typeof window.ga is 'function'
window.ga 'send', 'event', category, action, label
exports.getComponent = ->
... | noflo = require 'noflo'
debugAction = require('debug') 'noflo-ui:action'
debugActionFull = require('debug') 'noflo-ui:action:full'
sendEvent = (label, action = 'click', category = 'menu') ->
return unless typeof window.ga is 'function'
window.ga 'send', 'event', category, action, label
exports.getComponent = ->
... |
Add NotSupportedDongle in error case of pin view controller | class @OnboardingDevicePinViewController extends @OnboardingViewController
onAfterRender: ->
super
do @_insertPinCode
_insertPinCode: ->
@view.pinCode = new ledger.pin_codes.PinCode()
@view.pinCode.insertIn(@select('div#pin_container')[0])
@view.pinCode.setStealsFocus(yes)
@view.pinCode.on... | class @OnboardingDevicePinViewController extends @OnboardingViewController
onAfterRender: ->
super
do @_insertPinCode
_insertPinCode: ->
@view.pinCode = new ledger.pin_codes.PinCode()
@view.pinCode.insertIn(@select('div#pin_container')[0])
@view.pinCode.setStealsFocus(yes)
@view.pinCode.on... |
Remove fade in of navbar control | class Langtrainer.LangtrainerApp.Views.NavbarControl extends Backbone.View
template: JST['langtrainer_frontend_backbone/templates/navbar_control']
className: 'navbar-user-controls'
events:
'click .sign-in-btn': 'onSignInBtnClick'
'click .sign-up-btn': 'onSignUpBtnClick'
'click .sign-out-btn': 'onSign... | class Langtrainer.LangtrainerApp.Views.NavbarControl extends Backbone.View
template: JST['langtrainer_frontend_backbone/templates/navbar_control']
className: 'navbar-user-controls'
events:
'click .sign-in-btn': 'onSignInBtnClick'
'click .sign-up-btn': 'onSignUpBtnClick'
'click .sign-out-btn': 'onSign... |
Use @some instead of @find | class window.Followers extends Backbone.Collection
model: User
initialize: (models, opts) ->
@user = opts.user
url: -> "/#{@user.get('username')}/followers"
followed_by_me: ->
!! @find (model) ->
model.get('username') == currentUser.get('username')
class window.Following extends Backbone.Colle... | class window.Followers extends Backbone.Collection
model: User
initialize: (models, opts) ->
@user = opts.user
url: -> "/#{@user.get('username')}/followers"
followed_by_me: ->
@some (model) ->
model.get('username') == currentUser.get('username')
class window.Following extends Backbone.Collecti... |
Move map loading into app. | L.mapbox.accessToken = 'pk.eyJ1Ijoia25vY2siLCJhIjoiRVdjRFVjRSJ9.nIZeVnR6dJZ0hwNnKAiAlQ'
map = L.mapbox.map('map', 'examples.map-i86nkdio').
setView([40, -74.50], 9)
console.log('I did stuff')
| L.mapbox.accessToken = 'pk.eyJ1Ijoia25vY2siLCJhIjoiRVdjRFVjRSJ9.nIZeVnR6dJZ0hwNnKAiAlQ'
map = L.mapbox.map('map', 'knock.l5dpakki').
setView([47.61, -122.33], 13)
featureLayer = L.mapbox.featureLayer().addTo(map)
featureLayer.loadURL('http://zillowhack.hud.opendata.arcgis.com/datasets/2a462f6b548e4ab8bfd9b2523a3db4... |
Update UI behavior on User's profile card to update color using selected role | # Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
$("[data-toggle=tab]").click ->
$($(this).attr("href")).toggleClass "active" if $(this).parent().hasClass... | # Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
$("[data-toggle=tab]").click ->
$($(this).attr("href")).toggleClass "active" if $(this).parent().hasClass... |
Reduce number of AJAX calls in variant autocomplete. | # variant autocompletion
$(document).ready ->
if $("#variant_autocomplete_template").length > 0
window.variantTemplate = Handlebars.compile($("#variant_autocomplete_template").text())
window.variantStockTemplate = Handlebars.compile($("#variant_autocomplete_stock_template").text())
window.variantLineItemT... | # variant autocompletion
$(document).ready ->
if $("#variant_autocomplete_template").length > 0
window.variantTemplate = Handlebars.compile($("#variant_autocomplete_template").text())
window.variantStockTemplate = Handlebars.compile($("#variant_autocomplete_stock_template").text())
window.variantLineItemT... |
Fix Claim.put to allow options | {log, p, pjson} = require 'lightsaber'
Promise = require 'bluebird'
trustExchange = require './trustExchange'
class Claim
@put: (trustAtom) ->
results = for adaptor in trustExchange.adaptors()
adaptor.putClaim trustAtom
Promise.all results
module.exports = Claim
| {log, p, pjson} = require 'lightsaber'
Promise = require 'bluebird'
trustExchange = require './trustExchange'
class Claim
@put: (trustAtom, options) ->
results = for adaptor in trustExchange.adaptors()
adaptor.putClaim trustAtom, options
Promise.all results
module.exports = Claim
|
Remove old card pin verification | class @OnboardingDevicePinViewController extends @OnboardingViewController
onAfterRender: ->
super
do @_insertPinCode
_insertPinCode: ->
@_pinCode = new ledger.pin_codes.PinCode()
@_pinCode.insertIn(@select('div.greyed-container')[0])
@_pinCode.setStealsFocus(yes)
@_pinCode.on 'complete', ... | class @OnboardingDevicePinViewController extends @OnboardingViewController
onAfterRender: ->
super
do @_insertPinCode
_insertPinCode: ->
@_pinCode = new ledger.pin_codes.PinCode()
@_pinCode.insertIn(@select('div.greyed-container')[0])
@_pinCode.setStealsFocus(yes)
@_pinCode.on 'complete', ... |
Fix repository hint on accounts pages. | Travis.AccountIndexController = Em.Controller.extend
needs: ['profile', 'currentUser']
hooksBinding: 'controllers.profile.hooks'
allHooksBinding: 'controllers.profile.allHooks'
hooksWithoutAdminBinding: 'controllers.profile.hooksWithoutAdmin'
userBinding: 'controllers.currentUser'
sync: ->
@get('user')... | Travis.AccountIndexController = Em.Controller.extend
needs: ['profile', 'currentUser']
hooksBinding: 'controllers.profile.hooks'
allHooksBinding: 'controllers.profile.allHooks'
hooksWithoutAdminBinding: 'controllers.profile.hooksWithoutAdmin'
userBinding: 'controllers.currentUser'
sync: ->
@get('user')... |
Fix tests, and add test for brain event | chai = require "chai"
sinon = require "sinon"
chai.use require "sinon-chai"
expect = chai.expect
describe "remind", ->
beforeEach ->
@robot =
respond: sinon.spy()
hear: sinon.spy()
require("../src/remind")(@robot)
it "registers a respond listener", ->
expect(@... | chai = require "chai"
sinon = require "sinon"
chai.use require "sinon-chai"
expect = chai.expect
describe "remind", ->
before ->
@robot =
brain:
on: sinon.spy()
respond: sinon.spy()
hear: sinon.spy()
require("../src/remind")(@robot)
it "reg... |
Clean up implementation of status view. | {View} = require 'atom'
React = require 'react-atom-fork'
{_} = require 'lodash'
{a, div, span} = require 'reactionary-atom-fork'
module.exports =
class AnalysisStatusView extends View
Object.defineProperty @::, 'analysisCount', get: -> @items.length
items: []
@content: ->
@div class: 'inline-block'
ini... | {View} = require 'atom'
{_} = require 'lodash'
module.exports =
class AnalysisStatusView extends View
Object.defineProperty @::, 'analysisCount', get: -> @items.length
items: []
@content: ->
@div class: 'inline-block', =>
@a href: '#', click: 'showAnalysis', =>
@span class: 'dart-tools-status ... |
Fix bug where all users are returned when not authenticated | passport = require('passport')
BasicStrategy = require('passport-http').BasicStrategy
passport.serializeUser (user, done) ->
done(null, user._id)
passport.deserializeUser (id, done) ->
User = require('../models/user').model
User
.find(id)
.exec( (err, user) ->
if err?
console.error err
... | passport = require('passport')
BasicStrategy = require('passport-http').BasicStrategy
passport.serializeUser (user, done) ->
done(null, user._id)
passport.deserializeUser (id, done) ->
User = require('../models/user').model
unless id?
console.error 'No user ID supplied'
return done(err, false)
User
... |
Fix require and hide loader in err case. | kd = require 'kd'
nick = require 'app/util/nick'
kookies = require 'kookies'
DeleteModalView = require '../deletemodalview'
module.exports = class LeaveGroupModal extends DeleteModalView
constructor: (options = {}, data) ->
data = nick()
options.title = 'Please conf... | kd = require 'kd'
nick = require 'app/util/nick'
kookies = require 'kookies'
DeleteModalView = require '../deletemodalview'
module.exports = class LeaveGroupModal extends DeleteModalView
constructor: (options = {}, data) ->
data = nick()
options.title = 'Please conf... |
Set both viewport and uistate context | class Lanes.Components.RecordFinder extends Lanes.React.Component
propTypes:
query: Lanes.PropTypes.State.isRequired
model: Lanes.PropTypes.State.isRequired
commands: React.PropTypes.object.isRequired
contextTypes:
uistate: Lanes.PropTypes.State.isRequired
showFinde... | class Lanes.Components.RecordFinder extends Lanes.React.Component
propTypes:
query: Lanes.PropTypes.State.isRequired
model: Lanes.PropTypes.State.isRequired
commands: React.PropTypes.object.isRequired
contextTypes:
viewport: Lanes.PropTypes.State.isRequired
showFind... |
Copy JS files to public dir when building assets | # Exports an object that defines
# all of the configuration needed by the projects'
# depended-on grunt tasks.
#
# You can familiarize yourself with all of Lineman's defaults by checking out the parent file:
# https://github.com/testdouble/lineman/blob/master/config/application.coffee
#
module.exports = require(proc... | # Exports an object that defines
# all of the configuration needed by the projects'
# depended-on grunt tasks.
#
# You can familiarize yourself with all of Lineman's defaults by checking out the parent file:
# https://github.com/testdouble/lineman/blob/master/config/application.coffee
#
module.exports = require(proc... |
Use anchor link form of button | 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:
fallbackLink: React.PropTypes.shape(
to: Re... |
Add [] as word boundaries | module.exports =
findMisspellings: (text) ->
wordRegex = /(?:^|\s)([a-zA-Z']+)(?=\s|\.|$)/g
row = 0
misspellings = []
for line in text.split('\n')
while matches = wordRegex.exec(line)
word = matches[1]
continue unless $native.isMisspelled(word)
startColumn = matches.index... | module.exports =
findMisspellings: (text) ->
wordRegex = /(?:^|[\s\[\]])([a-zA-Z']+)(?=[\s\.\[\]]|$)/g
row = 0
misspellings = []
for line in text.split('\n')
while matches = wordRegex.exec(line)
word = matches[1]
continue unless $native.isMisspelled(word)
startColumn = ma... |
Add missing reference to this. | Impromptu = require '../impromptu'
class Instance extends Impromptu.Cache
run: (fn) ->
return get fn if @_cached
@set (err, results) =>
if err then fn err else @get fn
get: (fn) ->
fn null, @_cached ? @options.fallback
set: (fn) ->
@options.update.call @options.context, (err, value) =>... | Impromptu = require '../impromptu'
class Instance extends Impromptu.Cache
run: (fn) ->
return @get fn if @_cached
@set (err, results) =>
if err then fn err else @get fn
get: (fn) ->
fn null, @_cached ? @options.fallback
set: (fn) ->
@options.update.call @options.context, (err, value) =... |
Fix an error that may lead to [ERROR] Error: getaddrinfo ENOTFOUND undefined undefined:80 | Promise = require 'bluebird'
async = Promise.coroutine
request = Promise.promisifyAll require 'request'
requestAsync = Promise.promisify request, multiArgs: true
{SERVER_HOSTNAME, POI_VERSION, ROOT} = global
{log, warn, error} = require './utils'
module.exports =
checkUpdate: async (callback) ->
try
[resp... | Promise = require 'bluebird'
async = Promise.coroutine
request = Promise.promisifyAll require 'request'
requestAsync = Promise.promisify request, multiArgs: true
{POI_VERSION, ROOT} = global
{log, warn, error} = require './utils'
module.exports =
checkUpdate: async (callback) ->
try
[response, body] = yie... |
Append a test of the core.coffee | describe 'Test of core.coffee', ->
| describe 'Test of core.coffee', ->
elements = null
beforeEach ->
elements = [null, null, null]
for i,_ of elements
elements[i] = window.document.createElement('section')
elements[i].innerHTML = '''
<animation>
<keyframe target='h1'>
<keyframe target='h2'>
</animati... |
Add missing negation to data assertion in WorkspaceWorkflow | define [
'underscore'
'marionette'
'../core'
'../base'
'../query'
'tpl!templates/workflows/workspace.html'
], (_, Marionette, c, base, query, templates...) ->
templates = _.object ['workspace'], templates
class WorkspaceWorkflow extends Marionette.Layout
className: 'workspace-w... | define [
'underscore'
'marionette'
'../core'
'../base'
'../query'
'tpl!templates/workflows/workspace.html'
], (_, Marionette, c, base, query, templates...) ->
templates = _.object ['workspace'], templates
class WorkspaceWorkflow extends Marionette.Layout
className: 'workspace-w... |
Make the dub commands play nice with Windows. | # Grab a few objects that we'll need
popen = require('child_process').exec
path = require('path')
platform = require('os').platform
# Open a terminal and run dub
dub_build = ->
# Run the terminal app
cmdline = "osascript -e \'tell application \"Terminal\" to do script \"cd #{atom.project.path}; dub build\"\'"
po... | # Grab a few objects that we'll need
popen = require('child_process').exec
platform = require('os').platform
# TODO: linux support still needs to be added
commands =
build:
win32: "start cmd /k \"cd #{atom.project.getPaths().shift()} && dub run\""
darwin: "osascript -e \'tell application \"Terminal... |
Add context menu to atom-text-editor selector | 'menu': [
{
'label': 'Packages'
'submenu': [
'label': 'Symbols'
'submenu': [
{ 'label': 'File Symbols', 'command': 'symbols-view:toggle-file-symbols' }
{ 'label': 'Project Symbols', 'command': 'symbols-view:toggle-project-symbols' }
]
]
}
]
'context-menu':
'.overlaye... | 'menu': [
{
'label': 'Packages'
'submenu': [
'label': 'Symbols'
'submenu': [
{ 'label': 'File Symbols', 'command': 'symbols-view:toggle-file-symbols' }
{ 'label': 'Project Symbols', 'command': 'symbols-view:toggle-project-symbols' }
]
]
}
]
'context-menu':
'atom-text... |
Refactor sort environment stacks utility | MANAGED_VMS = 'Managed VMs'
module.exports = (stacks = []) ->
stacks.sort (a, b) ->
return 1 if a.title is MANAGED_VMS
return -1 if b.title is MANAGED_VMS
return new Date(a.meta.createdAt) - new Date(b.meta.createdAt)
| isManagedVMStack = require './isManagedVMStack'
module.exports = (stacks = []) ->
stacks.sort (a, b) ->
return 1 if isManagedVMStack a
return -1 if isManagedVMStack b
return new Date(a.meta.createdAt) - new Date(b.meta.createdAt)
|
Use different visitor per event | ua = require('universal-analytics')
visitor = ua('UA-49535937-3')
module.exports = (req, res, next) ->
eventParams =
ec: 'API Request' # category
ea: req.get('Referrer') || 'no referrer' # action
el: req.ip # label
dp: req.url ... | ua = require('universal-analytics')
module.exports = (req, res, next) ->
visitor = ua('UA-49535937-3')
eventParams =
ec: 'API Request' # category
ea: req.get('Referrer') || 'no referrer' # action
el: req.ip # label
dp: req.url ... |
Use path.basename() instead of fsUtils.base() | fsUtils = require 'fs-utils'
### Internal ###
module.exports =
class Package
@build: (path) ->
TextMatePackage = require 'text-mate-package'
AtomPackage = require 'atom-package'
if TextMatePackage.testName(path)
new TextMatePackage(path)
else
new AtomPackage(path)
@load: (path, option... | {basename} = require 'path'
### Internal ###
module.exports =
class Package
@build: (path) ->
TextMatePackage = require 'text-mate-package'
AtomPackage = require 'atom-package'
if TextMatePackage.testName(path)
new TextMatePackage(path)
else
new AtomPackage(path)
@load: (path, options... |
Disable use_bl for /top request | define [
"chaplin"
"models/posts"
"views/posts"
], (Chaplin, Posts, PostsView) ->
"use strict"
class PostsController extends Chaplin.Controller
show: (params) ->
# Unescape matched parts of url.
# Why the hell chaplin doesn't do it by himself?
# XXX: Seems like what we should use encod... | define [
"chaplin"
"models/posts"
"views/posts"
], (Chaplin, Posts, PostsView) ->
"use strict"
class PostsController extends Chaplin.Controller
show: (params) ->
# Unescape matched parts of url.
# Why the hell chaplin doesn't do it by himself?
# XXX: Seems like what we should use encod... |
Update compiled prompt path to use new variable name. | should = require 'should'
environment = require './shared/environment'
Impromptu = require '../lib/impromptu'
path = require 'path'
exec = require('child_process').exec
describe 'Config File', ->
impromptu = new Impromptu
after (done) ->
tempDir = path.dirname Impromptu::compiledPrompt
exec "rm -rf #{tem... | should = require 'should'
environment = require './shared/environment'
Impromptu = require '../lib/impromptu'
path = require 'path'
exec = require('child_process').exec
describe 'Config File', ->
impromptu = new Impromptu
after (done) ->
tempDir = path.dirname impromptu.path.compiled
exec "rm -rf #{tempD... |
Revert "Purposefully fail test - TravisCI integration test" | should = chai.should()
describe 'MyThing', ->
it 'should do stuff', ->
'this thing'.should.not.equal('this thing')
| should = chai.should()
describe 'MyThing', ->
it 'should do stuff', ->
'this thing'.should.equal('this thing')
|
Use options passed in constructor | _ = require 'underscore'
module.exports = class BunyanMongo
queue: []
collection: null
options:
collection_name: 'logs'
capped: true
size: 32 * 1024 * 1024
constructor: (options = {}) ->
_.extend @, options
setDB: (db) ->
options = _.pick @options, 'capped', 'size'
db.createColle... | _ = require 'underscore'
module.exports = class BunyanMongo
queue: []
collection: null
options:
collection_name: 'logs'
capped: true
size: 32 * 1024 * 1024
constructor: (options = {}) ->
_.extend @options, options
setDB: (db) ->
options = _.pick @options, 'capped', 'size'
db.crea... |
Clean up atom keymaps file | # 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... | # https://atom.io/docs/latest/behind-atom-keymaps-in-depth
'atom-workspace':
'cmd-shift-j': 'import-js:import'
'cmd-shift-k': 'import-js:goto'
'cmd-shift-i': 'import-js:fix-imports'
|
Fix typo in previous commit | jQuery ->
$('.modal .validate').on 'click', ->
$modal = $(this).closest('.modal')
$form = $modal.find('form')
if $form.length > 0
$form.first().submit()
else
$modal.modal('hide')
#display 'loading...' before some data-remote=true links
$('#top-menu [data-remote="true"], .postit-link ... | jQuery ->
$('.modal .validate').on 'click', ->
$modal = $(this).closest('.modal')
$form = $modal.find('form')
if $form.length > 0
$form.first().submit()
else
$modal.modal('hide')
#display 'loading...' before some data-remote=true links
$('#top-menu [data-remote="true"], .postit-link[... |
Use hardcoded number for shards. | redis = require 'redis'
# Connect to redis
if process.env.REDIS_DB_URL
parts = require("url").parse(process.env.REDIS_DB_URL)
db = redis.createClient(parts.port, parts.hostname)
db.auth(parts.auth.split(":")[1]) if parts.auth
else
db = redis.createClient()
if process.env.NODE_ENV == 'test'
# Select test da... | redis = require 'redis'
# Connect to redis
if process.env.REDIS_DB_URL
parts = require("url").parse(process.env.REDIS_DB_URL)
db = redis.createClient(parts.port, parts.hostname)
db.auth(parts.auth.split(":")[1]) if parts.auth
else
db = redis.createClient()
if process.env.NODE_ENV == 'test'
# Select test da... |
Add Elm Doc Comment Snippet | # 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:
#... |
Add source file watch task | gulp = require('gulp')
gutil = require('gulp-util')
coffee = require('gulp-coffee')
gulp.task 'coffee', ->
gulp.src('src/*.coffee')
.pipe(coffee({bare: true}).on('error', gutil.log))
.pipe(gulp.dest('./dist/'))
webserver = require('gulp-webserver')
gulp.task 'serve', ->
gulp.src([
'bower_components'
... | gulp = require('gulp')
gutil = require('gulp-util')
coffee = require('gulp-coffee')
gulp.task 'coffee', ->
gulp.src('src/*.coffee')
.pipe(coffee({bare: true}).on('error', gutil.log))
.pipe(gulp.dest('./dist/'))
webserver = require('gulp-webserver')
gulp.task 'serve', ->
gulp.src([
'bower_components'
... |
Use window's origin for connecting socket.io. | #= require templates/index
#= require_tree templates
#= require_tree models
#= require_tree collections
#= require_tree views
socket = io.connect('http://localhost')
socket.on 'connect', ->
socket.emit 'adduser', prompt("What's your name?"), ->
socket.on 'updatechat', (username, data) ->
$("#messages").app... | #= require templates/index
#= require_tree templates
#= require_tree models
#= require_tree collections
#= require_tree views
socket = io.connect(window.location.origin)
socket.on 'connect', ->
socket.emit 'adduser', prompt("What's your name?"), ->
socket.on 'updatechat', (username, data) ->
$("#messages")... |
Add seasons accounted for disclaimer above team table | {div, table, thead, tbody, tr, th, td} = React.DOM
table_headers = [
"Team"
"Win %"
"Wins"
"Losses"
"Ties"
]
@TeamTable = React.createClass
propTypes:
teams: React.PropTypes.array
calculateWinPercentage: (team) ->
"#{Math.round((team.wins.value / (team.wins.value + team.losses.value + team.ties.value)) * ... | {div, table, thead, tbody, tr, th, td, p} = React.DOM
table_headers = [
"Team"
"Win %"
"Wins"
"Losses"
"Ties"
]
@TeamTable = React.createClass
propTypes:
teams: React.PropTypes.array
calculateWinPercentage: (team) ->
"#{Math.round((team.wins.value / (team.wins.value + team.losses.value + team.ties.value))... |
Set first graph as main if no other suitable is found | exports.findMainGraph = (project) ->
return null unless project.graphs.length
if project.main
# Ensure currently set main graph exists
for graph in project.graphs
return project.main if graph.properties.id is project.main
# No 'main' graph sent, see if we can make a smart choice
for graph in proje... | exports.findMainGraph = (project) ->
return null unless project.graphs.length
if project.main
# Ensure currently set main graph exists
for graph in project.graphs
return project.main if graph.properties.id is project.main
# No 'main' graph sent, see if we can make a smart choice
for graph in proje... |
Fix progress bar with push | window.coviolations ?=
views: {}
models: {}
$ ->
NProgress.start()
NProgress.inc()
app = window.coviolations
waitRendering = 2
renderFinished = =>
NProgress.inc()
waitRendering -= 1
if waitRendering == 0
NProgress.done()
renderProjects = =>
... | window.coviolations ?=
views: {}
models: {}
$ ->
NProgress.start()
NProgress.inc()
app = window.coviolations
waitRendering = 2
renderFinished = =>
NProgress.inc()
waitRendering -= 1
if waitRendering <= 0
NProgress.done()
renderProjects = =>
... |
Fix Pencil import on case sensitive filesystems | Pencil = require './pencil'
{createShape} = require '../core/shapes'
module.exports = class Eraser extends Pencil
name: 'Eraser'
iconName: 'eraser'
constructor: () ->
@strokeWidth = 10
makePoint: (x, y, lc) ->
createShape('Point', {x, y, size: @strokeWidth, color: '#000'})
makeShape: -> createSha... | Pencil = require './Pencil'
{createShape} = require '../core/shapes'
module.exports = class Eraser extends Pencil
name: 'Eraser'
iconName: 'eraser'
constructor: () ->
@strokeWidth = 10
makePoint: (x, y, lc) ->
createShape('Point', {x, y, size: @strokeWidth, color: '#000'})
makeShape: -> createSha... |
Disable footer links that don't work. | # use the first element that is "scrollable"
# http://css-tricks.com/snippets/jquery/smooth-scrolling/
scrollableElement = (els) ->
for el in arguments
$scrollElement = $(el)
if $scrollElement.scrollTop() > 0
return el
else
$scrollElement.scrollTop(1)
isScrollable = $scrollElement.scrol... | # use the first element that is "scrollable"
# http://css-tricks.com/snippets/jquery/smooth-scrolling/
scrollableElement = (els) ->
for el in arguments
$scrollElement = $(el)
if $scrollElement.scrollTop() > 0
return el
else
$scrollElement.scrollTop(1)
isScrollable = $scrollElement.scrol... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.