Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Set yourRanking to false. Use params to request model. Use new current user API. | VoluntaryOnEmberjs.ProfileRankingsRoute = Ember.Route.extend
model: (params) ->
@controllerFor('profile.rankings').set('adjective', params.adjective)
@controllerFor('profile.rankings').set('negativeAdjective', params.negative_adjective)
@controllerFor('profile.rankings').set('topic', params.topic)
@co... | VoluntaryOnEmberjs.ProfileRankingsRoute = Ember.Route.extend
model: (params) ->
@controllerFor('profile.rankings').set('yourRanking', true); @controllerFor('profile.rankings').set('yourRankingClass', 'btn active');
@controllerFor('profile.rankings').set('globalRankingClass', 'btn')
@controllerFor('profil... |
Switch to mononoki font in Atom editor | "*":
core:
themes: [
"one-light-ui"
"solarized-dark-syntax"
]
editor:
fontSize: 16
invisibles: {}
showIndentGuide: true
showInvisibles: true
"exception-reporting":
userId: "76d6bd0a-16fd-42b8-0163-bce5c8c7e379"
welcome:
showOnStartup: false
whitespace:
ensureSin... | "*":
core:
themes: [
"one-light-ui"
"solarized-dark-syntax"
]
editor:
fontFamily: "mononoki"
fontSize: 18
invisibles: {}
showIndentGuide: true
showInvisibles: true
"exception-reporting":
userId: "76d6bd0a-16fd-42b8-0163-bce5c8c7e379"
welcome:
showOnStartup: false
... |
Correct namespace for commit request | class CommitRequest extends Backbone.Model
initialize: () ->
# do stuff
send: () =>
$.ajax gon.commit_request_path,
data: @request
success: (data) => @success(data)
| class Water.CommitRequest extends Backbone.Model
initialize: () ->
# do stuff
send: () =>
$.ajax gon.commit_request_path,
data: @request
success: (data) => @success(data)
|
Include colon as a word boundary | SpellChecker = require 'spellchecker'
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 SpellChecker... | SpellChecker = require 'spellchecker'
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 SpellChecke... |
Add keybindings for all platforms | '.workspace':
'ctrl-M': 'markdown-preview:toggle'
'.markdown-preview':
'cmd-+': 'markdown-preview:zoom-in'
'cmd-=': 'markdown-preview:zoom-in'
'cmd--': 'markdown-preview:zoom-out'
'cmd-_': 'markdown-preview:zoom-out'
'cmd-0': 'markdown-preview:reset-zoom'
| '.workspace':
'ctrl-M': 'markdown-preview:toggle'
'.platform-darwin .markdown-preview':
'cmd-+': 'markdown-preview:zoom-in'
'cmd-=': 'markdown-preview:zoom-in'
'cmd--': 'markdown-preview:zoom-out'
'cmd-_': 'markdown-preview:zoom-out'
'cmd-0': 'markdown-preview:reset-zoom'
'.platform-win32 .markdown-previe... |
Change back to using grammar name | # Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
fileTypes = {
"source.gfm": (editor) ->
editor.setSoftWrap(true)
editor.setTabLength(4)
"source.java": (editor) -... | # Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
fileTypes = {
"GitHub Markdown": (editor) ->
editor.setSoftWrap(true)
editor.setTabLength(4)
"Java": (editor) ->
... |
Make <SocketStream> tag xml compliant | # Plain HTML Formatter
fs = require('fs')
exports.init = ->
extensions: ['html']
assetType: 'html'
contentType: 'text/html'
compile: (path, options, cb) ->
input = fs.readFileSync(path, 'utf8')
# If passing optional headers for main view
input = input.replace('<SocketStream>', options.headers)... | # Plain HTML Formatter
fs = require('fs')
exports.init = ->
extensions: ['html']
assetType: 'html'
contentType: 'text/html'
compile: (path, options, cb) ->
input = fs.readFileSync(path, 'utf8')
# If passing optional headers for main view
if options && options.headers
input = input.replace('<Soc... |
Switch to using interpretation property for color | React = require 'react'
BS = require 'react-bootstrap'
ChapterSectionType = require './chapter-section-type'
module.exports = React.createClass
displayName: 'LearningGuideProgressBar'
propTypes:
section: React.PropTypes.object.isRequired
onPractice: React.PropTypes.func
render: ->
{section, onPr... | React = require 'react'
BS = require 'react-bootstrap'
ChapterSectionType = require './chapter-section-type'
module.exports = React.createClass
displayName: 'LearningGuideProgressBar'
propTypes:
section: React.PropTypes.object.isRequired
onPractice: React.PropTypes.func
render: ->
{section, onPr... |
Destroy no longer exists, now it's close | ScriptView = require './script-view'
module.exports =
scriptView: null
activate: (state) ->
@scriptView = new ScriptView(state.scriptViewState)
deactivate: ->
@scriptView.destroy()
serialize: ->
scriptViewState: @scriptView.serialize()
| ScriptView = require './script-view'
module.exports =
scriptView: null
activate: (state) ->
@scriptView = new ScriptView(state.scriptViewState)
deactivate: ->
@scriptView.close()
serialize: ->
scriptViewState: @scriptView.serialize()
|
Add span tags to match old behaviour of React | class Skr.Screens.TimeTracking.MiniControls extends Lanes.React.Component
onEditEvent: ->
@props.onEditEvent(@props.event)
EditButton: ->
return null unless @props.event
<BS.Button onClick={@onEditEvent} title="Edit Time Entry">
<LC.Icon type='pencil-square-o' 2x flush />
... | class Skr.Screens.TimeTracking.MiniControls extends Lanes.React.Component
onEditEvent: ->
@props.onEditEvent(@props.event)
EditButton: ->
return null unless @props.event
<BS.Button onClick={@onEditEvent} title="Edit Time Entry">
<LC.Icon type='pencil-square-o' 2x flush />
... |
Fix doc with mock stuff |
# This provides hyperclick support for Perl 6 using hyperclick
# Please see https://atom.io/packages/hyperclick
module.exports =
class Perl6HyperclickProvider
providerName: 'perl6-hyperclick'
getSuggestionForWord: (editor, text, range) ->
# Make sure the editor are valid Perl 6 editors
return unless edi... |
# This provides hyperclick support for Perl 6 using hyperclick
# Please see https://atom.io/packages/hyperclick
module.exports =
class Perl6HyperclickProvider
providerName: 'perl6-hyperclick'
getSuggestionForWord: (editor, text, range) ->
# Make sure the editor are valid Perl 6 editors
return unless edi... |
Extend list of recognised indent/outdent keywords | ".source.viml":
editor:
commentStart: '" '
increaseIndentPattern: "(?:^|\\s)(?:if|else|elseif|for|function!?|while)(?:\\s|$)"
decreaseIndentPattern: "(?:^|\\s)(?:endif|endfor|endfunction|endwhile)(?:\\s|$)"
| ".source.viml":
editor:
commentStart: '" '
increaseIndentPattern: "(?:^|\\s)(?:if|else|elseif|for|function!?|fu|fun|func|augroup|aug|try|catch|while)(?:\\s|$)"
decreaseIndentPattern: "(?:^|\\s)(?:endif|endfor|endf|endfun|endfunction|endtry|endwhile|(?:augroup|aug)\\.END)(?:\\s|$)"
|
Add a safety check to prevent an infinite loop. | Impromptu = require '../impromptu'
async = require 'async'
class Repository extends Impromptu.Cache.Global
prepare: (method, fn) ->
return Impromptu.Cache.Global::[method].call @, fn if @_prepared
parts = ['root', 'branch']
parts.push 'commit' if @options.commit
async.map parts, (part, done) =>
... | Impromptu = require '../impromptu'
async = require 'async'
class Repository extends Impromptu.Cache.Global
prepare: (method, fn) ->
return Impromptu.Cache.Global::[method].call @, fn if @_prepared
parts = ['root', 'branch']
parts.push 'commit' if @options.commit
async.map parts, (part, done) =>
... |
Add custom command for inserting a date stamp | path = require 'path'
# require('web-frame').setZoomFactor(1.15)
oldWindowDimensions = {}
atom.commands.add 'atom-workspace',
'custom:open-todo-list': ->
todoList = path.join(process.env.HOME, 'Dropbox/todo/todo.txt')
atom.workspace.open(todoList)
'custom:screenshot-prep': ->
oldWindowDimensions = a... | path = require 'path'
# require('web-frame').setZoomFactor(1.15)
oldWindowDimensions = {}
atom.commands.add 'atom-workspace',
'custom:insert-timestamp': ->
now = new Date()
atom.workspace.getActiveTextEditor().insertText(now.toISOString())
'custom:open-todo-list': ->
todoList = path.join(process.env... |
Add better key map for Quippet | # Your keymap
#
# Atom keymaps work similarly to stylesheets. Just as stylesheets use selectors
# to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts.
#
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
#
# Here's an exa... | # Your keymap
#
# Atom keymaps work similarly to stylesheets. Just as stylesheets use selectors
# to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts.
#
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
#
# Here's an exa... |
Add description for include utility func | module.exports =
# Public: Determines if a string should be considered linewise or character
#
# text - The string to consider
#
# Returns 'linewise' if the string ends with a line return and 'character'
# otherwise.
copyType: (text) ->
if text.lastIndexOf("\n") is text.length - 1
'linewise'
... | module.exports =
# Public: Determines if a string should be considered linewise or character
#
# text - The string to consider
#
# Returns 'linewise' if the string ends with a line return and 'character'
# otherwise.
copyType: (text) ->
if text.lastIndexOf("\n") is text.length - 1
'linewise'
... |
Set session token as client identifier cookie | module.exports = ->
{ dash } = require 'bongo'
bongo = this
(req, res, next) ->
{
channelName
queue: requestQueue
sessionToken
userArea
} = req.body
unless requestQueue?.length
return res.status(400).end()
responseQueue = new Array requestQueue.length
bongo.... | module.exports = ->
{ dash } = require 'bongo'
bongo = this
(req, res, next) ->
{
channelName
queue: requestQueue
sessionToken
userArea
} = req.body
unless requestQueue?.length
return res.status(400).end()
responseQueue = new Array requestQueue.length
bongo.... |
Set hreflang and rel="alternate" on Link. | Immutable = require 'immutable'
React = require 'react'
Router = require 'react-router'
utils = require '../utils.coffee'
URL = require '../url.coffee'
module.exports = React.createClass
displayName: 'Link'
render: ->
props = Immutable.fromJS(@props).toJS()
if props.lang
props.params.lang = props.lang
if !... | Immutable = require 'immutable'
React = require 'react'
Router = require 'react-router'
utils = require '../utils.coffee'
URL = require '../url.coffee'
module.exports = React.createClass
displayName: 'Link'
render: ->
props = Immutable.fromJS(@props).filterNot(
utils.keyIn 'lang', 'href'
).toJS()
if @props... |
Use format index as key | React = require 'react'
_ = require 'underscore'
classnames = require 'classnames'
{AnswersTable} = require './answers-table'
ArbitraryHtmlAndMath = require '../html'
FormatsListing = require './formats-listing'
FormatsListing = React.createClass
propTypes:
formats: React.PropTypes.arrayOf(React.PropTypes.strin... | React = require 'react'
_ = require 'underscore'
classnames = require 'classnames'
{AnswersTable} = require './answers-table'
ArbitraryHtmlAndMath = require '../html'
FormatsListing = require './formats-listing'
FormatsListing = React.createClass
propTypes:
formats: React.PropTypes.arrayOf(React.PropTypes.strin... |
Disable bib import if there's no value | # Copyright 2011-2015, The Trustees of Indiana University and Northwestern
# University. Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# ... | # Copyright 2011-2015, The Trustees of Indiana University and Northwestern
# University. Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
#
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... |
Include session in AuthView constructor | define [
'jquery'
'underscore'
'backbone'
'marionette'
'cs!collections/media-types'
'cs!views/workspace/menu/auth'
'cs!views/workspace/menu/add'
'cs!views/workspace/menu/toolbar-search'
'hbs!templates/layouts/workspace/menu'
], ($, _, Backbone, Marionette, mediaTypes, AuthView, AddView, toolbarView, m... | define [
'jquery'
'underscore'
'backbone'
'marionette'
'cs!collections/media-types'
'cs!session'
'cs!views/workspace/menu/auth'
'cs!views/workspace/menu/add'
'cs!views/workspace/menu/toolbar-search'
'hbs!templates/layouts/workspace/menu'
], ($, _, Backbone, Marionette, mediaTypes, session, AuthView,... |
Add feature flag for redirecting SL to v2 | Settings = require 'settings-sharelatex'
module.exports = Features =
externalAuthenticationSystemUsed: ->
Settings.ldap? or Settings.saml? or Settings.overleaf?.oauth?
hasFeature: (feature) ->
switch feature
when 'homepage'
return Settings.enableHomepage
when 'registration'
return not Features.ext... | Settings = require 'settings-sharelatex'
module.exports = Features =
externalAuthenticationSystemUsed: ->
Settings.ldap? or Settings.saml? or Settings.overleaf?.oauth?
hasFeature: (feature) ->
switch feature
when 'homepage'
return Settings.enableHomepage
when 'registration'
return not Features.ext... |
Replace all dashes in help topic name. | ###!
Copyright (c) 2002-2015 "Neo Technology,"
Network Engine for Objects in Lund AB [http://neotechnology.com]
This file is part of Neo4j.
Neo4j is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 ... | ###!
Copyright (c) 2002-2015 "Neo Technology,"
Network Engine for Objects in Lund AB [http://neotechnology.com]
This file is part of Neo4j.
Neo4j is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 ... |
Add CORS headers to eventsource | # ***** BEGIN LICENSE BLOCK *****
# Copyright (c) 2011-2012 VMware, Inc.
#
# For the license see COPYING.
# ***** END LICENSE BLOCK *****
utils = require('./utils')
transport = require('./transport')
class EventSourceReceiver extends transport.ResponseReceiver
protocol: "eventsource"
doSendFrame: (payload) ... | # ***** BEGIN LICENSE BLOCK *****
# Copyright (c) 2011-2012 VMware, Inc.
#
# For the license see COPYING.
# ***** END LICENSE BLOCK *****
utils = require('./utils')
transport = require('./transport')
class EventSourceReceiver extends transport.ResponseReceiver
protocol: "eventsource"
doSendFrame: (payload) ... |
Add new ObjectID parsing and error hanling | "use strict"
ObjectID = require('mongodb').ObjectID
exports.param = (req, res, next, id) ->
return res.send 400, 'invalid oid' if not /[a-f0-9]{24}/.test id
req.id = new ObjectID id
next()
exports.options = (req, res, next) ->
res.setHeader 'Access-Control-Allow-Methods', 'GET, PUT, PATCH, DELETE'
res.send... | "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... |
Move instantiate() and Add Documentation | qbnApp = angular.module 'qbnApp', []
class Quality
constructor: (@name, @defaultValue) ->
instantiate = (proto) ->
instance = Object.create proto
for key, value of proto when /^default\w{2}/.test(key)
[_, first, rest] = /^default(\w)(\w*)/.exec(key)
newName = first.toLowerCase() + rest
instance[newN... | qbnApp = angular.module 'qbnApp', []
# The immutable objects that make up the game itself serve as prototypes for the objects that make
# up the mutable game state. This function takes a game definition object and makes a state
# instance of it.
#
# By convention, any property on the prototype of the form "defaultThin... |
Add operation GET to response interceptor unwrapper | @App.factory 'MnoeApiSvc', ($log, Restangular, inflector) ->
return Restangular.withConfig((RestangularProvider) ->
RestangularProvider.setBaseUrl('/mnoe/jpi/v1/admin')
RestangularProvider.setDefaultHeaders({Accept: "application/json"})
# Unwrap api response
RestangularProvider.addResponseInterceptor... | @App.factory 'MnoeApiSvc', ($log, Restangular, inflector) ->
return Restangular.withConfig((RestangularProvider) ->
RestangularProvider.setBaseUrl('/mnoe/jpi/v1/admin')
RestangularProvider.setDefaultHeaders({Accept: "application/json"})
# Unwrap api response
RestangularProvider.addResponseInterceptor... |
Send and fire should have consistent interfaces | setImmediate = process.nextTick unless setImmediate?
class Channel
constructor: ->
@handlers = []
send: (args...) ->
setImmediate => @fire args...
fire: (message) ->
@package message
for handler in @handlers
handler message
receive: (handler) ->
@handlers.push handler
... | setImmediate = process.nextTick unless setImmediate?
class Channel
constructor: ->
@handlers = []
send: (message) ->
setImmediate => @fire( message )
fire: (message) ->
@package message
for handler in @handlers
handler message
receive: (handler) ->
@handlers.push handler
... |
Fix match count on result view | {_, $, fs, View} = require 'atom'
MatchView = require './match-view'
path = require 'path'
module.exports =
class ResultView extends View
@content: (model, filePath, matches) ->
iconClass = if fs.isReadmePath(filePath) then 'icon-book' else 'icon-file-text'
@li class: 'path list-nested-item', 'data-path': _... | {_, $, fs, View} = require 'atom'
MatchView = require './match-view'
path = require 'path'
module.exports =
class ResultView extends View
@content: (model, filePath, result) ->
iconClass = if fs.isReadmePath(filePath) then 'icon-book' else 'icon-file-text'
@li class: 'path list-nested-item', 'data-path': _.... |
Update ExpandableRecordArray to work correctly with Ember Model | Travis.ExpandableRecordArray = DS.RecordArray.extend
isLoaded: false
isLoading: false
load: (array) ->
@set 'isLoading', true
self = this
observer = ->
if @get 'isLoaded'
content = self.get 'content'
array.removeObserver 'isLoaded', observer
array.forEach (record) ->
... | Travis.ExpandableRecordArray = Ember.RecordArray.extend
isLoaded: false
isLoading: false
load: (array) ->
@set 'isLoading', true
self = this
observer = ->
if @get 'isLoaded'
content = self.get 'content'
array.removeObserver 'isLoaded', observer
array.forEach (record) -... |
Fix to test new pages | {Testing, expect, _} = require '../helpers/component-testing'
LearningGuide = require '../../../src/flux/learning-guide'
Button = require '../../../src/components/learning-guide/practice-button'
COURSE_ID = '1'
GUIDE_DATA = require '../../../api/courses/1/guide.json'
describe 'Learning Guide Practice Button', ->
... | {Testing, expect, _} = require '../helpers/component-testing'
LearningGuide = require '../../../src/flux/learning-guide'
Button = require '../../../src/components/learning-guide/practice-button'
COURSE_ID = '1'
GUIDE_DATA = require '../../../api/courses/1/guide.json'
describe 'Learning Guide Practice Button', ->
... |
Add failing test for bug | should = require('should')
missingSupport = require('../dist/lib/missing-support')
describe 'missing-support', ->
describe 'filtering caniuse-db data by browser selection', ->
it 'for browser request ie >= 7, safari >= 6, opera >= 10.1',->
data = missingSupport(['ie >= 7', 'safari >= 6', 'opera >= 10.1']).... | should = require('should')
missingSupport = require('../dist/lib/missing-support')
describe 'missing-support', ->
it 'provides list of selected browsers', ->
data = missingSupport(['ie >= 8'])
data.browsers.should.containDeep [
['ie','8']
['ie','9']
['ie', '10']
['ie', '11']
]
... |
Fix password reset rate limit to work on ip, not email which changes every request | PasswordResetHandler = require("./PasswordResetHandler")
RateLimiter = require("../../infrastructure/RateLimiter")
module.exports =
renderRequestResetForm: (req, res)->
res.render "user/passwordReset",
title:"Reset Password"
requestReset: (req, res)->
email = req.body.email.trim().toLowerCase()
opts =
... | PasswordResetHandler = require("./PasswordResetHandler")
RateLimiter = require("../../infrastructure/RateLimiter")
module.exports =
renderRequestResetForm: (req, res)->
res.render "user/passwordReset",
title:"Reset Password"
requestReset: (req, res)->
email = req.body.email.trim().toLowerCase()
opts =
... |
Simplify (if not shorten) code | determineBrowser = ->
[ 'chrome', 'firefox', 'safari', 'phantom_js', 'unsupported-browser' ]
.filter( (browser) -> $('html.'+browser).length
)[0]
extension_link_by_browser =
firefox: 'https://static.factlink.com/extension/firefox/factlink-latest.xpi'
safari: 'https://static.factlink.com/extension/firefox/fac... | determineBrowser = ->
[ 'chrome', 'firefox', 'safari', 'phantom_js', 'unsupported-browser' ]
.filter( (browser) -> $('html.'+browser).length
)[0]
extension_install_options_by_browser =
firefox:
href: 'https://static.factlink.com/extension/firefox/factlink-latest.xpi'
iconClass: 'install-firefox'
safa... |
Hide "Composed of:" element completely if there are no containing channels. | class window.SubchannelsView extends Backbone.Factlink.CompositeView
tagName: "div"
id: "contained-channels"
template: "channels/subchannels"
itemView: SubchannelItemView
events:
"click #more-button": "toggleMore"
initialize: ->
@collection.bind "remove", @renderCollection, this
toggleMore: ->
... | class window.SubchannelsView extends Backbone.Factlink.CompositeView
tagName: "div"
id: "contained-channels"
template: "channels/subchannels"
itemView: SubchannelItemView
events:
"click #more-button": "toggleMore"
initialize: ->
@collection.bind "add remove reset", @updateVisibility, @
@collect... |
Add the call to removeListeners for the generator | #= require utensils/utensils
#= require utensils/bindable
class utensils.<%= file_name.camelize %>
constructor: (@el, data) ->
@data = if data then data else @el.data()
@options()
@initialize()
@addListeners()
options: ->
initialize: ->
# PUBLIC #
dispose: ->
# PROTECTED #
addListen... | #= require utensils/utensils
#= require utensils/bindable
class utensils.<%= file_name.camelize %>
constructor: (@el, data) ->
@data = if data then data else @el.data()
@options()
@initialize()
@addListeners()
options: ->
initialize: ->
# PUBLIC #
dispose: ->
@removeListeners()
# P... |
Use the description and URL when present | {Range} = require('atom')
fuzzaldrin = require('fuzzaldrin')
module.exports =
class SnippetsProvider
selector: '*'
constructor: ->
@showIcon = atom.config.get('autocomplete-plus.defaultProvider') is 'Symbol'
getSuggestions: ({scopeDescriptor, prefix}) ->
return unless prefix?.length
scopeSnippets ... | {Range} = require('atom')
fuzzaldrin = require('fuzzaldrin')
module.exports =
class SnippetsProvider
selector: '*'
constructor: ->
@showIcon = atom.config.get('autocomplete-plus.defaultProvider') is 'Symbol'
getSuggestions: ({scopeDescriptor, prefix}) ->
return unless prefix?.length
scopeSnippets ... |
Add footer callback in report data tables to recalculate & render table totals on filering event | $(document).on "page:change", ->
$(".data-table").each ->
table = $(@)
return if $.fn.dataTable.isDataTable(table)
options =
responsive: true
order: [[0, "desc"]]
pageLength: 25
ascColumn = table.find("th.sort-asc").index()
descColumn = table.find("th.sort-desc").index()
... | $(document).on "page:change", ->
$(".data-table").each ->
table = $(@)
return if $.fn.dataTable.isDataTable(table)
fnFooterCallback = (row, data, start, end, display) ->
monetaryColumnIndex = 1
# Utility function to convert string dollar amount to a number
intVal = (i) ->
if... |
Make highlights async, use process.stdout.write not console.log | #!highlights/node_modules/coffee-script/bin/coffee
Highlights = require 'highlights'
fs = require 'fs'
path = require 'path'
highlighter = new Highlights()
highlighter.requireGrammarsSync
modulePath: require.resolve('./atom-language-perl6/package.json')
stdin = process.openStdin()
stdin.setEncoding 'utf8'
mystderr... | #!highlights/node_modules/coffee-script/bin/coffee
Highlights = require 'highlights'
fs = require 'fs'
path = require 'path'
highlighter = new Highlights()
highlighter.requireGrammarsSync
modulePath: require.resolve('./atom-language-perl6/package.json')
stdin = process.openStdin()
stdin.setEncoding 'utf8'
mystderr ... |
Make the match for the braces non greedy to allow for regex grouping in validator rules. | define ["jquery", "lib/forms/validators", "lib/forms/error_messages"], ($, Validators, ErrorMessages) ->
class InputValidator
constructor: (input, label, validator) ->
@input = input
@label = label
@validator = validator
@_initialize() if @input and @label and @validator
isValid: ->... | define ["jquery", "lib/forms/validators", "lib/forms/error_messages"], ($, Validators, ErrorMessages) ->
class InputValidator
constructor: (input, label, validator) ->
@input = input
@label = label
@validator = validator
@_initialize() if @input and @label and @validator
isValid: ->... |
Change name of ElementWrap Specs | describe "ElementWrapSpec", ->
describe "Get Tree Structure", ->
it "should get a tree Structure of all 'components' from the passed in element", ->
startElement = $j("
<div id='tree_test' style='display: none;'>
<div id='p1' class='ae-comp'>
<div id='p2' class='ae-comp'>
... | describe "ElementWrap specs", ->
describe "Get Tree Structure", ->
it "should get a tree Structure of all 'components' from the passed in element", ->
startElement = $j("
<div id='tree_test' style='display: none;'>
<div id='p1' class='ae-comp'>
<div id='p2' class='ae-comp'>
... |
Add textarea to listen changes in neuron form | selector = "form.neuron-form"
formHasChanged = false
$(document).on "page:load", ->
formHasChanged = false
$(document).on "change", "#{selector} input", ->
formHasChanged = true
$(document).on "page:before-change", ->
confirm(
"La información no ha sido guardada. ¿Estás seguro de continuar?"
) if formHas... | selector = "form.neuron-form"
formHasChanged = false
$(document).on "page:load", ->
formHasChanged = false
$(document).on "change", "#{selector} input, #{selector} textarea", ->
formHasChanged = true
$(document).on "page:before-change", ->
confirm(
"La información no ha sido guardada. ¿Estás seguro de cont... |
Replace load to init sticky | App.FoundationExtras =
initialize: ->
$(document).foundation()
$(window).trigger "load.zf.sticky"
$(window).trigger "resize"
clearSticky = ->
$("[data-sticky]").foundation("destroy") if $("[data-sticky]").length
$(document).on("page:before-unload", clearSticky)
window.addEventListene... | App.FoundationExtras =
initialize: ->
$(document).foundation()
$(window).trigger "init.zf.sticky"
$(window).trigger "resize"
clearSticky = ->
$("[data-sticky]").foundation("destroy") if $("[data-sticky]").length
$(document).on("page:before-unload", clearSticky)
window.addEventListene... |
Set default value of todayBtn to false. | Menglifang.Widgets.DatetimePicker = Ember.TextField.extend
resetable: true
format: 'yyyy-mm-dd hh:ii'
autoclose: true
todayBtn: true
startDate: '1949-10-01'
minuteStep: 10
minView: 0
maxView: 4
language: 'zh-CN'
didInsertElement: ->
options =
format: @get('format')
autoclose: @get(... | Menglifang.Widgets.DatetimePicker = Ember.TextField.extend
resetable: true
format: 'yyyy-mm-dd hh:ii'
autoclose: true
todayBtn: false
startDate: '1949-10-01'
minuteStep: 10
minView: 0
maxView: 4
language: 'zh-CN'
didInsertElement: ->
options =
format: @get('format')
autoclose: @get... |
Fix property calculation in absence of buttons. | `import Em from "vendor/ember"`
Component = Em.Component.extend
click: (evt) ->
if evt.target.tagName is "A" and evt.target.target != '_blank'
evt.stopPropagation()
evt.preventDefault()
@container.lookup("route:openxpki").sendAjax
data:
... | `import Em from "vendor/ember"`
Component = Em.Component.extend
click: (evt) ->
if evt.target.tagName is "A" and evt.target.target != '_blank'
evt.stopPropagation()
evt.preventDefault()
@container.lookup("route:openxpki").sendAjax
data:
... |
Add test for proper validated linter. | Helpers = require '../lib/helpers'
describe "The Results Validation Helper", ->
it "should throw an exception when nothing is passed.", ->
expect( -> Helpers.validateResults()).toThrow()
it "should throw an exception when a String is passed.", ->
expect( -> Helpers.validateResults('String')).toThrow()
des... | Helpers = require '../lib/helpers'
describe "The Results Validation Helper", ->
it "should throw an exception when nothing is passed.", ->
expect( -> Helpers.validateResults()).toThrow()
it "should throw an exception when a String is passed.", ->
expect( -> Helpers.validateResults('String')).toThrow()
des... |
Hide empty warning on past assignments | React = require 'react'
BS = require 'react-bootstrap'
{CloneAssignmentLink} = require './task-dnd'
isEmpty = require 'lodash/isEmpty'
partial = require 'lodash/partial'
{PastTaskPlansActions, PastTaskPlansStore} = require '../../flux/past-task-plans'
LoadableItem = require '../loadable-item'
EmptyWarning = (pro... | React = require 'react'
BS = require 'react-bootstrap'
{CloneAssignmentLink} = require './task-dnd'
isEmpty = require 'lodash/isEmpty'
partial = require 'lodash/partial'
{PastTaskPlansActions, PastTaskPlansStore} = require '../../flux/past-task-plans'
LoadableItem = require '../loadable-item'
PastAssignmentsLoa... |
Connect when getting upstream connection | noflo = require "../../lib/NoFlo"
class Split extends noflo.Component
description: "This component receives data on a single input port and sends the same data out to all connected output ports"
constructor: ->
@inPorts =
in: new noflo.Port()
@outPorts =
out: new noflo.ArrayPort()
@inPort... | noflo = require "../../lib/NoFlo"
class Split extends noflo.Component
description: "This component receives data on a single input port and sends the same data out to all connected output ports"
constructor: ->
@inPorts =
in: new noflo.Port()
@outPorts =
out: new noflo.ArrayPort()
@inPort... |
Allow question marks in do you | # Description
# @lefay do you ...?
#
# Author:
# lcaro
module.exports = (robot) ->
robot.respond /do you (.+)$/i, (msg) ->
msg.reply "yes I do in fact " + msg.match[1]
| # Description
# @lefay do you ...?
#
# Author:
# lcaro
module.exports = (robot) ->
robot.respond /do you (.+)\??$/i, (msg) ->
msg.reply "yes I do in fact " + msg.match[1]
|
Remove config as it shoud be set outside. | Config = require '../config'
argv = require('optimist')
.usage('Usage: $0 --projectKey key --clientId id --clientSecret secret')
.demand(['projectKey','clientId', 'clientSecret'])
.argv
MarketPlaceStockUpdater = require('../main').MarketPlaceStockUpdater
Config.timeout = 60000
Config.showProgress = true
updater... | Config = require '../config'
argv = require('optimist')
.usage('Usage: $0 --projectKey key --clientId id --clientSecret secret')
.demand(['projectKey','clientId', 'clientSecret'])
.argv
MarketPlaceStockUpdater = require('../main').MarketPlaceStockUpdater
updater = new MarketPlaceStockUpdater(Config, argv.project... |
Use _.string's `truncate` here instead | class Utils
@getHTMLTitleFromHistoryFragment: (fragment) ->
_.capitalize(fragment.split('\/').join(' '))
@getShortTaskID: (taskId) ->
split = taskId.split(/\-|\:|\./)
if split.length > 1
return "#{ split[0] }..."
else
if taskId.length > 20
... | class Utils
@getHTMLTitleFromHistoryFragment: (fragment) ->
_.capitalize(fragment.split('\/').join(' '))
@getShortTaskID: (taskId) ->
split = taskId.split(/\-|\:|\./)
if split.length > 1
return "#{ split[0] }..."
else
return _.truncate(taskId, 20)
... |
Add the option to pass a path into the urlFor helper method | helpers = (app) ->
# dynamic helpers are given request and response as parameters
app.dynamicHelpers
flash: (req, res) -> req.flash()
logged_in: -> true
# static helpers take any parametes and usually format data
app.helpers
# Object is a mongoose model object
urlFor: (object) ->
if obje... | helpers = (app) ->
# dynamic helpers are given request and response as parameters
app.dynamicHelpers
flash: (req, res) -> req.flash()
logged_in: -> true
# static helpers take any parametes and usually format data
app.helpers
# Object is a mongoose model object
urlFor: (object, path) ->
i... |
Disable Clear button when there's no crop | React = require 'react'
CropInitializer = require './initializer'
GenericTask = require '../generic'
module.exports = React.createClass
displayName: 'CropTask'
statics:
getSVGProps: ({workflow, classification, annotation}) ->
tasks = require '../index'
[previousCropAnnotation] = classification.ann... | React = require 'react'
CropInitializer = require './initializer'
GenericTask = require '../generic'
module.exports = React.createClass
displayName: 'CropTask'
statics:
getSVGProps: ({workflow, classification, annotation}) ->
tasks = require '../index'
[previousCropAnnotation] = classification.ann... |
Make simple functions more tidy | marked = require 'marked'
renderer = new marked.Renderer()
renderer.code = ->
''
renderer.blockquote = ->
''
renderer.heading = ->
''
renderer.html = ->
''
renderer.image = ->
''
renderer.list = ->
''
markdown = (text) ->
marked(text, renderer: renderer).replace(/<p>(.*)<\/p>/, "$1").trim()
module.expo... | marked = require 'marked'
renderer = new marked.Renderer()
renderer.code = -> ''
renderer.blockquote = -> ''
renderer.heading = -> ''
renderer.html = -> ''
renderer.image = -> ''
renderer.list = -> ''
markdown = (text) ->
marked(text, renderer: renderer).replace(/<p>(.*)<\/p>/, "$1").trim()
module.exports =
getS... |
Remove the Arnold emoji since it's not displaying | # Description:
# Listens for words and sometimes replies with an Arnie quote
#
# Dependencies:
# None
#
# Commands:
# None
#
# Author:
# Casey Lawrence <cjlaw@users.noreply.github.com>
#
odds = [1...100]
arnie_quotes = [
'GET TO THE CHOPPA! :arnold:',
'Your clothes, give them to me, now! :arnold:',
... | # Description:
# Listens for words and sometimes replies with an Arnie quote
#
# Dependencies:
# None
#
# Commands:
# None
#
# Author:
# Casey Lawrence <cjlaw@users.noreply.github.com>
#
odds = [1...100]
arnie_quotes = [
'GET TO THE CHOPPA!',
'Your clothes, give them to me, now!',
'Hasta La Vista... |
Fix notification class, clear on hover | Backbone = require 'backbone'
DropdownView = require '../../dropdown/client/dropdown_view.coffee'
mediator = require '../../../lib/mediator.coffee'
template = -> require('../templates/_dropdown_content.jade') arguments...
module.exports = class NotificationsView extends DropdownView
initialize: ->
super
m... | Backbone = require 'backbone'
DropdownView = require '../../dropdown/client/dropdown_view.coffee'
mediator = require '../../../lib/mediator.coffee'
template = -> require('../templates/_dropdown_content.jade') arguments...
module.exports = class NotificationsView extends DropdownView
initialize: ->
super
m... |
Add new Jasmine test to ensure Segment.io is called when appropriate | describe 'Logger', ->
it 'expose window.log_event', ->
expect(window.log_event).toBe Logger.log
describe 'log', ->
it 'send a request to log event', ->
spyOn $, 'getWithPrefix'
Logger.log 'example', 'data'
expect($.getWithPrefix).toHaveBeenCalledWith '/event',
event_type: 'example... | describe 'Logger', ->
it 'expose window.log_event', ->
expect(window.log_event).toBe Logger.log
describe 'log', ->
it 'send event to Segment.io if event is whitelisted', ->
spyOn 'analytics.track'
Logger.log 'seq_goto', 'data'
expect(analytics.track).toHaveBeenCalledWith 'seq_goto', 'data... |
Add custom event handlers to Game.State | class Game.State extends Game.TwoWay
constructor: () ->
@objects = {}
@eventCounters = {}
super
onEvent: (e) ->
# Add timestamped instance to the event counters object
if e.type not of @eventCounters
@eventCounters[e.type] = []
@eventCounters[e.type].push new Date()
# relay the eve... | class Game.State extends Game.TwoWay
constructor: () ->
@objects = {}
@eventCounters = {}
@eventHandlers = {}
super
onEvent: (e) ->
# Add timestamped instance to the event counters object
if e.type not of @eventCounters
@eventCounters[e.type] = []
@eventCounters[e.type].push new Da... |
Fix copy file url issue | class NCopyUrlView extends JView
constructor: ->
super
@path = FSHelper.plainPath @getData().path
@publicPath = @path.replace \
///.*\/(.*\.#{KD.config.userSitesDomain})\/(.*)///, 'http://$1/$2'
@inputUrlLabel = new KDLabelView
cssClass : 'public-url-label'
title : '... | class NCopyUrlView extends JView
constructor: ->
super
@path = FSHelper.plainPath @getData().path
@publicPath = @path.replace \
////home/(.*)/Web/(.*)///, "http://$1.#{KD.config.userSitesDomain}/$2"
@inputUrlLabel = new KDLabelView
cssClass : 'public-url-label'
title ... |
Remove extraneous variable from specs | {sortLines} = require '../lib/sort-lines'
describe "SortLines", ->
describe "sortLines(editor)", ->
[editor, buffer] = []
beforeEach ->
editor = atom.project.openSync()
buffer = editor.getBuffer()
editor.setText """
Hydrogen
Helium
Lithium
Beryllium
... | {sortLines} = require '../lib/sort-lines'
describe "SortLines", ->
describe "sortLines(editor)", ->
[editor] = []
beforeEach ->
editor = atom.project.openSync()
editor.setText """
Hydrogen
Helium
Lithium
Beryllium
Boron
"""
describe "when no lin... |
Update Atom RuboCop Linter command path | "*":
editor:
fontFamily: "Menlo"
fontSize: 15
showIndentGuide: true
invisibles: {}
core:
ignoredNames: [
".DS_Store"
".bundle"
".git"
]
disabledPackages: [
"preview-tabs"
"script"
]
projectHome: "/Users/justas/Projects"
"spell-check":
grammars:... | "*":
editor:
fontFamily: "Menlo"
fontSize: 15
showIndentGuide: true
invisibles: {}
core:
ignoredNames: [
".DS_Store"
".bundle"
".git"
]
disabledPackages: [
"preview-tabs"
"script"
]
projectHome: "/Users/justas/Projects"
"spell-check":
grammars:... |
Remove output listener when connection is closed | Peer = require './peer'
Guid = require 'guid'
module.exports =
createPeer: ->
id = Guid.create().toString()
new Peer(id, host: 'ec2-54-218-51-127.us-west-2.compute.amazonaws.com', port: 8080)
connectDocument: (doc, connection) ->
doc.outputEvents.on 'changed', (event) ->
console.log 'sending eve... | Peer = require './peer'
Guid = require 'guid'
module.exports =
createPeer: ->
id = Guid.create().toString()
new Peer(id, host: 'ec2-54-218-51-127.us-west-2.compute.amazonaws.com', port: 8080)
connectDocument: (doc, connection) ->
outputListener = (event) ->
console.log 'sending event', event
... |
Include only what we need for syntax highlighting | Vue = require 'vue'
hljs = require 'highlight.js'
path = require 'path'
vmdl = require '../../src/vue-mdl'
require './style/mdl.scss'
require 'highlight.js/styles/tomorrow.css'
require 'material-design-lite/material.min.js'
context = require.context './partials', false, /.vue$/
vmdl.registerAll Vue
Vue.component 'tit... | Vue = require 'vue'
hljs = require 'highlight.js/lib/highlight'
path = require 'path'
vmdl = require '../../src/vue-mdl'
require './style/mdl.scss'
require 'highlight.js/styles/tomorrow.css'
require 'material-design-lite/material.min.js'
context = require.context './partials', false, /.vue$/
vmdl.registerAll Vue
Vue.... |
Refresh apps whenever Applications directory removed | class NFolderItemView extends NFileItemView
constructor:(options = {},data)->
options.cssClass or= "folder"
super options, data
data.on "fs.chmod.finished", (recursive)=>
warn "todo : refresh folder" if recursive
if data.getExtension() is "kdapp"
data.on "fs.delete.finished", =>
... | class NFolderItemView extends NFileItemView
constructor:(options = {},data)->
options.cssClass or= "folder"
super options, data
# data.on "fs.chmod.finished", (recursive)=>
# warn "todo : refresh folder" if recursive
# FIXME GG Remove that here use watcher features instead
{nickname} =... |
Use jquery function load() instead of get() when refreshing a feed. Instead of inserting new new entries, the whole list of entries for the feed is inserted, replacing the previous list. | # Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
$(document).ready ->
# Dynamic styling when clicking on the sidebar folders
$(".menu-... | # Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
$(document).ready ->
##########################################################
# DYNAMIC... |
Fix markers persisting after disabling the plugin | {CompositeDisposable} = require 'event-kit'
module.exports = (findAndReplace, minimapPackage) ->
class MinimapFindResultsView
constructor: (@model) ->
@subscriptions = new CompositeDisposable
@subscriptions.add @model.onDidUpdate @markersUpdated
@decorationsByMarkerId = {}
destroy: ->
... | {CompositeDisposable} = require 'event-kit'
module.exports = (findAndReplace, minimapPackage) ->
class MinimapFindResultsView
constructor: (@model) ->
@subscriptions = new CompositeDisposable
@subscriptions.add @model.onDidUpdate @markersUpdated
@decorationsByMarkerId = {}
destroy: ->
... |
Add config for taTranslations (no functional change) | angular.module("admin.enterprises", [
"admin.paymentMethods",
"admin.utils",
"admin.shippingMethods",
"admin.users",
"textAngular",
"admin.side_menu",
"admin.taxons",
'admin.indexUtils',
'admin.tagRules',
'admin.dropdown',
'ngSanitize']
)
| angular.module("admin.enterprises", [
"admin.paymentMethods",
"admin.utils",
"admin.shippingMethods",
"admin.users",
"textAngular",
"admin.side_menu",
"admin.taxons",
'admin.indexUtils',
'admin.tagRules',
'admin.dropdown',
'ngSanitize']
)
.config [
'$provide', ($provide) ->
$prov... |
Use section element in package keymap view | {$$, $$$, _, View} = require 'atom'
# Displays the keybindings for a package namespace
module.exports =
class PackageKeymapView extends View
@content: ->
@div class: 'package-keymap', =>
@div class: 'package-keymap-heading icon icon-keyboard', 'Keybindings'
@table outlet: 'keymapTable', class: 'packa... | {$$, $$$, _, View} = require 'atom'
# Displays the keybindings for a package namespace
module.exports =
class PackageKeymapView extends View
@content: ->
@section class: 'package-keymap', =>
@div class: 'section-heading package-keymap-heading icon icon-keyboard', 'Keybindings'
@table outlet: 'keymapT... |
Use default attributes that make it clear that it is a new record. | # A model for a timelet
#
class Essence.Models.Timelet extends Backbone.Model
localStorage: new Backbone.LocalStorage 'Timelets'
defaults:
running: false
duration: 30
name: 'My Timelet'
| # A model for a timelet
#
class Essence.Models.Timelet extends Backbone.Model
localStorage: new Backbone.LocalStorage 'Timelets'
defaults:
running: false
duration: '--'
name: 'New timelet'
|
Send unset type as "Other" | module.exports =
initial:
value: 'initial'
slug: ''
copy: 'Select Organization Type'
type: null
gallery:
value: 'gallery'
slug: 'gallery'
copy: 'Gallery'
type: 'Gallery'
institution:
value: 'institution'
slug: 'institution'
copy: 'Institution'
type: 'Museum/Institut... | module.exports =
initial:
value: 'initial'
slug: ''
copy: 'Select Organization Type'
type: 'Other'
gallery:
value: 'gallery'
slug: 'gallery'
copy: 'Gallery'
type: 'Gallery'
institution:
value: 'institution'
slug: 'institution'
copy: 'Institution'
type: 'Museum/Insti... |
Fix a bug which prevent to see tenants because of the loader | Vosae.TenantsShowView = Vosae.PageTenantView.extend
classNames: ["outlet-tenants", "page-show-tenants"]
didInsertElement: ->
@_super()
# If user already selected or tenant or has only one tenant
# he will be automaticaly redirected to the tenant's dashboard
preselectedTenant = @get 'controller.ses... | Vosae.TenantsShowView = Vosae.PageTenantView.extend
classNames: ["outlet-tenants", "page-show-tenants"]
###
If user already selected or tenant or has only one tenant
he will be automaticaly redirected to the tenant's dashboard,
otherwise we hide the loader.
###
checkTenants: (->
preselectedTena... |
Remove classification.update from survey task | React = require 'react'
module.exports = React.createClass
displayName: 'SurveyAnnotationView'
getDefaultProperties: ->
task: null
classification: null
annotation: null
render: ->
<div>
{for identification, i in @props.annotation.value
identification._key ?= Math.random()
... | React = require 'react'
module.exports = React.createClass
displayName: 'SurveyAnnotationView'
getDefaultProperties: ->
task: null
classification: null
annotation: null
render: ->
<div>
{for identification, i in @props.annotation.value
identification._key ?= Math.random()
... |
Revert "add ab tests for home button" | # 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
# 3. Record your tests here: https://docs.google.com/a/circleci.com/spreadsheet/ccc?key=0AiVfWAkOq5p2dE1MNEU3Vkw0Rk9RQkJNVXIzWTAzUHc&usp=sharing
#
# You can add overrides, which will set th... | # 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
# 3. Record your tests here: https://docs.google.com/a/circleci.com/spreadsheet/ccc?key=0AiVfWAkOq5p2dE1MNEU3Vkw0Rk9RQkJNVXIzWTAzUHc&usp=sharing
#
# You can add overrides, which will set th... |
Add on new song submit handler. | goog.provide 'app.songs.edit.react.Page'
goog.require 'goog.ui.Textarea'
class app.songs.edit.react.Page
###*
@param {app.Routes} routes
@constructor
###
constructor: (routes) ->
{div,form,input,textarea,a} = React.DOM
@create = React.createClass
render: ->
div className: 'new-s... | goog.provide 'app.songs.edit.react.Page'
goog.require 'goog.ui.Textarea'
class app.songs.edit.react.Page
###*
@param {app.Routes} routes
@constructor
###
constructor: (routes) ->
{div,form,input,textarea,button,a} = React.DOM
@create = React.createClass
render: ->
div className:... |
Rename metadata -> segmentation in Events table to play well with metabase | 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, segmentation, callback = () ->) ->
logger.log {user_id, event, segmentation}, "no event tracking configured, logging event"
ca... |
Set default content to variables editor | BaseStackEditorView = require './basestackeditorview'
module.exports = class VariablesEditorView extends BaseStackEditorView
constructor: (options = {}, data) ->
super options, data
| BaseStackEditorView = require './basestackeditorview'
module.exports = class VariablesEditorView extends BaseStackEditorView
constructor: (options = {}, data) ->
unless options.content
options.content = """
{
"variables": {
}
}
"""
super options, data
|
Add collection detail E2E test cases. | expect = require('./helpers/expect')()
Page = require './helpers/page'
describe 'E2E Testing Collection Detail', ->
page = null
beforeEach ->
page = new Page '/quip/breast?project=QIN_Test'
it 'should load the page', ->
expect(page.content, 'The page was not loaded')
.to.eventually.exist
| #_ = require 'lodash'
#webdriver = require 'selenium-webdriver'
expect = require('./helpers/expect')()
Page = require './helpers/page'
describe 'E2E Testing Collection Detail', ->
page = null
before ->
page = new collectionDetailPage()
it 'should load the page', ->
expect(page.content, 'The page was... |
Remove react explicit dependency in progressbar test | React = require('react/addons')
expect = require('expect')
utils = require('./utils')
TestUtils = React.addons.TestUtils
ProgressBar = require('../progress_bar')
describe 'ProgressBar', ->
describe '#props', ->
it 'has the right default properties', ->
progress = TestUtils.renderIntoDoc... | expect = require('expect')
utils = require('./utils')
TestUtils = React.addons.TestUtils
ProgressBar = require('../progress_bar')
describe 'ProgressBar', ->
describe '#props', ->
it 'has the right default properties', ->
progress = TestUtils.renderIntoDocument(<ProgressBar />)
expect(pr... |
Add JFUM options to example | exists = require('fs').exists
app = module.exports = require('express')()
JFUM = require '../../src/index.coffee'
jfum = new JFUM()
app.options '/upload', jfum.optionsHandler.bind(jfum)
app.post '/upload', jfum.postHandler.bind(jfum), (req, res, next) ->
console.log req.jfum
return res.json foo: 'bar' if req.jfum ... | exists = require('fs').exists
app = module.exports = require('express')()
JFUM = require '../../src/index.coffee'
jfum = new JFUM
minFileSize: 0
maxFileSize: 10000000000
acceptFileTypes: /\.(gif|jpe?g|png)$/i
app.options '/upload', jfum.optionsHandler.bind(jfum)
app.post '/upload', jfum.postHandler.bind(jfum), (... |
Fix indentation issues question mark | {div, button} = React.DOM
LeagueButton = React.createFactory @LeagueButton
PlayerTable = React.createFactory @PlayerTable
TeamTable = React.createFactory @TeamTable
@League = React.createClass
getInitialState: ->
activeView: "Player Stats"
handleViewChange: (view) ->
@setState activeView: view
render: ->
di... | {div, button} = React.DOM
LeagueButton = React.createFactory @LeagueButton
PlayerTable = React.createFactory @PlayerTable
TeamTable = React.createFactory @TeamTable
@League = React.createClass
getInitialState: ->
activeView: "Player Stats"
handleViewChange: (view) ->
@setState activeView: view
render: ... |
Use CU_TEST_SERVER environment variable when creating URL to contact custard on. Allows for running Selenium on a different computer. | # Shared before/after functions for all integration tests
{wd40, browser} = require 'wd40'
cleaner = require '../cleaner'
request = require 'request'
base_url = 'http://localhost:3001'
login_url = "#{base_url}/login"
prepIntegration = ->
before (done) ->
cleaner.clear_and_set_fixtures ->
wd40.init ->
... | # Shared before/after functions for all integration tests
{wd40, browser} = require 'wd40'
cleaner = require '../cleaner'
request = require 'request'
test_server = process.env.CU_TEST_SERVER ? 'localhost'
base_url = "http://#{test_server}:3001"
login_url = "#{base_url}/login"
prepIntegration = ->
before (done) ->
... |
Add overleaf id to user schema | mongoose = require 'mongoose'
Settings = require 'settings-sharelatex'
Schema = mongoose.Schema
ObjectId = Schema.ObjectId
SubscriptionSchema = new Schema
admin_id : {type:ObjectId, ref:'User', index: {unique: true, dropDups: true}}
member_ids : [ type:ObjectId, ref:'User' ]
invited_emails: [ String ]
... | mongoose = require 'mongoose'
Settings = require 'settings-sharelatex'
Schema = mongoose.Schema
ObjectId = Schema.ObjectId
SubscriptionSchema = new Schema
admin_id : {type:ObjectId, ref:'User', index: {unique: true, dropDups: true}}
member_ids : [ type:ObjectId, ref:'User' ]
invited_emails: [ String ]
... |
Fix for scenarios where the localStorage item has old version's value |
FS = require('fs')
module.exports =
Save:->
try
Files = []
ActiveEditor = atom.workspace.getActiveEditor()
atom.workspace.eachEditor (editor)->
File = editor.getPath()
return unless File
Files.push File
CurrentFile = ActiveEditor && ActiveEditor.getPath() || null;... |
FS = require('fs')
module.exports =
Save:->
try
Files = []
ActiveEditor = atom.workspace.getActiveEditor()
atom.workspace.eachEditor (editor)->
File = editor.getPath()
return unless File
Files.push File
CurrentFile = ActiveEditor && ActiveEditor.getPath() || null;... |
Initialize $scope.address when switching to existing address mode | Sprangular.directive 'addressSelection', ->
restrict: 'E'
templateUrl: 'addresses/selection.html'
scope:
address: '='
addresses: '='
countries: '='
controller: ($scope) ->
$scope.existingAddress = false
$scope.$watch 'addresses', (addresses) ->
return unless addresses
if addres... | Sprangular.directive 'addressSelection', ->
restrict: 'E'
templateUrl: 'addresses/selection.html'
scope:
address: '='
addresses: '='
countries: '='
controller: ($scope) ->
$scope.existingAddress = false
$scope.$watch 'addresses', (addresses) ->
return unless addresses
if addres... |
Remove body from mac signature | class TentStatus.MacAuth
constructor: (@options) ->
@options = _.extend {
time: parseInt((new Date * 1) / 1000)
nonce: Math.random().toString(16).substring(3)
}, @options
signRequest: =>
request_string = @buildRequestString()
signature = CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA256... | class TentStatus.MacAuth
constructor: (@options) ->
@options = _.extend {
time: parseInt((new Date * 1) / 1000)
nonce: Math.random().toString(16).substring(3)
}, @options
signRequest: =>
request_string = @buildRequestString()
signature = CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA256... |
Add asterisk to display_name to trigger search | React = require 'react'
Select = require 'react-select'
PromiseRenderer = require './promise-renderer'
apiClient = require '../api/client'
debounce = require 'debounce'
module.exports = React.createClass
displayName: 'UserSearch'
searchUsers: (value, callback) ->
unless value is ''
apiClient.type('users... | React = require 'react'
Select = require 'react-select'
PromiseRenderer = require './promise-renderer'
apiClient = require '../api/client'
debounce = require 'debounce'
module.exports = React.createClass
displayName: 'UserSearch'
searchUsers: (value, callback) ->
unless value is ''
apiClient.type('users... |
Replace resource URLs with https versions | Reflux = require 'reflux'
{api} = require '../api/client'
config = require '../lib/config'
classifierActions = require '../actions/classifier-actions'
module.exports = Reflux.createStore
subjects: []
subject: null
init: ->
@next()
@listenTo classifierActions.moveToNextSubject, @next
getInitialState: ... | Reflux = require 'reflux'
{api} = require '../api/client'
config = require '../lib/config'
classifierActions = require '../actions/classifier-actions'
module.exports = Reflux.createStore
subjects: []
subject: null
init: ->
@next()
@listenTo classifierActions.moveToNextSubject, @next
getInitialState: ... |
Set up js for swapping video for image | { DEMO_BLOCKS } = require('sharify').data
imagesLoaded = require 'imagesloaded'
slides = require './slides.coffee'
loggedOutNav = require '../../../components/logged_out_nav/client/index.coffee'
blockTemplate = ->
require('../../../components/block_v2/templates/block.jade') arguments...
{ mountWithApolloProvider } =... | { DEMO_BLOCKS } = require('sharify').data
imagesLoaded = require 'imagesloaded'
{ default: Player } = require '@vimeo/player';
slides = require './slides.coffee'
loggedOutNav = require '../../../components/logged_out_nav/client/index.coffee'
blockTemplate = ->
require('../../../components/block_v2/templates/block.ja... |
Send analytics data when onboarding dismissed | define [
"base"
], (App) ->
App.controller "AutoCompileOnboardingController", ($scope) ->
recompileBtn = angular.element('#recompile')
popover = angular.element('.onboarding__autocompile')
{ top, left } = recompileBtn.offset()
# If pdf panel smaller than recompile button + popover, show to left.
# Otherwis... | define [
"base"
], (App) ->
App.controller "AutoCompileOnboardingController", ($scope) ->
recompileBtn = angular.element('#recompile')
popover = angular.element('.onboarding__autocompile')
{ top, left } = recompileBtn.offset()
# If pdf panel smaller than recompile button + popover, show to left.
# Otherwis... |
Disable default link behaviour on project filter links | $ ->
projects = $('#projects').clone()
languages = []
$('#languages a').click (e) ->
clicked_language = $(this).data().language
unless clicked_language?
resetLanguage()
return
unless e.ctrlKey or e.metaKey
languages = [].concat(clicked_language)
else
unless clicked_langu... | $ ->
projects = $('#projects').clone()
languages = []
$('#languages a').click (e) ->
clicked_language = $(this).data().language
unless clicked_language?
resetLanguage()
return false
unless e.ctrlKey or e.metaKey
languages = [].concat(clicked_language)
else
unless clicked... |
Convert dates to actual JS dates for form | angular.module("hyperadmin")
.controller "FormCtrl", ($scope, $state, Restangular, Flash) ->
@resource = { }
mode = $state.current.data.mode
if mode == "new"
method = "post"
target = "admin/#{$scope.resourceClass.plural}"
successMessage = "#{$scope.resourceClass.singular_human} created ... | angular.module("hyperadmin")
.controller "FormCtrl", ($scope, $state, Restangular, Flash) ->
@resource = { }
mode = $state.current.data.mode
if mode == "new"
method = "post"
target = "admin/#{$scope.resourceClass.plural}"
successMessage = "#{$scope.resourceClass.singular_human} created ... |
Fix about page mobile menu selector | loggedOutNav = require '../../../components/logged_out_nav/client/index.coffee'
module.exports = ->
$html = $('html, body')
$el = $('.js-about')
$links = $el.find('a[href*=#]')
$sections = $el.find('.js-section[id]')
loggedOutNav
$sections: $sections
scrollToId = (id) ->
$target = $sections.filte... | loggedOutNav = require '../../../components/logged_out_nav/client/index.coffee'
module.exports = ->
$html = $('html, body')
$el = $('.js-about')
$links = $el.find('a[href]')
$sections = $el.find('.js-section[id]')
loggedOutNav
$sections: $sections
scrollToId = (id) ->
$target = $sections.filter("... |
Change json payload to not have root element to align with what server expects. | App = window.App = Ember.Application.create()
App.ApplicationSerializer = DS.RESTSerializer.extend DS.EmbeddedRecordsMixin,
keyForAttribute: (key, relationship) ->
return Ember.String.capitalize(key)
extract: (store, type, payload, id, requestType) ->
normalizedPayload = {}
normalizedPayload[Ember.St... | App = window.App = Ember.Application.create()
App.ApplicationSerializer = DS.RESTSerializer.extend DS.EmbeddedRecordsMixin,
serializeIntoHash: (hash, type, record, options) ->
Ember.merge(hash, this.serialize(record, options))
keyForAttribute: (key, relationship) ->
return Ember.String.capitalize(key)
... |
Add Client-ID header for Twitch API | urlparse = require 'url'
request = require '../request'
Media = require '../media'
exports.lookup = (id) ->
return request.getJSON("https://api.twitch.tv/kraken/videos/#{id}").then((result) ->
media = new Media(
id: id
title: result.title
duration: result.length
... | urlparse = require 'url'
request = require '../request'
Media = require '../media'
CLIENT_ID = null
exports.lookup = (id) ->
if not CLIENT_ID
return Promise.reject(new Error('Client ID not set for Twitch API'))
return request.getJSON("https://api.twitch.tv/kraken/videos/#{id}",
headers:
... |
Make mine more visible in daylight | Crafty.c 'Mine',
init: ->
@requires 'Color, Enemy'
drone: (attr = {}) ->
@attr _.defaults(attr,
w: 25, h: 25, health: 200)
@origin 'center'
@color '#999999'
@enemy()
this
| Crafty.c 'Mine',
init: ->
@requires 'Color, Enemy'
drone: (attr = {}) ->
@attr _.defaults(attr,
w: 25, h: 25, health: 200)
@origin 'center'
@color '#666666'
@enemy()
this
|
Set up A/B test for Collection Hubs (for now admin-only) | # Centralizes configuration for currently running split tests
#
# eg.
# header_design:
# key: 'header_design'
# outcomes:
# old: 8
# new: 2
#
# Or, `outcomes` can be an array, when you specify `weighting: 'equal'.
# weighting: 'equal'
# outcomes: [
# 'old'
# 'new'
# ]
# edge: 'new'
# dimen... | # Centralizes configuration for currently running split tests
#
# eg.
# header_design:
# key: 'header_design'
# outcomes:
# old: 8
# new: 2
#
# Or, `outcomes` can be an array, when you specify `weighting: 'equal'.
# weighting: 'equal'
# outcomes: [
# 'old'
# 'new'
# ]
# edge: 'new'
# dimen... |
Remove trailing spaces, trigger jenkins | ### define
../view/skeletontracing/abstract_tree_view : AbstractTreeView
###
class AbstractTreeController
model : null
view : null
constructor : (@model) ->
container = $("#abstractTreeViewer")
@view = new AbstractTreeView(container.width(), container.height())
container.append(@view.canva... | ### define
../view/skeletontracing/abstract_tree_view : AbstractTreeView
###
class AbstractTreeController
model : null
view : null
constructor : (@model) ->
container = $("#abstractTreeViewer")
@view = new AbstractTreeView(container.width(), container.height())
container.append(@view.canvas)
... |
Set up environment variable to hold Kato "All" room HTTP POST URL. | # Description:
# Enable Hubot to post messages to Kato rooms using the HTTP API, allowing for messages with a coloured background and varying poster name.
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# Emit event "kato-http-message" from your script, after setting room name-id matches in Hub... | # Description:
# Enable Hubot to post messages to Kato rooms using the HTTP API, allowing for messages with a coloured background and varying poster name.
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# Emit event "kato-http-message" from your script, after setting Kato "All" room URL in envi... |
Fix form button alignment issue | angular.module("hyperadmin")
.directive "formActions", ->
template: """
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<md-button type="submit" class="md-primary md-raised"
ng-disabled="form.$invalid">Submit</md-button>
<md-button class="md-warn" ui-sref="^">Cancel</a>
</div>
<... | angular.module("hyperadmin")
.directive "formActions", ->
template: """
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10" layout="row">
<md-button type="submit" class="md-primary md-raised"
ng-disabled="form.$invalid">Submit</md-button>
<md-button class="md-warn" ui-sref="^">Cancel</... |
Increment number by 1000s until almost at target | # 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/
$ ->
animateMetric = $(".metric-box strong").each (index) ->
$this = $(this)
starting_point = 0
... | # 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/
roundUpToThousand = (value) ->
return 1000 * Math.ceil(value / 1000)
$ ->
animateMetric = $(".metric-bo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.