Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Fix bad parameter in sweepPrivateKey | @ledger.wallet ?= {}
_.extend ledger.wallet,
sweepPrivateKey: ({privateKey, account, txFee: 10000}, callback) ->
completion = new CompletionClosure(callback)
recipientAddress = account.getHDAccount().getCurrentPublicAddress()
ecKey = new window.bitcoin.ECKey.fromWIF(privateKey)
publicKey = e... | @ledger.wallet ?= {}
_.extend ledger.wallet,
sweepPrivateKey: ({privateKey, account, txFee}, callback) ->
txFee ?= 10000
completion = new CompletionClosure(callback)
recipientAddress = account.getHDAccount().getCurrentPublicAddress()
ecKey = new window.bitcoin.ECKey.fromWIF(privateKey)
... |
Fix Admin PayPal Verified Tag Update | $(".club-admin-status-text").html "<%= escape_javascript(render :partial => 'admin/club_live_status', :formats => [ :html ]) %>"
$(".club-promote-text").html "<%= escape_javascript(render :partial => 'admin/club_promote', :locals => { :club => @club }, :formats => [ :html ]) %>"
$(".modal").removeClass "paypal-confirm-... | $(".verified-status-tag").html "<%= escape_javascript(render :partial => 'shared/verified_status_tag', :formats => [ :html ]) %>"
$(".club-admin-status-text").html "<%= escape_javascript(render :partial => 'admin/club_live_status', :formats => [ :html ]) %>"
$(".club-promote-text").html "<%= escape_javascript(render :p... |
Allow views to be appended | define [
'jquery'
'underscore'
'backbone'
], ($, _, Backbone) ->
class Region
constructor: (el, parent) ->
@parent = parent
@el = el
show: (view) ->
@$el = @$el or @parent.$el.find(@el)
view.parent = @parent
@view = view
@view.setElement(@$el).render()
close: (... | define [
'jquery'
'underscore'
'backbone'
], ($, _, Backbone) ->
class Region
constructor: (el, parent) ->
@parent = parent
@el = el
show: (view) ->
@close()
@append(view)
append: (view) ->
@$el = @$el or @parent.$el.find(@el).eq(0)
view.parent = @parent
... |
Remove conditional polyfilling again. es6-promise should always be included since native Promise in Chrome is buggy. object-assign is so small it makes no sense to conditionally load on its own. fetch is a bit unfinished, and doesn't support cookies, so giving up on that for now. | run = () ->
ReactDOM = require 'react-dom'
cookie = require 'cookie'
{ XmlEntities } = require 'html-entities'
init = require './init.coffee'
{ store } = require './store.coffee'
userActions = require './actions/user-actions.coffee'
routes = require './views/routes.coffee'
createFactory = require './create-fac... | require('es6-promise').polyfill()
assign = require 'object-assign'
ReactDOM = require 'react-dom'
cookie = require 'cookie'
{ XmlEntities } = require 'html-entities'
init = require './init.coffee'
{ store } = require './store.coffee'
userActions = require './actions/user-actions.coffee'
routes = require './views/route... |
Return promise rejection to prevent Bluebird from complaining | Promise = require('bluebird')
canvas = require('./_canvas')
exports.getAll = ->
return canvas.get
resource: 'application'
options:
orderby: 'app_name asc'
expand: 'device'
exports.get = (id) ->
return canvas.get
resource: 'application'
id: id
.then (application) ->
if not application?
Promise.r... | Promise = require('bluebird')
canvas = require('./_canvas')
exports.getAll = ->
return canvas.get
resource: 'application'
options:
orderby: 'app_name asc'
expand: 'device'
exports.get = (id) ->
return canvas.get
resource: 'application'
id: id
.then (application) ->
if not application?
return Pr... |
Add blur method to SearchInputView. | define ['jquery', 'underscore', 'backbone', 'bootstrap', 'plugins/select_range'], ($, _, Backbone) ->
class SearchInputView extends Backbone.View
initialize: () ->
@$el.typeahead
source: @getTypeaheadAddresses
updater: (item) =>
_.defer @afterTypeahead
item
minLe... | define ['jquery', 'underscore', 'backbone', 'bootstrap', 'plugins/select_range'], ($, _, Backbone) ->
class SearchInputView extends Backbone.View
initialize: () ->
@$el.typeahead
source: @getTypeaheadAddresses
updater: (item) =>
_.defer @afterTypeahead
item
minLe... |
Make sure that regular scripts are build too | gulp = require "gulp"
defaultTasks = [
"scripts:minify:watch",
"styles:minify:watch",
"develop:watch",
]
gulp.task "default", defaultTasks, ->
| gulp = require "gulp"
defaultTasks = [
"scripts:watch",
"scripts:minify:watch",
"styles:minify:watch",
"develop:watch",
]
gulp.task "default", defaultTasks, ->
|
Add computed property for expiration display | `import DS from 'ember-data'`
Commit = DS.Model.extend
remoteId: DS.attr('string')
message: DS.attr('string')
state: DS.attr('string')
remoteUrl: DS.attr('string')
project: DS.belongsTo('project')
expiresAt: DS.attr('date')
createdAt: DS.attr('date')
authoredAt: DS.attr('date')
author: DS.belongsTo('... | `import DS from 'ember-data'`
Commit = DS.Model.extend
remoteId: DS.attr('string')
message: DS.attr('string')
state: DS.attr('string')
remoteUrl: DS.attr('string')
project: DS.belongsTo('project')
expiresAt: DS.attr('date')
createdAt: DS.attr('date')
authoredAt: DS.attr('date')
author: DS.belongsTo('... |
Add tests for buffer color properties | ColorScanner = require '../lib/color-scanner'
{TextEditor} = require 'atom'
describe 'ColorScanner', ->
[scanner, editor, bufferColor] = []
withTextEditor = (fixture, block) ->
describe "with #{fixture} buffer", ->
beforeEach ->
waitsForPromise -> atom.workspace.open(fixture)
runs -> edi... | ColorScanner = require '../lib/color-scanner'
{TextEditor} = require 'atom'
describe 'ColorScanner', ->
[scanner, editor, bufferColor] = []
withTextEditor = (fixture, block) ->
describe "with #{fixture} buffer", ->
beforeEach ->
waitsForPromise -> atom.workspace.open(fixture)
runs -> edi... |
Fix Message signature via API | class @WalletMessageIndexDialogViewController extends ledger.common.DialogViewController
view:
derivationPath: '#derivation_path'
message: '#message'
confirmButton: '#confirm_button'
error: "#error_container"
onAfterRender: ->
super
@_isEditable = @params.editable || no
chrome.app.wind... | class @WalletMessageIndexDialogViewController extends ledger.common.DialogViewController
view:
derivationPath: '#derivation_path'
message: '#message'
confirmButton: '#confirm_button'
error: "#error_container"
onAfterRender: ->
super
@_isEditable = @params.editable || no
chrome.app.wind... |
Test that total is updated when lines change | describe "Skr.Models.SalesOrder", ->
xit "must have a customer to save", (done)->
model = new Skr.Models.SalesOrder()
Lanes.Test.ModelSaver.perform(model, done).then (save)->
expect(save.error).toHaveBeenCalled()
expect(model.errors.customer).toContain("is not set")
| describe "Skr.Models.SalesOrder", ->
it "it calculates total", ->
so = new Skr.Models.SalesOrder()
so.lines.add(sku_code: 'TEST', price: 2.12, qty:1)
expect(so.total).toEqual(jasmine.any(_.bigDecimal))
expect(so.total.toString()).toEqual('2.12')
so.order_total = 1.42
... |
Add guard clause on variant overrides filter in case hub id is not present in the hubPermissions | angular.module("admin.variantOverrides").filter "hubPermissions", ($filter) ->
return (products, hubPermissions, hub_id) ->
return [] if !hub_id
return $filter('filter')(products, ((product) -> hubPermissions[hub_id].indexOf(product.producer_id) > -1), true)
| angular.module("admin.variantOverrides").filter "hubPermissions", ($filter) ->
return (products, hubPermissions, hub_id) ->
return [] if !hub_id
return [] if !hubPermissions[hub_id]
return $filter('filter')(products, ((product) -> hubPermissions[hub_id].indexOf(product.producer_id) > -1), true)
|
Remove redundant part of PanelView | Message = require './message'
class PanelView extends HTMLElement
initialize:(@linter) ->
@id = 'linter-panel'
@_decorations = []
empty: ->
return unless @_decorations.length
@_decorations.forEach (decoration) ->
try decoration.destroy()
@_decorations = []
@innerHTML = ''
update: ... | Message = require './message'
class PanelView extends HTMLElement
initialize:(@linter) ->
@id = 'linter-panel'
render: (messages) ->
messages.forEach (message) =>
if @linter.views.scope is 'file'
return unless message.currentFile
if message.currentFile and message.position
p = ... |
Add varying enemy spawn frequency depending on selected level | enemies = null
enemyList = []
class EnemyManager
maxEnemies: 15
spawnFrequency: 3 #seconds
constructor: ->
@enemiesOnScreen = 0
enemies = game.add.group()
enemies.enableBody = true
game.time.events.loop(Phaser.Timer.SECOND * @spawnFrequency, @spawnWrapper, this)
spawn: (x, y) ->
@enemi... | enemies = null
enemyList = []
class EnemyManager
maxEnemies: 15
constructor: ->
@enemiesOnScreen = 0
enemies = game.add.group()
enemies.enableBody = true
switch currentLevel
when 'one' then @spawnFrequency = 4 #seconds
when 'two' then @spawnFrequency = 3 #seconds
when 'thre... |
Set input encoding to utf8 | crypto = nodeRequire 'crypto'
module.exports =
class Pasteboard
signatureForMetadata: null
md5: (text) ->
crypto.createHash('md5').update(text).digest('hex')
write: (text, metadata) ->
@signatureForMetadata = @md5(text)
@metadata = metadata
$native.writeToPasteboard(text)
read: ->
text =... | crypto = nodeRequire 'crypto'
module.exports =
class Pasteboard
signatureForMetadata: null
md5: (text) ->
crypto.createHash('md5').update(text, 'utf8').digest('hex')
write: (text, metadata) ->
@signatureForMetadata = @md5(text)
@metadata = metadata
$native.writeToPasteboard(text)
read: ->
... |
Remove split which isn't in the node package dependencies | #!highlights/node_modules/coffee-script/bin/coffee
Highlights = require 'highlights'
fs = require 'fs'
path = require 'path'
split = require 'split'
highlighter = new Highlights()
highlighter.requireGrammarsSync
modulePath: require.resolve('./atom-language-perl6/package.json')
stdin = process.openStdin()
stdin.set... | #!highlights/node_modules/coffee-script/bin/coffee
Highlights = require 'highlights'
fs = require 'fs'
path = require 'path'
highlighter = new Highlights()
highlighter.requireGrammarsSync
modulePath: require.resolve('./atom-language-perl6/package.json')
stdin = process.openStdin()
stdin.setEncoding 'utf8'
stdin.o... |
Call toScroll after any new panel is . Also added an actual delay as it still scrolled to the 'old' location.. 10 ms was too short to allow the location to update after the old panel closes (on Chrome), 50 ms seems ok. | Darkswarm.controller "AccordionCtrl", ($scope, localStorageService, $timeout, $document, CurrentHub) ->
key = "accordion_#{$scope.order.id}#{CurrentHub.hub.id}#{$scope.order.user_id}"
value = if localStorageService.get(key) then {} else { details: true, billing: false, shipping: false, payment: false }
localStora... | Darkswarm.controller "AccordionCtrl", ($scope, localStorageService, $timeout, $document, CurrentHub) ->
key = "accordion_#{$scope.order.id}#{CurrentHub.hub.id}#{$scope.order.user_id}"
value = if localStorageService.get(key) then {} else { details: true, billing: false, shipping: false, payment: false }
localStora... |
Fix missing config in search specs | require './spec-helper'
ColorSearch = require '../lib/color-search'
describe 'ColorSearch', ->
[search, pigments, project] = []
beforeEach ->
waitsForPromise -> atom.packages.activatePackage('pigments').then (pkg) ->
pigments = pkg.mainModule
project = pigments.getProject()
waitsForPromise ->... | require './spec-helper'
ColorSearch = require '../lib/color-search'
describe 'ColorSearch', ->
[search, pigments, project] = []
beforeEach ->
atom.config.set 'pigments.sourceNames', [
'**/*.styl'
'**/*.less'
]
waitsForPromise -> atom.packages.activatePackage('pigments').then (pkg) ->
... |
Add a class for tracking current location | Q = require('q')
class GeoCoder
constructor: () ->
@geocoder = new google.maps.Geocoder()
code: (request) ->
deferred = Q.defer()
@geocoder.geocode request, (results, status) ->
if status is google.maps.GeocoderStatus.OK
deferred.resolve results.map (result) ->
address: result.f... | $ = require('jquery')
Bacon = require('bacon')
class GeoCoder
constructor: () ->
@geocoder = new google.maps.Geocoder()
code: (request) ->
deferred = $.Deferred()
@geocoder.geocode request, (results, status) ->
if status is google.maps.GeocoderStatus.OK
deferred.resolve results.map (resul... |
Change Author filter criteria in PaperEditRoute. | ETahi.PaperEditRoute = ETahi.AuthorizedRoute.extend
beforeModel: ->
visualEditorScript = '/visual-editor.js'
unless ETahi.LazyLoaderMixin.loaded[visualEditorScript]
$.getScript(visualEditorScript).then ->
ETahi.LazyLoaderMixin.loaded[visualEditorScript] = true
model: (params) ->
paper = @... | ETahi.PaperEditRoute = ETahi.AuthorizedRoute.extend
beforeModel: ->
visualEditorScript = '/visual-editor.js'
unless ETahi.LazyLoaderMixin.loaded[visualEditorScript]
$.getScript(visualEditorScript).then ->
ETahi.LazyLoaderMixin.loaded[visualEditorScript] = true
model: ->
paper = @modelFor(... |
Add popups to the index map | Shothere.Views.Movies ||= {}
class Shothere.Views.Movies.IndexView extends Shothere.Views.MapView
template: JST["templates/movies/index"]
initialize: () ->
@options.movies.bind('reset', @addAll)
addAll: () =>
@options.movies.each(@addOne)
addOne: (movie) =>
view = new Shothere.Views.Movies.Movie... | Shothere.Views.Movies ||= {}
class Shothere.Views.Movies.IndexView extends Shothere.Views.MapView
template: JST["templates/movies/index"]
templatePopup: JST["templates/movies/popup"]
initialize: () ->
@options.movies.bind('reset', @addAll)
addAll: () =>
@options.movies.each(@addOne)
addOne: (movi... |
Fix for issue with blank names | if @Curri && @Curri.user
userData =
email: Curri.user.email
classRole: Curri.user.classrole_type
created: Curri.user.created_at
firstName: Curri.user.first_name || ''
lastName: Curri.user.last_name || ''
analytics.identify(Curri.user.id, userData) | if @Curri && @Curri.user
userData =
email: Curri.user.email
classRole: Curri.user.classrole_type
created: Curri.user.created_at
firstName: Curri.user.first_name || 'No'
lastName: Curri.user.last_name || 'Name'
analytics.identify(Curri.user.id, userData) |
Fix StudentLoginModal when email or password is not included | ModalView = require 'views/core/ModalView'
template = require 'templates/courses/student-log-in-modal'
auth = require 'core/auth'
forms = require 'core/forms'
User = require 'models/User'
module.exports = class StudentSignInModal extends ModalView
id: 'student-log-in-modal'
template: template
events:
'cli... | ModalView = require 'views/core/ModalView'
template = require 'templates/courses/student-log-in-modal'
auth = require 'core/auth'
forms = require 'core/forms'
User = require 'models/User'
module.exports = class StudentSignInModal extends ModalView
id: 'student-log-in-modal'
template: template
events:
'cli... |
Fix error for parsing undefined | # Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
ready = ->
parseText = (text) ->
# parsing markdown to html
$('#item-preview-content').html(marked(text... | # Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
ready = ->
parseText = (text) ->
# parsing markdown to html
$('#item-preview-content').html(marked(text... |
Save the hub_id from the HomePi | mongo = require '../models/connection'
exports.collect = (req, res) ->
if req.get('content-type').indexOf('application/json') == -1
throw new Error("Body request is not JSON.")
jsonData = req.body
mongo.db.collection('sensor').count(
{sensor_id : jsonData.sensor_id}, (err, count) ->
... | mongo = require '../models/connection'
exports.collect = (req, res) ->
if req.get('content-type').indexOf('application/json') == -1
throw new Error("Body request is not JSON.")
jsonData = req.body
mongo.db.collection('sensors').count(
{sensor_id : jsonData.sensor_id}, (err, count) ->
... |
Add `templates` to the `hasFeature` function | Settings = require 'settings-sharelatex'
module.exports = Features =
externalAuthenticationSystemUsed: ->
Settings.ldap? or Settings.saml? or Settings.overleaf?.oauth?
hasFeature: (feature) ->
switch feature
when 'homepage'
return Settings.enableHomepage
when 'registration'
return not Features.ext... | Settings = require 'settings-sharelatex'
module.exports = Features =
externalAuthenticationSystemUsed: ->
Settings.ldap? or Settings.saml? or Settings.overleaf?.oauth?
hasFeature: (feature) ->
switch feature
when 'homepage'
return Settings.enableHomepage
when 'registration'
return not Features.ext... |
Fix scroll save for chat | # 3rd Party Libraries
immutable = require('immutable')
# Internal Libraries
misc = require('smc-util/misc')
{types} = misc
exports.get_store_def = (name) ->
name: name
stateTypes:
height : types.number # 0 means not rendered; otherwise is the height of the chat editor
inpu... | # 3rd Party Libraries
immutable = require('immutable')
# Internal Libraries
misc = require('smc-util/misc')
{types} = misc
exports.get_store_def = (name) ->
name: name
stateTypes:
height : types.number # 0 means not rendered; otherwise is the height of the chat editor
inpu... |
Make test helpers smart about checking for suffixed tests | Walrus = require '../../bin/walrus'
TestHelpers =
pass : ( specs, suffix='' ) ->
fs = require 'fs'
path = require 'path'
exec = require( 'child_process' ).exec
for file in fs.readdirSync specs when path.extname( file ) is '.wal'
do ( file ) ->
base = path.basename file, '.wal'... | Walrus = require '../../bin/walrus'
fs = require 'fs'
path = require 'path'
TestHelpers =
read : ( filename ) -> fs.readFileSync filename, 'utf8' if path.existsSync filename
pass : ( specs, suffix='' ) ->
fs = require 'fs'
path = require 'path'
exec = require( 'child_process' ).exec
for... |
Check if CC is valid when setting payment | Sprangular.controller 'CheckoutDeliveryAndPaymentCtrl', ($scope, Account, Cart, Checkout) ->
$scope.order = Cart.current
$scope.processing = false
$scope.user = Account.user
$scope.$watch 'order.state', (state) ->
$scope.done = state == 'confirm'
$scope.active = _.contains(['delivery', 'payment'], stat... | Sprangular.controller 'CheckoutDeliveryAndPaymentCtrl', ($scope, Account, Cart, Checkout) ->
$scope.order = Cart.current
$scope.processing = false
$scope.user = Account.user
$scope.$watch 'order.state', (state) ->
$scope.done = state == 'confirm'
$scope.active = _.contains(['delivery', 'payment'], stat... |
Initialize UPnP in a different way | uuid = require 'node-uuid'
ssdp = require './ssdp'
extend = require('./helpers').extend
configDefaults =
device:
schema:
prefix: 'urn:schemas-upnp-org:device'
uuid: 'uuid:' + uuid()
network:
ssdp:
timeout: 1800
address: '239.255.255.250'
p... | uuid = require 'node-uuid'
ssdp = require './ssdp'
xmlServer = require './xml-server'
upnp = {}
upnp.createDevice = (type, version, callback) =>
for arg in arguments
if typeof arg is 'Function'
callback = arg
@config =
device:
schema:
prefix: 'urn:schema... |
Clean up, don't allocate an extra date |
module.exports = (obj, methodName, key, logger) ->
metrics = require('./metrics')
if typeof obj[methodName] != 'function'
throw new Error("[Metrics] expected object property '#{methodName}' to be a function")
realMethod = obj[methodName]
key = "methods.#{key}"
obj[methodName] = (originalArgs...) ->
[first... |
module.exports = (obj, methodName, key, logger) ->
metrics = require('./metrics')
if typeof obj[methodName] != 'function'
throw new Error("[Metrics] expected object property '#{methodName}' to be a function")
realMethod = obj[methodName]
key = "methods.#{key}"
obj[methodName] = (originalArgs...) ->
[first... |
Add mobile operator codes for Iraq |
Phone = require('../Phone')
PhoneNumber = require('../PhoneNumber')
class Iraq
constructor: ->
@countryName = "Iraq"
@countryNameAbbr = "IRQ"
@countryCode = '964'
@regex = /^(?:\+|00)964(7?\d{1,2})\d{7}$/
@optionalTrunkPrefix = '0'
@nationalNumberSeparator = ' '
@nationalDestinationCode =
['1', '21'... |
Phone = require('../Phone')
PhoneNumber = require('../PhoneNumber')
class Iraq
constructor: ->
@countryName = "Iraq"
@countryNameAbbr = "IRQ"
@countryCode = '964'
@regex = /^(?:\+|00)964(7?\d{1,2})\d{7}$/
@optionalTrunkPrefix = '0'
@nationalNumberSeparator = ' '
@nationalDestinationCode =
['7(\\d{2}... |
Use sequentially instead of fromArray | Bacon = require 'baconjs'
atomStreams = require './streams.coffee'
filteredPathsStream = (pairwisePathsStream, filterFn) ->
pairwisePathsStream.flatMap (pair) ->
Bacon.fromArray filterFn(pair)
module.exports = ->
pathsStream = atomStreams.fromDisposable atom.project, 'onDidChangePaths'
.merge Bacon.fromAr... | Bacon = require 'baconjs'
atomStreams = require './streams.coffee'
filteredPathsStream = (pairwisePathsStream, filterFn) ->
pairwisePathsStream.flatMap (pair) ->
Bacon.sequentially 0, filterFn(pair)
module.exports = ->
pathsStream = atomStreams.fromDisposable atom.project, 'onDidChangePaths'
.merge Bacon.... |
Trim trailing whitespace when exiting insert mode | # auto-indent when changing line or inserting at end of line
atom.commands.onDidDispatch (evt) ->
validCommands = [
'vim-mode-plus:change',
'vim-mode-plus:insert-after-end-of-line'
]
return unless evt.type in validCommands
editor = atom.workspace.getActivePaneItem()
element = editor.getElement()
ret... | # auto-indent when changing line or inserting at end of line
handleAutoIndentAfterChangeLine = (evt) ->
validCommands = [
'vim-mode-plus:change',
'vim-mode-plus:insert-after-end-of-line'
]
return unless evt.type in validCommands
editor = atom.workspace.getActivePaneItem()
element = editor.getElement()... |
Remove tasks/gyp.js before running tests | module.exports = (grunt) ->
grunt.initConfig
clean:
package: ['tasks/gyp.js']
test: ['test/support/build']
coffee:
task:
options:
bare: true
files:
'tasks/gyp.js': 'tasks/gyp.coffee'
mochacli:
options:
bail: true
compilers: ['coffee:coffee-script/register']
files: ['test/... | module.exports = (grunt) ->
grunt.initConfig
clean:
package: ['tasks/gyp.js']
test: ['test/support/build']
coffee:
task:
options:
bare: true
files:
'tasks/gyp.js': 'tasks/gyp.coffee'
mochacli:
options:
bail: true
compilers: ['coffee:coffee-script/register']
files: ['test/... |
Add parens to call with return value | window.FactlinkAppMode ?= {}
window.FactlinkAppMode.coreInClient = (app) ->
app.onClientApp = true
app.startClientRegions()
annotatedSiteEnvoy = window.initClientCommunicator()
new ClientRouter controller: new ClientController annotatedSiteEnvoy
FactlinkApp.clientCloseDiscussionModalInitializer annotatedSi... | window.FactlinkAppMode ?= {}
window.FactlinkAppMode.coreInClient = (app) ->
app.onClientApp = true
app.startClientRegions()
annotatedSiteEnvoy = window.initClientCommunicator()
new ClientRouter controller: new ClientController(annotatedSiteEnvoy)
FactlinkApp.clientCloseDiscussionModalInitializer annotatedS... |
Remove start of line from comment regex in syntax highlighting | # If this is your first time writing a language grammar, check out:
# - http://manual.macromates.com/en/language_grammars
'scopeName': 'source.ait'
'name': 'Ait'
'fileTypes': [
'ait'
]
'patterns': [
{
'match': '^#.*$'
'name': 'comment.ait'
}
{
'captures':
'1':
'name': 'keyword.load.... | # If this is your first time writing a language grammar, check out:
# - http://manual.macromates.com/en/language_grammars
'scopeName': 'source.ait'
'name': 'Ait'
'fileTypes': [
'ait'
]
'patterns': [
{
'match': '#.*$'
'name': 'comment.ait'
}
{
'captures':
'1':
'name': 'keyword.load.a... |
Break up commands into two spawns | path = require 'path'
module.exports = (grunt) ->
{spawn} = require('./task-helpers')(grunt)
grunt.registerTask 'codesign', 'Codesign the app', ->
done = @async()
if process.platform is 'darwin' and process.env.XCODE_KEYCHAIN
unlockKeychain (error) ->
if error?
done(error)
... | path = require 'path'
module.exports = (grunt) ->
{spawn} = require('./task-helpers')(grunt)
grunt.registerTask 'codesign', 'Codesign the app', ->
done = @async()
if process.platform is 'darwin' and process.env.XCODE_KEYCHAIN
unlockKeychain (error) ->
if error?
done(error)
... |
Call openPanel instead of openPane | {_, Document} = require 'atom'
SettingsView = null
settingsView = null
configUri = 'atom://config'
createSettingsView = (state) ->
SettingsView ?= require './settings-view'
unless state instanceof Document
state = _.extend({deserializer: deserializer.name, version: deserializer.version}, state)
state = a... | {_, Document} = require 'atom'
SettingsView = null
settingsView = null
configUri = 'atom://config'
createSettingsView = (state) ->
SettingsView ?= require './settings-view'
unless state instanceof Document
state = _.extend({deserializer: deserializer.name, version: deserializer.version}, state)
state = a... |
Update format for campfire plugin | 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.trigger.message} in #{event.project.name}! #{event.error.exceptionClass}" + (if event.error.message then ": #{event.... |
Use select2 for data_type select | Augury.Views.Parameters.Edit = Backbone.View.extend(
initialize: (attrs) ->
@options = attrs
events:
'click button#save': 'save'
'click button#cancel': 'cancel'
'change :input': 'changed'
'focusout :input': 'validate'
render: ->
@$el.html JST["admin/templates/parameters/edit"](parameter:... | Augury.Views.Parameters.Edit = Backbone.View.extend(
initialize: (attrs) ->
@options = attrs
events:
'click button#save': 'save'
'click button#cancel': 'cancel'
'change :input': 'changed'
'focusout :input': 'validate'
render: ->
@$el.html JST["admin/templates/parameters/edit"](parameter:... |
Use cloned model for UserPopoverContentView to not run into trouble with urls for following/unfollowing | class window.UserPopoverContentView extends StatisticsPopoverContentView
templateHelpers: ->
heading: @model.get('name')
onRender: ->
@statisticsRegion.show new UserStatisticsView model: @model
@ui.buttonRegion.addClass 'statistics-popover-content-button-hidden'
@_showFollowButton()
_showFollo... | class window.UserPopoverContentView extends StatisticsPopoverContentView
templateHelpers: ->
heading: @model.get('name')
onRender: ->
@statisticsRegion.show new UserStatisticsView model: @model
@ui.buttonRegion.addClass 'statistics-popover-content-button-hidden'
@_showFollowButton()
_showFollo... |
Add a new spec for testing getCode() | {WorkspaceView} = require 'atom'
CodeContext = require '../lib/code-context'
describe 'CodeContext', ->
beforeEach ->
atom.workspaceView = new WorkspaceView
textSource = atom.workspace.getActiveEditor()
@codeContext = new CodeContext('test.txt', '/tmp/test.txt', null)
describe 'fileColonLine when line... | CodeContext = require '../lib/code-context'
describe 'CodeContext', ->
beforeEach ->
@codeContext = new CodeContext('test.txt', '/tmp/test.txt', null)
describe 'fileColonLine when lineNumber is not set', ->
it 'returns the full filepath when fullPath is truthy', ->
expect(@codeContext.fileColonLine(... |
Implement support for the new minimap decoration API | {View} = require 'atom'
MarkerView = require './marker-view'
module.exports =
class MinimapSelectionView extends View
markers: []
@content: ->
@div class: 'minimap-selection'
initialize: (@minimapView) ->
@subscribe @minimapView.editorView, "selection:changed", @handleSelection
attach: ->
@minimap... | {View} = require 'atom'
MarkerView = require './marker-view'
module.exports =
class MinimapSelectionView extends View
decorations: []
@content: ->
@div class: 'minimap-selection'
initialize: (@minimapView) ->
@subscribe @minimapView.editorView, "selection:changed", @handleSelection
@subscribe @minima... |
Allow usage of task inbox task ID URL parameter | angular.module('doubtfire.units.states.task-inbox', [
# 'doubtfire.units.states.task-inbox.task-commenter'
# 'doubtfire.units.states.task-inbox.task-submission'
])
#
# Teacher child state for units
#
.config(($stateProvider) ->
$stateProvider.state 'units#tasks', {
parent: 'units#index'
url: '/tasks/:tas... | angular.module('doubtfire.units.states.task-inbox', [
# 'doubtfire.units.states.task-inbox.task-commenter'
])
#
# Teacher child state for units
#
.config(($stateProvider) ->
$stateProvider.state 'units#tasks', {
parent: 'units#index'
url: '/tasks/:taskId'
views:
unitIndex:
templateUrl: "u... |
Improve width and height detection. | angular.module('browser').
factory('Browser', ->
return class Browser
@prefixs: ['webkit', 'Moz', 'ms', 'o', 'khtml']
@window: window
@element: window.document.documentElement
@body: window.document.getElementsByTagName('body')[0]
@height: ->
@window.innerHeight or
@element... | angular.module('browser').
factory('Browser', ->
return class Browser
@prefixs: ['webkit', 'Moz', 'ms', 'o', 'khtml']
@window: window
@element: window.document.documentElement
@body: window.document.getElementsByTagName('body')[0]
@_height: ->
@window.innerHeight or
@elemen... |
Add forceexit argument to test command | 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... | 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... |
Add basic unit tests for the hear & respond handlers | chai = require 'chai'
sinon = require 'sinon'
chai.use require 'sinon-chai'
expect = chai.expect
describe 'jira-linkifier', ->
beforeEach ->
@robot =
respond: sinon.spy()
hear: sinon.spy()
require('../src/jira-linkifier')(@robot)
it 'registers a respond listener', ->
expect(@robot.respon... | chai = require 'chai'
sinon = require 'sinon'
chai.use require 'sinon-chai'
expect = chai.expect
describe 'jira-linkifier', ->
beforeEach ->
@robot =
respond: sinon.spy()
hear: sinon.spy()
@prefixes = process.env.HUBOT_JIRA_LINKIFIER_PROJECT_PREFIXES = "XXX,YYY,ZZZ"
@jiraUrl = process... |
Fix deprecation warning with bodyParser middleware | express = require 'express'
assets = require 'connect-assets'
stylus = require 'stylus'
session = require 'express-session'
cookieParser = require 'cookie-parser'
bodyParser = require 'body-parser'
db = require './models'
#### Basic application initialization
# Create app instance
app = express()
# Define port to lis... | express = require 'express'
assets = require 'connect-assets'
stylus = require 'stylus'
session = require 'express-session'
cookieParser = require 'cookie-parser'
bodyParser = require 'body-parser'
db = require './models'
#### Basic application initialization
# Create app instance
app = express()
# Define port to lis... |
Change UI to only require weather if closed. | # 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/
$ ->
$(".report_reason input").removeAttr("required")
do update_reason = ->
if $(".report_greens inpu... | # 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/
$ ->
$(".report_reason input, .report_greens input").removeAttr("required")
do toggle_fields_for_greens ... |
Include apostrophe in word regex | module.exports =
findMisspellings: (text) ->
wordRegex = /(?:^|\s)([a-zA-Z]+)(?=\s|\.|$)/g
row = 0
misspellings = []
for line in text.split('\n')
while matches = wordRegex.exec(line)
word = matches[1]
continue unless $native.isMisspelled(word)
startColumn = matches.index ... | module.exports =
findMisspellings: (text) ->
wordRegex = /(?:^|\s)([a-zA-Z']+)(?=\s|\.|$)/g
row = 0
misspellings = []
for line in text.split('\n')
while matches = wordRegex.exec(line)
word = matches[1]
continue unless $native.isMisspelled(word)
startColumn = matches.index... |
Document toJSON unit tests added | 'use strict'
{Document, utils} = Neft
VIEWS_CACHE_FILE = 'tmp/views.json'
loaded = false
exports.uid = do (i = 0) -> -> "index_#{i++}.html"
exports.createView = do ->
getViewPath = (viewUid) ->
"tmp/views/#{viewUid}.json"
if utils.isNode
(html, viewUid = exports.uid()) ->
loade... | 'use strict'
{Document, utils} = Neft
VIEWS_CACHE_FILE = 'tmp/views.json'
loaded = false
exports.uid = do (i = 0) -> -> "index_#{i++}.html"
exports.createView = do ->
getViewPath = (viewUid) ->
"tmp/views/#{viewUid}.json"
if utils.isNode
(html, viewUid = exports.uid()) ->
loade... |
Add some more basic tests on denorm and field bindings | ###
Copyright 2015, Quixey Inc.
All rights reserved.
Licensed under the Modified BSD License found in the
LICENSE file in the root directory of this source tree.
###
Tinytest.add "denormalization A -> B", (test) ->
bar = new $$.Bar
foo = new $$.Foo
foo.insert()
console.log 1
try
... | ###
Copyright 2015, Quixey Inc.
All rights reserved.
Licensed under the Modified BSD License found in the
LICENSE file in the root directory of this source tree.
###
cleanUp = ->
if Meteor.isServer
$$.Foo.fetch().forEach (foo) -> foo.remove()
$$.Bar.fetch().forEach (bar) -> bar.re... |
Fix Holy 80 columns line | Declaration = require('../declaration')
class Filter extends Declaration
@names = ['filter']
# Check is it Internet Explorer filter
check: (decl) ->
v = decl.value
v.toLowerCase().indexOf('alpha(') == -1 and v.indexOf('DXImageTransform.Microsoft') == -1
module.exports = Filter
| Declaration = require('../declaration')
class Filter extends Declaration
@names = ['filter']
# Check is it Internet Explorer filter
check: (decl) ->
v = decl.value
v.toLowerCase().indexOf('alpha(') == -1 and
v.indexOf('DXImageTransform.Microsoft') == -1
module.exports = Filter
|
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: 'error'
... | 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:
... |
Refactor session service, add isAdmin() to check for admin status of current authenticated user | angular.module('kassa').service('SessionService',[
'$http'
'$q'
'$window'
'UserService'
($http, $q, $window, User)->
currentUser = null
equal = angular.equals
setUser = (user)-> currentUser = user
checkStatus = -> User.find('me').then(setUser)
signIn = (email, password, rememberMe=true... | angular.module('kassa').service('SessionService',[
'$http'
'$q'
'$window'
'UserService'
($http, $q, $window, User)->
authenticatedUser = null
equal = angular.equals
setUser = (user)-> authenticatedUser = user
checkStatus = -> User.find('me').then(setUser)
signIn = (email, password, rem... |
Add helper function execGruntTask(task, callback) | should = require('chai').should()
describe 'grunt-node-gyp', ->
describe 'configure', ->
it 'should configure a release build by default', ->
;
it 'should configure a debug build if the debug option is passed', ->
;
it 'should fail if there is no binding.gyp', ->
;
describe 'build', ->
it 'should... | should = require('chai').should()
grunt = require 'grunt'
gruntOptions =
gruntfile: __dirname + '/support/Gruntfile.coffee'
execGruntTask = (task, callback) ->
grunt.tasks 'gyp:' + task, gruntOptions, ->
callback()
describe 'grunt-node-gyp', ->
describe 'configure', ->
it 'should configure a release build by ... |
Add a default title for new books or content | define [
'marionette'
'cs!collections/content'
'hbs!templates/workspace/menu/add'
'hbs!templates/workspace/menu/add-item'
'bootstrapDropdown'
], (Marionette, allContent, addTemplate, addItemTemplate) ->
class AddItemView extends Marionette.ItemView
tagName: 'li'
template: addItemTemplate
even... | define [
'marionette'
'cs!collections/content'
'hbs!templates/workspace/menu/add'
'hbs!templates/workspace/menu/add-item'
'bootstrapDropdown'
], (Marionette, allContent, addTemplate, addItemTemplate) ->
class AddItemView extends Marionette.ItemView
tagName: 'li'
template: addItemTemplate
even... |
Fix incorrect template for user admin | angular.module('doubtfire.admin.states.users', [])
#
# Administration panel for all doubtfire users
#
.config((headerServiceProvider) ->
usersAdminViewStateData =
url: "/admin/users"
views:
main:
controller: "AdministerUsersCtrl"
templateUrl: "users/states/users/users.tpl.html"
data... | angular.module('doubtfire.admin.states.users', [])
#
# Administration panel for all doubtfire users
#
.config((headerServiceProvider) ->
usersAdminViewStateData =
url: "/admin/users"
views:
main:
controller: "AdministerUsersCtrl"
templateUrl: "admin/states/users/users.tpl.html"
data... |
Remove alt-shift-s bindings that conflict with typing AltGraph chars | # it's critical that these bindings be loaded after those snippets-1 so they
# are later in the cascade, hence breaking the keymap into 2 files
'atom-text-editor:not([mini])':
'tab': 'snippets:next-tab-stop'
'shift-tab': 'snippets:previous-tab-stop'
'alt-shift-s': 'snippets:available'
'.available-snippets atom-... | # it's critical that these bindings be loaded after those snippets-1 so they
# are later in the cascade, hence breaking the keymap into 2 files
'atom-text-editor:not([mini])':
'tab': 'snippets:next-tab-stop'
'shift-tab': 'snippets:previous-tab-stop'
|
Move `handleEvents` method definition under the `constructor` | AppMenu = require "./AppMenu"
AppWindow = require "./AppWindow"
fs = require "fs"
ipc = require "ipc"
EventEmitter = require "eventemitter3"
{Disposable} = require "event-kit"
assign = (dest, objects...) ->
for o in objects
dest[k] = v for k, v of o
... | AppMenu = require "./AppMenu"
AppWindow = require "./AppWindow"
fs = require "fs"
ipc = require "ipc"
EventEmitter = require "eventemitter3"
{Disposable} = require "event-kit"
assign = (dest, objects...) ->
for o in objects
dest[k] = v for k, v of o
... |
Set href on favicon <link> tag second time in a timeout | `import Ember from 'ember'`
manager = (headTag) ->
@headTag = headTag if headTag
return this
manager.prototype.getHeadTag = ->
@headTag || document.getElementsByTagName('head')[0]
manager.prototype.setFavicon = (href) ->
head = @getHeadTag()
if oldLink = @getLinkTag()
head.removeChild(oldLink)
lin... | `import Ember from 'ember'`
manager = (headTag) ->
@headTag = headTag if headTag
return this
manager.prototype.getHeadTag = ->
@headTag || document.getElementsByTagName('head')[0]
manager.prototype.setFavicon = (href) ->
head = @getHeadTag()
if oldLink = @getLinkTag()
head.removeChild(oldLink)
lin... |
Revert "Behaviors support for Yandex.Maps" | class @Gmaps4Rails.Yandex.Map extends Gmaps4Rails.Common
@include Gmaps4Rails.Interfaces.Map
@include Gmaps4Rails.Map
@include Gmaps4Rails.Yandex.Shared
@include Gmaps4Rails.Configuration
CONF:
disableDefaultUI: false
disableDoubleClickZoom: false
type: "yandex#map" ... | class @Gmaps4Rails.Yandex.Map extends Gmaps4Rails.Common
@include Gmaps4Rails.Interfaces.Map
@include Gmaps4Rails.Map
@include Gmaps4Rails.Yandex.Shared
@include Gmaps4Rails.Configuration
CONF:
disableDefaultUI: false
disableDoubleClickZoom: false
type: "yandex#map" ... |
Fix bug when switching node language to a published version (getBoundingClientRect bug) | viewportChannel = Backbone.Wreqr.radio.channel('viewport')
viewportChannel.commands.setHandler 'init', (blockpanel) ->
$(this).data 'blockpanel', blockpanel if typeof blockpanel != 'undefined'
ghostPanel = $('#ghost-blockpanel', $(this).data('blockpanel'))
ghostPanel.show()
$(this).data 'fixedtop', ghostPanel[... | viewportChannel = Backbone.Wreqr.radio.channel('viewport')
viewportChannel.commands.setHandler 'init', (blockpanel) ->
$(this).data 'blockpanel', blockpanel if typeof blockpanel != 'undefined'
ghostPanel = $('#ghost-blockpanel', $(this).data('blockpanel'))
if (ghostPanel[0])
ghostPanel.show()
$(this).dat... |
Tidy (looks easier to unterstand) | {spawn} = require 'child_process'
module.exports = (gulp) ->
gulp.task 'build:webserver', ->
node.kill() if node
node = spawn "coffee", ["src/server", '--port', '8000'],
stdio: "inherit"
node.on "close", (code) ->
switch code
when 8
gulp.log "Error detected, waiting for chan... | {spawn} = require 'child_process'
module.exports = (gulp) ->
gulp.task 'build:webserver', ->
node.kill() if node
node = spawn "coffee", 'src/server --port 8000 --env development'.split(' '),
stdio: "inherit"
node.on "close", (code) ->
switch code
when 8
gulp.log "Error detec... |
Update the 1.0 stable mark | #
# CoffeeScript jQuery Plugin Boilerplate
# By: Matthieu Aussaguel, http://www.mynameismatthieu.com, @mattaussaguel
# Version: 1.0 alpha 1.0
# Updated: June 27th, 2011
#
jQuery ->
$.pluginName = (element, options) ->
# default plugin settings
@defaults = {
message : 'hellow word' #... | #
# CoffeeScript jQuery Plugin Boilerplate
# By: Matthieu Aussaguel, http://www.mynameismatthieu.com, @mattaussaguel
# Version: 1.0 Stable
# Updated: June 27th, 2011
# More info: http://minijs.com/
#
jQuery ->
$.pluginName = (element, options) ->
# default plugin settings
@defaults = {
... |
Fix naming problem with ErrorType constants | class Game.State extends Game.TwoWay
constructor: () ->
@objects = {}
@eventCounters = {}
@eventHandlers = {}
super
onEvent: (e) ->
# Add timestamped instance to the event counters object
if e.type not of @eventCounters
@eventCounters[e.type] = []
@eventCounters[e.type].push new Da... | class Game.State extends Game.TwoWay
constructor: () ->
@objects = {}
@eventCounters = {}
@eventHandlers = {}
super
onEvent: (e) ->
# Add timestamped instance to the event counters object
if e.type not of @eventCounters
@eventCounters[e.type] = []
@eventCounters[e.type].push new Da... |
Add whitespaces around mathematical operators | # Number to time conversions
Number::second ?= ->
@seconds()
Number::seconds ?= ->
this * 1000
Number::minute ?= ->
@minutes()
Number::minutes ?= ->
@seconds() * 60
Number::hour ?= ->
@hours()
Number::hours ?= ->
@minutes() * 60
Number::day ?= ->
@days()
Number::days ?= ->
@hours() * 24
Number::... | # Number to time conversions
Number::second ?= ->
@seconds()
Number::seconds ?= ->
this * 1000
Number::minute ?= ->
@minutes()
Number::minutes ?= ->
@seconds() * 60
Number::hour ?= ->
@hours()
Number::hours ?= ->
@minutes() * 60
Number::day ?= ->
@days()
Number::days ?= ->
@hours() * 24
Number::... |
Return a 201 on login | {DeviceAuthenticator} = require 'meshblu-authenticator-core'
MeshbluDB = require 'meshblu-db'
debug = require('debug')('meshblu-email-password-authenticator:sessions-controller')
url = require 'url'
class SessionController
constructor: (meshbluJSON, @meshblu) ->
@authenticatorUuid = meshbluJSON.uuid
@authent... | {DeviceAuthenticator} = require 'meshblu-authenticator-core'
MeshbluDB = require 'meshblu-db'
debug = require('debug')('meshblu-email-password-authenticator:sessions-controller')
url = require 'url'
class SessionController
constructor: (meshbluJSON, @meshblu) ->
@authenticatorUuid = meshbluJSON.uuid
@authent... |
Use task helper for determining lateness | React = require 'react'
BS = require 'react-bootstrap'
S = require '../../helpers/string'
{TimeStore} = require '../../flux/time'
moment = require 'moment'
module.exports = React.createClass
displayName: 'EventInfoIcon'
propTypes:
event: React.PropTypes.object.isRequired
render: ->
due = mom... | React = require 'react'
BS = require 'react-bootstrap'
S = require '../../helpers/string'
{TimeStore} = require '../../flux/time'
moment = require 'moment'
TH = require '../../helpers/task'
module.exports = React.createClass
displayName: 'EventInfoIcon'
propTypes:
event: React.PropTypes.object.isRe... |
Make sure cache views are set before onShow | class Backbone.Factlink.CachingController extends Backbone.Factlink.BaseController
openController: ->
super
@cached_views = new Backbone.Factlink.DetachedViewCache
closeController: ->
super
@cached_views.cleanup()
onAction: -> @unbindFrom @permalink_event if @permalink_event?
makePermalinkEve... | class Backbone.Factlink.CachingController extends Backbone.Factlink.BaseController
openController: ->
@cached_views = new Backbone.Factlink.DetachedViewCache
super
closeController: ->
@cached_views.cleanup()
super
onAction: -> @unbindFrom @permalink_event if @permalink_event?
makePermalinkEve... |
Disable built-in atom spell-check 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... |
Remove spaces before computing hash | ssdeep = require 'ssdeep'
htmlToText = require 'html-to-text'
fs = require 'fs'
extractText = (body) ->
return htmlToText.fromString body
module.exports = {
computeHash: (body, contentType) ->
if contentType and /text\/html/.test(contentType)
body = extractText(body)
return ssdeep.hash(body)
}
| ssdeep = require 'ssdeep'
htmlToText = require 'html-to-text'
fs = require 'fs'
extractText = (body) ->
return htmlToText.fromString body
removeSpaces = (body) ->
return body.replace(/\s+/g, ' ')
module.exports = {
computeHash: (body, contentType) ->
if contentType and /text\/html/.test(contentType)
... |
Move the sorting of files to createdOn | `import Ember from 'ember'`
`import PaginateMixin from 'irene/mixins/paginate'`
FileListComponent = Ember.Component.extend PaginateMixin,
project: null
targetObject: "file"
sortProperties: ["id:desc"]
classNames: ["columns", "margin-top"]
extraQueryStrings: Ember.computed "project.id", ->
query =
... | `import Ember from 'ember'`
`import PaginateMixin from 'irene/mixins/paginate'`
FileListComponent = Ember.Component.extend PaginateMixin,
project: null
targetObject: "file"
sortProperties: ["createdOn:desc"]
classNames: ["columns", "margin-top"]
extraQueryStrings: Ember.computed "project.id", ->
quer... |
Clear dataset elements for pooled objects | module.exports =
class DOMElementPool
constructor: ->
@freeElementsByTagName = {}
@freedElements = new Set
clear: ->
@freedElements.clear()
for tagName, freeElements of @freeElementsByTagName
freeElements.length = 0
build: (tagName, className, textContent) ->
element = @freeElementsByT... | module.exports =
class DOMElementPool
constructor: ->
@freeElementsByTagName = {}
@freedElements = new Set
clear: ->
@freedElements.clear()
for tagName, freeElements of @freeElementsByTagName
freeElements.length = 0
build: (tagName, className, textContent = "") ->
element = @freeElemen... |
Use multi property set in example | Monkey.registerView 'post', '''
div[id="monkey"]
h1 title
p body
h3 "Comments (" commentCount ")"
form[submit=postComment]
p
textarea[change=commentEdited]
p
input[type="submit" value="Post"]
ul
- collection comments
- view comment
'''
Monkey.registerView... | Monkey.registerView 'post', '''
div[id="monkey"]
h1 title
p body
h3 "Comments (" commentCount ")"
form[submit=postComment]
p
textarea[change=commentEdited]
p
input[type="submit" value="Post"]
ul
- collection comments
- view comment
'''
Monkey.registerView... |
Add command for reloading all | UIWatcher = require './ui-watcher'
module.exports =
activate: (state) ->
new UIWatcher
themeManager: atom.themes
| UIWatcher = require './ui-watcher'
module.exports =
activate: (state) ->
new UIWatcher
themeManager: atom.themes
rootView.command 'dev-live-reload:reload-all', ->
uiWatcher.reloadAll()
|
Add observe event on EditorRegistry | {Emitter, CompositeDisposable} = require('atom')
EditorLinter = require('./editor-linter')
class EditorRegistry
constructor: ->
@emitter = new Emitter
@subscriptions = new CompositeDisposable
@editorLinters = new Map()
create: (textEditor) ->
@editorLinters.set(textEditor, editorLinter = new Edito... | {Emitter, CompositeDisposable} = require('atom')
EditorLinter = require('./editor-linter')
class EditorRegistry
constructor: ->
@emitter = new Emitter
@subscriptions = new CompositeDisposable
@editorLinters = new Map()
create: (textEditor) ->
@editorLinters.set(textEditor, editorLinter = new Edito... |
Remove text-error from title of error view | {View} = require 'atom'
{GitNotFoundError} = require './git-bridge'
class GitNotFoundErrorView extends View
@content: (err) ->
@div class: 'overlay from-top padded merge-conflict-error merge-conflicts-message', =>
@div class: 'panel', =>
@div class: "panel-heading text-error", =>
@code '... | {View} = require 'atom'
{GitNotFoundError} = require './git-bridge'
class GitNotFoundErrorView extends View
@content: (err) ->
@div class: 'overlay from-top padded merge-conflict-error merge-conflicts-message', =>
@div class: 'panel', =>
@div class: "panel-heading", =>
@code 'git'
... |
Add start fun = issue | # Parse YAML to get config
parse = require './libs/yaml.js'
fs = require 'fs'
path = require 'path'
get = require './libs/get.js'
checks = require './libs/checks.js'
parse = require './libs/parse.js'
# Read instances
start = (args, dir) ->
# Check instances
checks.instances(dir)
# Parse YAML
parsed = parse.par... | # Parse YAML to get config
parse = require './libs/yaml.js'
fs = require 'fs'
path = require 'path'
get = require './libs/get.js'
checks = require './libs/checks.js'
parse = require './libs/parse.js'
exec = require 'child_process'
# Read instances
start = (args, dir) ->
# Check instances
checks.instances(dir)
# ... |
Fix help link to be real | require 'colors'
inquirer = require 'inquirer'
W = require 'when'
###*
* A light wrapper for the prompt interface, which uses inquirer to gather info
* from the user via command line. The use of deferred and the progress event
* are mainly for testing. You get access the the readline object from the
* promp... | require 'colors'
inquirer = require 'inquirer'
W = require 'when'
###*
* A light wrapper for the prompt interface, which uses inquirer to gather info
* from the user via command line. The use of deferred and the progress event
* are mainly for testing. You get access the the readline object from the
* promp... |
Use updated sort syntax for sortedPhases. | ETahi.PaperManageController = Ember.ObjectController.extend
sortedPhases: ( ->
Ember.ArrayProxy.createWithMixins(Em.SortableMixin, {
content: @get('model.phases')
sortProperties: ['position']
})
).property('model.phases.[]', 'model.phases.tasks.@each')
updatePositions: (phase)->
relevantP... | ETahi.PaperManageController = Ember.ObjectController.extend
positionSort: ["position:asc"]
sortedPhases: Ember.computed.sort('phases', 'positionSort')
updatePositions: (phase)->
relevantPhases = @get('model.phases').filter((p)->
p != phase && p.get('position') >= phase.get('position')
)
releva... |
Add a check for Chase's "System Unavailable" error. | wesabe.provide 'fi-scripts.com.chase.errors',
dispatch: ->
if page.present e.errors.unableToCompleteAction
job.fail 503, 'fi.error'
elements:
errors:
unableToCompleteAction: [
'//text()[contains(string(.), "We were unable to process your request")]'
]
| wesabe.provide 'fi-scripts.com.chase.errors',
dispatch: ->
if page.present e.errors.unableToCompleteAction
job.fail 503, 'fi.error'
if page.present e.errors.systemUnavailable
job.fail 503, 'fi.unavailable'
elements:
errors:
unableToCompleteAction: [
'//text()[contains(string(... |
Support empty query parameters for Spree.url | #= require jsuri
class window.Spree
@ready: (callback) ->
jQuery(document).ready(callback)
# Helper function to take a URL and add query parameters to it
# Uses the JSUri library from here: https://code.google.com/p/jsuri/
# Thanks to Jake Moffat for the suggestion: https://twitter.com/jakeonrails/statuses... | #= require jsuri
class window.Spree
@ready: (callback) ->
jQuery(document).ready(callback)
# Helper function to take a URL and add query parameters to it
# Uses the JSUri library from here: https://code.google.com/p/jsuri/
# Thanks to Jake Moffat for the suggestion: https://twitter.com/jakeonrails/statuses... |
Allow empty state in loading indicator | window.ReactLoadingIndicator = React.createBackboneClass
displayName: 'ReactLoadingIndicator'
changeOptions: 'sync request'
render: ->
if !@model() || @model().loading()
_img ['ajax-loader', src: Factlink.Global.ajax_loader_image]
else
_span()
| window.ReactLoadingIndicator = React.createBackboneClass
displayName: 'ReactLoadingIndicator'
changeOptions: 'sync request'
render: ->
if !@model() || @model().loading()
_img ['ajax-loader', src: Factlink.Global.ajax_loader_image]
else if @model().length > 0
_span()
else
@props.chil... |
Add logging for Labels http actions | EditorRealTimeController = require "../Editor/EditorRealTimeController"
LabelsHandler = require './LabelsHandler'
logger = require 'logger-sharelatex'
module.exports = LabelsController =
getAllLabels: (req, res, next) ->
project_id = req.params.project_id
LabelsHandler.getAllLabelsForProject project_id, (err, p... | EditorRealTimeController = require "../Editor/EditorRealTimeController"
LabelsHandler = require './LabelsHandler'
logger = require 'logger-sharelatex'
module.exports = LabelsController =
getAllLabels: (req, res, next) ->
project_id = req.params.project_id
logger.log {project_id}, "getting all labels for project... |
Make the main entry point depend on noPlugin, not replicate it | ###!
* Storyboard
* (c) Guillermo Grau Panea 2016
* License: MIT
###
# Chalk is disabled by default in the browser. Override
# this default (we'll handle ANSI code conversion ourselves
# when needed)
chalk = require 'chalk'
chalk.enabled = true
k = require './gral/constants'
mainStory = require './gral/stories'
filt... | module.exports = require './noPlugins'
k = require './gral/constants'
hub = require './gral/hub'
# Browser side: in production, nothing.
# In development, everything, including wsClient
if k.IS_BROWSER
if process.env.NODE_ENV isnt 'production'
hub.addListener require './listeners/console'
hub.addListener re... |
Add modules arg, remove @get, pass generations functions as update property | module.exports = (Impromptu) ->
@register 'pwd', ->
process.env.PWD
@register 'prettyPwd', ->
cwd = process.env.PWD
if cwd.indexOf process.env.HOME == 0
cwd = '~' + cwd.slice process.env.HOME.length
cwd
@register 'user', (done) ->
@exec 'whoami', done
@register 'host', (done) ->
... | module.exports = (Impromptu, system) ->
@register 'pwd',
update: ->
process.env.PWD
@register 'prettyPwd',
update: ->
cwd = process.env.PWD
if cwd.indexOf process.env.HOME == 0
cwd = '~' + cwd.slice process.env.HOME.length
cwd
@register 'user',
update: (done) ->
... |
Clean backtraces from injected files | currentTest = {}
startTime = null
QUnit.testStart (context) ->
currentTest = {}
currentTest.name = context.name
currentTest.assertions = 0
currentTest.backtrace = []
startTime = (new Date()).getTime()
QUnit.log (context) ->
if context.result
currentTest.assertions++
return
stackTrace = []
cu... | currentTest = {}
startTime = null
QUnit.testStart (context) ->
currentTest = {}
currentTest.name = context.name
currentTest.assertions = 0
currentTest.backtrace = []
startTime = (new Date()).getTime()
QUnit.log (context) ->
if context.result
currentTest.assertions++
return
stackTrace = []
cu... |
Change DS.attr type from integer to number | App.User = DS.Model.extend
firstName: DS.attr("string")
lastName: DS.attr("string")
email: DS.attr("string")
role: DS.attr("string")
password: DS.attr("string")
App.CurrentUser = App.User.extend({})
App.Room = DS.Model.extend
name: DS.attr("string")
room_user_state: DS.belongsTo("room_user_state")... | App.User = DS.Model.extend
firstName: DS.attr("string")
lastName: DS.attr("string")
email: DS.attr("string")
role: DS.attr("string")
password: DS.attr("string")
App.CurrentUser = App.User.extend({})
App.Room = DS.Model.extend
name: DS.attr("string")
room_user_state: DS.belongsTo("room_user_state")... |
Use dispatcher for route loading. | goog.provide 'App'
class App
###*
@param {Element} element
@param {app.Error} error
@param {app.Routes} routes
@param {app.Storage} storage
@param {app.react.App} reactApp
@param {este.Router} router
@constructor
###
constructor: (element, error, routes, storage, reactApp, router) ->... | goog.provide 'App'
class App
###*
@param {Element} element
@param {app.Error} error
@param {app.Routes} routes
@param {app.Storage} storage
@param {app.react.App} reactApp
@param {este.Router} router
@param {app.Dispatcher} dispatcher
@constructor
###
constructor: (element, error... |
Remove src from nof list of directories | module.exports = (grunt) ->
{spawn} = require('./task-helpers')(grunt)
grunt.registerTask 'nof', 'Un-focus all specs', ->
nof = require.resolve('.bin/nof')
spawn({cmd: nof, args: ['spec', 'src']}, @async())
| module.exports = (grunt) ->
{spawn} = require('./task-helpers')(grunt)
grunt.registerTask 'nof', 'Un-focus all specs', ->
nof = require.resolve('.bin/nof')
spawn({cmd: nof, args: ['spec']}, @async())
|
Add batch download tracking separately | Species.BatchDownloadComponent = Ember.Component.extend
tagName: 'a'
template: Ember.Handlebars.compile('<i class="fa fa-download"></i>')
click: (event) ->
checked = $(event.target).closest('.inner-table-container').
find('td.download-col input:checked')
documentIds = checked.map( ->
$(@).clo... | Species.BatchDownloadComponent = Ember.Component.extend
tagName: 'a'
template: Ember.Handlebars.compile('<i class="fa fa-download"></i>')
click: (event) ->
checked = $(event.target).closest('.inner-table-container').
find('td.download-col input:checked')
documentIds = checked.map( ->
$(@).clo... |
Fix regex gone wild overwritting. | Lanes.Models.Mixins.HasCodeField = {
INVALID: /[^A-Z0-9a-z]/
included: ->
this.prototype.INVALID_CODE_CLanes.RS ||= Lanes.Models.mixins.Lanes.sCodeField.INVALID
initialize: ->
this.on('change:code', this.upcaseCode )
upcaseCode: ->
this.set('code', this.get('code').toUpperCas... | Lanes.Models.Mixins.HasCodeField = {
INVALID: /[^A-Z0-9a-z]/
included: (klass)->
klass::INVALID_CODE_CHARS ||= Lanes.Models.mixins.Lanes.sCodeField.INVALID
initialize: ->
this.on('change:code', this.upcaseCode)
upcaseCode: ->
this.set('code', this.get('code').toUpperCase())
}... |
Make it possible to copy JSONs | module.exports = class JSONModal
@Show: (json) ->
unless typeof(json) == 'object'
try
json = JSON.parse(json)
catch
json = "\"#{json}\""
try
json = JSON.parse(json)
catch
console.e... | module.exports = class JSONModal
@Show: (json) ->
unless typeof(json) == 'object'
try
json = JSON.stringify JSON.parse(json), null, ' '
catch
json = json
return new Promise((fulfil, reject) ->
element = document.createElement('div... |
Allow newlines in comment field. Meta/ctrl-enter submits | class Views.DiscussionView extends View
@content: ->
@div class: 'discussion', =>
@subview 'commentsList', new Views.RelationView(
buildItem: (comment) -> new Views.CommentItem(comment)
)
@div class: 'text-entry', =>
@textarea rows: 2, outlet: 'textarea'
@button "Submit C... | class Views.DiscussionView extends View
@content: ->
@div class: 'discussion', =>
@subview 'commentsList', new Views.RelationView(
buildItem: (comment) -> new Views.CommentItem(comment)
)
@div class: 'text-entry', =>
@textarea rows: 2, outlet: 'textarea'
@button "Submit C... |
Make BeanBuilder more flexible, fix members' scopes. | {Wrappers} = require "#{__dirname}/wrappers"
class BeanBuilder
constructor: ({@basePath, @suffix}) ->
if @suffix[0] is '_'
@suffix = @suffix[1..]
build: (config) ->
throw new Error 'No task defined.' unless config
suffixLength = @suffix.length
config.type = Wrappers.underscored(config.type... | {Wrappers} = require "#{__dirname}/wrappers"
class BeanBuilder
basePath: null
suffix: null
createObjectCallback: null
constructor: ({@basePath, @suffix, @createObjectCallback}) ->
if @suffix[0] is '_'
@suffix = @suffix[1..]
build: (config) ->
throw new Error 'No task defined.' unless config... |
Use a real editor in SideViewSpec. | SideView = require '../lib/side-view'
describe 'SideView', ->
side = null
view = null
line = null
beforeEach ->
line = {}
side = {
klass: -> 'klass',
site: -> 99,
description: -> '',
lines: -> [line]
}
view = new SideView(side)
it 'triggers conflict resolution', ->
... | SideView = require '../lib/side-view'
Conflict = require '../lib/conflict'
util = require './util'
describe 'SideView', ->
[view, ours, theirs] = []
beforeEach ->
editor = util.openPath("single-2way-diff.txt").getEditor()
conflict = Conflict.all(editor)[0]
[ours, theirs] = [conflict.ours, conflict.th... |
Add in /status end point | Settings = require "settings-sharelatex"
logger = require "logger-sharelatex"
logger.initialize("track-changes")
HttpController = require "./app/js/HttpController"
express = require "express"
app = express()
app.use express.logger()
app.post "/doc/:doc_id/flush", HttpController.flushUpdatesWithLock
app.use (error, ... | Settings = require "settings-sharelatex"
logger = require "logger-sharelatex"
logger.initialize("track-changes")
HttpController = require "./app/js/HttpController"
express = require "express"
app = express()
app.use express.logger()
app.post "/doc/:doc_id/flush", HttpController.flushUpdatesWithLock
app.get "/status... |
Return empty array when prefix is empty | fs = require 'fs'
path = require 'path'
module.exports =
selector: '.source.lua'
disableForSelector: '.source.lua .comment, .source.lua .string'
inclusionPriority: 10
excludeLowerPriority: true
# Required: Return a promise, an array of suggestions, or null.
getSuggestions: ( { editor, bufferP... | fs = require 'fs'
path = require 'path'
module.exports =
selector: '.source.lua'
disableForSelector: '.source.lua .comment, .source.lua .string'
inclusionPriority: 10
excludeLowerPriority: true
# Required: Return a promise, an array of suggestions, or null.
getSuggestions: ( { editor, bufferP... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.