Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Fix blank page if node by id was not found. | #= require routes/map.route
Wheelmap.PopupRoute = Wheelmap.MapRoute.extend
model: (params)->
@get('store').find('node', params.node_id)
setupController: (controller, model, queryParams)->
@_super(controller, model, queryParams)
@controllerFor('map').set('poppingNode', controller)
renderTemplate: (... | #= require routes/map.route
Wheelmap.PopupRoute = Wheelmap.MapRoute.extend
model: (params, queryParams)->
self = @
@get('store').find('node', params.node_id).then(null, ()->
# if node was not found
self.transitionTo('index')
)
setupController: (controller, model, queryParams)->
@_supe... |
Make root div inline-block as well | {View} = require 'atom'
# View to show the grammar name in the status bar.
module.exports =
class GrammarStatusView extends View
@content: ->
@div class: 'grammar-status', =>
@a href: '#', class: 'inline-block', outlet: 'grammarLink'
initialize: (@statusBar) ->
@subscribe @statusBar, 'active-buffer-... | {View} = require 'atom'
# View to show the grammar name in the status bar.
module.exports =
class GrammarStatusView extends View
@content: ->
@div class: 'grammar-status inline-block', =>
@a href: '#', class: 'inline-block', outlet: 'grammarLink'
initialize: (@statusBar) ->
@subscribe @statusBar, 'a... |
Fix incorrect watch path in grunt task | module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
meta:
banner: '/*! <%= pkg.name %> <%= pkg.version %> | (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %> | <%= pkg.license %> License */\n'
coffee:
compile:
... | module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
meta:
banner: '/*! <%= pkg.name %> <%= pkg.version %> | (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %> | <%= pkg.license %> License */\n'
coffee:
compile:
... |
Set attribute before doing anything with it | Backbone = require 'backbone'
Promise = require 'bluebird-q'
{ API_URL } = require('sharify').data
Channel = require '../../../../models/channel.coffee'
mediator = require '../../../../lib/mediator.coffee'
module.exports = class ConnectCreateView extends Backbone.View
className: 'Connect__create'
events:
clic... | Backbone = require 'backbone'
Promise = require 'bluebird-q'
{ API_URL } = require('sharify').data
Channel = require '../../../../models/channel.coffee'
mediator = require '../../../../lib/mediator.coffee'
module.exports = class ConnectCreateView extends Backbone.View
className: 'Connect__create'
events:
clic... |
Change Atom editor font size | "*":
core:
themes: [
"one-light-ui"
"solarized-dark-syntax"
]
editor:
fontSize: 15
"exception-reporting":
userId: "76d6bd0a-16fd-42b8-0163-bce5c8c7e379"
welcome:
showOnStartup: false
| "*":
core:
themes: [
"one-light-ui"
"solarized-dark-syntax"
]
editor:
fontSize: 16
"exception-reporting":
userId: "76d6bd0a-16fd-42b8-0163-bce5c8c7e379"
welcome:
showOnStartup: false
|
Make flash messages auto dismissible | #= require_self
#= require_tree .
window.Neighborly =
configs:
turbolinks: true
pjax: false
respond_with:
'Create': 'New'
'Update': 'Edit'
modules: -> []
initPage: ->
that = this
unless window.Turbolinks is undefined
$(document).bind "page:fetch", ->
that.Loading.s... | #= require_self
#= require_tree .
window.Neighborly =
configs:
turbolinks: true
pjax: false
respond_with:
'Create': 'New'
'Update': 'Edit'
modules: -> []
initPage: ->
unless window.Turbolinks is undefined
$(document).bind "page:fetch", =>
this.Loading.show()
$(d... |
Comment some code in app.Facebook. | goog.provide 'app.Facebook'
class app.Facebook
###*
@param {app.user.Store} userStore
@constructor
###
constructor: (@userStore) ->
###*
@type {Object}
@private
###
fb_: null
###*
Enable Facebook api.
###
init: ->
window.fbAsyncInit = =>
@fb_ = window.FB
@fb_.in... | goog.provide 'app.Facebook'
class app.Facebook
###*
@param {app.user.Store} userStore
@constructor
###
constructor: (@userStore) ->
###*
@type {Object}
@private
###
fb_: null
###*
Load Facebook api async.
###
init: ->
window.fbAsyncInit = =>
@fb_ = window.FB
@fb... |
Fix mdlint VS NodeJS >= 5 for Travis | module.exports = (grunt) ->
# =============================== Load plugins =============================== #
grunt.loadNpmTasks 'grunt-eslint'
grunt.loadNpmTasks 'grunt-travis-lint'
grunt.loadNpmTasks 'grunt-jsonlint'
grunt.loadNpmTasks 'grunt-coffeelint'
grunt.loadNpmTasks 'grunt-mdlint'
# ===============... | module.exports = (grunt) ->
# =============================== Load plugins =============================== #
grunt.loadNpmTasks 'grunt-eslint'
grunt.loadNpmTasks 'grunt-travis-lint'
grunt.loadNpmTasks 'grunt-jsonlint'
grunt.loadNpmTasks 'grunt-coffeelint'
grunt.loadNpmTasks 'grunt-mdlint'
# ===============... |
Fix datetimepicker call after plugin update | #= require jquery
#= require jquery_ujs
#= require jquery-fileupload/basic
#= require jquery-fileupload/vendor/tmpl
#= require attachments
#= require dropzone_effects
#= require bootstrap-sprockets
#= require moment
#= require moment/de
#= require bootstrap-datetimepicker
#= require marked.min
# http://github.com/t... | #= require jquery
#= require jquery_ujs
#= require jquery-fileupload/basic
#= require jquery-fileupload/vendor/tmpl
#= require attachments
#= require dropzone_effects
#= require bootstrap-sprockets
#= require moment
#= require moment/de
#= require bootstrap-datetimepicker
#= require marked.min
# http://github.com/t... |
Modify the DOM instead of setting the 'data' prop via jQuery to mark a section as 'progressive-loaded' | # TODO: API for load missing content or binding to page events
$ ->
setup_listener()
load_missing_content()
setup_listener = ->
$(document).on 'progressive_render:end', load_missing_content
$(document).on 'ajax:end', load_missing_content
$(document).on 'turbolinks:load', load_missing_content if window.Turbol... | # TODO: API for load missing content or binding to page events
$ ->
setup_listener()
load_missing_content()
setup_listener = ->
$(document).on 'progressive_render:end', load_missing_content
$(document).on 'ajax:end', load_missing_content
$(document).on 'turbolinks:load', load_missing_content if window.Turbol... |
Use singular type in InteractorsView | class InteractorEmptyView extends Backbone.Marionette.ItemView
tagName: 'span'
template: "fact_relations/interactor_empty"
class InteractorView extends Backbone.Marionette.Layout
tagName: 'span'
className: 'separator-list-item'
template: "fact_relations/interactor"
class window.InteractorsView extends Backb... | class InteractorEmptyView extends Backbone.Marionette.ItemView
tagName: 'span'
template: "fact_relations/interactor_empty"
class InteractorView extends Backbone.Marionette.Layout
tagName: 'span'
className: 'separator-list-item'
template: "fact_relations/interactor"
class window.InteractorsView extends Backb... |
Remove unnecesary space on coffeescript file | App.AdvancedSearch =
advanced_search_terms: ->
$('#js-advanced-search').data('advanced-search-terms')
toggle_form: (event) ->
event.preventDefault()
$('#js-advanced-search').slideToggle()
toggle_date_options: ->
if $('#js-advanced-search-date-min').val() == 'custom'
$('#js-custom-date').s... | App.AdvancedSearch =
advanced_search_terms: ->
$('#js-advanced-search').data('advanced-search-terms')
toggle_form: (event) ->
event.preventDefault()
$('#js-advanced-search').slideToggle()
toggle_date_options: ->
if $('#js-advanced-search-date-min').val() == 'custom'
$('#js-custom-date').s... |
Add scrollToFix for content bar in paper show page | ETahi.PaperIndexView = Ember.View.extend
setBackgroundColor:(->
$('html').addClass('matte')
).on('didInsertElement')
resetBackgroundColor:(->
$('html').removeClass('matte')
).on('willDestroyElement')
| ETahi.PaperIndexView = Ember.View.extend
setBackgroundColor:(->
$('html').addClass('matte')
).on('didInsertElement')
resetBackgroundColor:(->
$('html').removeClass('matte')
).on('willDestroyElement')
setupScrollFixing: (->
$('.control-bar').scrollToFixed()
$('#tahi-container > main > aside >... |
Fix the down motion to stop on last line | class Motion
constructor: (@editor) ->
isComplete: -> true
class MoveLeft extends Motion
execute: ->
{column, row} = @editor.getCursorScreenPosition()
@editor.moveCursorLeft() if column > 0
select: ->
{column, row} = @editor.getCursorScreenPosition()
if column > 0
@editor.selectLeft()
... | class Motion
constructor: (@editor) ->
isComplete: -> true
class MoveLeft extends Motion
execute: ->
{column, row} = @editor.getCursorScreenPosition()
@editor.moveCursorLeft() if column > 0
select: ->
{column, row} = @editor.getCursorScreenPosition()
if column > 0
@editor.selectLeft()
... |
Adjust logo property on change | SHARED_DATA = null
SHARED_COLLECTION = null
class Skr.Models.Location extends Skr.Models.Base
cacheDuration: [1, 'day']
mixins: [ 'FileSupport', 'HasCodeField' ]
props:
id: {type:"integer"}
code: {type:"code"}
name: {type:"string"}
address_id:... | SHARED_DATA = null
SHARED_COLLECTION = null
class Skr.Models.Location extends Skr.Models.Base
cacheDuration: [1, 'day']
mixins: [ 'FileSupport', 'HasCodeField' ]
props:
id: {type:"integer"}
code: {type:"code"}
name: {type:"string"}
address_id:... |
Speed up geyser by caching known element types. | geyser = do ->
parse = (spec) ->
dotIndex = spec.indexOf '.'
switch dotIndex
when -1
tag: spec
when 0
tag: 'div'
classes: split (spec.substr 1), '.'
else
tokens = split spec, '.'
tag: tokens.shift()
classes: tokens
generate = (arg) ->
co... | geyser = do ->
_cache = {}
parse = (spec) ->
dotIndex = spec.indexOf '.'
switch dotIndex
when -1
tag: spec
when 0
tag: 'div'
classes: split (spec.substr 1), '.'
else
tokens = split spec, '.'
tag: tokens.shift()
classes: tokens
getEleme... |
Fix missing import, resolves Sentry 4041 | React = require "react/addons"
classNames = require 'classnames'
{RetinaImg} = require 'nylas-component-kit'
{Actions, FocusedContentStore} = require "nylas-exports"
class DraftDeleteButton extends React.Component
@displayName: 'DraftDeleteButton'
@containerRequired: false
@propTypes:
selection: React.PropT... | React = require "react/addons"
classNames = require 'classnames'
{RetinaImg} = require 'nylas-component-kit'
{Actions, FocusedContentStore, DestroyDraftTask} = require "nylas-exports"
class DraftDeleteButton extends React.Component
@displayName: 'DraftDeleteButton'
@containerRequired: false
@propTypes:
sele... |
Add authentication controller to routes | express = require 'express'
bodyParser = require 'body-parser'
errorHandler = require 'errorhandler'
meshbluHealthcheck = require 'express-meshblu-healthcheck'
morgan = require 'morgan'
MessagesController = require './src/controllers/messages-controller'
messagesController = new Me... | bodyParser = require 'body-parser'
errorHandler = require 'errorhandler'
express = require 'express'
meshbluHealthcheck = require 'express-meshblu-healthcheck'
morgan = require 'morgan'
AuthenticateController = require './src/controllers/authenticate-controller'
MessagesController ... |
Convert to the newer unit test methodology. | {expect} = require "chai"
utils = require "../../utils"
{Collections} = utils.require "base"
describe "step_interpolator_transform module", ->
source = {start: 0, end: 10}
target = {start: 20, end: 80}
generate_jitter = ->
Collections("Jitter").create
width: 1
center: 0
distribution: 'uni... | {expect} = require "chai"
utils = require "../../utils"
{Collections} = utils.require "base"
Jitter = utils.require("models/transforms/jitter_transform").Model
describe "step_interpolator_transform module", ->
source = {start: 0, end: 10}
target = {start: 20, end: 80}
generate_jitter = ->
new Jitter({
... |
Simplify setting lastOpened serialized value | _ = require 'underscore'
module.exports =
projectPaths: null
fuzzyFinderView: null
loadPathsTask: null
activate: (state) ->
rootView.command 'fuzzy-finder:toggle-file-finder', =>
@createView().toggleFileFinder()
rootView.command 'fuzzy-finder:toggle-buffer-finder', =>
@createView().toggleB... | _ = require 'underscore'
module.exports =
projectPaths: null
fuzzyFinderView: null
loadPathsTask: null
activate: (state) ->
rootView.command 'fuzzy-finder:toggle-file-finder', =>
@createView().toggleFileFinder()
rootView.command 'fuzzy-finder:toggle-buffer-finder', =>
@createView().toggleB... |
Change font size in atom | "*":
"atom-beautify":
general:
_analyticsUserId: "016f8b6e-eda5-4d72-acc8-57bcde20fdff"
core:
autoHideMenuBar: true
disabledPackages: [
"exception-reporting"
"linter-perl"
"perltidy"
]
projectHome: "/home/caramelomartins/Projects"
themes: [
"nucleus-dark-ui"
... | "*":
"atom-beautify":
general:
_analyticsUserId: "016f8b6e-eda5-4d72-acc8-57bcde20fdff"
core:
autoHideMenuBar: true
disabledPackages: [
"exception-reporting"
"linter-perl"
"perltidy"
]
projectHome: "/home/caramelomartins/Projects"
themes: [
"nucleus-dark-ui"
... |
Use ide.$http, rather than jquery | define [
], () ->
class LabelsMaster
constructor: (@ide, @$scope) ->
@_state = {
documents: {}
}
@$scope.$on 'doc:labels:updated', (e, data) =>
if data.docId and data.labels
@_state.documents[data.docId] = data.labels
@$scope.$on 'entity:deleted', (e, entity) =>
if entity.type == 'doc... | define [
], () ->
class LabelsMaster
constructor: (@ide, @$scope) ->
@_state = {
documents: {}
}
@$scope.$on 'doc:labels:updated', (e, data) =>
if data.docId and data.labels
@_state.documents[data.docId] = data.labels
@$scope.$on 'entity:deleted', (e, entity) =>
if entity.type == 'doc... |
Use our correct template syntax | class window.ExtendedFactTitleView extends Backbone.Marionette.Layout
tagName: "header"
id: "single-factlink-header"
template: "facts/_extended_fact_title"
events:
"click .back-to-profile": "navigateToProfile"
regions:
creatorProfileRegion: ".created_by_region"
onRender: ->
@creatorProfileRe... | class window.ExtendedFactTitleView extends Backbone.Marionette.Layout
tagName: "header"
id: "single-factlink-header"
template: "facts/extended_fact_title"
events:
"click .back-to-profile": "navigateToProfile"
regions:
creatorProfileRegion: ".created_by_region"
onRender: ->
@creatorProfileReg... |
Add post author to prepopulated reply mentions | TentStatus.Views.PostReplyForm = class PostReplyFormView extends TentStatus.Views.NewPostForm
@template_name: '_post_reply_form'
@view_name: 'post_reply_form'
is_reply_form: true
constructor: ->
super
toggle: =>
if @visible
@hide()
else
@show()
hide: =>
@visible = false
D... | TentStatus.Views.PostReplyForm = class PostReplyFormView extends TentStatus.Views.NewPostForm
@template_name: '_post_reply_form'
@view_name: 'post_reply_form'
is_reply_form: true
constructor: ->
super
toggle: =>
if @visible
@hide()
else
@show()
hide: =>
@visible = false
D... |
Add italic to html container editor | init = ->
$("[data-provider='summernote']").summernote
height: 300
maximumImageFileSize: 262144 # 256KB
$(document).ready(init)
| init = ->
$("[data-provider='summernote']").summernote
height: 300
maximumImageFileSize: 262144 # 256KB
toolbar: [
['style', ['style']],
['font', ['bold', 'italic', 'underline', 'clear']],
['fontname', ['fontname']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
... |
Allow arrays as param lists in | vm = require 'vm'
exports.allowUnsafeEval = (fn) ->
previousEval = global.eval
try
global.eval = (source) -> vm.runInThisContext(source)
fn()
finally
global.eval = previousEval
exports.allowUnsafeNewFunction = (fn) ->
previousFunction = global.Function
try
global.Function = exports.Function
... | vm = require 'vm'
exports.allowUnsafeEval = (fn) ->
previousEval = global.eval
try
global.eval = (source) -> vm.runInThisContext(source)
fn()
finally
global.eval = previousEval
exports.allowUnsafeNewFunction = (fn) ->
previousFunction = global.Function
try
global.Function = exports.Function
... |
Revert "re-run tests on changes in site.js" | module.exports = (config) ->
config.set
basePath: ''
frameworks: [ 'jasmine' ]
files: [
'public/vendor/zepto-1.1.4.js'
'public/site.js'
'spec/**/*.coffee'
]
exclude: []
preprocessors: {
'**/*.coffee': ['coffee']
}
reporters: [ 'progress' ]
port: 9876
col... | module.exports = (config) ->
config.set
basePath: ''
frameworks: [ 'jasmine' ]
files: [
'public/vendor/zepto-1.1.4.js'
'spec/**/*.coffee'
]
exclude: []
preprocessors: {
'**/*.coffee': ['coffee']
}
reporters: [ 'progress' ]
port: 9876
colors: true
logLevel:... |
Simplify the code that initializes process.env.PATH | path = require "path"
latexmk = require "./latexmk"
module.exports =
configDefaults:
texPath: "$PATH:/usr/texbin"
outputDirectory: ""
enableShellEscape: false
activate: ->
@initialize()
atom.workspaceView.command "latex:build", => @build()
initialize: ->
envPath = process.env.PATH
t... | path = require "path"
latexmk = require "./latexmk"
module.exports =
configDefaults:
texPath: "$PATH:/usr/texbin"
outputDirectory: ""
enableShellEscape: false
activate: ->
@initialize()
atom.workspaceView.command "latex:build", => @build()
initialize: ->
atom.config.observe "latex.texPa... |
Use a common beforeEach in TransactionManager tests | r = require('require-root')('generic-dht')
TransactionManager = r 'src/transactions/TransactionManager'
describe 'TransactionManager', ()->
beforeEach ()->
@responseCb = jasmine.createSpy 'responseCb'
@errorCb = jasmine.createSpy 'errorCb'
@manager = new TransactionManager @responseCb, @errorCb
it 's... | r = require('require-root')('generic-dht')
TransactionManager = r 'src/transactions/TransactionManager'
describe 'TransactionManager', ()->
commonBeforeEach = ()->
@responseCb = jasmine.createSpy 'responseCb'
@errorCb = jasmine.createSpy 'errorCb'
@manager = new TransactionManager @responseCb, @errorCb
... |
Remove h1 from CKEDITOR format_tags | window.Tahi ||= {}
class Tahi.RichEditableElement
constructor: (@element) ->
@instance = CKEDITOR.inline @element,
extraPlugins: 'sharedspace'
removePlugins: 'floatingspace,resize'
sharedSpaces:
top: 'toolbar'
toolbar: [
[ 'Format' ]
[ 'Bold', 'Italic', 'Underline'... | window.Tahi ||= {}
class Tahi.RichEditableElement
constructor: (@element) ->
@instance = CKEDITOR.inline @element,
extraPlugins: 'sharedspace'
removePlugins: 'floatingspace,resize'
sharedSpaces:
top: 'toolbar'
toolbar: [
[ 'Format' ]
[ 'Bold', 'Italic', 'Underline'... |
Fix infinite scroll for pages w/ query string params already on them | $ ->
# Don't run on non-video pages
return if not $('.videos').length
# $(window).sausage({page: '.video'
# , content: (i, page) ->
# '<span class="sausage-span">' + (i + 1) + ". " + page.find('.date').html() + '</span>'
# })
every = (milliseconds, callback) => setInterval callback, milliseconds
nearB... | $ ->
# Don't run on non-video pages
return if not $('.videos').length
# $(window).sausage({page: '.video'
# , content: (i, page) ->
# '<span class="sausage-span">' + (i + 1) + ". " + page.find('.date').html() + '</span>'
# })
every = (milliseconds, callback) => setInterval callback, milliseconds
nearB... |
Use the official parentData method to access parents data | Template.instancesOfProcurementForm.events
"click .add-instance-of-procurement": -> @instancesOfProcurementCollection.insert {}
Template.instancesOfProcurementForm.helpers
"iop": -> @instancesOfProcurementCollection.find()
Template.instancesOfProcurementForm.created = ->
collection = @data.instancesOfProc... | Template.instancesOfProcurementForm.events
"click .add-instance-of-procurement": -> @instancesOfProcurementCollection.insert {}
Template.instancesOfProcurementForm.helpers
"iop": -> @instancesOfProcurementCollection.find()
Template.instancesOfProcurementForm.created = ->
collection = @data.instancesOfProc... |
Disable language-sql atom built-in package | "*":
core:
audioBeep: false
closeEmptyWindows: false
disabledPackages: [
"language-clojure"
"language-go"
"language-java"
"language-perl"
"language-objective-c"
"language-property-list"
"metrics"
"open-on-github"
"package-generator"
"symbols-view... | "*":
core:
audioBeep: false
closeEmptyWindows: false
disabledPackages: [
"language-clojure"
"language-go"
"language-java"
"language-perl"
"language-objective-c"
"language-property-list"
"metrics"
"open-on-github"
"package-generator"
"symbols-view... |
Disable representatives job for now. | # Copyright 2013 Matt Farmer
#
# 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
#
# Unless required by applicable law or agreed to in... | # Copyright 2013 Matt Farmer
#
# 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
#
# Unless required by applicable law or agreed to in... |
Refactor loading of order responses | Sprangular.service "Orders", ($http) ->
service =
find: (number) ->
$http.get("/api/orders/#{number}")
.then (response) ->
Sprangular.extend(response.data, Sprangular.Order)
all: ->
$http.get("/api/orders")
.then (response) ->
Sprangular.extend(response.data, ... | Sprangular.service "Orders", ($http) ->
service =
find: (number) ->
$http.get("/api/orders/#{number}")
.then (response) ->
service._loadOrder(response.data)
all: ->
$http.get("/api/orders")
.then (response) ->
_.map response.data, (record) ->
servi... |
Store the version available for update. | {CompositeDisposable} = require 'atom'
AboutView = null
StatusBarView = null
aboutURI = 'atom://about'
createAboutView = (state) ->
AboutView ?= require './about-view'
new AboutView(state)
atom.deserializers.add
name: 'AboutView'
deserialize: (state) -> createAboutView(state)
module.exports = About =
act... | {CompositeDisposable} = require 'atom'
AboutView = null
StatusBarView = null
# The local storage key for the available update version.
AvailableUpdateVersion = 'about:version-available'
aboutURI = 'atom://about'
createAboutView = (state) ->
AboutView ?= require './about-view'
new AboutView(state)
atom.deserial... |
Fix UpdateOnSignInOrOutMixin so it doesn't trigger forceUpdate when impossible | window.UpdateOnSignInOrOutMixin =
componentDidMount: ->
window.currentSession.user().on 'change:username', (-> @forceUpdate()), @
componentWillUnmount: ->
window.currentSession.user().off null, null, @
| window.UpdateOnSignInOrOutMixin =
componentDidMount: ->
window.currentSession.user().on 'change:username', ( ->
if @isMounted()
@forceUpdate()
), @
componentWillUnmount: ->
window.currentSession.user().off null, null, @
|
Make it possible to prefix routes. | ModelEmitter = require './model-emitter'
Route = require './route'
class App extends ModelEmitter
constructor: (state = {}) ->
super
@_routes = {}
@views = []
addRoute: (path, cb) ->
unless (route = @_routes[path])?
route = new Route path
route.callbacks ?= []
route.callbac... | ModelEmitter = require './model-emitter'
Route = require './route'
class App extends ModelEmitter
prefix: ''
constructor: (state = {}) ->
super
@_routes = {}
@views = []
addRoute: (path, cb) ->
unless (route = @_routes[path])?
route = new Route @prefix + path
route.callbacks... |
Improve look of issues display | {$$, EditorView, View} = require 'atom'
marked = require 'marked'
module.exports =
class GitIssueView extends View
@content: ->
@div =>
@h1 'GitHub Issues'
@ul()
constructor: (opt) ->
super
{@issues} = opt
issueList = @issues
.sort (a,b) -> +a.number - +b.number
.map (issue... | {$$, EditorView, View} = require 'atom'
marked = require 'marked'
_ = require 'lodash'
module.exports =
class GitIssueView extends View
@content: ->
@section 'class':'padded pane-item', =>
@h1 'class':'section-heading', 'GitHub Issues'
@div 'data-element':'issue-list'
constructor: (opt={}) ->
... |
Refactor sidebar own machine list class definition | kd = require 'kd'
globals = require 'globals'
KDCustomHTMLView = kd.CustomHTMLView
EnvironmentsModal = require 'app/environment/environmentsmodal'
SidebarMachineList = require './sidebarmachinelist'
module.exports = class SidebarOwnMachinesList extends SidebarMachineList
constructor:... | kd = require 'kd'
KDCustomHTMLView = kd.CustomHTMLView
SidebarMachineList = require './sidebarmachinelist'
curryIn = require 'app/util/curryIn'
module.exports = class SidebarOwnMachinesList extends SidebarMachineList
constructor: (options = {}, data) ->
options.title ?= 'Your ... |
Enforce more validations on linter and messages | {Range} = require('atom')
helpers = require('./helpers')
module.exports = Validate =
linter: (linter) ->
# set undefined to false for backward compatibility
linter.modifiesBuffer = Boolean(linter.modifiesBuffer)
unless linter.grammarScopes instanceof Array
throw new Error("grammarScopes is not an ... | {Range} = require('atom')
helpers = require('./helpers')
module.exports = Validate =
linter: (linter) ->
# set undefined to false for backward compatibility
linter.modifiesBuffer = Boolean(linter.modifiesBuffer)
unless linter.grammarScopes instanceof Array
throw new Error("grammarScopes is not an ... |
Make left dive into diff view | '.workspace':
'ctrl-9': 'github:toggle-git-panel'
'ctrl-(': 'github:toggle-git-panel-focus' # ctrl-shift-9
'.github-Panel':
'cmd-enter': 'github:commit'
'ctrl-enter': 'github:commit'
'.github-StagingView':
'left': 'github:focus-diff-view'
'tab': 'core:focus-next'
'shift-tab': 'core:focus-previous'
'.gi... | '.workspace':
'ctrl-9': 'github:toggle-git-panel'
'ctrl-(': 'github:toggle-git-panel-focus' # ctrl-shift-9
'.github-Panel':
'cmd-enter': 'github:commit'
'ctrl-enter': 'github:commit'
'.github-StagingView':
'tab': 'core:focus-next'
'shift-tab': 'core:focus-previous'
'.github-CommitView-editor atom-text-ed... |
Switch Crystal beautifier to using Executables | ###
Requires https://github.com/jaspervdj/stylish-haskell
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Crystal extends Beautifier
name: "Crystal"
link: "http://crystal-lang.org"
isPreInstalled: false
options: {
Crystal: false
}
beautify: (text, language, options) ->
... | ###
Requires https://github.com/jaspervdj/stylish-haskell
###
"use strict"
Beautifier = require('./beautifier')
module.exports = class Crystal extends Beautifier
name: "Crystal"
link: "http://crystal-lang.org"
executables: [
{
name: "Crystal"
cmd: "crystal"
homepage: "http://crystal-lang.o... |
Make the markdown a bit more customizable with h1, h2, and div | Backbone = require 'backbone'
sd = require('sharify').data
{ Markdown } = require 'artsy-backbone-mixins'
insane = require('insane')
_ = require 'underscore'
module.exports = class Page extends Backbone.Model
_.extend @prototype, Markdown
urlRoot: "#{sd.API_URL}/api/v1/page"
sanitizedHtml: (attr) ->
clean... | Backbone = require 'backbone'
sd = require('sharify').data
{ Markdown } = require 'artsy-backbone-mixins'
insane = require('insane')
_ = require 'underscore'
module.exports = class Page extends Backbone.Model
_.extend @prototype, Markdown
urlRoot: "#{sd.API_URL}/api/v1/page"
sanitizedHtml: (attr) ->
clean... |
Fix slider breakage after navigation | ###
# 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 version ... | ###
# 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 version ... |
Enhance pattern-type test with more assertions on cases of invalid patterns | describe 'error of incorrect pattern type when', ->
it 'is not an Object or Array', ->
a.throws (-> ss 'foobar'), 'Error: Given argument type String ("foobar") is incompatible with parameter type PlainObject.'
| describe 'error of incorrect pattern type', ->
it 'when arg is not a PlainObject', ->
a.throws (-> ss 'foobar'), 'Error: Given argument type String ("foobar") is incompatible with parameter type PlainObject.'
a.throws (-> ss /blah/), 'Error: Given argument type Object ({}) is incompatible with parameter type... |
Include comma 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 SpellChecke... | 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 SpellCheck... |
Use node by default; don't depend on coffee. | {exec} = require 'child_process'
path = require 'path'
fs = require 'fs'
REFRESH_RATE = 500 # in msecs
RUN_PATH = path.join __dirname, "run_test.coffee"
seen = {} # cache of file names
shouldRun = true # if a change in file was detected
canRun = true # if tests are... | {exec} = require 'child_process'
path = require 'path'
fs = require 'fs'
REFRESH_RATE = 500 # in msecs
EXECUTE_WITH = "node"
RUN_PATH = path.join __dirname, "run_test.js"
unless path.exists RUN_PATH
EXECUTE_WITH = "coffee"
RUN_PATH = path.join __dirname, "run_test.coffee"
seen = {} ... |
Add other page fields to preview functionality | #= require jquery
#= require jquery_ujs
#= require foundation
#= require ace/ace
#= require ace/theme-monokai
#= require ace/mode-coffee
#= require ace/mode-handlebars
#= require ace/mode-yaml
#= require ace/mode-haml
#= require tinymce-jquery
#= require_directory .
#= require_self
$ ->
$(document).foundation()
co... | #= require jquery
#= require jquery_ujs
#= require foundation
#= require ace/ace
#= require ace/theme-monokai
#= require ace/mode-coffee
#= require ace/mode-handlebars
#= require ace/mode-yaml
#= require ace/mode-haml
#= require tinymce-jquery
#= require_directory .
#= require_self
$ ->
$(document).foundation()
co... |
Fix settings javascript for Firefox compatibility | # 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/
$(document).ready ->
$(".new").hide()
$(".view-option").show()
$(".edit-option").hide()
$(".options"... | # 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/
$(document).ready ->
$(".new").hide()
$(".view-option").show()
$(".edit-option").hide()
$(".options"... |
Add message poller and users poller to state data | App.IndexRoute = App.AuthenticatedRoute.extend
setupController: (controller, model)->
stateData = {}
stateIds = []
activeState = null
# Loop thru all room states
# find the first joined room to load
# start pollers for all joined rooms
model.forEach (item)=>
stateId = item.get... | App.IndexRoute = App.AuthenticatedRoute.extend
setupController: (controller, model)->
stateData = {}
stateIds = []
activeState = null
# Loop thru all room states
# find the first joined room to load
# start pollers for all joined rooms
model.forEach (item)=>
stateId = item.get... |
Move class loading after window.onload to show splash quickly | ###
Top module for Rubic (for Chrome App)
###
# Compatibility modules
require("compat/es7compat")
require("compat/bbjscompat")
# UI helpers
require("ui/bootbox-promise")
# Load main controller
require("controller/windowcontroller") # Needed to solve circular dependency
$(->
# Controller must be initiated after ... | ###
Top module for Rubic (for Chrome App)
###
# Compatibility modules
require("compat/es7compat")
require("compat/bbjscompat")
# UI helpers
require("ui/bootbox-promise")
$(->
require("app/preferences").initCache().then(->
# WindowController should be loaded before MainController
# to solve circular depen... |
Use the date object instead of a param | # Description:
# Hubot enforces the correct time to talk about lunch.
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# lunch -> Isn't it a little early to be talking about lunch?
#
#
# Author:
# arosenb2
module.exports = (robot) ->
robot.hear /lunch/i, (msg) ->
if ! isPastLunchTime() ... | # Description:
# Hubot enforces the correct time to talk about lunch.
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# lunch -> Isn't it a little early to be talking about lunch?
#
#
# Author:
# arosenb2
module.exports = (robot) ->
robot.hear /lunch/i, (msg) ->
if ! isPastLunchTime() ... |
Update default config by specifying its type | {CompositeDisposable} = require 'atom'
module.exports =
configDefaults:
directory: 'testdata'
notationalVelocityView: null
activate: (state) ->
# Events subscribed to in atom's system can be easily cleaned up with a
# CompositeDisposable
@subscriptions = new CompositeDisposable
# Register ... | {CompositeDisposable} = require 'atom'
module.exports =
config:
directory:
type: 'string'
default: 'testdata'
notationalVelocityView: null
activate: (state) ->
# Events subscribed to in atom's system can be easily cleaned up with a
# CompositeDisposable
@subscriptions = new Composit... |
Use subarrays as browsers (chrome at least) don't support slice. | # Gets added by gulp build.
# base64 = require 'base64binary'
uint8ArrayToInt = (arr) ->
len = arr.length
return 0 if len == 0
return arr[len-1] + (uint8ArrayToInt(arr[...len-1]) << 8)
validate = (key) ->
# See http://crypto.stackexchange.com/a/5948.
key = key.replace(/\r?\n/g, '')
key = /AAAAB3NzaC1yc2E[A-Za-... | # Gets added by gulp build.
# base64 = require 'base64binary'
uint8ArrayToInt = (arr) ->
len = arr.length
return 0 if len == 0
return arr[len-1] + (uint8ArrayToInt(arr.subarray(0, len-1)) << 8)
validate = (key) ->
# See http://crypto.stackexchange.com/a/5948.
key = key.replace(/\r?\n/g, '')
key = /AAAAB3NzaC1y... |
Apply email sanitization procedure to emails from all domains except koding.com | sanitize = (email, options = {}) ->
email = email.trim().toLowerCase()
return switch
when checkGmail email then sanitizeGmail email, options
else email
sanitizeGmail = (email, options = {}) ->
options.excludeDots or= no
options.excludePlus or= no
[local, host] = email.split '@'
[username, ... | sanitize = (email, options = {}) ->
options.excludeDots or= no
options.excludePlus or= no
[local, host] = email.split '@'
[username, label...] = local.split '+'
label = label.join '+'
# . have no meaning, they're being abused to create fake accounts
username = excludeDots username if options.excl... |
Fix using Javascript reserved keyword | # Initializers
$ ->
# jQuery datepickers (also evaluates dynamically added HTML)
$(document).on 'focus', '.datepicker:not(.hasDatepicker)', ->
defaults = dateFormat: 'yy-mm-dd'
options = $(@).data 'datepicker-options'
$(@).datepicker $.extend(defaults, options)
# Clear Filters button
$('.clear_filt... | # Initializers
$ ->
# jQuery datepickers (also evaluates dynamically added HTML)
$(document).on 'focus', '.datepicker:not(.hasDatepicker)', ->
defaults = dateFormat: 'yy-mm-dd'
options = $(@).data 'datepicker-options'
$(@).datepicker $.extend(defaults, options)
# Clear Filters button
$('.clear_filt... |
Use __dirname to make sure the relative path is relative to where we expect. | Promise = require 'bluebird'
fs = Promise.promisifyAll require 'fs'
os = require 'os'
crypto = require 'crypto'
# Parses the output of /proc/cpuinfo to find the "Serial : 710abf21" line
# or the hostname if there isn't a serial number (when run in dev mode)
# The uuid is the SHA1 hash of that value.
exports.getDeviceU... | Promise = require 'bluebird'
fs = Promise.promisifyAll require 'fs'
os = require 'os'
crypto = require 'crypto'
# Parses the output of /proc/cpuinfo to find the "Serial : 710abf21" line
# or the hostname if there isn't a serial number (when run in dev mode)
# The uuid is the SHA1 hash of that value.
exports.getDeviceU... |
Update comments in source file | ###
jquery.turbolinks.js ~ v0.1.0 ~ https://github.com/kossnocorp/jquery.turbolinks
jQuery plugin for rebind events problem caused by Tubrolinks
The MIT License
Copyright (c) 2012 Sasha Koss
###
$ = require?('jquery') || window.jQuery
callbacks = []
ready = ->
callback() for callback in callbacks
$(rea... | ###
jquery.turbolinks.js ~ v0.1.0 ~ https://github.com/kossnocorp/jquery.turbolinks
jQuery plugin for drop-in fix binded events problem caused by Turbolinks
The MIT License
Copyright (c) 2012 Sasha Koss
###
$ = require?('jquery') || window.jQuery
# List for store callbacks passed to `$` or `$.ready`
callba... |
Add logging when receiving crashes | # Notifies about Crashlytics crashes via a Crashlytics web hook
#
# Dependencies:
# "url": ""
# "querystring": ""
#
# Configuration:
# Just put this url <HUBOT_URL>:<PORT>/hubot/jenkins-notify?room=<room> to your Jenkins
# Notification config. See here: https://wiki.jenkins-ci.org/display/JENKINS/Notification+P... | # Notifies about Crashlytics crashes via a Crashlytics web hook
#
# Dependencies:
# "url": ""
# "querystring": ""
#
# Configuration:
# Just put this url <HUBOT_URL>:<PORT>/hubot/jenkins-notify?room=<room> to your Jenkins
# Notification config. See here: https://wiki.jenkins-ci.org/display/JENKINS/Notification+P... |
Implement delete button for queries in the QueryList | define [
'underscore'
'marionette'
'../base'
'tpl!templates/query/item.html'
], (_, Marionette, base, templates...) ->
templates = _.object ['item'], templates
class EmptyQueryItem extends base.EmptyView
icon: false
message: 'You have not yet created any queries or have had an... | define [
'underscore'
'marionette'
'../base'
'tpl!templates/query/item.html'
], (_, Marionette, base, templates...) ->
templates = _.object ['item'], templates
class EmptyQueryItem extends base.EmptyView
icon: false
message: 'You have not yet created any queries or have had an... |
Fix ROC domains to (0, 1) | H2O.PredictOutput = (_, _go, prediction) ->
{ frame, model } = prediction
_plots = signals []
renderPlot = (title, render) ->
container = signal null
render (error, vis) ->
if error
debug error
else
container vis.element
_plots.push title: title, plot: container
swit... | H2O.PredictOutput = (_, _go, prediction) ->
{ frame, model } = prediction
_plots = signals []
renderPlot = (title, render) ->
container = signal null
render (error, vis) ->
if error
debug error
else
container vis.element
_plots.push title: title, plot: container
swit... |
Use cnx host/port settings to create search uri | define (require) ->
Backbone = require('backbone')
SEARCH_URI = "#{location.protocol}//#{location.hostname}:6543/search"
return class SearchResults extends Backbone.Model
url: () -> "#{SEARCH_URI}#{@query}"
defaults:
query:
limits: []
sort: []
results:
items: []
... | define (require) ->
Backbone = require('backbone')
settings = require('cs!settings')
SEARCH_URI = "#{location.protocol}//#{settings.cnxarchive.host}:#{settings.cnxarchive.port}/search"
return class SearchResults extends Backbone.Model
url: () -> "#{SEARCH_URI}#{@query}"
defaults:
query:
... |
Use minim to add warning about unrecognized format | deckardcain = require('deckardcain')
fury = require('fury')
fury.use(require('fury-adapter-apib-parser'))
fury.use(require('fury-adapter-swagger'))
apiElementsToJson = require('./api-elements-to-json')
createAnnotation = (message, type) ->
{
element: 'annotation'
meta: {classes: [type]}
content: messag... | deckardcain = require('deckardcain')
fury = require('fury')
fury.use(require('fury-adapter-apib-parser'))
fury.use(require('fury-adapter-swagger'))
apiElementsToJson = require('./api-elements-to-json')
createWarning = (message) ->
annotation = new fury.minim.elements.Annotation(message)
annotation.classes.push('... |
Make all edit session uri's relative | fsUtils = require 'fs-utils'
path = require 'path'
_ = require 'underscore'
archive = require 'ls-archive'
File = require 'file'
module.exports=
class ArchiveEditSession
registerDeserializer(this)
@activate: ->
Project = require 'project'
Project.registerOpener (filePath) ->
new ArchiveEditSession(f... | fsUtils = require 'fs-utils'
path = require 'path'
_ = require 'underscore'
archive = require 'ls-archive'
File = require 'file'
module.exports=
class ArchiveEditSession
registerDeserializer(this)
@activate: ->
Project = require 'project'
Project.registerOpener (filePath) ->
new ArchiveEditSession(f... |
Increase SavesDelayed debounce to 200ms. | ETahi.SavesDelayed = Ember.Mixin.create
saveInFlight: false
saveDelayed: ->
Ember.run.debounce(@, @saveModel, 100)
saveModel: ->
unless @get('saveInFlight')
@set('saveInFlight', true)
@get('model').save().then =>
@set('saveInFlight', false)
actions:
saveModel: ->
@saveDe... | ETahi.SavesDelayed = Ember.Mixin.create
saveInFlight: false
saveDelayed: ->
Ember.run.debounce(@, @saveModel, 200)
saveModel: ->
unless @get('saveInFlight')
@set('saveInFlight', true)
@get('model').save().then =>
@set('saveInFlight', false)
actions:
saveModel: ->
@saveDe... |
Remove unneeded initialization of variable from superclass | {$$} = require 'space-pen'
SelectList = require 'select-list'
$ = require 'jquery'
_ = require 'underscore'
module.exports =
class CommandPaletteView extends SelectList
@activate: ->
new CommandPaletteView
@viewClass: ->
"#{super} command-palette overlay from-top"
filterKey: 'eventDescription'
previ... | {$$} = require 'space-pen'
SelectList = require 'select-list'
$ = require 'jquery'
_ = require 'underscore'
module.exports =
class CommandPaletteView extends SelectList
@activate: ->
new CommandPaletteView
@viewClass: ->
"#{super} command-palette overlay from-top"
filterKey: 'eventDescription'
keyBi... |
Return null from OpenURL.execute() to reduce output size | _ = require "underscore"
Util = require "../util/util"
HasProperties = require "../common/has_properties"
class OpenURL extends HasProperties
type: 'OpenURL'
execute: (data_source) ->
selected = data_source.get("selected")
if selected['0d'].flag
indices = selected['0d'].indices
else if selected[... | _ = require "underscore"
Util = require "../util/util"
HasProperties = require "../common/has_properties"
class OpenURL extends HasProperties
type: 'OpenURL'
execute: (data_source) ->
selected = data_source.get("selected")
if selected['0d'].flag
indices = selected['0d'].indices
else if selected[... |
Fix delete button on sub comments | window.ReactSubComment = React.createBackboneClass
displayName: 'ReactSubComment'
propTypes:
fact_opinionators: React.PropTypes.instanceOf(Opinionators).isRequired
model: React.PropTypes.instanceOf(SubComment).isRequired
_save: ->
@model().saveWithState()
_content_tag: ->
if @model().get('form... | window.ReactSubComment = React.createBackboneClass
displayName: 'ReactSubComment'
propTypes:
fact_opinionators: React.PropTypes.instanceOf(Opinionators).isRequired
model: React.PropTypes.instanceOf(SubComment).isRequired
_save: ->
@model().saveWithState()
_content_tag: ->
if @model().get('form... |
Hide vcs-ignored files in Atom | "*":
"autocomplete-python":
useKite: false
core:
disabledPackages: [
"metrics"
"linter-python-pep8"
]
telemetryConsent: "no"
themes: [
"one-dark-ui"
"monokai"
]
editor:
fontSize: 11
scrollPastEnd: true
showIndentGuide: true
showInvisibles: true
s... | "*":
"autocomplete-python":
useKite: false
core:
disabledPackages: [
"metrics"
"linter-python-pep8"
]
telemetryConsent: "no"
themes: [
"one-dark-ui"
"monokai"
]
editor:
fontSize: 11
scrollPastEnd: true
showIndentGuide: true
showInvisibles: true
s... |
Use cookies for callback instead of session | passport = require 'passport'
debug = require('debug')('meshblu-google-authenticator:routes')
url = require 'url'
class Router
constructor: (@app) ->
register: =>
@app.get '/', (request, response) => response.status(200).send status: 'online'
@app.get '/login', @storeCallbackUrl, passport.authenticate '... | passport = require 'passport'
debug = require('debug')('meshblu-google-authenticator:routes')
url = require 'url'
class Router
constructor: (@app) ->
register: =>
@app.get '/', (request, response) => response.status(200).send status: 'online'
@app.get '/login', @storeCallbackUrl, passport.authenticate '... |
Remove trailing slashes and HTML file extension from prettyfied URLs | require [
"handlebars"
], (
Handlebars
) ->
helpers =
highlightMatches: (match) ->
result = match.wrap (match) ->
"<span class=\"match\">#{match}</span>"
new Handlebars.SafeString result
prettyUrl: (url) ->
url.replace /^((http|https):\/\/)?(www.)?/, ""
Handlebars.registerHe... | require [
"handlebars"
], (
Handlebars
) ->
helpers =
highlightMatches: (match) ->
result = match.wrap (match) ->
"<span class=\"match\">#{match}</span>"
new Handlebars.SafeString result
prettyUrl: (url) ->
url.replace(/^((http|https):\/\/)?(www.)?/, "")
.replace(/\/$/... |
Refactor virtual pageview spec to have a setup function | //= require analytics/virtual_pageview
describe 'VirtualPageview', ->
element = null
describe 'given "data-virtual-pageview" anchor link', ->
beforeEach ->
element = $('<body>' +
'<a id="a_link" data-virtual-pageview="/top-3-search-result" href="https://peoplefinder.service.gov.uk/people/john-s... | //= require analytics/virtual_pageview
describe 'VirtualPageview', ->
element = null
describe 'given "data-virtual-pageview" anchor link', ->
setUpPage = (page_url) ->
element = $('<body>' +
'<a id="a_link" data-virtual-pageview="' + page_url + '" href="https://peoplefinder.service.gov.uk/peopl... |
Use addObject instead of pushObject. | ETahi.ControllerParticipants = Ember.Mixin.create
needs: ['application']
currentUser: Ember.computed.alias('controllers.application.currentUser')
allUsers: (->
paperId = @get('paper.id') || @get('litePaper.id')
DS.PromiseObject.create
promise: $.getJSON("/filtered_users/collaborators/#{paperId}")
... | ETahi.ControllerParticipants = Ember.Mixin.create
needs: ['application']
currentUser: Ember.computed.alias('controllers.application.currentUser')
allUsers: (->
paperId = @get('paper.id') || @get('litePaper.id')
DS.PromiseObject.create
promise: $.getJSON("/filtered_users/collaborators/#{paperId}")
... |
Make animation duration much shorter | # 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 ->
$this = $(this)
starting_point = 0
$targe... | # 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 ->
$this = $(this)
starting_point = 0
$targe... |
Switch to preview after drag and drop | {
namespace,
utils,
jQuery: $,
templates: {tpl}
} = uploadcare
{dragdrop} = uploadcare.widget
namespace 'uploadcare.widget.tabs', (ns) ->
class ns.FileTab extends ns.BaseSourceTab
constructor: ->
super
@wrap.append tpl 'tab-file', {avalibleTabs: @dialogApi.avalibleTabs}
@wrap.on 'cl... | {
namespace,
utils,
jQuery: $,
templates: {tpl}
} = uploadcare
{dragdrop} = uploadcare.widget
namespace 'uploadcare.widget.tabs', (ns) ->
class ns.FileTab extends ns.BaseSourceTab
constructor: ->
super
@wrap.append tpl 'tab-file', {avalibleTabs: @dialogApi.avalibleTabs}
@wrap.on 'cl... |
Use the users name in the auto complete box | #= require ../auto_complete/search_list_view
class AutoCompleteSearchUserView extends Backbone.Factlink.StepView
tagName: "li"
template: "auto_complete/search_item"
templateHelpers: ->
query = @options.query
highlightedTitle: -> highlightTextInTextAsHtml(query, @username)
onRender: ->
@$el.addC... | #= require ../auto_complete/search_list_view
class AutoCompleteSearchUserView extends Backbone.Factlink.StepView
tagName: "li"
template: "auto_complete/search_item"
templateHelpers: ->
query = @options.query
highlightedTitle: -> highlightTextInTextAsHtml(query, @name)
onRender: ->
@$el.addClass... |
Fix menu canvas & navigation render in visualization-story | Visualization = require './visualization.js'
class VisualizationStory extends Visualization
# Override onSync method to set Visualization Canvas offset x & use render(false)
onSync: =>
# Setup visualization parameters
@parameters = $.parseJSON @visualization.get('parameters')
@setupParameters()
# ... | Visualization = require './visualization.js'
class VisualizationStory extends Visualization
# Override onSync method to set Visualization Canvas offset x & use render(false)
onSync: =>
# Setup visualization parameters
@parameters = $.parseJSON @visualization.get('parameters')
@setupParameters()
# ... |
Change dependency module of student-project to project-viewer | angular.module('doubtfire.projects', [
'doubtfire.projects.states'
'doubtfire.projects.student-project'
'doubtfire.projects.project-lab-list'
'doubtfire.projects.project-outcome-alignment'
'doubtfire.projects.project-portfolio-wizard'
'doubtfire.projects.project-progress-dashboard'
])
| angular.module('doubtfire.projects', [
'doubtfire.projects.states'
'doubtfire.projects.project-viewer'
'doubtfire.projects.project-lab-list'
'doubtfire.projects.project-outcome-alignment'
'doubtfire.projects.project-portfolio-wizard'
'doubtfire.projects.project-progress-dashboard'
])
|
Use an alert instead of the access_denied template | Router.configure
layoutTemplate: "layout"
loadingTemplate: "loading"
waitOn: ->
if Meteor.user()
Meteor.subscribe "patients"
else
ready: -> true
Router.map ->
@route "home",
path: "/"
template: "home"
@route "admin",
path: "/admin"
... | Router.configure
layoutTemplate: "layout"
loadingTemplate: "loading"
waitOn: ->
if Meteor.user()
Meteor.subscribe "patients"
else
ready: -> true
Router.map ->
@route "home",
path: "/"
template: "home"
@route "admin",
path: "/admin"
... |
Fix casing on JSON folder paths | module.exports = (grunt) ->
grunt.initConfig
clean:
test: ['tmp']
semverCopy:
inlineObject:
resources:
name: "inlineResource"
range: "~1.1"
parentDirectory: "./test/fixtures/MyResource"
dest: 'tmp/inlineResource'
inlineObjects:
resources: [
{
name: "inlineResourcesA... | module.exports = (grunt) ->
grunt.initConfig
clean:
test: ['tmp']
semverCopy:
inlineObject:
resources:
name: "inlineResource"
range: "~1.1"
parentDirectory: "./test/fixtures/MyResource"
dest: 'tmp/inlineResource'
inlineObjects:
resources: [
{
name: "inlineResourcesA... |
Add Grunt task to reset stuff | fs = require 'fs'
path = require 'path'
Mocha = require 'mocha'
module.exports = (grunt) ->
# Project configuration.
grunt.initConfig
mocha:
db:
src: ['test/db/*.coffee']
default:
src: ['test/*.coffee']
coffee:
default:
files: [
expand: true # E... | fs = require 'fs'
path = require 'path'
Mocha = require 'mocha'
exec = require('child_process').exec
module.exports = (grunt) ->
# Project configuration.
grunt.initConfig
mocha:
db:
src: ['test/db/*.coffee']
default:
src: ['test/*.coffee']
coffee:
default:
files:... |
Rename tag prefix to 'context-cnxmod' | React = require 'react'
MultiInput = require './multi-input'
CnxModTag = React.createClass
propTypes:
exerciseId: React.PropTypes.string.isRequired
validateInput: (value) ->
'Must match CNX module ID (without version number)' unless value.match(
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-... | React = require 'react'
MultiInput = require './multi-input'
CnxModTag = React.createClass
propTypes:
exerciseId: React.PropTypes.string.isRequired
validateInput: (value) ->
'Must match CNX module ID (without version number)' unless value.match(
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-... |
Check screen width before increasing max position | class @LayoutNav
$ ->
$('#scrolling-tabs').on 'scroll', ->
currentPosition = $(this).scrollLeft()
return if currentPosition == 0
if $('.nav-control').length
maxPosition = $(this)[0].scrollWidth - $(this).parent().width() + 59
else
maxPosition = $(this)[0].scrollWidth - $(th... | class @LayoutNav
$ ->
$('#scrolling-tabs').on 'scroll', ->
currentPosition = $(this).scrollLeft()
return if currentPosition == 0
maxPosition = $(this)[0].scrollWidth - $(this).parent().width()
maxPosition += 59 if $('.nav-control').length and window.innerWidth > 480
$('.fade-out').t... |
Adjust code to attach event handler at body, not document level | define ["t5/core/dom", "t5/core/events", "underscore"],
(dom, events, _) ->
dom.onDocument events.palette.willChange, (event, memo) ->
values = _.map memo.selectedOptions, (o) -> o.value
(dom "event-selection").update JSON.stringify values
(dom "event-reorder").update memo.reorder.toString() | define ["t5/core/dom", "t5/core/events", "underscore", "t5/core/console"],
(dom, events, _, console) ->
dom.body.on events.palette.willChange, (event, memo) ->
console.info "palette-demo, palette willChange"
values = _.map memo.selectedOptions, (o) -> o.value
(dom "event-selection").update J... |
Fix nanobar updates when there is no nanobar. | #= require nanobar.js
class @PodsProgressBar
update: (factor) ->
progress = factor * 100
@nanobar.go(progress)
start: ->
$container = $('.progress-container').empty()
@nanobar = new Nanobar
target: $container.get(0)
id: 'pods-progress'
| #= require nanobar.js
class @PodsProgressBar
update: (factor) ->
progress = factor * 100
if @nanobar
@nanobar.go(progress)
start: ->
$container = $('.progress-container').empty()
@nanobar = new Nanobar
target: $container.get(0)
id: 'pods-progress'
|
Fix scrollTo in results summary links | SearchResults = React.createClass
scrollTo: (event)->
console.log(event)
window.scrollTo(0,$("activities_bookmark").offsetTop)
render: ->
message = (@props.results.map (group)-> `<span>{group.pagination.total_items} <GenericLink link={{url: 'javascript:void(0)', onclick: this.scrollTo, text: group.hea... | SearchResults = React.createClass
generateScrollTo: (type)->
return (event)->
window.scrollTo(0,$("#{type}_bookmark").offsetTop)
render: ->
message = @props.results.map (group)=>
link = {url: 'javascript:void(0)', onclick: @generateScrollTo(group.type), text: group.header, className: ''}
... |
Set propTypes and add key to ExerciseStep | React = require 'react'
_ = require 'underscore'
tasks = require './collection'
{ExerciseStep} = require '../exercise'
{ExerciseButton} = require '../buttons'
TaskReview = React.createClass
displayName: 'TaskReview'
getInitialState: ->
@getSteps(@props)
componentWillMount: ->
{collectionUUID, moduleUUI... | React = require 'react'
_ = require 'underscore'
tasks = require './collection'
{ExerciseStep} = require '../exercise'
{ExerciseButton} = require '../buttons'
TaskReview = React.createClass
displayName: 'TaskReview'
propTypes:
moduleUUID: React.PropTypes.string.isRequired
collectionUUID: React.PropTy... |
Fix page's title in club and tags | define [
"chaplin"
"models/posts"
"views/posts"
], (Chaplin, Posts, PostsView) ->
"use strict"
class PostsController extends Chaplin.Controller
show: (params) ->
id = params.id
if params.isClub
query = club: params.club
else if params.isTag
query = tag: params.tag
... | define [
"chaplin"
"models/posts"
"views/posts"
], (Chaplin, Posts, PostsView) ->
"use strict"
class PostsController extends Chaplin.Controller
show: (params) ->
id = params.id
if params.isClub
query = club: params.club
params.title = "!#{params.club}"
else if params.is... |
Revert "Compare deltaY instead of "normalized" delta" | #= require jquery.mousewheel
shouldUseNativeBehaviour = ($el) ->
# We explicitly only want a scrollbar when there is something to scroll (overflow-y: auto),
# but there isn't anything to scroll
$el.css('overflow-y') == 'auto' && $el[0].scrollHeight <= $el.innerHeight()
shouldPreventScroll = ($el, deltaY) ->
#... | #= require jquery.mousewheel
shouldUseNativeBehaviour = ($el) ->
# We explicitly only want a scrollbar when there is something to scroll (overflow-y: auto),
# but there isn't anything to scroll
$el.css('overflow-y') == 'auto' && $el[0].scrollHeight <= $el.innerHeight()
shouldPreventScroll = ($el, delta) ->
# ... |
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... |
Replace on ajax:sucess triggers replace:success | $(document).on 'ajax:success', '[data-replace-self-on-ajax-success]', (event, data, status, xhr) ->
$(this).replaceWith(data)
$.fancybox.update()
| $(document).on 'ajax:success', '[data-replace-self-on-ajax-success]', (event, data, status, xhr) ->
newEl = $(data)
$(this).replaceWith(newEl)
newEl.trigger('replace:success')
|
Remove unused $scope attributes from Checkout controller | Sprangular.controller 'CheckoutCtrl', (
$scope,
$location,
countries,
order,
Status,
Account,
Cart,
Checkout,
Angularytics,
Env,
$translate
) ->
Status.setPageTitle('checkout.checkout')
user = Account.user
$scope.countries = countries
$scope.order = order
$scope.processing = false
$s... | Sprangular.controller 'CheckoutCtrl', (
$scope,
$location,
countries,
order,
Status,
Account,
Cart,
Checkout,
Angularytics,
Env,
$translate
) ->
Status.setPageTitle('checkout.checkout')
user = Account.user
$scope.order = order
$scope.secure = $location.protocol() == 'https'
$scope.curr... |
Add bootsrap.js to SearchView dependencies. | define ['jquery', 'underscore', 'backbone'], ($, _, Backbone) ->
class SearchView extends Backbone.View
el: $('#search')
events:
'submit form': 'searchRoute'
typeaheadOptions:
source: (query, process) ->
params = $.param { query: query }
$.getJSON "/autocomplete?#{params}", ... | define ['jquery', 'underscore', 'backbone', 'bootstrap'], ($, _, Backbone) ->
class SearchView extends Backbone.View
el: $('#search')
events:
'submit form': 'searchRoute'
typeaheadOptions:
source: (query, process) ->
params = $.param { query: query }
$.getJSON "/autocomplete... |
Comment symbol to allow toggling comments | '.source.haskell':
'editor':
'increaseIndentPattern': '((^.*(=|\\bdo|\\bwhere|\\bthen|\\belse|\\bof)\\s*$)|(^.*\\bif(?!.*\\bthen\\b.*\\belse\\b.*).*$))'
'decreaseIndentPattern': '^\\s*$'
| '.source.haskell':
'editor':
'commentStart': '-- '
'increaseIndentPattern': '((^.*(=|\\bdo|\\bwhere|\\bthen|\\belse|\\bof)\\s*$)|(^.*\\bif(?!.*\\bthen\\b.*\\belse\\b.*).*$))'
'decreaseIndentPattern': '^\\s*$'
|
Add redirect in main route | `import Ember from 'ember'`
Application = Ember.Route.extend
setupController: (controller, model)->
controller.set('current_user', @store.find('user', 'me'))
`export default Application`
| `import Ember from 'ember'`
Application = Ember.Route.extend
setupController: (controller, model)->
controller.set('current_user', @store.find('user', 'me'))
redirect: ->
@transitionTo('projects')
`export default Application`
|
Make new tasks appear at the top of the list. | angular.module('todoApp').controller "TodoListController", ($scope, Task) ->
$scope.init = (taskListId) ->
@taskService = new Task(taskListId)
$scope.tasks = @taskService.all()
$scope.addTask = ->
task = description: $scope.taskDescription
$scope.tasks.push(task)
@taskService.create(task)
| angular.module('todoApp').controller "TodoListController", ($scope, Task) ->
$scope.init = (taskListId) ->
@taskService = new Task(taskListId)
$scope.tasks = @taskService.all()
$scope.addTask = ->
task = description: $scope.taskDescription
$scope.tasks.unshift(task)
@taskService.create(task)
|
Make "original-fs" available as built-in module | return (process, require, asarSource) ->
{createArchive} = process.binding 'atom_common_asar'
# Make asar.coffee accessible via "require".
process.binding('natives').ATOM_SHELL_ASAR = asarSource
# Monkey-patch the fs module.
require('ATOM_SHELL_ASAR').wrapFsWithAsar require('fs')
# Make graceful-fs work ... | return (process, require, asarSource) ->
{createArchive} = process.binding 'atom_common_asar'
# Make asar.coffee accessible via "require".
process.binding('natives').ATOM_SHELL_ASAR = asarSource
# Monkey-patch the fs module.
require('ATOM_SHELL_ASAR').wrapFsWithAsar require('fs')
# Make graceful-fs work ... |
Truncate title for blocks and channels | module.exports =
"""
query user($id: ID! $per: Int, $page: Int, $perBlocks: Int, $q: String) {
user(id: $id) {
contents(per: $per, type: "channel", page: $page, q: $q) {
title
updated_at(relative: true)
user {
name
}
kind {
__typename
... | module.exports =
"""
query user($id: ID! $per: Int, $page: Int, $perBlocks: Int, $q: String, $sort: SearchSorts, $seed: Int) {
user(id: $id) {
contents(per: $per, type: "channel", page: $page, q: $q, sort_by: $sort, seed: $seed) {
title(truncate: 50)
updated_at(relative: true)
us... |
Disable background-tips, exception reporting and metrics plugins, cleanup | "*":
editor:
fontFamily: "PragmataPro"
showInvisibles: true
showIndentGuide: true
invisibles: {}
fontSize: 16
core:
disabledPackages: [
"autocomplete"
"spell-check"
]
projectHome: "/home/edgard/Documents/code"
themes: [
"one-dark-ui"
"one-dark-syntax"
... | "*":
editor:
fontFamily: "PragmataPro"
showInvisibles: true
showIndentGuide: true
invisibles: {}
fontSize: 16
core:
disabledPackages: [
"autocomplete"
"spell-check"
"background-tips"
"exception-reporting"
"metrics"
]
projectHome: "/home/edgard/Documents/... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.