Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Check that file exists before opening | path = require 'path'
url = require 'url'
{allowUnsafeNewFunction} = require 'loophole'
archive = allowUnsafeNewFunction -> require 'ls-archive'
{File} = require 'pathwatcher'
fs = require 'fs-plus'
Serializable = require 'serializable'
module.exports=
class ArchiveEditor extends Serializable
atom.deserializers.add... | path = require 'path'
url = require 'url'
{allowUnsafeNewFunction} = require 'loophole'
archive = allowUnsafeNewFunction -> require 'ls-archive'
{File} = require 'pathwatcher'
fs = require 'fs-plus'
Serializable = require 'serializable'
module.exports=
class ArchiveEditor extends Serializable
atom.deserializers.add... |
Use the recommended requestInterceptor, preFetch was deprecated. | //= require swagger-ui-dist
$ ->
options = $(".swagger").data("swagger-options")
ui = SwaggerUIBundle({
url: options.api_docs_url,
dom_id: "#swagger-ui",
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.p... | //= require swagger-ui-dist
$ ->
options = $(".swagger").data("swagger-options")
ui = SwaggerUIBundle({
url: options.api_docs_url,
dom_id: "#swagger-ui",
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.p... |
Fix debounce on variant search dropdown | angular.module("admin.utils").directive "variantAutocomplete", ($timeout) ->
restrict: 'C'
link: (scope, element, attrs) ->
$timeout ->
if $("#variant_autocomplete_template").length > 0
variantTemplate = Handlebars.compile($("#variant_autocomplete_template").text())
if Spree.routes
... | angular.module("admin.utils").directive "variantAutocomplete", ($timeout) ->
restrict: 'C'
link: (scope, element, attrs) ->
$timeout ->
if $("#variant_autocomplete_template").length > 0
variantTemplate = Handlebars.compile($("#variant_autocomplete_template").text())
if Spree.routes
... |
Update text to match new wording | {Testing, expect, sinon, _, ReactTestUtils} = require 'shared/specs/helpers'
{Coach} = require 'concept-coach/coach'
{CCModal} = require 'concept-coach/modal'
describe 'Coach wrapper component', ->
beforeEach ->
@props =
open: false
displayLauncher: true
moduleUUID: 'm_uuid'
collection... | {Testing, expect, sinon, _, ReactTestUtils} = require 'shared/specs/helpers'
{Coach} = require 'concept-coach/coach'
{CCModal} = require 'concept-coach/modal'
describe 'Coach wrapper component', ->
beforeEach ->
@props =
open: false
displayLauncher: true
moduleUUID: 'm_uuid'
collection... |
Fix nested example path in test | assert = require 'assert'
should = require 'should'
peg = require 'pegjs'
fs = require 'fs'
requirejs = require('requirejs')
requirejs.config nodeRequire: require
brain = new (requirejs 'dist/lib/geekywalletlib.js')
grammar = fs.readFileSync 'lib/syntax/grammar.peg', 'utf8'
parser = peg.buildParser grammar
wallet = fs... | assert = require 'assert'
should = require 'should'
peg = require 'pegjs'
fs = require 'fs'
requirejs = require('requirejs')
requirejs.config nodeRequire: require
brain = new (requirejs 'dist/lib/geekywalletlib.js')
grammar = fs.readFileSync 'lib/syntax/grammar.peg', 'utf8'
parser = peg.buildParser grammar
wallet = fs... |
Fix legacy trial expired modal | shownToGroup = {}
angular.module('loomioApp').factory 'LegacyTrialExpiredModal', (ModalService, AppConfig, AhoyService) ->
appropriateToShow: (group, user) ->
user.isAdminOf(group) and group.showLegacyTrialExpiredModal
# !shownToGroup[group.id] and
# AppConfig.chargify? and
# group.hasNoSubscription... | shownToGroup = {}
angular.module('loomioApp').factory 'LegacyTrialExpiredModal', (ModalService, AppConfig, AhoyService) ->
appropriateToShow: (group, user) ->
user.isAdminOf(group) and group.showLegacyTrialExpiredModal
# !shownToGroup[group.id] and
# AppConfig.chargify? and
# group.hasNoSubscription... |
Fix country selection bug on address checkout step | window.MultiShippingAddress ||= {}
$.extend(MultiShippingAddress, { SameAsBilling: {} })
class MultiShippingAddress.SameAsBilling.CopyBillToShip
constructor: (@$form) ->
@findShippingAddresses()
@bindForm()
billAddress: null
shippingAddresses: []
getName: ($input) ->
$input.attr('name').match(/.*... | window.MultiShippingAddress ||= {}
$.extend(MultiShippingAddress, { SameAsBilling: {} })
class MultiShippingAddress.SameAsBilling.CopyBillToShip
constructor: (@$form) ->
@findShippingAddresses()
@bindForm()
@bindCountrySelects()
billAddress: null
shippingAddresses: []
getName: ($input) ->
$in... |
Use task refresh on extension success | angular.module('doubtfire.projects.states.dashboard.directives.task-dashboard.directives.task-status-card', [])
#
# Status of the card
#
.directive('taskStatusCard', ->
restrict: 'E'
templateUrl: 'projects/states/dashboard/directives/task-dashboard/directives/task-status-card/task-status-card.tpl.html'
scope:
... | angular.module('doubtfire.projects.states.dashboard.directives.task-dashboard.directives.task-status-card', [])
#
# Status of the card
#
.directive('taskStatusCard', ->
restrict: 'E'
templateUrl: 'projects/states/dashboard/directives/task-dashboard/directives/task-status-card/task-status-card.tpl.html'
scope:
... |
Fix Bug With Reducing Qualities | class Quality
constructor: (@id, @name, @description, @defaultValue,
@defaultProgress, @maxProgress, @progressEscalation,
@visible) ->
Object.freeze @
increase: (whole, partial) ->
levelUp = () =>
@value++
@maxProgress += @maxProgress * @progressEscalation
... | class Quality
constructor: (@id, @name, @description, @defaultValue,
@defaultProgress, @defaultMaxProgress, @progressEscalation,
@visible) ->
Object.freeze @
increase: (whole, partial) ->
up = 1
down = -1
level = (direction) =>
@value += direction
@maxPro... |
Add pdf-view to Atom package list | packages: [
"advanced-open-file"
"atom-alignment"
"atom-beautify"
"atom-transpose"
"change-case"
"color-picker"
"docblockr"
"editorconfig"
"emmet"
"expand-region"
"git-blame"
"language-apache"
"language-applescript"
"language-awk"
"language-babel"
"language-diff"
"language-env"
"lang... | packages: [
"advanced-open-file"
"atom-alignment"
"atom-beautify"
"atom-transpose"
"change-case"
"color-picker"
"docblockr"
"editorconfig"
"emmet"
"expand-region"
"git-blame"
"language-apache"
"language-applescript"
"language-awk"
"language-babel"
"language-diff"
"language-env"
"lang... |
Add toggle-quotes package to Atom | packages: [
"auto-indent"
"git-blame"
"git-diff-popup"
"git-plus"
"merge-conflicts"
"package-sync"
"ruby-test"
]
| packages: [
"auto-indent"
"git-blame"
"git-diff-popup"
"git-plus"
"merge-conflicts"
"package-sync"
"ruby-test"
"toggle-quotes"
]
|
Use jquery to send ajax request | Q = require 'q'
class NCN
constructor: (@host = '') -> return
request = (method, url, data) ->
deferred = Q.defer()
x = new XMLHttpRequest()
x.responseType = 'json'
x.addEventListener 'load', () -> deferred.resolve x.response
x.addEventListener 'error', () -> deferred.reject x
x.open('metho... | Bacon = require 'bacon'
$ = require 'jquery'
class NCN
constructor: (@host = '') ->
request = (method) -> (path, data) ->
Bacon.fromPromise(
$.ajax @host + path,
data: data
type: method
dataType: 'json')
get: request 'GET'
post: request 'POST'
delete: request 'DELETE'
put:... |
Allow error action to bubble if not a 403 | `import BaseRoute from './_base'`
`import ajax from 'ic-ajax'`
Route = BaseRoute.extend
model: ->
mePath = '/api/me'
# return the current user as the model if authenticated, otherwise a blank object
new Ember.RSVP.Promise (resolve, reject) =>
ajax
url: mePath
dataType: 'json'
... | `import BaseRoute from './_base'`
`import ajax from 'ic-ajax'`
Route = BaseRoute.extend
model: ->
mePath = '/api/me'
# return the current user as the model if authenticated, otherwise a blank object
new Ember.RSVP.Promise (resolve, reject) =>
ajax
url: mePath
dataType: 'json'
... |
Add message for visitors from Flatterline. | resize = () ->
screenWidth = $(window).width() + "px"
screenHeight = $(window).height() + "px"
$("#intro, #intro .item, #intro-video, #intro-video .item").css
width: screenWidth
height: screenHeight
$ ->
resize()
$(window).resize resize
| resize = () ->
screenWidth = $(window).width() + "px"
screenHeight = $(window).height() + "px"
$("#intro, #intro .item, #intro-video, #intro-video .item").css
width: screenWidth
height: screenHeight
$ ->
resize()
$(window).resize resize
if document.referrer.match /flatterline/i
$('#intro .he... |
Simplify by porting to Process API | noflo = require 'noflo'
findHandler = (actionParts, routes) ->
normalized = routes.map (route) ->
if route.indexOf('*') is -1
# No wildcards here
return route
routeParts = route.split ':'
for part, idx in routeParts
continue unless part is '*'
continue unless actionParts[idx]
... | noflo = require 'noflo'
findHandler = (actionParts, routes) ->
normalized = routes.map (route) ->
if route.indexOf('*') is -1
# No wildcards here
return route
routeParts = route.split ':'
for part, idx in routeParts
continue unless part is '*'
continue unless actionParts[idx]
... |
Update campfire to work with the new request method | NotificationPlugin = require "../../notification-plugin"
class Campfire extends NotificationPlugin
@receiveEvent: (config, event) ->
# Build the message
if event.error
message = "#{event.error.exceptionClass}" + (if event.error.message then ": #{event.error.message}" else "") + " (#{event.error.url})"
... | NotificationPlugin = require "../../notification-plugin"
class Campfire extends NotificationPlugin
@receiveEvent: (config, event) ->
# Build the message
if event.error
message = "#{event.error.exceptionClass}" + (if event.error.message then ": #{event.error.message}" else "") + " (#{event.error.url})"
... |
Add Way to Enumerate Qualities | class Quality
constructor: (@name, @description, @defaultValue, @defaultProgress, @maxProgress) ->
angular.module 'qbn.quality', ['qbn.state']
.factory 'qualityLibrary', (makeGameState) ->
library = {}
api =
register: (id, name, options) ->
quality = Object.freeze new Quality()
librar... | class Quality
constructor: (@name, @description, @defaultValue, @defaultProgress, @maxProgress) ->
angular.module 'qbn.quality', ['qbn.state']
.factory 'qualityLibrary', (makeGameState) ->
library = {}
api =
register: (id, name, options) ->
quality = Object.freeze new Quality()
librar... |
Add required activate method to avoid logging during specs | module.exports =
configDefaults:
numbers: { one: 1, two: 2 }
| module.exports =
configDefaults:
numbers: { one: 1, two: 2 }
activate: -> # no-op
|
Fix layout when extending RouteController | ################################################################################
# Client-side Config
#
Voltage =
settings:
defaultTemplate: 'voltagePage'
config: (appConfig) ->
@settings = _.extend(@settings, appConfig)
render: (router) ->
router.render 'voltageBlank'
router.render 'voltagePa... | ################################################################################
# Client-side Config
#
Voltage =
settings:
defaultTemplate: 'voltagePage'
config: (appConfig) ->
@settings = _.extend(@settings, appConfig)
render: (router) ->
router.render 'voltageBlank'
router.template = 'volta... |
Remove commented code from Gquery | class @Gquery extends Backbone.Model
initialize : ->
window.gqueries.add(this)
@references = 1
future_value: -> @get('future')
present_value: -> @get 'present'
safe_present_value: =>
x = @present_value()
# if @get('key') == 'chp_heat_and_electricity_from_wet_biomass'
# return (if @is_acc... | class @Gquery extends Backbone.Model
initialize : ->
window.gqueries.add(this)
@references = 1
future_value: -> @get('future')
present_value: -> @get 'present'
safe_present_value: =>
x = @present_value()
if @is_acceptable_value(x) then x else 0
safe_future_value: =>
x = @future_value()
... |
Add test to pass through the message if min is not set | ReturnValue = require 'nanocyte-component-return-value'
PassThroughIfLengthGreaterThanMin = require '../src/pass-through-if-length-greater-than-min'
describe 'PassThroughIfLengthGreaterThanMin', ->
beforeEach ->
@sut = new PassThroughIfLengthGreaterThanMin
it 'should exist', ->
expect(@sut).to.be.an.insta... | ReturnValue = require 'nanocyte-component-return-value'
PassThroughIfLengthGreaterThanMin = require '../src/pass-through-if-length-greater-than-min'
describe 'PassThroughIfLengthGreaterThanMin', ->
beforeEach ->
@sut = new PassThroughIfLengthGreaterThanMin
it 'should exist', ->
expect(@sut).to.be.an.insta... |
Remove use of Function::bind in specs | describe "Bacon.once", ->
describe "should send single event and end", ->
expectStreamEvents(
-> Bacon.once("pow")
["pow"])
describe "accepts an Error event as parameter", ->
expectStreamEvents(
-> Bacon.once(new Bacon.Error("oop"))
[error()])
describe "Allows wrapped events, for i... | describe "Bacon.once", ->
describe "should send single event and end", ->
expectStreamEvents(
-> Bacon.once("pow")
["pow"])
describe "accepts an Error event as parameter", ->
expectStreamEvents(
-> Bacon.once(new Bacon.Error("oop"))
[error()])
describe "Allows wrapped events, for i... |
Put text in header links | Controller = require 'zooniverse/controllers/base-controller'
class SiteHeader extends Controller
className: 'site-navigation'
template: require './templates/site-header'
elements:
'.site-links': 'linksContainer'
addNavLink: (href, label) ->
a = @linksContainer.append '<a></a>'
a.attr 'href', href... | Controller = require 'zooniverse/controllers/base-controller'
class SiteHeader extends Controller
className: 'site-navigation'
template: require './templates/site-header'
elements:
'.site-links': 'linksContainer'
addNavLink: (href, label) ->
@linksContainer.append "<a href='#{href}'>#{label}</a>"
mod... |
Move to native Javascript dates | Tasks = new Meteor.Collection("tasks")
Lists = new Meteor.Collection("lists")
Folders = new Meteor.Collection("folders")
if Meteor.isClient
Template.todos.tasks = ->
Tasks.find()
Template.todos.events
'click a.completeBox': (e) ->
now = moment()
Tasks.update this._id,
$set:
c... | Tasks = new Meteor.Collection("tasks")
Lists = new Meteor.Collection("lists")
Folders = new Meteor.Collection("folders")
if Meteor.isClient
Template.todos.tasks = ->
Tasks.find()
Template.todos.events
'click a.completeBox': (e) ->
now = new Date()
Tasks.update this._id,
$set:
... |
Add notational-velocity and space-underscore to package list | 'packages': [
'advanced-new-file'
'advanced-railscasts-syntax'
'atom-color-highlight'
'auto-copyright'
'autocomplete-paths'
'autocomplete-plus'
'autocomplete-snippets'
'block-travel'
'bug-report'
'file-type-icons'
'highlight-selected'
'indentation-indicator'
'language-generic-config'
'langua... | 'packages': [
'advanced-new-file'
'advanced-railscasts-syntax'
'atom-color-highlight'
'auto-copyright'
'block-travel'
'bug-report'
'file-type-icons'
'highlight-selected'
'indentation-indicator'
'language-generic-config'
'language-haml'
'language-r'
'language-swift'
'language-todotxt'
'lang... |
Remove spine require in dashboard | Spine = require('spine')
_ = require('underscore/underscore')
ToolWindow = require('controllers/ToolWindow')
class Dashboard extends Spine.Controller
constructor: ->
super
elements:
'.tools': 'workspace'
tools: []
channels: []
sources: ["GalaxyZooSubject", "SkyServerSubject"]
count: 0
ren... | _ = require('underscore/underscore')
ToolWindow = require('controllers/ToolWindow')
class Dashboard extends Spine.Controller
constructor: ->
super
elements:
'.tools': 'workspace'
tools: []
channels: []
sources: ["GalaxyZooSubject", "SkyServerSubject"]
count: 0
render: =>
@html require... |
Allow display of up to 1000 pending invitations | angular.module('loomioApp').directive 'pendingInvitationsCard', ->
scope: {group: '='}
restrict: 'E'
templateUrl: 'generated/components/memberships_page/pending_invitations_card/pending_invitations_card.html'
replace: true
controller: ($scope, CurrentUser, Records, ModalService, CancelInvitationForm, AppConfi... | angular.module('loomioApp').directive 'pendingInvitationsCard', ->
scope: {group: '='}
restrict: 'E'
templateUrl: 'generated/components/memberships_page/pending_invitations_card/pending_invitations_card.html'
replace: true
controller: ($scope, CurrentUser, Records, ModalService, CancelInvitationForm, AppConfi... |
Use span instead of array for killing warning | remote = require 'remote'
windowManager = remote.require './lib/window'
window.akashicRecordsWindow = null
initialAkashicRecordsWindow = ->
window.akashicRecordsWindow = windowManager.createWindow
x: config.get 'poi.window.x', 0
y: config.get 'poi.window.y', 0
width: 820
height: 650
window.akashicR... | remote = require 'remote'
windowManager = remote.require './lib/window'
window.akashicRecordsWindow = null
initialAkashicRecordsWindow = ->
window.akashicRecordsWindow = windowManager.createWindow
x: config.get 'poi.window.x', 0
y: config.get 'poi.window.y', 0
width: 820
height: 650
window.akashicR... |
Fix the isDev util function to work properly on prod | moment = require('lib/moment')
exports.isDev = (req) ->
# We are on DEV when Host has string like
# '/dev.' or '/staging.' or '.local' or '.dev' or 'localhost'
re = /(\/dev\.|\/staging\.|\.local$|\.dev$|localhost)/
return re.test(req.headers.Host)
exports.prettyDate = (date) ->
moment.utc(date).local().f... | moment = require('lib/moment')
exports.isDev = (req) ->
# We are on DEV when Host has string like
# 'dev.' or 'staging.' or '.local' or '.dev' or 'localhost'
re = /(^dev\.|^staging\.|\.local$|\.dev$|localhost)/
return re.test(req.headers.Host)
exports.prettyDate = (date) ->
moment.utc(date).local().forma... |
Apply small fix to prevent error of "sinceDate not found" | `import Ember from 'ember'`
DateableMixin = Ember.Mixin.create
# Method to check if something has happened in the last val*period
inLast: (field, val, period) ->
sinceDate(field,val, period, new Date())
# Method to check if something will happen in the next val*period
inNext: (field, val, period) ->
u... | `import Ember from 'ember'`
DateableMixin = Ember.Mixin.create
# Method to check if something has happened in the last val*period
inLast: (field, val, period) ->
@sinceDate(field,val, period, new Date())
# Method to check if something will happen in the next val*period
inNext: (field, val, period) ->
... |
Add Events for js methods | $ ->
$(document).off 'click', 'form .remove_fields'
$(document).off 'click', 'form .add_fields'
$(document).on 'click', 'form .remove_fields', (event) ->
$(this).prev('input[type=hidden]').val('1')
$(this).closest('.fields').hide()
event.preventDefault()
$(document).on 'click', 'form .add_fields... | $ ->
$(document).off 'click', 'form .remove_fields'
$(document).off 'click', 'form .add_fields'
$(document).on 'click', 'form .remove_fields', (event) ->
$(this).prev('input[type=hidden]').val('1')
$(this).closest('.fields').hide()
$(document).trigger('dynamicFieldsFor.remove', @)
event.preventDe... |
Uninstall linter-jshint in favor of linter-eslint | packages: [
"advanced-open-file"
"atom-alignment"
"atom-handlebars"
"auto-update-packages"
"docblockr"
"editorconfig"
"emmet"
"expand-region"
"language-apache"
"language-applescript"
"language-awk"
"language-env"
"language-gitattributes"
"language-gitignore"
"language-hosts"
"language-in... | packages: [
"advanced-open-file"
"atom-alignment"
"atom-handlebars"
"auto-update-packages"
"docblockr"
"editorconfig"
"emmet"
"expand-region"
"language-apache"
"language-applescript"
"language-awk"
"language-env"
"language-gitattributes"
"language-gitignore"
"language-hosts"
"language-in... |
Use fat arrow to access external context in CoffeeScript | Neighborly.Static ?= {}
Neighborly.Static.Learn =
init: Backbone.View.extend
el: '.learn-page'
initialize: ->
$('.expand-section').click (event) ->
that = this
event.preventDefault()
$(this).parents('.main-section').find('.section-content').slideToggle 500, ->
elem = ... | Neighborly.Static ?= {}
Neighborly.Static.Learn =
init: Backbone.View.extend
el: '.learn-page'
initialize: ->
$('.expand-section').click (event) ->
event.preventDefault()
$(this).parents('.main-section').find('.section-content').slideToggle 500, =>
elem = $(this).find('.expan... |
Allow packages to provide multiple file-icon classes | {CompositeDisposable} = require 'event-kit'
FileIcons = require './file-icons'
module.exports =
class FileView extends HTMLElement
initialize: (@file) ->
@subscriptions = new CompositeDisposable()
@subscriptions.add @file.onDidDestroy => @subscriptions.dispose()
@draggable = true
@classList.add('fi... | {CompositeDisposable} = require 'event-kit'
FileIcons = require './file-icons'
module.exports =
class FileView extends HTMLElement
initialize: (@file) ->
@subscriptions = new CompositeDisposable()
@subscriptions.add @file.onDidDestroy => @subscriptions.dispose()
@draggable = true
@classList.add('fi... |
Test that tasks collection resets after logout | {Testing, expect, sinon, _} = require 'openstax-react-components/test/helpers'
{TaskReview} = require 'task/review'
Collection = require 'task/collection'
TASK = require 'cc/tasks/C_UUID/m_uuid/GET'
describe 'Task Collection', ->
beforeEach ->
@taskId = 'm_uuid/C_UUID'
@task = _.extend({}, TASK, taskId: @t... | {Testing, expect, sinon, _} = require 'openstax-react-components/test/helpers'
{TaskReview} = require 'task/review'
Collection = require 'task/collection'
TASK = require 'cc/tasks/C_UUID/m_uuid/GET'
User = require 'user/model'
describe 'Task Collection', ->
beforeEach ->
@taskId = 'm_uuid/C_UUID'
@task = _... |
Fix name of okular viewer | BaseViewer = require './base-viewer'
module.exports =
class SumatraViewer extends BaseViewer
_getArgs = (opts = {}) ->
args = ["--unique"]
args.push "--noraise" if opts?.keepFocus
args
forwardSync: (pdfFile, texFile, line, col, opts = {}) ->
args = _getArgs opts
args.push "#{pdfFile}#src:#{lin... | BaseViewer = require './base-viewer'
module.exports =
class OkularViewer extends BaseViewer
_getArgs = (opts = {}) ->
args = ["--unique"]
args.push "--noraise" if opts?.keepFocus
args
forwardSync: (pdfFile, texFile, line, col, opts = {}) ->
args = _getArgs opts
args.push "#{pdfFile}#src:#{line... |
Change schema registration so that ids will work |
tv4 = require 'tv4'
chai = require 'chai' if not chai
yaml = require 'js-yaml'
path = require 'path'
fs = require 'fs'
getSchema = (name) ->
filepath = path.join __dirname, '../schema', name+'.json'
content = fs.readFileSync filepath, { encoding: 'utf-8' }
return JSON.parse content
getExamples = (name) ->
f... |
tv4 = require 'tv4'
chai = require 'chai' if not chai
yaml = require 'js-yaml'
path = require 'path'
fs = require 'fs'
schemaPath = '../schema'
getSchema = (name) ->
filepath = path.join __dirname, schemaPath, name
loadSchema filepath
loadSchema = (filepath) ->
content = fs.readFileSync filepath, { encoding: ... |
Send default size options and fix sharable terminal mode. | class SharableClientTerminalPane extends TerminalPane
constructor: (options = {}, data) ->
sessionOptions = options.sessionKey
options.vmName = sessionOptions.vmName
options.vmRegion = sessionOptions.vmRegion
options.joinUser = sessionOptions.host
options.session = sessionOptions.key
op... | class SharableClientTerminalPane extends TerminalPane
constructor: (options = {}, data) ->
sessionOptions = options.sessionKey
options.vmName = sessionOptions.vmName
options.vmRegion = sessionOptions.vmRegion
options.joinUser = sessionOptions.host
options.session = sessionOptions.key
op... |
Correct reference to carousel on experiments page | loggedOutNav = require '../../../components/logged_out_nav/client/index.coffee'
slides = require './experiments.coffee'
{ mountWithApolloProvider } = require '../../../react/apollo/index.js'
{ default: DescriptiveCarousel } = require '../../../react/components/ExperimentsCarousel/index.js'
{ CURRENT_PATH } = require('s... | loggedOutNav = require '../../../components/logged_out_nav/client/index.coffee'
slides = require './experiments.coffee'
{ mountWithApolloProvider } = require '../../../react/apollo/index.js'
{ default: DescriptiveCarousel } = require '../../../react/components/DescriptiveCarousel/index.js'
{ CURRENT_PATH } = require('s... |
Fix static backend path route | CONFIG = require '../config'
Request = require 'superagent'
module.exports = (app, done) ->
# Swagger interface
app.get '/backend/:id*?', (req, res, next) ->
Request
.get("#{CONFIG.backendURI}/#{CONFIG.backendStaticPath}/#{req.params.id}")
.end (err, backendResp) ->
if backendResp.headers['content-type']... | CONFIG = require '../config'
Request = require 'superagent'
log = require('../log')(module)
module.exports = (app, done) ->
# Swagger interface
app.get '/backend/*', (req, res, next) ->
uri = "#{CONFIG.backendURI}/#{CONFIG.backendStaticPath}/#{req.params[0]}"
log.debug "Retrieving static backend asset '#{uri}'... |
Add run cell commands to menu | # See https://atom.io/docs/latest/hacking-atom-package-word-count#menus for more details
# 'context-menu':
# 'atom-text-editor': [
# {
# 'label': 'Toggle atom-repl'
# 'command': 'atom-repl:toggle'
# }
# ]
'menu': [
{
'label': 'Packages'
'submenu': [
'label': 'Hydrogen'
'sub... | # See https://atom.io/docs/latest/hacking-atom-package-word-count#menus for more details
# 'context-menu':
# 'atom-text-editor': [
# {
# 'label': 'Toggle atom-repl'
# 'command': 'atom-repl:toggle'
# }
# ]
'menu': [
{
'label': 'Packages'
'submenu': [
'label': 'Hydrogen'
'sub... |
Add support for embedded coffeescript in vue | configManager = require '../config-manager'
resolve = require 'resolve'
path = require 'path'
# Check if there is a local coffee-script package, use that package if it exists
scopedRequire = (filepath) ->
basedir = path.dirname(filepath)
rst = null
try rst = path.dirname(resolve.sync('coffee-s... | configManager = require '../config-manager'
resolve = require 'resolve'
path = require 'path'
# Check if there is a local coffee-script package, use that package if it exists
scopedRequire = (filepath) ->
basedir = path.dirname(filepath)
rst = null
try rst = path.dirname(resolve.sync('coffee-s... |
Allow GH sync also for non-authenticated users | noflo = require 'noflo'
exports.getComponent = ->
c = new noflo.Component
c.description = 'Get user token from action'
c.icon = 'key'
c.inPorts.add 'in',
datatype: 'object'
c.outPorts.add 'token',
datatype: 'string'
c.outPorts.add 'out',
datatype: 'object'
c.outPorts.add 'error',
datatype... | noflo = require 'noflo'
exports.getComponent = ->
c = new noflo.Component
c.description = 'Get user token from action'
c.icon = 'key'
c.inPorts.add 'in',
datatype: 'object'
c.outPorts.add 'token',
datatype: 'string'
c.outPorts.add 'out',
datatype: 'object'
c.outPorts.add 'error',
datatype... |
Change default theme to paperdark | poi:
theme: "papercyan"
layout: "horizonal"
window:
x: 60
y: 60
width: 1274
height: 616
webview:
width: 800
shortcut:
bosskey: "CmdOrCtrl+i"
proxy:
use: "none"
socks5:
host: "127.0.0.1"
port: 1080
http:
host: "127.0.0.1"
port: 8099
shadowsocks:
server:
... | poi:
theme: "paperdark"
layout: "horizonal"
window:
x: 60
y: 60
width: 1274
height: 616
webview:
width: 800
shortcut:
bosskey: "CmdOrCtrl+i"
proxy:
use: "none"
socks5:
host: "127.0.0.1"
port: 1080
http:
host: "127.0.0.1"
port: 8099
shadowsocks:
server:
... |
Change order of params for easier access | class Locker
constructor: () ->
@is_locked = false
try: (fun, args...) ->
if @is_locked
return
@is_locked = true
ret = fun args...
@is_locked = false
return ret
# a basic class with generic getter / setter function
class BaseClass
constructor: ->
# ownProperty is unsafe. Rathe... | class Locker
constructor: () ->
@is_locked = false
try: (args..., fun) ->
if @is_locked
return
@is_locked = true
ret = fun args...
@is_locked = false
return ret
# a basic class with generic getter / setter function
class BaseClass
constructor: ->
# ownProperty is unsafe. Rathe... |
Use each instead of every for optionals | _ = require 'underscore'
class Base
constructor: (props) ->
_.each props, (v, k) =>
@[k] = v
validate: ->
validProperty = (property)=>
valid = false
valid = typeof @[property] isnt 'undefined'
if @validator and @validator[property]
valid = @validator[property]()
vali... | _ = require 'underscore'
class Base
constructor: (props) ->
_.each props, (v, k) =>
@[k] = v
validate: ->
validProperty = (property)=>
valid = false
valid = typeof @[property] isnt 'undefined'
if @validator and @validator[property]
valid = @validator[property]()
vali... |
Make hubot respond with bug info anytime anyone mentions a bug in irc, even if they don't mention hubot | # Description:
# In which Hubot gives you bugzilla information
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot bug <number> - Shows bug summary
#
# Author:
# greenb
QS = require 'querystring'
Cheerio = require 'cheerio'
module.exports = (robot) ->
domain = 'http://bugs.sfola... | # Description:
# In which Hubot gives you bugzilla information
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot bug <number> - Shows bug summary
#
# Author:
# greenb
QS = require 'querystring'
Cheerio = require 'cheerio'
module.exports = (robot) ->
domain = 'http://bugs.sfola... |
Fix switch on wrong property | reloadStylesheets = ->
queryString = '?reload=' + new Date().getTime();
$('link[rel="stylesheet"]').each ->
@href = @href.replace(/\?.*|$/, queryString);
connect = (opts={}) ->
# if user is running mozilla then use it's built-in WebSocket
window.WebSocket ||= window.MozWebSocket
connection = new WebSock... | reloadStylesheets = ->
queryString = '?reload=' + new Date().getTime();
$('link[rel="stylesheet"]').each ->
@href = @href.replace(/\?.*|$/, queryString);
connect = (opts={}) ->
# if user is running mozilla then use it's built-in WebSocket
window.WebSocket ||= window.MozWebSocket
connection = new WebSock... |
Clean up guards when no fibers are waiting. | FiberUtils.synchronize = (guardObject, uniqueId, body, options={}) ->
# Use the guard object to determine whether we have reentered.
guards = guardObject._guards ?= {}
guards[uniqueId] ?= new FiberUtils.OrderedFence options
topLevel = guards[uniqueId].enter()
try
return body()
finally
guards[unique... | FiberUtils.synchronize = (guardObject, uniqueId, body, options={}) ->
# Use the guard object to determine whether we have reentered.
guards = guardObject._guards ?= {}
guards[uniqueId] ?= new FiberUtils.OrderedFence options
topLevel = guards[uniqueId].enter()
try
return body()
finally
guards[unique... |
Use key.full before key.name for bindings | _ = require 'lodash'
direction = require './direction'
bindings = require '../key-bindings.json'
module.exports = exports = (game) ->
game.on 'key.*', (ch, key) ->
action = bindings[key.name ? key.full]
if action?
parts = action.split('.')
if parts[0] is 'direction'
parts[1] = direction.normalize par... | _ = require 'lodash'
direction = require './direction'
bindings = require '../key-bindings.json'
module.exports = exports = (game) ->
game.on 'key.*', (ch, key) ->
action = bindings[key.full ? key.name]
if action?
parts = action.split('.')
if parts[0] is 'direction'
parts[1] = direction.normalize par... |
Make CMD+Click or CTRL+Click work | @CodequestManager = do (Backbone, Marionette) ->
Marionette.Renderer.oldRender = Marionette.Renderer.render
Marionette.Renderer.render = (template, data) ->
template = template() if typeof template == 'function'
unless JST[template]
return Marionette.Renderer.oldRender(template, data)
return JST[... | @CodequestManager = do (Backbone, Marionette) ->
Marionette.Renderer.oldRender = Marionette.Renderer.render
Marionette.Renderer.render = (template, data) ->
template = template() if typeof template == 'function'
unless JST[template]
return Marionette.Renderer.oldRender(template, data)
return JST[... |
Use isolated scope for directive | 'use strict'
IBAN = require 'iban'
angular
.module 'mm.iban', ['ng']
.directive 'ngIban', ->
restrict: 'A'
require: 'ngModel'
link: (scope, elem, attrs, ctrl) ->
parseIban = (value) ->
if value? then value.toUpperCase().replace /\s/g, '' else undefined
isValidIban = (value) ->
... | 'use strict'
IBAN = require 'iban'
angular
.module 'mm.iban', ['ng']
.directive 'ngIban', ->
restrict: 'A'
require: 'ngModel'
scope:
ngModel: '='
link: (scope, elem, attrs, ctrl) ->
parseIban = (value) ->
if value? then value.toUpperCase().replace /\s/g, '' else undefined
... |
Update tests to test promise API as well. | should = require('chai').should()
bundle = require '../lib/bundle'
describe 'bundle', ->
it 'should bundle all dependencies', (done) ->
bundle
entry: './fixtures/entry',
exclude: /excluded/
include: ['./fixtures/included']
export: 'entry'
, (err, bundle) ->
done()
| should = require('chai').should()
bundle = require '../lib/bundle'
opts =
entry: './fixtures/entry',
exclude: /excluded/
include: ['./fixtures/included']
export: 'entry'
describe 'bundle', ->
it 'should bundle all dependencies', (done) ->
bundle opts, (err, bundle) ->
bundle.toString().should.cont... |
Remove first .abstract element if it exists | define (require) ->
$ = require('jquery')
toc = require('cs!collections/toc')
Node = require('cs!models/content/node')
require('backbone-associations')
return class Page extends Node
defaults:
authors: []
constructor: () ->
super(arguments...)
toc.add(@)
parse: (response, opti... | define (require) ->
$ = require('jquery')
toc = require('cs!collections/toc')
Node = require('cs!models/content/node')
require('backbone-associations')
return class Page extends Node
defaults:
authors: []
constructor: () ->
super(arguments...)
toc.add(@)
parse: (response, opti... |
Add /feature bid route for Eigen | #
# Auction related routes
#
express = require 'express'
routes = require './routes'
app = module.exports = express()
app.set 'views', __dirname + '/templates'
app.set 'view engine', 'jade'
app.get '/auction-registration/:id', routes.auctionRegistration
app.get '/auction/:id/bid/:artwork', routes.bid
app.get '/aucti... | #
# Auction related routes
#
express = require 'express'
routes = require './routes'
app = module.exports = express()
app.set 'views', __dirname + '/templates'
app.set 'view engine', 'jade'
app.get '/auction-registration/:id', routes.auctionRegistration
app.get '/auction/:id/bid/:artwork', routes.bid
app.get '/aucti... |
Use removeListener instead of off |
#
module.exports =
class ObjectSelection
constructor: (@options={}) ->
@options.class ?= 'object-selection'
setObject: (object) ->
@_unbindObject(@object)
@object = object
@_bindObject(@object)
@path.remove() if @path
@path = null
if @object
@path = svg.path('').front()
@p... |
#
module.exports =
class ObjectSelection
constructor: (@options={}) ->
@options.class ?= 'object-selection'
setObject: (object) ->
@_unbindObject(@object)
@object = object
@_bindObject(@object)
@path.remove() if @path
@path = null
if @object
@path = svg.path('').front()
@p... |
Return null when not found | EnumerableWrapper =
getLength: ->
@value.length
forEach: (callback) ->
if @wrappers.constructor == Object
callback(key, wrapper) for key, wrapper of @wrappers
else if @wrappers.constructor == Array
@wrappers.forEach(callback)
map: (callback) ->
@wrappers.map(callback)
find: (callb... | EnumerableWrapper =
getLength: ->
@value.length
forEach: (callback) ->
if @wrappers.constructor == Object
callback(key, wrapper) for key, wrapper of @wrappers
else if @wrappers.constructor == Array
@wrappers.forEach(callback)
map: (callback) ->
@wrappers.map(callback)
find: (callb... |
Switch appveyor from apm to npm | module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
coffee:
glob_to_multiple:
expand: true
cwd: 'src'
src: ['**/*.coffee']
dest: 'lib'
ext: '.js'
coffeelint:
options:
no_empty_param_list:
level: 'erro... | path = require('path')
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
coffee:
glob_to_multiple:
expand: true
cwd: 'src'
src: ['**/*.coffee']
dest: 'lib'
ext: '.js'
coffeelint:
options:
no_empty_param_list... |
Fix bug with not called observers listening to aliases. | Wheelmap.ToolbarController = Ember.Controller.extend
needs: 'map'
statusFilters: ['yes', 'limited', 'no', 'unknown']
map: Ember.computed.alias('controllers.map')
_extraFilter: false # Flag for executing special status filter behavior only once
init: ()->
@_super()
if $.cookie('last_status_filters')
... | Wheelmap.ToolbarController = Ember.Controller.extend
needs: 'map'
statusFilters: ['yes', 'limited', 'no', 'unknown']
_extraFilter: false # Flag for executing special status filter behavior only once
init: ()->
@_super()
if $.cookie('last_status_filters')
@set('statusFilters', JSON.parse($.cookie... |
Add RMQ to sparse tables contest | import contest from "../../lib/contest"
import label from "../../lib/label"
import link from "../../lib/link"
import page from "../../lib/page"
import problem from "../../lib/problem"
import topic from "../../lib/topic"
import {ruen} from "../../lib/util"
export default sparse_tables = () ->
return {
topic... | import contest from "../../lib/contest"
import label from "../../lib/label"
import link from "../../lib/link"
import page from "../../lib/page"
import problem from "../../lib/problem"
import topic from "../../lib/topic"
import {ruen} from "../../lib/util"
export default sparse_tables = () ->
return {
topic... |
Remove no longer needed requires | {CompositeDisposable} = require 'atom'
module.exports =
config:
executablePath:
type: 'string'
title: 'PHP Executable Path'
default: 'php' # Let OS's $PATH handle the rest
activate: ->
@regex = '(Parse|Fatal) ' +
'(?<error>error):(\\s*(?<type>parse|syntax) error,?)?\\s*' +
... | {CompositeDisposable} = require 'atom'
module.exports =
config:
executablePath:
type: 'string'
title: 'PHP Executable Path'
default: 'php' # Let OS's $PATH handle the rest
activate: ->
@regex = '(Parse|Fatal) ' +
'(?<error>error):(\\s*(?<type>parse|syntax) error,?)?\\s*' +
... |
Enable tests to absolutely fail | # Generated on 2014-12-25 using generator-bower 0.0.1
'use strict'
mountFolder = (connect, dir) ->
connect.static require('path').resolve(dir)
module.exports = (grunt) ->
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks)
yeomanConfig =
src: 'src'
dist : 'dist'
grunt.initConfig
... | # Generated on 2014-12-25 using generator-bower 0.0.1
'use strict'
mountFolder = (connect, dir) ->
connect.static require('path').resolve(dir)
module.exports = (grunt) ->
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks)
yeomanConfig =
src: 'src'
dist : 'dist'
grunt.initConfig
... |
Adjust indentation to make coffeescript happy | AjaxPrefix.addAjaxPrefix(jQuery, -> CMS.prefix)
@CMS =
Models: {}
Views: {}
prefix: $("meta[name='path_prefix']").attr('content')
_.extend CMS, Backbone.Events
$ ->
Backbone.emulateHTTP = true
$.ajaxSetup
headers : { 'X-CSRFToken': $.cookie 'csrftoken' }
dataType: 'json'
$(document).ajaxError ... | AjaxPrefix.addAjaxPrefix(jQuery, -> CMS.prefix)
@CMS =
Models: {}
Views: {}
prefix: $("meta[name='path_prefix']").attr('content')
_.extend CMS, Backbone.Events
$ ->
Backbone.emulateHTTP = true
$.ajaxSetup
headers : { 'X-CSRFToken': $.cookie 'csrftoken' }
dataType: 'json'
$(document).ajaxError ... |
Return a *real* promise so that we can then/catch | User = require '../../../models/user.coffee'
Artwork = require '../../../models/artwork.coffee'
ArtworkInquiry = require '../../../models/artwork_inquiry.coffee'
openInquiryQuestionnaireFor = require '../../../components/inquiry_questionnaire/index.coffee'
module.exports = (id) ->
user = User.instantiate()
inquiry... | Promise = require 'bluebird-q'
User = require '../../../models/user.coffee'
Artwork = require '../../../models/artwork.coffee'
ArtworkInquiry = require '../../../models/artwork_inquiry.coffee'
openInquiryQuestionnaireFor = require '../../../components/inquiry_questionnaire/index.coffee'
module.exports = (id) ->
user... |
Use RootView::open instead of RootView::openSync | {_, $, fs, View} = require 'atom'
MatchView = require './match-view'
path = require 'path'
module.exports =
class ResultView extends View
@content: (filePath, matches) ->
iconClass = if fs.isReadmePath(filePath) then 'icon-book' else 'icon-file-text'
@li class: 'path list-nested-item', 'data-path': _.escape... | {_, $, fs, View} = require 'atom'
MatchView = require './match-view'
path = require 'path'
module.exports =
class ResultView extends View
@content: (filePath, matches) ->
iconClass = if fs.isReadmePath(filePath) then 'icon-book' else 'icon-file-text'
@li class: 'path list-nested-item', 'data-path': _.escape... |
Add root node to POST contributions/ | `// @ngInject`
angular.module('cobudget').config (RestangularProvider, config) ->
RestangularProvider.setBaseUrl(config.apiEndpoint)
RestangularProvider.setDefaultHttpFields
withCredentials: true
RestangularProvider.setDefaultHeaders
Accept: "application/json"
RestangularProvider.setResponseInterceptor... | `// @ngInject`
angular.module('cobudget').config (RestangularProvider, config) ->
RestangularProvider.setBaseUrl(config.apiEndpoint)
RestangularProvider.setDefaultHttpFields
withCredentials: true
RestangularProvider.setDefaultHeaders
Accept: "application/json"
RestangularProvider.setResponseInterceptor... |
Add normalize.css before other css files. | exports.config =
files:
javascripts:
joinTo:
'js/app.js': /^(vendor|bower_components|app)/
stylesheets:
joinTo: 'css/app.css'
templates:
joinTo: 'js/app.js'
plugins:
handlebars:
include:
enabled: false
| exports.config =
files:
javascripts:
joinTo:
'js/app.js': /^(bower_components|vendor|app)/
stylesheets:
joinTo:
'css/app.css': /^(bower_components|vendor|app)/
order:
before: ['bower_components/normalize-css/normalize.css']
templates:
joinTo: 'js/app.js'
... |
Add a more prominent link to the original journal | Controller = require 'zooniverse/controllers/base-controller'
Api = require 'zooniverse/lib/api'
class SubjectMetadata extends Controller
template: (context) ->
"
<p class='subject-metadata'><b>Volume:</b> #{context.metadata?.volume} <b>Year:</b> #{context.metadata?.year} <b>Page:</b> #{context.metadata... | Controller = require 'zooniverse/controllers/base-controller'
Api = require 'zooniverse/lib/api'
class SubjectMetadata extends Controller
template: (context) ->
"
<p class='subject-metadata'><b>Volume:</b> #{context.metadata?.volume} <b>Year:</b> #{context.metadata?.year} <b>Page:</b> #{context.metadata... |
Increase timeout before loading chosen | class window.ChosenActivator
@activate: ->
$(".js--chosen").not(".optional").chosen()
$(".js--chosen.optional").chosen(allow_single_deselect: true)
$ ->
ChosenActivator.activate()
AjaxModal.on_show ->
# Give the browser just enough time to set the width of the select before
# activating Chosen. ... | class window.ChosenActivator
@activate: ->
$(".js--chosen").not(".optional").chosen()
$(".js--chosen.optional").chosen(allow_single_deselect: true)
$ ->
ChosenActivator.activate()
AjaxModal.on_show ->
# Give the browser just enough time to set the width of the select before
# activating Chosen. ... |
Add loader and a method to deal with it. | kd = require 'kd'
KDListItemView = kd.ListItemView
KDCustomHTMLView = kd.CustomHTMLView
AvatarView = require 'app/commonviews/avatarviews/avatarview'
module.exports = class UserItem extends KDListItemView
constructor: (options = {}, data) ->
options.type = 'user'
options.justFirstName ?= yes
... | kd = require 'kd'
AvatarView = require 'app/commonviews/avatarviews/avatarview'
KDLoaderView = kd.LoaderView
KDListItemView = kd.ListItemView
KDCustomHTMLView = kd.CustomHTMLView
module.exports = class UserItem extends KDListItemView
constructor: (options = {}, data) ->
options.type ... |
Refactor my own knowledge on vanilla DOM manipulation | 'use strict'
App =
items: [
{name: 'Learn Brunch', check: true}
{name: 'Find a way to automate tests', check: true}
{name: 'Apply to my projects', check: false}
# '...'
{name: 'Profit!', check: false}
]
init: ->
tmpl = require 'views/list'
html = tmpl items: App.items
document.get... | 'use strict'
App =
items: [
{name: 'Learn Brunch', check: true}
{name: 'Find a way to automate tests', check: true}
{name: 'Apply to my projects', check: false}
# '...'
{name: 'Profit!', check: false}
]
init: ->
tmpl = require 'views/list'
html = tmpl items: App.items
document.bod... |
Fix issue where clearing filters would reset in-project status | ns = @edsc.models.data
ns.Project = do (ko) ->
class Project
constructor: ->
@datasets = ko.observableArray()
toggleDataset: (dataset) =>
datasets = @datasets
if datasets.contains(dataset)
datasets.remove(dataset)
else
datasets.push(dataset)
exports = Project
| ns = @edsc.models.data
ns.Project = do (ko) ->
class Project
constructor: ->
@datasets = ko.observableArray()
toggleDataset: (dataset) =>
datasets = @datasets
if datasets.contains(dataset)
datasets.remove(dataset)
else
datasets.push(dataset)
hasDataset: (other) ... |
Change AbstractButton.icon's type to Instance in bokehjs | _ = require "underscore"
Widget = require "./widget"
p = require "../../core/properties"
class AbstractButton extends Widget.Model
type: "AbstractButton"
@define {
callback: [ p.Instance ]
label: [ p.String, "Button" ]
icon: [ p.String ]
button_type: [... | _ = require "underscore"
Widget = require "./widget"
p = require "../../core/properties"
class AbstractButton extends Widget.Model
type: "AbstractButton"
@define {
callback: [ p.Instance ]
label: [ p.String, "Button" ]
icon: [ p.Instance ]
button_type: [... |
Use appropriate icon name in PreviewSaveTool | _ = require "underscore"
$ = require "jquery"
$1 = require "bootstrap/modal"
ActionTool = require "./action_tool"
preview_save_tool_template = require "./preview_save_tool_template"
class PreviewSaveToolView extends ActionTool.View
className: "bk-bs-modal"
template: preview_save_tool_template
initialize: (optio... | _ = require "underscore"
$ = require "jquery"
$1 = require "bootstrap/modal"
ActionTool = require "./action_tool"
preview_save_tool_template = require "./preview_save_tool_template"
class PreviewSaveToolView extends ActionTool.View
className: "bk-bs-modal"
template: preview_save_tool_template
initialize: (optio... |
Handle backbone links in the modal on the site properly | # Add a default clickhandler so we can use hrefs
Backbone.View::defaultClickHandler = (e, routeTo=null) ->
routeTo ||= $(e.target).closest("a").attr("href")
# Return if a modifier key is pressed or when Backbone has not properly been initialized
# Make sure we return "true" so other functions can determine what ... | # Add a default clickhandler so we can use hrefs
Backbone.View::defaultClickHandler = (e, routeTo=null) ->
routeTo ||= $(e.target).closest("a").attr("href")
# Return if a modifier key is pressed or when Backbone has not properly been initialized
# Make sure we return "true" so other functions can determine what ... |
Improve date picker UX by defaulting to year first | # 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/
$ ->
$('[data-toggle="tooltip"]').tooltip(placement: 'right')
$('.datepicker').datepi... | # 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/
$ ->
$('[data-toggle="tooltip"]').tooltip(placement: 'right')
$('.datepicker').datepi... |
Update copy for a more natural sentence | # Description
# Notifies based on the results of xcode builds and controls xcode builds
#
# Dependencies
# None
#
# Configuration
# None
#
# Commands:
# hubot build <bot name> - Start a build for bot named <bot name> UNIMPLEMENTED
#
# Author:
# bmnick
url = require('url')
querystring = require('querystring')... | # Description
# Notifies based on the results of xcode builds and controls xcode builds
#
# Dependencies
# None
#
# Configuration
# None
#
# Commands:
# hubot build <bot name> - Start a build for bot named <bot name> UNIMPLEMENTED
#
# Author:
# bmnick
url = require('url')
querystring = require('querystring')... |
Access panes on workspace instead of view | {$} = require 'atom'
module.exports =
configDefaults:
enabled: false
activate: ->
atom.workspaceView.on 'focusout', ".editor:not(.mini)", (event) =>
editor = $(event.target).closest('.editor').view()?.getModel()
@autosave(editor)
atom.workspaceView.on 'pane:before-item-destroyed', (event,... | {$} = require 'atom'
module.exports =
configDefaults:
enabled: false
activate: ->
atom.workspaceView.on 'focusout', ".editor:not(.mini)", (event) =>
editor = $(event.target).closest('.editor').view()?.getModel()
@autosave(editor)
atom.workspaceView.on 'pane:before-item-destroyed', (event,... |
Use astrifex.svg-star instead of md5.svg-star | 'use strict'
module.exports = angular.module('astrifex', [
'ui.router'
'md5.svg-star'
require('../../../tmp/templates').name
require('../common/index').name
require('./maker/index').name
])
| 'use strict'
module.exports = angular.module('astrifex', [
'ui.router'
'astrifex.svg-star'
require('../../../tmp/templates').name
require('../common/index').name
require('./maker/index').name
])
|
Drop px units and spaces from size label | _ = require 'underscore-plus'
{View} = require 'atom'
ImageEditor = require './image-editor'
module.exports =
class ImageEditorStatusView extends View
@content: ->
@div class: 'status-image inline-block', =>
@span class: 'image-size', outlet: 'imageSizeStatus'
initialize: (@statusBar) ->
@attach()
... | _ = require 'underscore-plus'
{View} = require 'atom'
ImageEditor = require './image-editor'
module.exports =
class ImageEditorStatusView extends View
@content: ->
@div class: 'status-image inline-block', =>
@span class: 'image-size', outlet: 'imageSizeStatus'
initialize: (@statusBar) ->
@attach()
... |
Move Antimatter task to level 8C | import contest from "../../lib/contest"
import label from "../../lib/label"
import link from "../../lib/link"
import page from "../../lib/page"
import problem from "../../lib/problem"
import topic from "../../lib/topic"
import {ruen} from "../../lib/util"
export default sparse_tables = () ->
return {
topic... | import contest from "../../lib/contest"
import label from "../../lib/label"
import link from "../../lib/link"
import page from "../../lib/page"
import problem from "../../lib/problem"
import topic from "../../lib/topic"
import {ruen} from "../../lib/util"
export default sparse_tables = () ->
return {
topic... |
Fix deprecated selectors in keymap | '.editor':
'ctrl-f2': 'bookmarks:view-all'
'f2': 'bookmarks:jump-to-next-bookmark'
'shift-f2': 'bookmarks:jump-to-previous-bookmark'
'.platform-darwin .editor':
'cmd-f2': 'bookmarks:toggle-bookmark'
'cmd-shift-f2': 'bookmarks:clear-bookmarks'
'.platform-win32 .editor':
'alt-ctrl-f2': 'bookmarks:toggle-boo... | 'atom-text-editor':
'ctrl-f2': 'bookmarks:view-all'
'f2': 'bookmarks:jump-to-next-bookmark'
'shift-f2': 'bookmarks:jump-to-previous-bookmark'
'.platform-darwin atom-text-editor':
'cmd-f2': 'bookmarks:toggle-bookmark'
'cmd-shift-f2': 'bookmarks:clear-bookmarks'
'.platform-win32 atom-text-editor':
'alt-ctrl... |
Increment results line when scanning using a stream | async = require 'async'
fs = require 'fs'
VariableScanner = require '../variable-scanner'
class PathScanner
constructor: (@path) ->
@scanner = new VariableScanner
load: (done) ->
currentChunk = ''
currentLine = 0
currentOffset = 0
lastIndex = 0
results = []
readStream = fs.createRea... | async = require 'async'
fs = require 'fs'
VariableScanner = require '../variable-scanner'
class PathScanner
constructor: (@path) ->
@scanner = new VariableScanner
load: (done) ->
currentChunk = ''
currentLine = 0
currentOffset = 0
lastIndex = 0
line = 0
results = []
readStream = f... |
Add an example menu item. | 'context-menu':
'.tree-view':
'Add File': 'tree-view:add'
'Rename': 'tree-view:move'
'Delete': 'tree-view:remove'
| menu: [
{
label: 'View'
submenu: [
{
label: 'Toggle Treeview'
command: 'tree-view:toggle'
}
]
}
]
'context-menu':
'.tree-view':
'Add File': 'tree-view:add'
'Rename': 'tree-view:move'
'Delete': 'tree-view:remove'
|
Disable Twilio validation because it keeps failing | #!/usr/bin/env coffee
feathers = require("feathers")
bodyParser = require("body-parser")
path = require("path")
twilio = require("twilio")
config = require("./config")
# Public Directory
publicPath = path.resolve(__dirname, "../app")
# Services
transmissionService = require("./services/transmissionService")
provider... | #!/usr/bin/env coffee
feathers = require("feathers")
bodyParser = require("body-parser")
path = require("path")
twilio = require("twilio")
config = require("./config")
# Public Directory
publicPath = path.resolve(__dirname, "../app")
# Services
transmissionService = require("./services/transmissionService")
provider... |
Fix issue caused by asynchronous routing delaying a callback function | define ['backbone.marionette'], (Marionette) ->
class Router extends Marionette.AppRouter
routes:
'unit/:id': 'renderUnit',
'unit/?*params': 'renderUnitsWithFilter'
renderUnit: (id)->
app.vent.trigger 'unit:render-one', id
renderUnitsWithFilter: (params)... | define ['backbone.marionette'], (Marionette) ->
delayTime = 500
class Router extends Marionette.AppRouter
routes:
'unit/:id': 'renderUnit',
'unit/?*params': 'renderUnitsWithFilter'
renderUnit: (id)->
delayed = -> app.vent.trigger 'unit:render-one', id
... |
Clean slate for live coding | Crafty.defineScene 'New', ->
#Crafty.e('2D,DOM,Color').attr(
#x: 10
#y: 10
#w: 20
#h: 20
#).color('#0000FF')
#Crafty.e('2D,Canvas,Color,Fourway').attr(
#x: 100
#y: 100
#w: 40
#h: 40
#).color('#FF0000').fourway()
Crafty.e('2D,WebGL,Color,Fourway,Player').attr(
x: 100
... | Crafty.defineScene 'New', ->
->
|
Fix JS to have translation pages working | display_locale_fields = () ->
attr = $('#attr_list a.active').data('attr')
locales = $('#locale').val()
show = $("select[name='show-only']").val()
$('#attr_fields .panel').hide()
for locale in locales
do (locale) ->
value = $('#attr_fields .panel.' + attr + '.' + locale + ' :input').val().re... | display_locale_fields = () ->
attr = $('#attr_list a.active').data('attr')
locale = $('#locale').val()
show = $("select[name='show-only']").val()
$('#attr_fields .panel').hide()
value = $('#attr_fields .panel.' + attr + '.' + locale + ' :input').val().replace /^\s+|\s+$/g, ""
if show == 'incomplete... |
Build should fail on any error. | fs = require 'fs'
path = require 'path'
mkdir = (path, cb) ->
cb = cb or ->
mode = 0o777 & (~process.umask())
fs.mkdir path, mode, (err) ->
if err?.code is 'ENOENT'
mkdir path.dirname(path), (err) ->
mkdir path, (err) ->
cb null
cb null
module.exports = (opts) ->
# Get full p... | fs = require 'fs'
path = require 'path'
mkdir = (path, cb) ->
cb = cb or ->
mode = 0o777 & (~process.umask())
fs.mkdir path, mode, (err) ->
if err?.code is 'ENOENT'
mkdir path.dirname(path), (err) ->
mkdir path, (err) ->
cb null
cb null
module.exports = (opts) ->
# Get full p... |
Read correct field for state update. | containers = $(".ontology-version-state")
final_states = ["done", "failed"]
poll_time = 3000 # milliseconds
return if _.isEmpty(containers) || !containers.length
update = (container) ->
updateContainer = (container) ->
current_state = container.data('state')
$.getJSON container.data('uri'), (data) ->
... | containers = $(".ontology-version-state")
final_states = ["done", "failed"]
poll_time = 3000 # milliseconds
return if _.isEmpty(containers) || !containers.length
update = (container) ->
updateContainer = (container) ->
current_state = container.data('state')
$.getJSON container.data('uri'), (data) ->
... |
Use Stack instead of Express | express = require 'express'
app = express()
app.get '/', (request, response) ->
response.send('Hello World!')
port = process.env.PORT or 5000
app.listen port, ->
console.log("Listening on " + port)
# Extract rendering/serving portion to own module shared by viewer and cli | cli = require 'cli'
handleIndex = (request, response, next) ->
console.dir(response)
response.writeHead 200,
'Content-Type': 'text/html'
response.end('Hello World!')
port = process.env.PORT or 5000
cli.createServer([
handleIndex
]).listen(port)
# Extract rendering/serving portion to own mod... |
Add metadata for each suggestion | {Range} = require('atom')
fuzzaldrin = require('fuzzaldrin')
module.exports =
class SnippetsProvider
selector: '*'
getSuggestions: ({scopeDescriptor, prefix}) ->
return unless prefix?.length
scopeSnippets = atom.config.get('snippets', {scope: scopeDescriptor})
@findSuggestionsForPrefix(scopeSnippets,... | {Range} = require('atom')
fuzzaldrin = require('fuzzaldrin')
module.exports =
class SnippetsProvider
selector: '*'
getSuggestions: ({scopeDescriptor, prefix}) ->
return unless prefix?.length
scopeSnippets = atom.config.get('snippets', {scope: scopeDescriptor})
@findSuggestionsForPrefix(scopeSnippets,... |
Add a delay before fetching matching records on search. | # 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/
$ ->
$('#search').on 'keyup', ->
$('.search-bar form').submit() | # 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/
$ ->
delay = (ms, func) -> setTimeout func, ms
submit_form = ->
console.log "submitted that damned ... |
Load performance store and use options for learning guide | React = require 'react'
LearningGuide = require '../flux/learning-guide'
LoadableItem = require './loadable-item'
Teacher = require './learning-guide/teacher'
Student = require './learning-guide/student'
LearningGuideStudentShell = React.createClass
contextTypes:
router: React.PropTypes.func
render: ->
... | React = require 'react'
LearningGuide = require '../flux/learning-guide'
LoadableItem = require './loadable-item'
TeacherComponent = require './learning-guide/teacher'
StudentComponent = require './learning-guide/student'
TeacherStudentComponent = require './learning-guide/teacher-student'
{PerformanceStore, Performan... |
Add basic reads from all tests. | describe 'PodsList', ->
subject = null
beforeEach (done) ->
subject = new SeedsStore('test')
expect(subject.clear()).eventually.notify(done)
it 'counts 0', (done) ->
expect(subject.countForAll()).eventually.equal(0).notify(done)
it 'counts n', (done) ->
subject.update([{name: 1},{name: 2},{name:... | describe 'PodsList', ->
subject = null
beforeEach (done) ->
subject = new SeedsStore('test')
expect(subject.clear()).eventually.notify(done)
it 'counts 0', (done) ->
expect(subject.countForAll()).eventually.equal(0).notify(done)
it 'counts n', (done) ->
subject.update([{name: 1},{name: 2},{name:... |
Hide only the immediate li children of the list, rather than embedded lists too. | class Filter
constructor: (options) ->
@list = options.list
@icon = options.icon
@form = options.form
@attrs = options.attrs
@open = options.open
@close = options.close
this.draw()
draw: ->
$(@icon).addClass 'filter-button'
form = $('<form class="filter-form" style="display:... | class Filter
constructor: (options) ->
@list = options.list
@icon = options.icon
@form = options.form
@attrs = options.attrs
@open = options.open
@close = options.close
this.draw()
draw: ->
$(@icon).addClass 'filter-button'
form = $('<form class="filter-form" style="display:... |
Expand keywords into multiple key:value pairs | define (require) ->
$ = require('jquery')
_ = require('underscore')
router = require('cs!router')
SearchHeaderView = require('cs!../header/header')
BaseView = require('cs!helpers/backbone/views/base')
template = require('hbs!./advanced-template')
require('less!./advanced')
return class AdvancedSearchVi... | define (require) ->
$ = require('jquery')
_ = require('underscore')
router = require('cs!router')
SearchHeaderView = require('cs!../header/header')
BaseView = require('cs!helpers/backbone/views/base')
template = require('hbs!./advanced-template')
require('less!./advanced')
return class AdvancedSearchVi... |
Use options to observe phpExecutablePath config | linterPath = atom.packages.getLoadedPackage("linter").path
Linter = require "#{linterPath}/lib/linter"
{CompositeDisposable} = require 'atom'
class LinterPhp extends Linter
# The syntax that the linter handles. May be a string or
# list/tuple of strings. Names should be all lowercase.
@syntax: ['text.html.php', ... | linterPath = atom.packages.getLoadedPackage("linter").path
Linter = require "#{linterPath}/lib/linter"
class LinterPhp extends Linter
# The syntax that the linter handles. May be a string or
# list/tuple of strings. Names should be all lowercase.
@syntax: ['text.html.php', 'source.php']
# A string, list, tupl... |
Use correct js file for test | fs = require('fs')
expect = require('chai').expect
jsdom = require('jsdom').jsdom
html = fs.readFileSync("#{__dirname}/index.html", 'utf-8')
global.document = jsdom(html)
global.window = document.parentWindow
global.jQuery = $ = require('jquery')
require('../jquery.serializeJSON.js')
data =
phone:... | fs = require('fs')
expect = require('chai').expect
jsdom = require('jsdom').jsdom
html = fs.readFileSync("#{__dirname}/index.html", 'utf-8')
global.document = jsdom(html)
global.window = document.parentWindow
global.jQuery = $ = require('jquery')
require('../dist/jquery.serializeJSON.js')
data =
p... |
Load 10 records in poll page | angular.module('loomioApp').controller 'PollsPageController', ($scope, $q, $rootScope, Records, AbilityService, TranslationService, LoadingService, ModalService, PollCommonStartModal) ->
$rootScope.$broadcast('currentComponent', { page: 'pollsPage'})
@pollIds = []
from = 0
per = 1
Records.polls.searchResul... | angular.module('loomioApp').controller 'PollsPageController', ($scope, $q, $rootScope, Records, AbilityService, TranslationService, LoadingService, ModalService, PollCommonStartModal) ->
$rootScope.$broadcast('currentComponent', { page: 'pollsPage'})
@pollIds = []
from = 0
per = 10
Records.polls.searchResu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.