Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Fix deleting of newly uploaded figures | ETahi.FigureOverlayView = ETahi.OverlayView.extend
templateName: 'overlays/figure_overlay'
layoutName: 'layouts/no_assignee_overlay_layout' #TODO: include assignee here?
uploads: Ember.ArrayController.create content: []
figures: null
didInsertElement: ->
@set 'figures', @get('controller.paper.figures')
... | ETahi.FigureOverlayView = ETahi.OverlayView.extend
templateName: 'overlays/figure_overlay'
layoutName: 'layouts/no_assignee_overlay_layout' #TODO: include assignee here?
uploads: []
figures: Em.computed.alias('controller.paper.figures')
setupUpload: (->
uploader = $('.js-jquery-fileupload')
uploader.... |
Revert "only start the idris compiler when there is an idris file opened" | IdrisController = require './idris-controller'
{CompositeDisposable} = require 'atom'
module.exports =
active: false
statusbar: null
config:
pathToIdris:
type: 'string'
default: 'idris'
description: 'Path to the idris executable'
activate: ->
@disposables = new CompositeDisposable
... | IdrisController = require './idris-controller'
{CompositeDisposable} = require 'atom'
module.exports =
config:
pathToIdris:
type: 'string'
default: 'idris'
description: 'Path to the idris executable'
activate: ->
@controller = new IdrisController
subscription = atom.commands.add 'at... |
Update atom theme and change font-size | "*":
editor:
fontFamily: "input"
fontSize: 13
showInvisibles: true
showIndentGuide: true
invisibles: {}
core:
themes: [
"one-dark-ui"
"facebook-syntax"
]
welcome:
showOnStartup: false
whitespace:
removeTrailingWhitespace: true
ignoreWhitespaceOnCurrentLine: fa... | "*":
editor:
fontFamily: "input"
fontSize: 12
showInvisibles: true
showIndentGuide: true
invisibles: {}
core:
themes: [
"atom-material-ui"
"gotham-syntax"
]
welcome:
showOnStartup: false
whitespace:
removeTrailingWhitespace: true
ignoreWhitespaceOnCurrentLine:... |
Add form 4 profit command | fs = require 'fs'
optimist = require 'optimist'
parseOptions = (args=[]) ->
options = optimist(args)
options.usage('Usage: filings <command>')
options.alias('h', 'help').describe('h', 'Print this usage message')
options.alias('v', 'version').describe('v', 'Print the filings version')
options
module.exports ... | fs = require 'fs'
path = require 'path'
optimist = require 'optimist'
{FormFour} = require './filings'
parseOptions = (args=[]) ->
options = optimist(args)
options.usage('Usage: filings <command>')
options.alias('h', 'help').describe('h', 'Print this usage message')
options.alias('v', 'version').describe('v', ... |
Refactor pseudo class selector script a bit | # Helper function needed to deal with array-like stylesheet objects.
toArray = (obj) -> Array::slice.call obj
# Scans your stylesheet for pseudo classes and adds a class with the same name.
# Thanks to Knyle Style Sheets for the idea.
processStyles = ->
# Compile regular expression.
pseudos = [ 'link', 'visited',... | # Scans your stylesheet for pseudo classes and adds a class with the same name.
# Thanks to Knyle Style Sheets for the idea.
$ ->
addPseudoClasses()
add = (a, b) -> a + b
addPseudoClasses = ->
# Compile regular expression.
pseudos = [ 'link', 'visited', 'hover', 'active', 'focus', 'target',
'enabl... |
Change html margin when the sidebar opens to compensate for change in | scrollbarWidth = 0
FactlinkJailRoot.loaded_promise.then ->
# Create the measurement nod; see http://davidwalsh.name/detect-scrollbar-width
scrollDiv = document.createElement("div");
$(scrollDiv).css(
width: "100px"
height: "100px"
overflow: "scroll"
position: "absolute"
top: "-9999px"
)
do... | scrollbarWidth = 0
FactlinkJailRoot.loaded_promise.then ->
# Create the measurement nod; see http://davidwalsh.name/detect-scrollbar-width
scrollDiv = document.createElement("div");
$(scrollDiv).css(
width: "100px"
height: "100px"
overflow: "scroll"
position: "absolute"
top: "-9999px"
)
do... |
Add keyup event listener on hour/minute inputs | angular.module('admin.orderCycles', ['ngTagsInput', 'admin.indexUtils', 'admin.enterprises'])
.directive 'datetimepicker', ($timeout, $parse) ->
require: "ngModel"
link: (scope, element, attrs, ngModel) ->
$timeout ->
flatpickr(element, Object.assign({},
window.FLATP... | angular.module('admin.orderCycles', ['ngTagsInput', 'admin.indexUtils', 'admin.enterprises'])
.directive 'datetimepicker', ($timeout, $parse) ->
require: "ngModel"
link: (scope, element, attrs, ngModel) ->
$timeout ->
fp = flatpickr(element, Object.assign({},
window.... |
Add "insertText" and "deleteContentBackward" inputType handlers | #= require trix/controllers/abstract_input_controller
class Trix.Level2InputController extends Trix.AbstractInputController
events:
beforeinput: (event) ->
log(event)
input: (event) ->
log(event)
log = (event) ->
console.log("[#{event.type}] #{event.inputType}: #{JSON.stringify(event.data)}")... | #= require trix/controllers/abstract_input_controller
{objectsAreEqual} = Trix
class Trix.Level2InputController extends Trix.AbstractInputController
mutationIsExpected: (mutationSummary) ->
result = objectsAreEqual(mutationSummary, @inputSummary)
console.log("[mutation] [#{if result then "expected" else "un... |
Simplify browser-specific extension install logic | 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_link_by_browser =
firefox: 'https://static.factlink.com/extension/firefox/factlink-latest.xpi'
safari: 'https://static.factlink.com/extension/firefox/fac... |
Fix CoffeeScript example. Use readline-sync. Old ffi thing does not work. | # IMPORTANT: choose one
RL_LIB = "libreadline" # NOTE: libreadline is GPL
#RL_LIB = "libedit"
HISTORY_FILE = require('path').join(process.env.HOME, '.mal-history')
rlwrap = {} # namespace for this module in web context
ffi = require('ffi')
fs = require('fs')
rllib = ffi.Library(RL_LIB, {
'readline': ['string',... | readlineSync = require('readline-sync');
exports.readline = (prompt = 'user> ') ->
readlineSync.question(prompt)
|
Make react happy with keys | React = require 'react'
deep = require 'deep-get-set'
module.exports = React.createClass
displayName: "SimpleTable"
propTypes:
columns: React.PropTypes.array
data: React.PropTypes.array
render: ->
columns = @props.columns.map (column) ->
if typeof column is "string"
<th key={column}>{... | React = require 'react'
deep = require 'deep-get-set'
module.exports = React.createClass
displayName: "SimpleTable"
propTypes:
columns: React.PropTypes.array
data: React.PropTypes.array
render: ->
columns = @props.columns.map (column) ->
if typeof column is "string"
<th key={column}>{... |
Implement fadeout/in in control iframe; return deferred for completion handlers | class FactlinkJailRoot.ControlIframe
constructor: ->
@el = document.createElement('iframe')
@el.className = 'factlink-control-frame'
#need to append to outer document before we can access frame document.
FactlinkJailRoot.$factlinkCoreContainer.append(@el)
@$el = $(@el)
@doc = @el.contentWindow... | control_visibility_transition_time = 300+1000/60 #keep in sync with scss
class FactlinkJailRoot.ControlIframe
constructor: ->
@el = document.createElement('iframe')
@el.className = 'factlink-control-frame'
#need to append to outer document before we can access frame document.
FactlinkJailRoot.$factli... |
Remove unnecessary quotes of eventListeners. | _ = require('underscore')
class DeploymentMonitor
timeout = 10000
constructor: ()->
@_deployment = null
@_chat = null
@_currentTimeout = 0
@_eventListeners = {
'change': ()=>
@_resetTimeout()
@_monitorTimeout()
'close': ()=>
@.removeDeployment()
'error': ... | _ = require('underscore')
class DeploymentMonitor
timeout = 10000
constructor: ()->
@_deployment = null
@_chat = null
@_currentTimeout = 0
@_eventListeners = {
change: ()=>
@_resetTimeout()
@_monitorTimeout()
close: ()=>
@.removeDeployment()
error: ()=>
... |
Fix creation of tooltips with grammatical token info | App.CwbResultTableView = Em.View.extend
didInsertElement: ->
@$('[data-ot]').each (index, token) ->
new Opentip token, $(token).data('ot'),
style: 'dark'
fixed: true
| App.CwbResultTableView = Em.View.extend
contentBinding: 'controller.arrangedContent'
# We need to create tooltips with grammatical info for tokens after both of these have happened:
# - the controller's content property has been filled with a page of search results
# - the view has been rendered
contentDidC... |
Make sure Turbolinks is defined before patching. | # Monkey patch Turbolinks to render 401
# See https://github.com/turbolinks/turbolinks/issues/179
# https://github.com/projecthydra-labs/hyrax/issues/617
Turbolinks.HttpRequest.prototype.requestLoaded = ->
@endRequest =>
if 200 <= @xhr.status < 300 or @xhr.status == 401
@delegate.requestCompletedWithRes... | # Monkey patch Turbolinks to render 401
# See https://github.com/turbolinks/turbolinks/issues/179
# https://github.com/projecthydra-labs/hyrax/issues/617
if Turbolinks?
Turbolinks.HttpRequest.prototype.requestLoaded = ->
@endRequest =>
if 200 <= @xhr.status < 300 or @xhr.status == 401
@delegate.... |
Implement decorator pattern for student dashboard. | #= require almond
window.ttm ||= {}
ttm.ClassMixer = (klass)->
klass.build = ->
it = new klass
it.initialize && it.initialize.apply(it, arguments)
it
klass.prototype.klass = klass
klass
define "lib/class_mixer", ->
return ttm.ClassMixer
| #= require almond
window.ttm ||= {}
window.decorators ||= {}
ttm.ClassMixer = (klass)->
klass.build = ->
it = new klass
it.initialize && it.initialize.apply(it, arguments)
it
klass.prototype.klass = klass
klass
define "lib/class_mixer", ->
return ttm.ClassMixer
|
Fix new author form holding on to new author. | ETahi.AddAuthorFormComponent = Ember.Component.extend
tagName: 'div'
setNewAuthor: ( ->
unless @get('newAuthor')
@set('newAuthor', {})
).on('init')
actions:
toggleAuthorForm: ->
@sendAction('hideAuthorForm')
saveNewAuthor: ->
@sendAction('saveAuthor', @get('newAuthor'))
| ETahi.AddAuthorFormComponent = Ember.Component.extend
tagName: 'div'
setNewAuthor: ( ->
unless @get('newAuthor')
@set('newAuthor', {})
).on('init')
actions:
toggleAuthorForm: ->
@sendAction('hideAuthorForm')
saveNewAuthor: ->
author = @get('newAuthor')
@sendAction('saveAut... |
Call setModel after fetching model | Lanes.React.Mixins.Screen = {
childContextTypes:
screen: React.PropTypes.object
listenNetworkEvents: true
loadOrCreateModel: (options) ->
if options.prop and @props[options.prop]
@props[options.prop]
else
model = new options.klass
if options.attr... | Lanes.React.Mixins.Screen = {
childContextTypes:
screen: React.PropTypes.object
listenNetworkEvents: true
loadOrCreateModel: (options) ->
if options.prop and @props[options.prop]
@props[options.prop]
else
model = new options.klass
if options.att... |
Remove Clang Plus Plus Command Variable. | module.exports =
configDefaults:
clangCommand: 'clang'
clangPlusPlusCommand: 'clang++'
clangExecutablePath: null
clangIncludePaths: '.'
clangSuppressWarnings: false
clangDefaultCFlags: '-Wall'
clangDefaultCppFlags: '-Wall'
activate: ->
console.log 'activate linter-clang'
| module.exports =
configDefaults:
clangCommand: 'clang'
clangExecutablePath: null
clangIncludePaths: '.'
clangSuppressWarnings: false
clangDefaultCFlags: '-Wall'
clangDefaultCppFlags: '-Wall'
activate: ->
console.log 'activate linter-clang'
|
Add dot atom directory ivar | app = require 'app'
fs = require 'fs'
path = require 'path'
protocol = require 'protocol'
# Handles requests with 'atom' protocol.
#
# It's created by {AtomApplication} upon instantiation and is used to create a
# custom resource loader for 'atom://' URLs.
#
# The following directories are searched in order:
# * ~/.... | app = require 'app'
fs = require 'fs'
path = require 'path'
protocol = require 'protocol'
# Handles requests with 'atom' protocol.
#
# It's created by {AtomApplication} upon instantiation and is used to create a
# custom resource loader for 'atom://' URLs.
#
# The following directories are searched in order:
# * ~/.... |
Set picker format based on times | Gather.Views.Work.JobFormView = Backbone.View.extend
initialize: (options) ->
events:
'cocoon:after-insert': 'shiftInserted'
shiftInserted: (event, inserted) ->
@initDatePickers(inserted)
initDatePickers: (inserted) ->
$(inserted).find(".datetimepicker").datetimepicker()
| Gather.Views.Work.JobFormView = Backbone.View.extend
initialize: (options) ->
@formatFields()
events:
'cocoon:after-insert': 'shiftInserted'
'change #work_job_times': 'formatFields'
formatFields: ->
dateFormat = I18n.t('datepicker.pformat')
timeFormat = I18n.t('timepicker.pformat')
time... |
Use unfollow labels for 'Follow topic' button | class window.FavouriteTopicButtonView extends ActionButtonView
mini: true
onRender: -> @updateButton()
initialize: ->
@user = currentUser
@bindTo @user.favourite_topics, 'add remove change reset', @updateButton, @
templateHelpers: =>
disabled_label: Factlink.Global.t.follow_topic.capitalize()
... | class window.FavouriteTopicButtonView extends ActionButtonView
mini: true
onRender: -> @updateButton()
initialize: ->
@user = currentUser
@bindTo @user.favourite_topics, 'add remove change reset', @updateButton, @
templateHelpers: =>
disabled_label: Factlink.Global.t.follow_topic.capitalize()
... |
Fix for bad game time output | #!/usr/bin/env coffee
argv = require('yargs')
.usage('Usage: $0 --teams [num] --time [num] --rest [num] --areas [num]')
.demand(['teams'])
.default('time', 33)
.default('rest', 7)
.default('areas', 1)
.argv
{teams, time, rest, areas} = argv
{timeNeededMinutes, tourneySchedule, playoffGames} = require('../... | #!/usr/bin/env coffee
argv = require('yargs')
.usage('Usage: $0 --teams [num] --time [num] --rest [num] --areas [num]')
.demand(['teams'])
.default('time', 33)
.default('rest', 7)
.default('areas', 1)
.argv
{teams, time, rest, areas} = argv
{timeNeededMinutes, tourneySchedule, playoffGames, schedule} = re... |
Fix the resizeHandler, dunno why it needs to be called two times ~ FIXME later | class DevToolsController extends AppController
name = "DevTools"
version = "0.1"
route = "/:name?/#{name}"
KD.registerAppClass this, {
name, version, behavior: "application", route,
menu : [
{ title : "Create a new App", eventName : "create" }
{ type : "separator"... | class DevToolsController extends AppController
name = "DevTools"
version = "0.1"
route = "/:name?/#{name}"
KD.registerAppClass this, {
name, version, behavior: "application", route,
menu : [
{ title : "Create a new App", eventName : "create" }
{ type : "separator"... |
Fix missing availability check for window.localStorage (e.g. it is disabled by default in android webviews) | unless Offline
throw new Error("Offline simulate brought in without offline.js")
for state in ['up', 'down']
if document.querySelector("script[data-simulate='#{ state }']") or localStorage.OFFLINE_SIMULATE is state
Offline.options ?= {}
Offline.options.checks ?= {}
Offline.options.checks.active = state... | unless Offline
throw new Error("Offline simulate brought in without offline.js")
for state in ['up', 'down']
if document.querySelector("script[data-simulate='#{ state }']") or localStorage?.OFFLINE_SIMULATE is state
Offline.options ?= {}
Offline.options.checks ?= {}
Offline.options.checks.active = stat... |
Allow ReactDOM -> React fallback | try
ReactDOM = require 'react-dom'
catch
ReactDOM = window.ReactDOM
unless ReactDOM?
throw "Can't find ReactDOM"
module.exports = ReactDOM | try
ReactDOM = require 'react-dom'
catch
ReactDOM = window.ReactDOM
# can fall back to normal React until 0.15
unless ReactDOM?
try
ReactDOM = require 'react'
catch
ReactDOM = window.React
unless ReactDOM?
throw "Can't find ReactDOM"
module.exports = ReactDOM
|
Use relative path to atom require | require 'atom'
{runSpecSuite} = require '../spec/jasmine-helper'
atom.openDevTools()
document.title = "Benchmark Suite"
benchmarkSuite = require.resolve('./benchmark-suite')
runSpecSuite(benchmarkSuite, true)
| require '../src/atom'
{runSpecSuite} = require '../spec/jasmine-helper'
atom.openDevTools()
document.title = "Benchmark Suite"
benchmarkSuite = require.resolve('./benchmark-suite')
runSpecSuite(benchmarkSuite, true)
|
Add tasks to 'Home' list by default | Template.newTaskForm.events
'submit #new-task, click #addTaskButton': (e) ->
e.preventDefault()
body = $('#new-task-text').val()
$('#new-task-text').val("")
now = new Date()
priority = 'low'
list = 'Adel'
Tasks.insert
body: body
dateDue: moment(now).add('w', 1).toDate()
d... | Template.newTaskForm.events
'submit #new-task, click #addTaskButton': (e) ->
e.preventDefault()
body = $('#new-task-text').val()
$('#new-task-text').val("")
now = new Date()
priority = 'low'
list = 'Home'
Tasks.insert
body: body
dateDue: moment(now).add('w', 1).toDate()
d... |
Rename `Anchor` and `Buffer` events to passive-voice scheme | {View} = require 'space-pen'
module.exports =
class Tab extends View
@content: (editSession) ->
@div class: 'tab', =>
@span class: 'file-name', outlet: 'fileName'
@span class: 'close-icon'
initialize: (@editSession) ->
@buffer = @editSession.buffer
@subscribe @buffer, 'path-change', => @up... | {View} = require 'space-pen'
module.exports =
class Tab extends View
@content: (editSession) ->
@div class: 'tab', =>
@span class: 'file-name', outlet: 'fileName'
@span class: 'close-icon'
initialize: (@editSession) ->
@buffer = @editSession.buffer
@subscribe @buffer, 'path-changed', => @u... |
Truncate to 4 images by default | class OpinionatorsAvatarView extends Backbone.Marionette.Layout
tagName: 'span'
className: 'opinionators-avatar'
template: 'opinionators/avatar'
onRender: ->
UserPopoverContentView.makeTooltip @, @model
class window.OpinionatorsAvatarsView extends Backbone.Marionette.CompositeView
tagName: 'span'
clas... | class OpinionatorsAvatarView extends Backbone.Marionette.Layout
tagName: 'span'
className: 'opinionators-avatar'
template: 'opinionators/avatar'
onRender: ->
UserPopoverContentView.makeTooltip @, @model
class window.OpinionatorsAvatarsView extends Backbone.Marionette.CompositeView
tagName: 'span'
clas... |
Fix up makeRequest, so it copes with `analytics.url` being un-configured. | settings = require "settings-sharelatex"
logger = require "logger-sharelatex"
_ = require "underscore"
request = require "request"
makeRequest: (opts, callback)->
if settings.apis?.analytics?.url?
request opts, callback
else
callback()
module.exports =
recordEvent: (user_id, event, segmentation = {}, call... | settings = require "settings-sharelatex"
logger = require "logger-sharelatex"
_ = require "underscore"
request = require "request"
makeRequest = (opts, callback)->
if settings.apis?.analytics?.url?
urlPath = opts.url
opts.url = "#{settings.apis.analytics.url}#{urlPath}"
request opts, callback
else
callback(... |
Fix the 401 page looking incorrect. | CI.outer.Error = class Error extends CI.outer.Page
constructor: ->
@name = "error"
@status = renderContext.status or 404
@url = renderContext.githubPrivateAuthURL
title: =>
titles =
401: "Login required"
404: "Page not found"
500: "Internal server error"
titles[@status] or "... | CI.outer.Error = class Error extends CI.outer.Page
constructor: ->
super
@name = "error"
@status = renderContext.status or 404
@url = renderContext.githubPrivateAuthURL
title: =>
titles =
401: "Login required"
404: "Page not found"
500: "Internal server error"
titles[@sta... |
Improve string cell spec coverage | describe 'HeaderCells StringCell', ->
HeaderCell = require '../../lib/header-cells/string-cell'
initView = ({ model } = {}) ->
model ?= new Backbone.Model label: 'header cell label'
new HeaderCell { model }
showView = ->
initView(arguments...).render()
it 'renders the label', ->
expect(showVi... | describe 'HeaderCells StringCell', ->
HeaderCell = require '../../lib/header-cells/string-cell'
initView = ({ model } = {}) ->
model ?= new Backbone.Model label: 'header cell label'
new HeaderCell { model }
showView = ->
initView(arguments...).render()
it 'renders the label', ->
expect(showVi... |
Set up travis for Topic Map [rev: Alex Scown] | module.exports = (grunt) ->
documentation = 'doc'
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
clean: [
'bin'
'.grunt'
documentation
]
jsdoc:
dist:
src: ['topicmap.js', 'README.md']
options:
destination: documentation
template: ... | module.exports = (grunt) ->
documentation = 'doc'
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
clean: [
'bin'
'.grunt'
documentation
]
jsdoc:
dist:
src: ['topicmap.js', 'README.md']
options:
destination: documentation
template: ... |
Test length of name array in initials | #
# User icon via gravatar email address or user initials
#
angular.module('doubtfire.common.user-icon', [])
.directive('userIcon', ->
restrict: 'E'
replace: true
scope:
user: '=?'
size: '=?'
email: '=?'
templateUrl: 'common/user-icon/user-icon.tpl.html'
controller: ($scope, $http, currentUser, md... | #
# User icon via gravatar email address or user initials
#
angular.module('doubtfire.common.user-icon', [])
.directive('userIcon', ->
restrict: 'E'
replace: true
scope:
user: '=?'
size: '=?'
email: '=?'
templateUrl: 'common/user-icon/user-icon.tpl.html'
controller: ($scope, $http, currentUser, md... |
Add translation for pop up messages |
# 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/
ready = ->
engine = new Bloodhound(
datumTokenizer: (d) ->
console.log d
Bloodhound.tok... |
# 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/
ready = ->
engine = new Bloodhound(
datumTokenizer: (d) ->
console.log d
Bloodhound.tok... |
Fix for another parse error | {BufferedProcess, CompositeDisposable} = require 'atom'
lsc = require 'atom-livescript'
module.exports =
provideLinter: ->
grammarScopes: ['source.livescript']
scope: 'file'
lintOnFly: true
lint: (textEditor)=>
new Promise (resolve, reject)=>
filePath = textEditor.getPath()
file... | {BufferedProcess, CompositeDisposable} = require 'atom'
lsc = require 'atom-livescript'
module.exports =
provideLinter: ->
grammarScopes: ['source.livescript']
scope: 'file'
lintOnFly: true
lint: (textEditor)=>
new Promise (resolve, reject)=>
filePath = textEditor.getPath()
file... |
Call toggle each time command is dispatched | grammarListView = null
grammarStatusView = null
module.exports =
config:
showOnRightSideOfStatusBar:
type: 'boolean'
default: true
activate: ->
@commandDisposable = atom.commands.add('atom-text-editor', 'grammar-selector:show', createGrammarListView)
atom.packages.onDidActivateAll(createGr... | commandDisposable = null
grammarListView = null
grammarStatusView = null
module.exports =
config:
showOnRightSideOfStatusBar:
type: 'boolean'
default: true
activate: ->
commandDisposable = atom.commands.add('atom-text-editor', 'grammar-selector:show', createGrammarListView)
atom.packages.o... |
Add default value for existingAddress attribute in compile stage | Sprangular.directive 'addressSelection', ->
restrict: 'E'
templateUrl: 'addresses/selection.html'
scope:
address: '='
addresses: '='
countries: '='
disabled: '=disabledFields'
submitted: '='
existingAddress: '='
controller: ($scope) ->
$scope.$watch 'addresses', (addresses) ->
... | Sprangular.directive 'addressSelection', ->
restrict: 'E'
templateUrl: 'addresses/selection.html'
scope:
address: '='
addresses: '='
countries: '='
disabled: '=disabledFields'
submitted: '='
existingAddress: '='
controller: ($scope) ->
$scope.$watch 'addresses', (addresses) ->
... |
Make compatible with coffee 1.1.3 bug | # Implements global `ajaxBeforeSend` event.
#
# jQuery already provides a handful of global AJAX events. However,
# there is no global version of `beforeSend`, so `ajaxBeforeSend` is
# added to complement it.
#
# Reference: http://docs.jquery.com/Ajax_Events
# Skip for Zepto which doesn't have ajaxSetup but does alrea... | # Implements global `ajaxBeforeSend` event.
#
# jQuery already provides a handful of global AJAX events. However,
# there is no global version of `beforeSend`, so `ajaxBeforeSend` is
# added to complement it.
#
# Reference: http://docs.jquery.com/Ajax_Events
# Skip for Zepto which doesn't have ajaxSetup but does alrea... |
Add toggle menu item for panels | 'menu': [
'label': 'Find'
'submenu': [
{ 'label': 'Find in Buffer', 'command': 'find-and-replace:show'}
{ 'label': 'Replace in Buffer', 'command': 'find-and-replace:show-replace'}
{ 'label': 'Select Next', 'command': 'find-and-replace:select-next'}
{ 'label': 'Select All', 'command': 'find-and-repla... | 'menu': [
'label': 'Find'
'submenu': [
{ 'label': 'Find in Buffer', 'command': 'find-and-replace:show'}
{ 'label': 'Replace in Buffer', 'command': 'find-and-replace:show-replace'}
{ 'label': 'Select Next', 'command': 'find-and-replace:select-next'}
{ 'label': 'Select All', 'command': 'find-and-repla... |
Indent msg.send so that we all can Clay. Sheeeeeeeeeit. | # Description:
# When you get some bad news sometimes you got to let it out.
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# sheeeit - Display an image or animated gif
#
# Author:
# danishkhan
sheits = [
"http://www.circlenoir.com/forums/attachment.php?attachmentid=478&stc=1#.jpg",
"ht... | # Description:
# When you get some bad news sometimes you got to let it out.
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# sheeeit - Display an image or animated gif
#
# Author:
# danishkhan
sheits = [
"http://www.circlenoir.com/forums/attachment.php?attachmentid=478&stc=1#.jpg",
"ht... |
Fix markers persisting after tokenisation when they should have been hidden | {CompositeDisposable} = require 'atom'
module.exports =
class MinimapPigmentsBinding
constructor: ({@editor, @minimap, @colorBuffer}) ->
@displayedMarkers = []
@subscriptions = new CompositeDisposable
@colorBuffer.initialize().then => @updateMarkers()
@subscriptions.add @colorBuffer.onDidUpdateColo... | {CompositeDisposable} = require 'atom'
module.exports =
class MinimapPigmentsBinding
constructor: ({@editor, @minimap, @colorBuffer}) ->
@displayedMarkers = []
@subscriptions = new CompositeDisposable
@colorBuffer.initialize().then => @updateMarkers()
@subscriptions.add @colorBuffer.editor.displayB... |
Simplify spec files regex since webpack should be doing all the heavy lifting | webpackConfig = require('./webpack.config.coffee')
webpackConfig.entry = {}
module.exports = (config) ->
config.set
frameworks: ['jasmine']
browsers: ['Chrome']
files: [
'./spec/**/*.coffee'
]
preprocessors:
'./spec/**/*spec.coffee': ['webpack']
webpack: webpackConfig
web... | webpackConfig = require('./webpack.config.coffee')
webpackConfig.entry = {}
module.exports = (config) ->
config.set
frameworks: ['jasmine']
browsers: ['Chrome']
files: [
'./spec/**/*.coffee'
]
preprocessors:
'./spec/**/*': ['webpack']
webpack: webpackConfig
webpackMiddlew... |
Fix bugs with shared url | Router.configure
layoutTemplate: 'Layout'
Router.route '/', ->
return @redirect '/course/si'
Router.route '/si', ->
return @redirect '/course/si'
Router.route '/tsi', ->
return @redirect '/course/tsi'
Router.route '/course/:course',
name: 'course'
waitOn: ->
return [
Meteor.subscribe 'Grade'
Mete... | Router.configure
layoutTemplate: 'Layout'
Router.route '/', ->
return @redirect '/course/si'
Router.route '/si', ->
return @redirect '/course/si'
Router.route '/tsi', ->
return @redirect '/course/tsi'
Router.route '/course/:course',
name: 'course'
waitOn: ->
return [
Meteor.subscribe 'Grade'
Mete... |
Break tests down into one | define (require) ->
Piece = require 'Piece'
ranks = require 'ranks'
describe 'Piece', ->
for rank of ranks
do (rank) ->
it "should not throw if rank #{rank}", ->
expect(->
new Piece
rank: rank
side: 0
).to.not.throw()
it 'should... | define (require) ->
Piece = require 'Piece'
ranks = require 'ranks'
describe 'Piece', ->
it 'should not throw if rank is valid', ->
for rank of ranks
expect(->
new Piece
rank: rank
side: 0
).to.not.throw()
it 'should throw if rank is not valid', ... |
Use fs.readdirSync() for listing package directories | require 'window'
measure 'spec suite require time', ->
fsUtils = require 'fs-utils'
path = require 'path'
require 'spec-helper'
requireSpecs = (directoryPath, specType) ->
for specPath in fsUtils.listTreeSync(path.join(directoryPath, 'spec')) when /-spec\.coffee$/.test specPath
require specPath
s... | fs = require 'fs'
require 'window'
measure 'spec suite require time', ->
fsUtils = require 'fs-utils'
path = require 'path'
require 'spec-helper'
requireSpecs = (directoryPath, specType) ->
for specPath in fsUtils.listTreeSync(path.join(directoryPath, 'spec')) when /-spec\.coffee$/.test specPath
re... |
Add method to reset avatar | Meteor.methods
setAvatarFromService: (image, service) ->
if not Meteor.userId()
throw new Meteor.Error 203, '[methods] typingStatus -> Usuário não logado'
user = Meteor.user()
file = new FS.File image
file.attachData image, ->
file.name user.username
Avatars.insert file, (err, fileObj) ->
Meteo... | Meteor.methods
setAvatarFromService: (image, service) ->
if not Meteor.userId()
throw new Meteor.Error 203, '[methods] typingStatus -> Usuário não logado'
user = Meteor.user()
file = new FS.File image
file.attachData image, ->
file.name user.username
Avatars.insert file, (err, fileObj) ->
Meteo... |
Fix displaying error messages from forms | angular.module("hyperadmin")
.controller "FormCtrl", ($scope, Restangular) ->
@submit = =>
target = @meta.target
method = @meta.method
onError = (response) =>
errors = response.data
onSuccess = (resource) =>
# Do nothing yet
if method == "post"
Restangular.... | angular.module("hyperadmin")
.controller "FormCtrl", ($scope, Restangular) ->
@submit = =>
target = @meta.target
method = @meta.method
onError = (response) =>
@errors = response.data
onSuccess = (resource) =>
# Do nothing yet
if method == "post"
Restangular... |
Allow autofocus to accept a container element | _ = require 'underscore'
{ isTouchDevice } = require '../util/device.coffee'
module.exports =
firstVisibleInput: ($el) ->
$el.find('input:visible, textarea:visible').first()
moveCursorToEnd: ($input) ->
val = $input.val()
$input.val('').val val
autofocus: ($input, defer = false) ->
return if is... | _ = require 'underscore'
{ isTouchDevice } = require '../util/device.coffee'
module.exports =
firstVisibleInput: ($el) ->
$el.find('input:visible, textarea:visible').first()
moveCursorToEnd: ($input) ->
val = $input.val()
$input.val('').val val
isFocusable: ($el) ->
$el.is('input') or $el.is('t... |
Send UUID on 'data' rather than 'disconnect' | noflo = require("noflo")
uuid = require("node-uuid")
class RandomUuid extends noflo.Component
description: "Generate a random UUID token"
constructor: ->
@inPorts =
in: new noflo.Port
@outPorts =
out: new noflo.Port
@inPorts.in.on "disconnect", =>
token = uuid.v4()
@outPorts.... | noflo = require('noflo')
uuid = require('node-uuid')
class RandomUuid extends noflo.Component
description: 'Generate a random UUID token'
constructor: ->
@inPorts =
in: new noflo.Port
@outPorts =
out: new noflo.Port
@inPorts.in.on 'begingroup', (group) =>
@outPorts.out.beginGroup g... |
Add jQuery and show move data. | require 'js-yaml'
socket = require 'socket.io'
solid = require 'solid'
{Engine} = require './engine'
engine = new Engine
moves: require './data/bw/moves.yml'
io = socket.listen solid (app) ->
app.get '/', @render ->
@doctype 5
@html ->
@head ->
@js '/socket.io/socket.io.js'
@script ... | require 'js-yaml'
socket = require 'socket.io'
solid = require 'solid'
{Engine} = require './engine'
engine = new Engine
moves: require './data/bw/moves.yml'
io = socket.listen solid (app) ->
app.get '/jquery.js', @jquery
app.get '/', @render ->
@doctype 5
@html ->
@head ->
@js '/jquery.j... |
Test client request is a writable stream | client = require 'nack/client'
process = require 'nack/process'
config = __dirname + "/fixtures/echo.ru"
exports.testClientRequest = (test) ->
test.expect 8
p = process.createProcess config
p.on 'ready', () ->
c = client.createConnection p.sockPath
test.ok c
request = c.request 'GET', '/foo', {}
... | client = require 'nack/client'
process = require 'nack/process'
config = __dirname + "/fixtures/echo.ru"
exports.testClientRequest = (test) ->
test.expect 10
p = process.createProcess config
p.on 'ready', () ->
c = client.createConnection p.sockPath
test.ok c
request = c.request 'GET', '/foo', {}... |
Add a spec for class-list enhancements | DefaultFileIcons = require '../lib/default-file-icons'
FileIcons = require '../lib/file-icons'
describe 'FileIcons', ->
afterEach ->
FileIcons.setService(new DefaultFileIcons)
it 'provides a default', ->
expect(FileIcons.getService()).toBeDefined()
expect(FileIcons.getService()).not.toBeNull()
it '... | DefaultFileIcons = require '../lib/default-file-icons'
FileIcons = require '../lib/file-icons'
describe 'FileIcons', ->
afterEach ->
FileIcons.setService(new DefaultFileIcons)
it 'provides a default', ->
expect(FileIcons.getService()).toBeDefined()
expect(FileIcons.getService()).not.toBeNull()
it '... |
Fix bug in transforming linked todo_list titles into plain text | # Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
OUT.registerCreatedHandler "todo_list", (selector) ->
$(selector).find("a.new").click()
... | # Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
OUT.registerCreatedHandler "todo_list", (selector) ->
$(selector).find("a.new").click()
... |
Set visitor attributes on stance construction | angular.module('loomioApp').factory 'StanceModel', (DraftableModel, AppConfig, MentionLinkService) ->
class StanceModel extends DraftableModel
@singular: 'stance'
@plural: 'stances'
@indices: ['pollId', 'authorId']
@serializableAttributes: AppConfig.permittedParams.stance
@draftParent: 'poll'
... | angular.module('loomioApp').factory 'StanceModel', (DraftableModel, AppConfig, MentionLinkService) ->
class StanceModel extends DraftableModel
@singular: 'stance'
@plural: 'stances'
@indices: ['pollId', 'authorId']
@serializableAttributes: AppConfig.permittedParams.stance
@draftParent: 'poll'
... |
Remove existence check in def and set defined properties as writable. | # This file contains utilities to deal with prototype extensions.
#### def
# Defines a non-enumerable property on the specified constructor's `prototype`.
#
# def Object, merge: (o) ->
# # merge implementation
#
# {foo: 10}.merge bar: 20 # {foo: 10, bar: 20}
def = (ctor, o) ->
for name, value of o
... | # This file contains utilities to deal with prototype extensions.
#### def
# Defines a non-enumerable property on the specified constructor's `prototype`.
#
# def Object, merge: (o) ->
# # merge implementation
#
# {foo: 10}.merge bar: 20 # {foo: 10, bar: 20}
def = (ctor, o) ->
for name, value of o
... |
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,... |
Validate parameters, and: 1. check that room creator is not removed 2. relabel room if access permissions changed 3. add new members that we're previously in the room 4. remove existing members that should no longer be in the room | Meteor.methods
updateRoom: (rid, name, users, accessPermissions) ->
if not Meteor.userId()
throw new Meteor.Error('invalid-user', "[methods] updateRoom -> Invalid user")
room = ChatRoom.findOne rid
if room.t not in ['d'] and name? and name isnt room.name
Meteor.call 'saveRoomName', rid, name
Meteor.ca... | Meteor.methods
updateRoom: (rid, name, usernames, accessPermissions) ->
console.log '[method] updateRoom -> arguments', arguments
if not Meteor.userId()
throw new Meteor.Error('invalid-user', "[methods] updateRoom -> Requires authenticated user")
# validate params exist
unless rid and name and usernames ... |
Set image dimensions after loading the File | class Trix.ImageAttachmentView
constructor: (@attachment) ->
@attachment.delegate = this
@image = document.createElement("img")
render: ->
@loadPreview() if @attachment.isPending()
@updateImageAttributes()
@image
loadPreview: ->
reader = new FileReader
reader.onload = (event) =>
... | class Trix.ImageAttachmentView
constructor: (@attachment) ->
@attachment.delegate = this
@image = document.createElement("img")
render: ->
@loadFile() if @attachment.isPending()
@updateImageAttributes()
@image
loadFile: ->
reader = new FileReader
reader.onload = (event) =>
if @... |
Add Select Inside Brackets to Selection menu | 'menu': [
{
'label': 'Packages'
'submenu': [
'label': 'Bracket Matcher'
'submenu': [
{ 'label': 'Go To Matching Bracket', 'command': 'bracket-matcher:go-to-matching-bracket' }
{ 'label': 'Select Inside Brackets', 'command': 'bracket-matcher:select-inside-brackets' }
{ 'labe... | 'menu': [
{
'label': 'Packages'
'submenu': [
'label': 'Bracket Matcher'
'submenu': [
{ 'label': 'Go To Matching Bracket', 'command': 'bracket-matcher:go-to-matching-bracket' }
{ 'label': 'Select Inside Brackets', 'command': 'bracket-matcher:select-inside-brackets' }
{ 'labe... |
Change to post in channel not reply. | module.exports = (robot) ->
robot.hear /the more you know/, (msg) ->
msg.reply "http://www.youtube.com/watch?v=v3rhQc666Sg"
| module.exports = (robot) ->
robot.hear /the more you know/, (msg) ->
msg.send "http://www.youtube.com/watch?v=v3rhQc666Sg"
|
Remove a test that fails in TeamCity. |
define ['lib/amd/Backbone','neo4j/webadmin/modules/databrowser/views/PropertyContainerView'], (Backbone, PropertyContainerView) ->
# TODO: Refactor out the "shouldBeConvertedToString" into it's own class
describe "PropertyContainerView", ->
pcv = new PropertyContainerView(template:null)
it "recogni... |
define ['lib/amd/Backbone','neo4j/webadmin/modules/databrowser/views/PropertyContainerView'], (Backbone, PropertyContainerView) ->
# TODO: Refactor out the "shouldBeConvertedToString" into it's own class
describe "PropertyContainerView", ->
pcv = new PropertyContainerView(template:null)
it "recogni... |
Revert "Some nice warnings away" | reqr = if global.GENTLY then GENTLY.hijack(require) else require
stream = reqr "stream"
class PaginationStream extends stream.Readable
constructor: (fetchPage) ->
super objectMode: true
@_fetchPage = fetchPage
@_pageno = 0
@_items = []
@_itemsRead = 0
_read: ->
if @... | reqr = if global.GENTLY then GENTLY.hijack(require) else require
TransloaditClient = reqr "./TransloaditClient"
stream = reqr "stream"
class PaginationStream extends stream.Readable
constructor: (@_fetchPage) ->
super objectMode: true
@_pageno = 0
@_items = []
@_itemsRead = 0
... |
Move initializing of observing into a method | ###
Use intersection observer to lazy load. Not using vue-in-viewport-mixin since
needs are simpler and I want more control.
###
export default
props:
intersectionOptions:
type: Object
default: -> {}
data: -> inViewport: false
mounted: ->
return unless @shouldObserve and IntersectionObserver?
@obser... | ###
Use intersection observer to lazy load. Not using vue-in-viewport-mixin since
needs are simpler and I want more control.
###
export default
props:
intersectionOptions:
type: Object
default: -> {}
data: -> inViewport: false
# Start observing on init
mounted: -> @startObserving()
computed:
# C... |
Test logout signal is emitted after destroy | {Testing, expect, sinon, _} = require 'openstax-react-components/test/helpers'
User = require 'user/model'
describe 'User', ->
it 'defaults to not logged in', ->
expect(User.isLoggedIn()).to.be.false
| {Testing, expect, sinon, _} = require 'openstax-react-components/test/helpers'
User = require 'user/model'
describe 'User', ->
it 'defaults to not logged in', ->
expect(User.isLoggedIn()).to.be.false
it 'resets courses when destroy is called, but still emits signals', ->
fakeCourse =
destroy: -> ... |
Clear config subscriptions when unobserving | module.exports =
observeConfig: (keyPath, args...) ->
@configSubscriptions ?= {}
@configSubscriptions[keyPath] = config.observe(keyPath, args...)
unobserveConfig: ->
for keyPath, subscription of @configSubscriptions ? {}
subscription.cancel()
| module.exports =
observeConfig: (keyPath, args...) ->
@configSubscriptions ?= {}
@configSubscriptions[keyPath] = config.observe(keyPath, args...)
unobserveConfig: ->
if @configSubscriptions?
subscription.cancel() for keyPath, subscription of @configSubscriptions
@configSubscriptions = null
|
Remove function to open collections when clicking on the database label in the tree | class window.DatabaseItemView extends Backbone.View
tagName: 'li'
className: 'databaseItem'
events:
'click .databaseItem span': 'gotoDatabase',
'click .databaseItem a': 'toggleCollections'
initialize: ->
@template = _.template $('#databaseItemTemplate').html()
render: ->
id = @model.get '_i... | class window.DatabaseItemView extends Backbone.View
tagName: 'li'
className: 'databaseItem'
events:
'click .databaseItem span': 'gotoDatabase',
'click .databaseItem a': 'toggleCollections'
initialize: ->
@template = _.template $('#databaseItemTemplate').html()
render: ->
id = @model.get '_i... |
Update Utils.FullHeightHeader. Put instance into @el so @el can access @compute() | # USE
# If the element is not a component, add full-height-header attribute to the tag.
# With a component, add 'full_height_header: true' to the persisted options
class @MC.Utils.FullHeightHeader
@autoInit: ->
$('[full-height-header]').each (i, el) => new @($(el))
constructor: (@el) ->
@component = @el.da... | # USE
# If the element is not a component, add full-height-header attribute to the tag.
# With a component, add 'full_height_header: true' to the persisted options
class @MC.Utils.FullHeightHeader
@autoInit: ->
$('[full-height-header]').each (i, el) => new @($(el))
constructor: (@el) ->
@el.data('fullHeigh... |
Add link to global header | $ ->
GlobalHeader = React.createClass
propTypes:
imagePath: React.PropTypes.string.isRequired
imageTitle: React.PropTypes.string.isRequired
render: ->
<h1 className="GlobalHeader-heading">
<img src={@props.imagePath} alt={@props.imageTitle} title={@props.imageTitle} />
</h1>
... | $ ->
GlobalHeader = React.createClass
propTypes:
imagePath: React.PropTypes.string.isRequired
imageTitle: React.PropTypes.string.isRequired
render: ->
<h1 className="GlobalHeader-heading">
<a href="https://github.com/ruedap/nekostagram">
<img src={@props.imagePath} alt={@pr... |
Work on RequireJS Jasmine test. | describe "RequireJS", ->
beforeEach ->
@addMatchers
requirejsTobeUndefined: ->
typeof requirejs is "undefined"
requireTobeUndefined: ->
typeof require is "undefined"
defineTobeUndefined: ->
typeof define is "undefined"
it "check that the RequireJS object is present ... | describe "RequireJS", ->
beforeEach ->
@addMatchers
requirejsTobeUndefined: ->
typeof requirejs is "undefined"
requireTobeUndefined: ->
typeof require is "undefined"
defineTobeUndefined: ->
typeof define is "undefined"
it "check that the RequireJS object is present ... |
Adjust `Builder` signature to match implementations | _ = require "underscore-plus"
module.exports =
class Builder
constructor: ->
@envPathKey = switch process.env.platform
when "win32" then "Path"
else "PATH"
run: -> null
constructArgs: -> null
parseLogFile: (texFilePath) -> null
constructChildProcessOptions: ->
env = _.clone(process.env)... | _ = require "underscore-plus"
module.exports =
class Builder
constructor: ->
@envPathKey = switch process.env.platform
when "win32" then "Path"
else "PATH"
run: (args, callback) -> null
constructArgs: (filePath) -> null
parseLogFile: (texFilePath) -> null
constructChildProcessOptions: ->
... |
Fix bug due to accidental use of `path` module | _ = require "underscore-plus"
module.exports =
class Builder
constructor: ->
@envPathKey = switch process.env.platform
when "win32" then "Path"
else "PATH"
run: (args, callback) -> null
constructArgs: (filePath) -> null
parseLogFile: (texFilePath) -> null
constructChildProcessOptions: ->
... | _ = require "underscore-plus"
path = require "path"
module.exports =
class Builder
constructor: ->
@envPathKey = switch process.env.platform
when "win32" then "Path"
else "PATH"
run: (args, callback) -> null
constructArgs: (filePath) -> null
parseLogFile: (texFilePath) -> null
constructChil... |
Allow /auth/status to use credentials (cookies) | settings =
# to customize, set environmental var BASE_URL when building or running webpack-dev-server
# Currently is set on an endpoint by endpoint basis until all are implemented by BE
# baseUrl: process?.env?.BASE_URL
endpoints:
'exercise.*.send.save':
url: 'api/steps/{id}'
method: 'PATCH'
... | settings =
# to customize, set environmental var BASE_URL when building or running webpack-dev-server
# Currently is set on an endpoint by endpoint basis until all are implemented by BE
# baseUrl: process?.env?.BASE_URL
endpoints:
'exercise.*.send.save':
url: 'api/steps/{id}'
method: 'PATCH'
... |
Update menu test to match new options | {Testing, expect, sinon, _} = require 'openstax-react-components/test/helpers'
Menu = require 'user/menu'
User = require 'user/model'
Course = require 'course/model'
sandbox = null
describe 'User menu component', ->
beforeEach ->
@props =
course: new Course(ecosystem_book_uuid: 'test-collection-uuid')
... | {Testing, expect, sinon, _} = require 'openstax-react-components/test/helpers'
Menu = require 'user/menu'
User = require 'user/model'
Course = require 'course/model'
sandbox = null
describe 'User menu component', ->
beforeEach ->
@props =
course: new Course(ecosystem_book_uuid: 'test-collection-uuid')
... |
Trim remove_delay down closer to transition duration | FactlinkJailRoot.showShouldSelectTextNotification = ->
showNotification
message: 'To create an annotation, select a statement and click the Factlink button.'
type_classes: 'fl-message-icon-add'
FactlinkJailRoot.showLoadedNotification = ->
showNotification
message: 'Factlink is loaded!'
type_classes... | FactlinkJailRoot.showShouldSelectTextNotification = ->
showNotification
message: 'To create an annotation, select a statement and click the Factlink button.'
type_classes: 'fl-message-icon-add'
FactlinkJailRoot.showLoadedNotification = ->
showNotification
message: 'Factlink is loaded!'
type_classes... |
Update Commands section of header | # Description:
# Get the CI status reported to GitHub for a repo and pull request
#
# Dependencies:
# "githubot": "0.4.x"
#
# Configuration:
# HUBOT_GITHUB_TOKEN
# HUBOT_GITHUB_USER
# HUBOT_GITHUB_API
#
# Commands:
# hubot repo show <repo> - shows activity of repository
#
# Notes:
# HUBOT_GITHUB_API allow... | # Description:
# Get the CI status reported to GitHub for a repo and pull request
#
# Dependencies:
# "githubot": "0.4.x"
#
# Configuration:
# HUBOT_GITHUB_TOKEN
# HUBOT_GITHUB_USER
# HUBOT_GITHUB_API
#
# Commands:
# hubot status jekyll/jekyll 2004
# hubot status 2004
#
# Notes:
# HUBOT_GITHUB_API allow... |
Increase polling to 150 seconds maximum before showing error message. | angular.module("admin.orders").controller "bulkInvoiceCtrl", ($scope, $http, $timeout) ->
$scope.createBulkInvoice = ->
$scope.invoice_id = null
$scope.poll = 1
$scope.loading = true
$scope.message = null
$scope.error = null
$http.post('/admin/orders/invoices', {order_ids: $scope.selected_ord... | angular.module("admin.orders").controller "bulkInvoiceCtrl", ($scope, $http, $timeout) ->
$scope.createBulkInvoice = ->
$scope.invoice_id = null
$scope.poll = 1
$scope.loading = true
$scope.message = null
$scope.error = null
$http.post('/admin/orders/invoices', {order_ids: $scope.selected_ord... |
Upgrade helper specs to match latest module | describe 'helpers', ->
helpers = require('../lib/helpers')
beforeEach ->
atom.notifications.clear()
describe '::error', ->
it 'adds an error notification', ->
helpers.error(new Error())
expect(atom.notifications.getNotifications().length).toBe(1)
describe '::shouldTriggerLinter', ->
no... | describe 'helpers', ->
helpers = require('../lib/helpers')
beforeEach ->
atom.notifications.clear()
describe '::showError', ->
it 'adds an error notification', ->
helpers.showError(new Error())
expect(atom.notifications.getNotifications().length).toBe(1)
describe '::shouldTriggerLinter', -... |
Update view and entity on value change. | do (_=_, $ = jQuery || null, JEFRi = JEFRi) ->
JEFRi.Template.rendered.entity :> ([entity, $render]) ->
definition = entity._definition()
for field, property of definition.properties
behaviors.editField entity, field, property, $render
behaviors =
editField: (entity, field, property, $parent) ->
$view = ... | do (_=_, $ = jQuery || null, JEFRi = JEFRi) ->
JEFRi.Template.rendered.entity :> ([entity, $render]) ->
definition = entity._definition()
for field, property of definition.properties
behaviors.editField entity, field, property, $render
behaviors =
editField: (entity, field, property, $parent) ->
$view = ... |
Replace Leaflet tile with MapQuest tile | #= require leaflet
$ ->
map = L.map('map').setView [51.505, -0.09], 2
L.tileLayer('http://{s}.tile.cloudmade.com/aff7873cf13349fe803e6a003f5c62bc/997/256/{z}/{x}/{y}.png', {
attribution: "Metadata Census",
maxZoom: 18
}).addTo(map)
| #= require leaflet
$ ->
map = L.map('map').setView [51.505, -0.09], 2
L.tileLayer('http://otile{s}.mqcdn.com/tiles/1.0.0/{type}/{z}/{x}/{y}.png', {
attribution: null,
subdomains: '1234',
type: 'osm',
}).addTo(map)
|
Use meta-. to jump to declaration | window.keymap.bindKeys '.editor'
'meta-j': 'outline-view:toggle'
'f3': 'outline-view:jump-to-declaration'
| window.keymap.bindKeys '.editor'
'meta-j': 'outline-view:toggle'
'meta-.': 'outline-view:jump-to-declaration'
|
Fix Bitbucket to use url | NotificationPlugin = require "../../notification-plugin"
url = require "url"
qs = require 'qs'
class BitbucketIssue extends NotificationPlugin
@receiveEvent: (config, event, callback) ->
query_object =
"title": @title(event)
"content": @markdownBody(event)
"kind": config.kind
"prior... | NotificationPlugin = require "../../notification-plugin"
url = require "url"
qs = require 'qs'
class BitbucketIssue extends NotificationPlugin
BASE_URL = "https://bitbucket.org"
@receiveEvent: (config, event, callback) ->
query_object =
"title": @title(event)
"content": @markdownBody(event)
... |
Apply setAccessors to SetSort before we override them. | #= require ../object
#= require ./set
class Batman.SetProxy extends Batman.Object
constructor: (@base) ->
super()
@length = @base.length
@base.on 'itemsWereAdded', (items...) =>
@set 'length', @base.length
@fire('itemsWereAdded', items...)
@base.on 'itemsWereRemoved', (items...) =>
... | #= require ../object
#= require ./set
class Batman.SetProxy extends Batman.Object
constructor: (@base) ->
super()
@length = @base.length
@base.on 'itemsWereAdded', (items...) =>
@set 'length', @base.length
@fire('itemsWereAdded', items...)
@base.on 'itemsWereRemoved', (items...) =>
... |
Remove unused grammar property in runtime test | assert = require("assert")
SpyReader = require "./helpers/spy_reader"
ts = require("..")
{ repeat, seq } = ts.rules
grammar = ts.grammar
name: 'trivial_grammar'
start: 'paragraph'
rules:
paragraph: -> repeat(@sentence)
sentence: -> seq repeat(@word), "."
word: -> /\w+/
cCode = ts.compile(grammar)
li... | assert = require("assert")
SpyReader = require "./helpers/spy_reader"
ts = require("..")
{ repeat, seq } = ts.rules
grammar = ts.grammar
name: 'trivial_grammar'
rules:
paragraph: -> repeat(@sentence)
sentence: -> seq repeat(@word), "."
word: -> /\w+/
cCode = ts.compile(grammar)
libPath = ts.buildParse... |
Add `.loading` class to body when `Status.isLoading` | Sprangular.service "Status", ($rootScope, $translate) ->
status =
initialized: false
pageTitle: "Home"
bodyClasses: {default: true}
requestedPath: null
httpLoading: false
routeChanging: false
cachedProducts: []
meta: {}
isLoading: ->
@httpLoading || @routeChanging
cach... | Sprangular.service "Status", ($rootScope, $translate) ->
status =
initialized: false
pageTitle: "Home"
bodyClasses: {default: true}
requestedPath: null
httpLoading: false
routeChanging: false
cachedProducts: []
meta: {}
isLoading: ->
@httpLoading || @routeChanging
cach... |
Update naming and remove admin restrictions | express = require 'express'
adminOnly = require '../../lib/middleware/admin_only'
JSONPage = require '../../components/json_page'
app = module.exports = express()
app.set 'views', __dirname
app.set 'view engine', 'jade'
page = new JSONPage
name: 'professional-buyer',
paths:
show: '/professional-buyer'
edi... | express = require 'express'
adminOnly = require '../../lib/middleware/admin_only'
JSONPage = require '../../components/json_page'
app = module.exports = express()
app.set 'views', __dirname
app.set 'view engine', 'jade'
page = new JSONPage
name: 'professional-buyer',
paths:
show: '/professional-buyer'
edi... |
Clean requires in stack application module (server) | request = require("request-json")
fs = require('fs')
slugify = require 'cozy-slug'
{AppManager} = require '../lib/paas'
spawn = require('child_process').spawn
log = require('printit')
prefix: "applications"
StackApplication = require ... | request = require("request-json")
fs = require('fs')
slugify = require 'cozy-slug'
spawn = require('child_process').spawn
log = require('printit')
prefix: "applications"
{AppManager} = require '../lib/paas'
StackApplication = require ... |
Fix home not logged in test | should = require 'should'
{wd40, browser} = require('../wd40')
url = 'http://localhost:3001'
describe 'Home page (not logged in)', ->
before (done) ->
wd40.init ->
browser.get url, done
before (done) =>
wd40.getText 'body', (err, text) =>
@bodyText = text
done()
it 'tells me about th... | should = require 'should'
{wd40, browser} = require('../wd40')
url = 'http://localhost:3001'
describe 'Home page (not logged in)', ->
before (done) ->
wd40.init ->
browser.get url, done
before (done) =>
wd40.getText 'body', (err, text) =>
@bodyText = text
done()
it 'tells me about th... |
Allow markdown preview view to be scrolled with core:move-up/move-down | fs = require 'fs'
$ = require 'jquery'
ScrollView = require 'scroll-view'
{$$$} = require 'space-pen'
module.exports =
class MarkdownPreviewView extends ScrollView
registerDeserializer(this)
@deserialize: ({path}) ->
new MarkdownPreviewView(project.bufferForPath(path))
@content: ->
@div class: 'markdow... | fs = require 'fs'
$ = require 'jquery'
ScrollView = require 'scroll-view'
{$$$} = require 'space-pen'
module.exports =
class MarkdownPreviewView extends ScrollView
registerDeserializer(this)
@deserialize: ({path}) ->
new MarkdownPreviewView(project.bufferForPath(path))
@content: ->
@div class: 'markdow... |
Revert "CHECKPOINT re-implemented binarySearch using slices" |
{ isListAscending } = require './is-list-ascending.coffee'
_binarySearch = (sortedList, needle)->
return -1 if sortedList.length is 0
mid = Math.floor (sortedList.length / 2)
return mid if sortedList[mid] is needle
if sortedList[mid] > needle
return _binarySearch sortedList[0..mid - 1], needle
else
... |
{ isListAscending } = require './is-list-ascending.coffee'
_binarySearch = (sortedList, needle, start, end)->
return -1 if end < start
mid = Math.floor (start + ((end - start) / 2))
return mid if sortedList[mid] is needle
if sortedList[mid] > needle
return _binarySearch sortedList, needle, start, mid... |
Create two routers, one for the site and another for API responses | __doc__ = """
An application that provides a service for confirming mobile numbers
"""
koa = require 'koa'
gzip = require 'koa-gzip'
router = require 'koa-router'
formatApiErrors = require './response/formatApiErrors'
secret = require './secret'
# The server is implemented using Koa and generators. See http://koajs... | __doc__ = """
An application that provides a service for confirming mobile numbers
"""
koa = require 'koa'
gzip = require 'koa-gzip'
router = require 'koa-router'
formatApiErrors = require './response/formatApiErrors'
secret = require './secret'
# The server is implemented using Koa and generators. See http://koajs... |
Remove console log and don't open view on load | {CompositeDisposable} = require 'atom'
HistoryView = null
ChangesView = null
HISTORY_URI = 'atom://git-experiment/view-history'
CHANGES_URI = 'atom://git-experiment/view-changes'
module.exports = GitExperiment =
subscriptions: null
activate: (state) ->
# Events subscribed to in atom's system can be easily cl... | {CompositeDisposable} = require 'atom'
HistoryView = null
ChangesView = null
HISTORY_URI = 'atom://git-experiment/view-history'
CHANGES_URI = 'atom://git-experiment/view-changes'
module.exports = GitExperiment =
subscriptions: null
activate: (state) ->
# Events subscribed to in atom's system can be easily cl... |
Remove all backdrops when modal is hidden | ###
Copyright 2015 ppy Pty. Ltd.
This file is part of osu!web. osu!web is distributed with the hope of
attracting more community contributions to the core ecosystem of osu!.
osu!web is free software: you can redistribute it and/or modify
it under the terms of the Affero GNU General Public License as published by
the ... | ###
Copyright 2015 ppy Pty. Ltd.
This file is part of osu!web. osu!web is distributed with the hope of
attracting more community contributions to the core ecosystem of osu!.
osu!web is free software: you can redistribute it and/or modify
it under the terms of the Affero GNU General Public License as published by
the ... |
Add a method to check if the javascript is working. | #= require jquery.js
#= require bootstrap.js
#= require jquery_ujs
#= require jquery-ui.js
#= require jquery.cookie
#= require jquery.titlealert
#= require jquery.mousewheel
#= require jquery.expanding
#= require jquery.iframe-transport
#= require jquery.liveready
#= require jquery.resizestop
#= require simply-scroll
#... | #= require jquery.js
#= require bootstrap.js
#= require jquery_ujs
#= require jquery-ui.js
#= require jquery.cookie
#= require jquery.titlealert
#= require jquery.mousewheel
#= require jquery.expanding
#= require jquery.iframe-transport
#= require jquery.liveready
#= require jquery.resizestop
#= require simply-scroll
#... |
Use CourseGroupingLabel when referring to sections | _ = require 'underscore'
React = require 'react'
BS = require 'react-bootstrap'
DesktopImage = require './desktop-image'
BlankCourse = React.createClass
propTypes:
courseId: React.PropTypes.string
render: ->
<div className="blank-course">
<h3 className="title">
Welcome to your OpenStax Conc... | _ = require 'underscore'
React = require 'react'
BS = require 'react-bootstrap'
DesktopImage = require './desktop-image'
CourseGroupingLabel = require '../course-grouping-label'
BlankCourse = React.createClass
propTypes:
courseId: React.PropTypes.string
render: ->
<div className="blank-course">
<h3 ... |
Replace jQuery .live method by .on | # 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 () ->
$('.line a').live 'click', (event) ->
window.open $(this).att... | # 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 () ->
$('.line a').on 'click', (event) ->
window.open $(this).attr(... |
Fix starting mode when loading user profile page | ###
# Copyright 2015-2017 ppy Pty. Ltd.
#
# This file is part of osu!web. osu!web is distributed with the hope of
# attracting more community contributions to the core ecosystem of osu!.
#
# osu!web is free software: you can redistribute it and/or modify
# it under the terms of the Affero GNU General Pub... | ###
# Copyright 2015-2017 ppy Pty. Ltd.
#
# This file is part of osu!web. osu!web is distributed with the hope of
# attracting more community contributions to the core ecosystem of osu!.
#
# osu!web is free software: you can redistribute it and/or modify
# it under the terms of the Affero GNU General Pub... |
Remove named plugin from classroom | mongoose = require 'mongoose'
log = require 'winston'
config = require '../../server_config'
plugins = require '../plugins/plugins'
User = require '../users/User'
jsonSchema = require '../../app/schemas/models/classroom.schema'
ClassroomSchema = new mongoose.Schema {}, {strict: false, minimize: false, read:config.mong... | mongoose = require 'mongoose'
log = require 'winston'
config = require '../../server_config'
plugins = require '../plugins/plugins'
User = require '../users/User'
jsonSchema = require '../../app/schemas/models/classroom.schema'
ClassroomSchema = new mongoose.Schema {}, {strict: false, minimize: false, read:config.mong... |
Clear the session if a 403 occurs | Route = Ember.Route.extend
model: ->
# return the current user as the model if authenticated, otherwise a blank object
new Promise (resolve, reject) =>
promise = $.ajax
url: '/api/me'
dataType: 'json'
promise.done (result) =>
user = Ember.Object.create(result)
if re... | Route = Ember.Route.extend
model: ->
# return the current user as the model if authenticated, otherwise a blank object
new Promise (resolve, reject) =>
promise = $.ajax
url: '/api/me'
dataType: 'json'
promise.done (result) =>
user = Ember.Object.create(result)
if re... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.