Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Add setImmediate function in renderer. | path = require 'path'
Module = require 'module'
# Expose information of current process.
process.__atom_type = 'renderer'
process.resourcesPath = path.resolve process.argv[1], '..', '..', '..'
# We modified the original process.argv to let node.js load the
# atom-renderer.js, we need to restore it here.
process.argv.... | path = require 'path'
timers = require 'timers'
Module = require 'module'
# Expose information of current process.
process.__atom_type = 'renderer'
process.resourcesPath = path.resolve process.argv[1], '..', '..', '..'
# We modified the original process.argv to let node.js load the
# atom-renderer.js, we need to re... |
Switch to Scroller api in PublicChatPane | kd = require 'kd'
React = require 'kd-react'
immutable = require 'immutable'
ActivityFlux = require 'activity/flux'
ChatPane = require 'activity/components/chatpane'
module.exports = class PublicChatPane extends React.Component
@defaultProps =
thread : immutable.Map()
... | kd = require 'kd'
React = require 'kd-react'
immutable = require 'immutable'
ActivityFlux = require 'activity/flux'
ChatPane = require 'activity/components/chatpane'
module.exports = class PublicChatPane extends React.Component
@defaultProps =
thread : immutable.Map()
... |
Fix an edge case where the user types in some weird combination of keys. | $ ->
$('.flash').delay(4000).fadeOut()
$('#close_flash_early').click( -> closeFlashEarly())
closeFlashEarly = ->
$('.flash').stop().fadeOut() | $ ->
# Close flashes.
$('.flash').delay(4000).fadeOut()
$('#close_flash_early').click( -> closeFlashEarly())
# Nothing to see here, move along.
keys = []
konami = '38,38,40,40,37,39,37,39,66,65'
$(document).keydown (event) =>
keys.push(event.keyCode)
if (keys.toString().indexOf(konami) >= 0)
... |
Fix carousel initial rendering issue. | _ = require 'underscore'
Q = require 'bluebird-q'
Backbone = require 'backbone'
FilterArtworks = require '../../../../collections/filter_artworks.coffee'
initCarousel = require '../../../../components/merry_go_round/index.coffee'
template = -> require('./index.jade') arguments...
module.exports = class HeroArtworksCar... | _ = require 'underscore'
Q = require 'bluebird-q'
Backbone = require 'backbone'
FilterArtworks = require '../../../../collections/filter_artworks.coffee'
initCarousel = require '../../../../components/merry_go_round/index.coffee'
template = -> require('./index.jade') arguments...
module.exports = class HeroArtworksCar... |
Add mask literate elements by default | ((E, $) ->
'use strict'
$(document).ready ->
$('#lettersVisibility').on 'click', (e) ->
E.accounts.changeUnmarkVisibility()
$('#labelLettersVisibility').on 'click', (e) ->
if $('#lettersVisibility').is(':checked')
$('#lettersVisibility').prop('checked', false)
else
$('#l... | ((E, $) ->
'use strict'
$(document).ready ->
E.accounts.changeUnmarkVisibility()
$('#lettersVisibility').on 'click', (e) ->
E.accounts.changeUnmarkVisibility()
$('#labelLettersVisibility').on 'click', (e) ->
if $('#lettersVisibility').is(':checked')
$('#lettersVisibility').prop('... |
Hide postcode - not necessary as passed from billing address and wrecks mobile UX | Darkswarm.directive "stripeElements", ($injector, StripeElements) ->
restrict: 'E'
template: "<label for='card-element'>\
<div id='card-element'></div>\
<div id='card-errors' class='error'></div>\
</label>"
link: (scope, elem, attr)->
if $injector.has('stripeObject')
... | Darkswarm.directive "stripeElements", ($injector, StripeElements) ->
restrict: 'E'
template: "<label for='card-element'>\
<div id='card-element'></div>\
<div id='card-errors' class='error'></div>\
</label>"
link: (scope, elem, attr)->
if $injector.has('stripeObject')
... |
Check runtime status as part of the tests | describe 'Graph Editor', ->
win = null
doc = null
before ->
iframe = document.getElementById 'app'
win = iframe.contentWindow
doc = iframe.contentDocument
describe 'component search', ->
search = null
it 'should initially show the breadcrumb', ->
search = doc.querySelector 'noflo-sear... | describe 'Graph Editor', ->
win = null
doc = null
before ->
iframe = document.getElementById 'app'
win = iframe.contentWindow
doc = iframe.contentDocument
describe 'runtime', ->
runtime = null
it 'should be available as an element', ->
runtime = doc.querySelector 'noflo-runtime'
i... |
Drop suffix from handler path | Task = require 'task'
describe "Task", ->
describe "populating the window with fake properties", ->
describe "when jQuery is loaded in a child process", ->
it "doesn't log to the console", ->
spyOn(console, 'log')
spyOn(console, 'error')
spyOn(console, 'warn')
jqueryTask = ... | Task = require 'task'
describe "Task", ->
describe "populating the window with fake properties", ->
describe "when jQuery is loaded in a child process", ->
it "doesn't log to the console", ->
spyOn(console, 'log')
spyOn(console, 'error')
spyOn(console, 'warn')
jqueryTask = ... |
Fix Author View hover class toggle | ETahi.AuthorViewComponent = Ember.Component.extend DragNDrop.Dragable,
classNames: ['authors-overlay-item']
classNameBindings: ['hoverState:__hover', 'isEditable:__editable']
editState: false
hoverState: false
deleteState: false
attachHoverEvent: (->
self = this
toggleHoverClass = (e) ->
sel... | ETahi.AuthorViewComponent = Ember.Component.extend DragNDrop.Dragable,
classNames: ['authors-overlay-item']
classNameBindings: ['hoverState:__hover', 'isEditable:__editable']
editState: false
hoverState: false
deleteState: false
attachHoverEvent: (->
toggleHoverClass = (e) =>
@toggleProperty 'ho... |
Load preview modules with actual preview elements | class CMS.Views.ModuleEdit extends Backbone.View
tagName: 'section'
className: 'edit-pane'
events:
'click .cancel': 'cancel'
'click .module-edit': 'editSubmodule'
'click .save-update': 'save'
initialize: ->
@$el.load @model.editUrl(), =>
@model.loadModule(@el)
@$el.find('.preview')... | class CMS.Views.ModuleEdit extends Backbone.View
tagName: 'section'
className: 'edit-pane'
events:
'click .cancel': 'cancel'
'click .module-edit': 'editSubmodule'
'click .save-update': 'save'
initialize: ->
@$el.load @model.editUrl(), =>
@model.loadModule(@el)
@$el.find('.preview :... |
Remove unused param for sendEmailValidation | exports.loadUsers = (params, callback) ->
if @isId params
params = teamId: params
else unless params and typeof params is 'object'
throw new TSArgsError 'teamsnap.loadUsers', 'must provide a teamId or
query parameters'
@loadItems 'user', params, callback
exports.loadMe = (callback) ->
@collecti... | exports.loadUsers = (params, callback) ->
if @isId params
params = teamId: params
else unless params and typeof params is 'object'
throw new TSArgsError 'teamsnap.loadUsers', 'must provide a teamId or
query parameters'
@loadItems 'user', params, callback
exports.loadMe = (callback) ->
@collecti... |
Disable artist representation links for everyone but admins for the time being | _ = require 'underscore'
{ API_URL } = require('sharify').data
Backbone = require 'backbone'
RelatedLinksView = require '../view.coffee'
Partners = require '../../../collections/partners.coffee'
module.exports = class RelatedRepresentationsLinksView extends RelatedLinksView
headerTemplate: _.template '<h2>Gallery Re... | _ = require 'underscore'
{ API_URL } = require('sharify').data
Backbone = require 'backbone'
RelatedLinksView = require '../view.coffee'
Partners = require '../../../collections/partners.coffee'
CurrentUser = require '../../../models/current_user.coffee'
module.exports = class RelatedRepresentationsLinksView extends R... |
Initialize select value taking prompt into account. | `import Em from "vendor/ember"`
Component = Em.Component.extend
options: Em.computed "content.{options,prompt,is_optional}", ->
prompt = @get "content.prompt"
prompt = "" if not prompt and @get "content.is_optional"
options = @get "content.options"
if typeof prompt is "string" and ... | `import Em from "vendor/ember"`
Component = Em.Component.extend
sanitizeValue: Em.on "init", ->
value = @get "content.value"
if typeof value isnt "string"
options = @get "options"
@set "content.value", options[0]?.value or ""
options: Em.computed "content.{options,promp... |
Add icons and styling to access level, humanize access level | { tr,td,button,i } = React.DOM
shared_filesystem_storage.AccessItem = React.createClass
getInitialState: ->
deleting: false
handleDelete: (e) ->
e.preventDefault()
shared_filesystem_storage.ConfirmDialog.ask 'Are you sure?',
#validationTerm: @props.shared_network.name
description: 'Wo... | { tr,td,button,i } = React.DOM
shared_filesystem_storage.AccessItem = React.createClass
getInitialState: ->
deleting: false
handleDelete: (e) ->
e.preventDefault()
shared_filesystem_storage.ConfirmDialog.ask 'Are you sure?',
#validationTerm: @props.shared_network.name
description: 'Would y... |
Load jQuery from global namespace first. | ###
jquery.turbolinks.js ~ v1.0.0-rc1 ~ https://github.com/kossnocorp/jquery.turbolinks
jQuery plugin for drop-in fix binded events problem caused by Turbolinks
The MIT License
Copyright (c) 2012 Sasha Koss
###
$ = require?('jquery') || window.jQuery
# List for store callbacks passed to `$` or `$.ready`
ca... | ###
jquery.turbolinks.js ~ v1.0.0-rc1 ~ https://github.com/kossnocorp/jquery.turbolinks
jQuery plugin for drop-in fix binded events problem caused by Turbolinks
The MIT License
Copyright (c) 2012 Sasha Koss
###
$ = window.jQuery or require?('jquery')
# List for store callbacks passed to `$` or `$.ready`
ca... |
Decrease threads number in order to show threads working | $(document).ready ->
assert = (condition) -> throw 'Assertion failed' unless condition
contents = """
#################################################################
#################################################################
#################################################################
#####... | $(document).ready ->
assert = (condition) -> throw 'Assertion failed' unless condition
contents = """
#################################################################
#################################################################
#################################################################
#####... |
Add rudimentary error handling for tree ftecher | class Water.TreeFetcher extends Backbone.Model
fetch: (node_type, path) =>
@trigger "start_fetch"
url = [@attributes.repository_path, node_type, @attributes.ref , path].join("/")
$.ajax
url: url
data: bare: 1
success: (data) => @data_did_fetch(data)
dataType: "html"
data_did_fetc... | class Water.TreeFetcher extends Backbone.Model
fetch: (node_type, path) =>
@trigger "start_fetch"
url = [@attributes.repository_path, node_type, @attributes.ref , path].join("/")
$.ajax
url: url
data: bare: 1
success: (data) => @data_did_fetch(data)
error: (hdr, status, error) => @... |
Fix for depreciated class warning | # Keybindings require three things to be fully defined: A selector that is
# matched against the focused element, the keystroke and the command to
# execute.
#
# Below is a basic keybinding which registers on all platforms by applying to
# the root workspace element.
# For more detailed documentation see
# https://ato... | # Keybindings require three things to be fully defined: A selector that is
# matched against the focused element, the keystroke and the command to
# execute.
#
# Below is a basic keybinding which registers on all platforms by applying to
# the root workspace element.
# For more detailed documentation see
# https://ato... |
Make sure the jQuery event handler is called. | window.App ||= {}
class App.Base
constructor: ->
if (window.jQuery) then @setClearEventHandlers() # clearing application event handlers only possible with jQuery
return this
###
Run the new action for the create action. Generally the create action will 'render :new' if there was a problem.
This prev... | window.App ||= {}
class App.Base
constructor: ->
if (window.jQuery) then @setClearEventHandlers() # clearing application event handlers only possible with jQuery
return this
###
Run the new action for the create action. Generally the create action will 'render :new' if there was a problem.
This prev... |
Update analytics.log.event indexes to match prod | mongoose = require 'mongoose'
plugins = require '../plugins/plugins'
AnalyticsLogEventSchema = new mongoose.Schema({
created:
type: Date
'default': Date.now
}, {strict: false})
AnalyticsLogEventSchema.index({event: 1, created: -1})
module.exports = AnalyticsLogEvent = mongoose.model('analytics.log.event', A... | mongoose = require 'mongoose'
plugins = require '../plugins/plugins'
AnalyticsLogEventSchema = new mongoose.Schema({
created:
type: Date
'default': Date.now
}, {strict: false})
AnalyticsLogEventSchema.index event: 1
AnalyticsLogEventSchema.index created: -1
module.exports = AnalyticsLogEvent = mongoose.mode... |
Add tests for templateJSON property. | #= require test_helper
testPhases = undefined
testTemplate = undefined
module 'Unit: ManuscriptManagerTemplate',
setup: ->
phase = name: 'First Phase', task_types: ['ATask', 'AnotherTask']
@testThing = 5
template =
name: 'A name'
paper_type: 'A type'
template:
phases: [phase]
... | #= require test_helper
testPhases = undefined
testTemplate = undefined
module 'Unit: ManuscriptManagerTemplate',
setup: ->
phase = name: 'First Phase', task_types: ['ATask', 'AnotherTask']
@testThing = 5
template =
name: 'A name'
id: 1
paper_type: 'A type'
template:
phase... |
Use terrain map type on JS map module | Neighborly.Map = (mapCanvasSelector) ->
window.mapCanvasSelector = mapCanvasSelector
$.getScript('https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&callback=Neighborly.MapInitialize')
Neighborly.MapInitialize = ->
mapCanvasSelector = '.map-canvas' if typeof mapCanvasSelector is 'undefined'
ma... | Neighborly.Map = (mapCanvasSelector) ->
window.mapCanvasSelector = mapCanvasSelector
$.getScript('https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&callback=Neighborly.MapInitialize')
Neighborly.MapInitialize = ->
mapCanvasSelector = '.map-canvas' if typeof mapCanvasSelector is 'undefined'
ma... |
Revert "Don't send search query when query field is empty" | #= require jquery
#= require jquery_ujs
#= require turbolinks
#= require_tree .
onReady = ->
$('#gems-search').keyup ->
if $("#query").val().length
$.get $(this).attr('action'), $(this).serialize(), null, 'script'
false
$(document).ready onReady
$(document).on 'page:change', ->
if window._gaq?
... | #= require jquery
#= require jquery_ujs
#= require turbolinks
#= require_tree .
onReady = ->
$('#gems-search').keyup ->
$.get $(this).attr('action'), $(this).serialize(), null, 'script'
false
$(document).ready onReady
$(document).on 'page:change', ->
if window._gaq?
_gaq.push ['_trackPageview']
els... |
Put toggle button on new line | 'use strict'
{toggleGem} = require './actions'
store = require './store'
Gem = React.createClass
mixins: [Reflux.connect store, 'status']
onClick: (event) ->
toggleGem()
return
render: ->
statusStr = if @state?.status then 'activated' else 'deactivated'
(<p>
Gem is {statusStr}
... | 'use strict'
{toggleGem} = require './actions'
store = require './store'
Gem = React.createClass
mixins: [Reflux.connect store, 'status']
onClick: (event) ->
toggleGem()
return
render: ->
statusStr = if @state?.status then 'activated' else 'deactivated'
(<div>
<p>Gem is {statusStr}</p>
... |
Extend a chart to contain several distinct datasets. | mongoose = require 'mongoose'
Schema = mongoose.Schema
ObjectId = Schema.ObjectId
mongoose.model "User", new Schema
user:
type: String
required: true
unique: true
password:
type: String
required: true
User = module.exports.User = mongoose.model "User"
mongoose.model "Chart", new Schema
owne... | mongoose = require 'mongoose'
Schema = mongoose.Schema
ObjectId = Schema.ObjectId
mongoose.model "User", new Schema
user:
type: String
required: true
unique: true
password:
type: String
required: true
User = module.exports.User = mongoose.model "User"
mongoose.model "Chart", new Schema
owne... |
Watch for JSON files when linting | path = require('path')
gulp = require('gulp')
mocha = require('gulp-mocha')
coffeelint = require('gulp-coffeelint')
mochaNotifierReporter = require('mocha-notifier-reporter')
OPTIONS =
config:
coffeelint: path.join(__dirname, 'coffeelint.json')
files:
coffee: [ 'lib/**/*.coffee', 'gulpfile.coffee' ]
tests: 'li... | path = require('path')
gulp = require('gulp')
mocha = require('gulp-mocha')
coffeelint = require('gulp-coffeelint')
mochaNotifierReporter = require('mocha-notifier-reporter')
OPTIONS =
config:
coffeelint: path.join(__dirname, 'coffeelint.json')
files:
coffee: [ 'lib/**/*.coffee', 'gulpfile.coffee' ]
tests: 'li... |
Resolve issue with incorrect url for remote CSS when using addCssUrl, and bundle option is false. This results from the file.url property being a boolean value instead of a string, and the result is the link tag is output as <link href='true' /> rather than with the correct url. Looks like this was already fixed for JS... | # csso = require 'csso'
cleanCss = require 'clean-css'
Bundle = require './bundle'
fs = require 'fs'
os = require 'os'
path = require 'path'
class Css extends Bundle
constructor: (@options) ->
@fileExtension = '.css'
super
minify: (code) ->
return code unless @options.minifyCss
... | # csso = require 'csso'
cleanCss = require 'clean-css'
Bundle = require './bundle'
fs = require 'fs'
os = require 'os'
path = require 'path'
class Css extends Bundle
constructor: (@options) ->
@fileExtension = '.css'
super
minify: (code) ->
return code unless @options.minifyCss
... |
Change `window.atob` methods to Node.js natvie methods. | # base64
#
# @description
# @Copyright 2014 Fantasy <fantasyshao@icloud.com>
# @create 2014-12-11
# @update 2014-12-21
exports.encode = (str) ->
try
str = str.replace /\n/g, ''
.replace /\s/g, ''
window.btoa str
catch err
console.debug err
exports.decode = (str) ->
try
JSON.string... | # base64
#
# @description
# @Copyright 2014 Fantasy <fantasyshao@icloud.com>
# @create 2014-12-11
# @update 2014-12-22
exports.encode = (str) ->
try
new Buffer(str).toString('base64')
catch err
console.debug err
exports.decode = (str) ->
try
new Buffer(str, 'base64').toString('ascii')
catch err
... |
Add a blank value to an empty array to make sure the param is submitted | jQuery ($) ->
EditableForm = $.fn.editableform.Constructor
EditableForm.prototype.saveWithUrlHook = (value) ->
originalUrl = @options.url
model = @options.model
nestedName = @options.nested
nestedId = @options.nid
nestedLocale = @options.locale
@options.url = (params) =>
if typeof ori... | jQuery ($) ->
EditableForm = $.fn.editableform.Constructor
EditableForm.prototype.saveWithUrlHook = (value) ->
originalUrl = @options.url
model = @options.model
nestedName = @options.nested
nestedId = @options.nid
nestedLocale = @options.locale
@options.url = (params)... |
Add convenient accessors for Window API. | Window = process.atom_binding('window').Window
module.exports = Window
| Window = process.atom_binding('window').Window
# Convient accessors.
setupGetterAndSetter = (constructor, name, getter, setter) ->
constructor.prototype.__defineGetter__ name, ->
this[getter].apply(this, arguments)
constructor.prototype.__defineSetter__ name, ->
this[setter].apply(this, arguments)
setupGe... |
Change to CustomEvent for IE 11 | React = require 'react'
window.React = React
React.initializeTouchEvents true
router = require './router'
mainContainer = document.createElement 'div'
mainContainer.id = 'panoptes-main-container'
document.body.appendChild mainContainer
if process.env.NON_ROOT isnt 'true' and location.hash isnt ""
location.pathname ... | React = require 'react'
window.React = React
React.initializeTouchEvents true
router = require './router'
mainContainer = document.createElement 'div'
mainContainer.id = 'panoptes-main-container'
document.body.appendChild mainContainer
if process.env.NON_ROOT isnt 'true' and location.hash isnt ""
location.pathname ... |
Clear all the jobs link. | window.JobsListView = class JobsListView extends Backbone.View
initialize: ->
@model.bind 'add', => this.render()
$(@el).append('<h2>Jobs List</h2>')
@list = $('<ul class="jobs-list" />').appendTo(@el)
$(@el).append('<p class="hint">Save jobs here by clicking "Add to jobs list" on a job.')
$(... | window.JobsListView = class JobsListView extends Backbone.View
events:
'click p.clear-all a': 'clearAll'
initialize: ->
@model.bind 'add', => this.render()
@model.bind 'remove', => this.render()
$(@el).append('<h2>Jobs List</h2>')
@list = $('<ul class="jobs-list" />').appendTo(@el)
$(@e... |
Add tests for fetch stocks. | _ = require 'underscore'
Promise = require 'bluebird'
FetchStocks = require '../lib/fetchstocks'
{ExtendedLogger} = require 'sphere-node-utils'
Config = require '../config'
describe 'FetchStocks', ->
beforeEach ->
@logger = new ExtendedLogger
@fetchStocks = new FetchStocks @logger, Config, 'anyKey'
it 's... | _ = require 'underscore'
Promise = require 'bluebird'
FetchStocks = require '../lib/fetchstocks'
{ExtendedLogger} = require 'sphere-node-utils'
Config = require '../config'
describe 'FetchStocks', ->
beforeEach ->
@logger = new ExtendedLogger
@fetchStocks = new FetchStocks @logger, Config
it 'should get ... |
Make sure all palette instances use their own set of used colors | class PG.Palette
colors:
red:
stroke: "#b64639"
fill: "#dc6355"
orange:
stroke: "#b27a01"
fill: "#e3b514"
yellowGreen:
stroke: "#9bac0c"
fill: "#c3d52a"
lime:
stroke: "#60a121"
fill: "#8cd347"
mediumSeaGreen:
stroke: "#1a9853"
fill: "#47... | class PG.Palette
defaults:
red:
stroke: "#b64639"
fill: "#dc6355"
orange:
stroke: "#b27a01"
fill: "#e3b514"
yellowGreen:
stroke: "#9bac0c"
fill: "#c3d52a"
lime:
stroke: "#60a121"
fill: "#8cd347"
mediumSeaGreen:
stroke: "#1a9853"
fill: "#... |
Fix user validation in campaign | @Campaigns = new Meteor.Collection 'campaigns'
@Campaigns.attachSchema new SimpleSchema
name:
type: String
label: "Nome"
max: 100
description:
type: String
label: "Descrição"
max: 10000
createdAt:
type: Date
label: "Criado em"
autoValue: ->
if @isInsert
return new Date
if @isUpsert
re... | @Campaigns = new Meteor.Collection 'campaigns'
@Campaigns.attachSchema new SimpleSchema
name:
type: String
label: "Nome"
max: 100
description:
type: String
label: "Descrição"
max: 10000
createdAt:
type: Date
label: "Criado em"
autoValue: ->
if @isInsert
return new Date
if @isUpsert
re... |
Implement NestedAttributesStrategy for autocompleteTokenField widget | namespace 'Exo.Widgets.AutocompleteTokenField', (exports) ->
exports.ReplaceIdStrategy = (tokens) ->
if id = tokens[0]?.id
@originalInput.value = id
exports.ArrayStrategy = (tokens) ->
inputName = @originalInput.name + "[]"
@$el.find('[type="hidden"]').remove()
for token in tokens
inpu... | namespace 'Exo.Widgets.AutocompleteTokenField', (exports) ->
# TODO add docs for all of these!!!
exports.ReplaceIdStrategy = (tokens) ->
if id = tokens[0]?.id
@originalInput.value = id
exports.ArrayStrategy = (tokens) ->
inputName = @originalInput.name + "[]"
@$el.find('[type="hidden"]').re... |
Fix for bad asset compilation on production, this MUST BE REMOVED in the future | class Cfp.Views.RankingView extends Backbone.View
el: '#ranking'
events:
'change #rank' : 'changeRank'
changeRank: ->
rank = new Cfp.Models.Rank
rank.save
value: @selectedRank()
selectedRank: =>
@$('#rank').val()
| class Cfp.Views.RankingView extends Backbone.View
el: '#ranking'
events:
'change #rank' : 'changeRank'
changeRank: ->
rank = new Cfp.Models.Rank
rank.save
value: @selectedRank()
selectedRank: =>
@$('#rank:checked').val()
|
Support a default value when undefined in the review panel toggles. | define [
"base"
], (App) ->
App.directive "reviewPanelToggle", () ->
restrict: "E"
scope:
onToggle: '&'
ngModel: '='
disabled: '=?'
onDisabledClick: '=?'
link: (scope) ->
if !scope.disabled?
scope.disabled = false
scope.onChange = (args...) ->
scope.onToggle({ isOn: scope.localModel }... | define [
"base"
], (App) ->
App.directive "reviewPanelToggle", () ->
restrict: "E"
scope:
onToggle: '&'
ngModel: '='
valWhenUndefined: '=?'
disabled: '=?'
onDisabledClick: '=?'
link: (scope) ->
if !scope.disabled?
scope.disabled = false
scope.onChange = (args...) ->
scope.onToggle(... |
Add some tests around the bucketing | expect = require('chai').expect
algorhythm = require('../../lib/algorhythmic')
describe 'Algorhythmic', ->
it 'works', ->
expect(algorhythm).to.be.ok
| expect = require('chai').expect
algorhythm = require('../../lib/algorhythmic')
describe 'Algorhythmic', ->
describe 'bucketing an identifier', ->
bucket = randomString = null
it 'buckets an empty string', ->
expect(algorhythm.convert('')).to.be.ok
it 'buckets a single character string', ->
... |
Update the conf to work. | exports.config =
paths:
watched:['client']
files:
javascripts:
joinTo: 'app.js'
stylesheets:
joinTo: 'app.css'
templates:
joinTo: 'app.js' | exports.config =
sourceMaps: false
paths:
watched:['client']
files:
javascripts:
joinTo:
'javascripts/app.js': /^client(\/|\\)app/
'javascripts/vendor.js': /^(bower_components|(client(\/|\\)vendor))/
stylesheets:
joinTo: 'stylesheets/app.css'
templates:
default: '... |
Send events when traversing result pages | App.ResultToolbarController = Em.ArrayController.extend
content: []
searchBinding: 'currentSearchController.content'
pageSize: 15
_currentPageNo: 0
currentPageNo: ((key, value) ->
if value?
numPages = @get('numPages')
@_currentPageNo = if value < 0 then 0 else (if value >= numPages then numP... | App.ResultToolbarController = Em.ArrayController.extend
content: []
searchBinding: 'currentSearchController.content'
pageSize: 15
_currentPageNo: 0
currentPageNo: ((key, value) ->
if value?
numPages = @get('numPages')
@_currentPageNo = if value < 0 then 0 else (if value >= numPages then numP... |
Disable saving when items are all empty | ETahi.InlineEditBodyPartComponent = Em.Component.extend
editing: false
snapshot: []
confirmDelete: false
createSnapshot: (->
@set('snapshot', Em.copy(@get('block'), true))
).observes('editing')
hasContent: true
# hasContent: Em.computed.notEmpty('bodyPart.value')
hasNoContent: Em.computed.not('ha... | ETahi.InlineEditBodyPartComponent = Em.Component.extend
editing: false
snapshot: []
confirmDelete: false
createSnapshot: (->
@set('snapshot', Em.copy(@get('block'), true))
).observes('editing')
hasContent: (->
@get('block').any(@_isEmpty)
).property('block.@each.value')
hasNoContent: Em.compu... |
Refactor shipping-rate-selection directive to remove annoying refresh issue | Sprangular.directive 'shippingRateSelection', ->
restrict: 'E'
templateUrl: 'shipping/rates.html'
scope:
order: '='
controller: ($scope, Checkout, Env) ->
$scope.loading = false
$scope.address = {}
$scope.currencySymbol = Env.currency.symbol
$scope.$watch 'order.shippingRate', (rate, oldRa... | Sprangular.directive 'shippingRateSelection', ->
restrict: 'E'
templateUrl: 'shipping/rates.html'
scope:
order: '='
controller: ($scope, Checkout, Env) ->
$scope.loading = false
$scope.address = {}
$scope.currencySymbol = Env.currency.symbol
$scope.$watch 'order.shippingRate', (rate, oldRa... |
Move comment to next line | {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()
@subscribe atom.workspaceV... | {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()
@subscribe atom.workspaceV... |
Fix QuickSearch for quick searches that are drawn after DOMReady | class Tenon.features.QuickSearch
constructor: ->
@$content = $('.toolbox #quick-search-container')
@$toggle = $('#quick-search-toggle')
@openClass = 'open'
@$field = $('#quick-search')
# listeners
$(document).on('keyup', '#quick-search', $.debounce(500, @_submitSearch))
@$toggle.on('clic... | class Tenon.features.QuickSearch
constructor: ->
@$content = $('.toolbox #quick-search-container')
@$toggle = $('#quick-search-toggle')
@openClass = 'open'
# listeners
$(document).on('keyup', '#quick-search', $.debounce(500, @_submitSearch))
@$toggle.on('click', @toggleNav)
# $(document)... |
Make path an optional parameter | 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:... | Bacon = require 'bacon'
$ = require 'jquery'
class NCN
constructor: (@host = '') ->
@toilets = new NCN @host + '/toilets'
request = (method) -> (path, data) ->
[path, data] = [@host, path] unless data?
Bacon.fromPromise(
$.ajax @host + path,
data: data
type: method
dataTyp... |
Remove uneeded initialization after ajax refresh. | App.Followable =
update: (followable_id, button) ->
$("#" + followable_id + " .js-follow").html(button)
# Temporary line. Waiting for issue resolution: https://github.com/consul/consul/issues/1736
initialize_modules()
| App.Followable =
update: (followable_id, button) ->
$("#" + followable_id + " .js-follow").html(button)
|
Add includePaths to sass options. | module.exports = (grunt) ->
require('load-grunt-tasks') grunt
grunt.initConfig
clean:
folder: 'build'
sass:
options:
sourceMap: true
dist:
files: 'build/main.css': 'stylesheets/main.sass'
watch:
files: ['stylesheets/**/*.sass', 'stylesheets/**/*.scss']
ta... | module.exports = (grunt) ->
require('load-grunt-tasks') grunt
grunt.initConfig
clean:
folder: 'build'
sass:
options:
sourceMap: true
includePaths: ['bower_components']
dist:
files: 'build/main.css': 'stylesheets/main.sass'
watch:
files: ['stylesheets/**... |
Add watcher for landing page coffeescript | Path = require('path')
fs = require('fs')
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON("package.json")
coffee:
compile:
files:
'js/odometer.js': 'coffee/odometer.coffee'
'js/landing-page.js': 'coffee/landing-page.coffee'
watch:
coffee:
... | Path = require('path')
fs = require('fs')
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON("package.json")
coffee:
compile:
files:
'js/odometer.js': 'coffee/odometer.coffee'
'js/landing-page.js': 'coffee/landing-page.coffee'
watch:
coffee:
... |
Add context menu to atom-text-editor selector | 'menu': [
'label': 'Edit'
'submenu': [
'label': 'Select Encoding'
'command': 'encoding-selector:show'
]
]
'context-menu':
'.overlayer': [
'label': 'Change Encoding'
'command': 'encoding-selector:show'
]
| 'menu': [
'label': 'Edit'
'submenu': [
'label': 'Select Encoding'
'command': 'encoding-selector:show'
]
]
'context-menu':
'atom-text-editor': [
'label': 'Change Encoding'
'command': 'encoding-selector:show'
]
|
Use log helpers in Rebuild command | path = require 'path'
_ = require 'underscore-plus'
optimist = require 'optimist'
config = require './config'
Command = require './command'
Install = require './install'
module.exports =
class Rebuild extends Command
@commandNames: ['rebuild']
constructor: ->
@atomNodeDirectory = path.join(config.getAtomDir... | path = require 'path'
_ = require 'underscore-plus'
optimist = require 'optimist'
config = require './config'
Command = require './command'
Install = require './install'
module.exports =
class Rebuild extends Command
@commandNames: ['rebuild']
constructor: ->
@atomNodeDirectory = path.join(config.getAtomDir... |
Check for, and deny anonymous api_keys | Meteor.startup ->
if Meteor.isServer
lib = require './lib.coffee'
keys = require '/server/utils/deploykeys.coffee'
authenticationHandler = ->
if (key = @params.query?['api-key']) or (key = @request.headers?['api-key'])
if (apiKey = APIKeys.findOne key: key)
user = Meteor.users.fi... | Meteor.startup ->
if Meteor.isServer
lib = require './lib.coffee'
keys = require '/server/utils/deploykeys.coffee'
authenticationHandler = ->
if (key = @params.query?['api-key']) or (key = @request.headers?['api-key'])
if (apiKey = APIKeys.findOne key: key)
user = Meteor.users.fi... |
Change webkit buils target to Electron(atom-shell) | webpack = require "webpack"
option = require "./gulp.coffee"
module.exports =
watchDelay : 500
output :
filename : "[name].js"
sourceMapFilename : "map/[file].map"
publicPath : "/js/"
devtool : "#source-map"
resolve :
root ... | webpack = require "webpack"
option = require "./gulp.coffee"
module.exports =
watchDelay : 500
output :
filename : "[name].js"
sourceMapFilename : "map/[file].map"
publicPath : "/js/"
devtool : "#source-map"
target : "atom"
resolve ... |
Fix the logic in SidebarController which triggers the FinderController reset to auto-mount vms | class SidebarController extends KDViewController
constructor:->
super
mainController = KD.getSingleton 'mainController'
mainController.on 'ManageRemotes', -> new ManageRemotesModal
mainController.on 'ManageDatabases', -> new ManageDatabasesModal
mainController.on 'AccountChanged', @bound 'accoun... | class SidebarController extends KDViewController
constructor:->
super
mainController = KD.getSingleton 'mainController'
mainController.on 'ManageRemotes', -> new ManageRemotesModal
mainController.on 'ManageDatabases', -> new ManageDatabasesModal
mainController.on 'AccountChanged', @bound 'accoun... |
Add scroll at new message | Chamber.Views.Messages ||= {}
class Chamber.Views.Messages.IndexView extends Backbone.View
template: JST["backbone/templates/messages/index"]
initialize: () ->
#@options.messages.bind('reset', @addAll)
@options.messages.bind('add', @addOne)
#addAll: () =>
# @options.messages.each(@addOne)
addOn... | Chamber.Views.Messages ||= {}
class Chamber.Views.Messages.IndexView extends Backbone.View
template: JST["backbone/templates/messages/index"]
initialize: () ->
#@options.messages.bind('reset', @addAll)
@options.messages.bind('add', @addOne)
#addAll: () =>
# @options.messages.each(@addOne)
addOn... |
Add value, text, and html | addBinding = ViewModel.addBinding
addBinding
name: 'text'
autorun: (c, bindArg) ->
bindArg.element.text bindArg.getVmValue()
return
addBinding
name: 'default'
bind: (bindArg) ->
bindArg.element.on bindArg.bindName, (event) ->
if ~bindArg.bindValue.indexOf(')', bindArg.bindValue.length - 1)
... | addBinding = ViewModel.addBinding
addBinding
name: 'default'
bind: (bindArg) ->
bindArg.element.on bindArg.bindName, (event) ->
if ~bindArg.bindValue.indexOf(')', bindArg.bindValue.length - 1)
bindArg.getVmValue()
else
bindArg.setVmValue(event)
return
return
addBinding
... |
Refresh the whole page after logging in on the Inquire via Phone modal | AuthModalView = require '../../../../components/auth_modal/view.coffee'
{ templateMap } = require '../../../../components/auth_modal/maps.coffee'
mediator = require '../../../../lib/mediator.coffee'
templateMap['phone_number'] = -> require('./templates/phone_number.jade') arguments...
module.exports = class InquireVi... | AuthModalView = require '../../../../components/auth_modal/view.coffee'
{ templateMap } = require '../../../../components/auth_modal/maps.coffee'
mediator = require '../../../../lib/mediator.coffee'
templateMap['phone_number'] = -> require('./templates/phone_number.jade') arguments...
module.exports = class InquireVi... |
Read book_id from course and use that for link | React = require 'react'
BS = require 'react-bootstrap'
{CourseStore} = require '../../flux/course'
module.exports = React.createClass
displayName: 'BrowseTheBook'
contextTypes:
router: React.PropTypes.func
getDefaultProps: ->
bsStyle: 'primary'
propTypes:
courseId: React.PropTypes.string
ch... | React = require 'react'
BS = require 'react-bootstrap'
{CourseStore} = require '../../flux/course'
module.exports = React.createClass
displayName: 'BrowseTheBook'
contextTypes:
router: React.PropTypes.func
getDefaultProps: ->
bsStyle: 'primary'
propTypes:
courseId: React.PropTypes.string
ch... |
Modify needs to know current course | React = require 'react'
NewCourseRegistration = require './new-registration'
ModifyCourseRegistration = require './modify-registration'
UserStatus = require '../user/status-mixin'
Course = require './model'
CourseRegistration = React.createClass
propTypes:
collectionUUID: React.PropTypes.string.isRequired
... | React = require 'react'
NewCourseRegistration = require './new-registration'
ModifyCourseRegistration = require './modify-registration'
UserStatus = require '../user/status-mixin'
Course = require './model'
CourseRegistration = React.createClass
propTypes:
collectionUUID: React.PropTypes.string.isRequired
... |
Remove glitterbomb as default template in atom | 'global':
'editor':
'showInvisibles': true
'preferredLineLength': 120
'softWrapped': true
'showIndentGuide': true
'fontSize': 12
'invisibles': {}
'core':
'disabledPackages': [
'metrics'
]
'themes': [
'atom-dark-ui'
'glitterbomb'
]
'exception-reporting':
... | 'global':
'editor':
'showInvisibles': true
'preferredLineLength': 120
'softWrapped': true
'showIndentGuide': true
'fontSize': 12
'invisibles': {}
'core':
'disabledPackages': [
'metrics'
]
'exception-reporting':
'userId': '2f6c1fe2-cfdb-87de-4712-11b4b505fed4'
'welcome':... |
Fix AMD and Phaser integration. | # App
# ===
# Highest-level application script.
# Dependencies
# ------------
# Configure RequireJS. Dependency references default to the `lib` directory.
# We're using CoffeeScript, so our `app` package code is in the compiled js
# directory `release`.
requirejs.config
baseUrl: 'lib'
paths:
app: '../release'
... | # App
# ===
# Highest-level application script.
# Dependencies
# ------------
# Configure RequireJS. Dependency references default to the `lib` directory.
# We're using CoffeeScript, so our `app` package code is in the compiled js
# directory `release`.
requirejs.config
baseUrl: 'lib'
paths:
app: '../release'
... |
Allow regexp in hot topics | # Let people know of emergent / constant questions
#
# hot topic anything = whatever you want to rememeber
# forget hot topic anything
# hot topics
module.exports = (robot) ->
robot.brain.data.hot_topics or= {}
robot.respond /hot topic (.*) = (.*)/i, (msg) ->
robot.brain.data.hot_topics[msg.match[1].toLowerCa... | # Let people know of emergent / constant questions
#
# hot topic anything = whatever you want to rememeber
# forget hot topic anything
# hot topics
module.exports = (robot) ->
robot.brain.data.hot_topics or= {}
robot.respond /hot topic (.*) = (.*)/i, (msg) ->
robot.brain.data.hot_topics[msg.match[1].toLowerCa... |
Comment out listening event for now | dgram = require "dgram"
class ListenServer
passphrase: ''
handleMessage: (msg, rinfo) ->
try
data = JSON.parse(msg)
if data and @checkPassphrase(data)
@incomingData(data)
checkPassphrase: (data) ->
if @passphrase == ''
true
else
data.passphrase and data.passphrase == ... | dgram = require "dgram"
class ListenServer
passphrase: ''
handleMessage: (msg, rinfo) ->
try
data = JSON.parse(msg)
if data and @checkPassphrase(data)
@incomingData(data)
checkPassphrase: (data) ->
if @passphrase == ''
true
else
data.passphrase and data.passphrase == ... |
Add fillingOptions as its own method | # fillOptions = () ->
# $('#selectLocation').
Template.locationEdit.created = () ->
Meteor.call 'getOptions', (error, result) ->
locationsData = JSON.parse result
locations = locationsData.locations
for location in locations
$('#selectLocation').append '<option>'+location.name+'</option>'
Templ... | fillOptions = (name) ->
$('#selectLocation').append '<option>' + name + '</option>'
Template.locationEdit.created = () ->
Meteor.call 'getOptions', (error, result) ->
locationsData = JSON.parse result
locations = locationsData.locations
for location in locations
fillOptions location.name
Templa... |
Add additional controls to the index page Map | # medellin coords 6.29, -75.54
map_center = new google.maps.LatLng(19.311143,-39.199219)
marker = null
map = null
initialize_map = ->
mapOptions =
zoom: 2,
scrollwheel: false,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: map_center
map = new google.maps.Map(document.getElementById('mapa'), ma... | # medellin coords 6.29, -75.54
map_center = new google.maps.LatLng(19.311143,-39.199219)
marker = null
map = null
initialize_map = ->
mapOptions =
zoom: 2,
scrollwheel: false,
draggable: true,
panControl: true,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: map_center
map = new google.m... |
Add strut session initial data, for fixing first-load bug | loadPpt = ->
pptData = StrutBuilder.build(JSON.parse(localStorage.regions))
#[
#{ #slide 1
#start: 0,
#end: 2.5,
#texts: [
#{text: 'Hum', position: 1.2},
#{text: 'bewafaa', position: 1.7}
#]
#},
#{ #slide 2
#start: ... | loadPpt = ->
pptData = StrutBuilder.build(JSON.parse(localStorage.regions))
#[
#{ #slide 1
#start: 0,
#end: 2.5,
#texts: [
#{text: 'Hum', position: 1.2},
#{text: 'bewafaa', position: 1.7}
#]
#},
#{ #slide 2
#start: ... |
Change default sort to character_sum for Articles | StockStore = require './stock_store.coffee'
ArticleStore = new StockStore(
sortKey: 'title'
sortAsc: true
descKeys:
character_sum: true
view_count: true
modelKey: 'article'
)
module.exports = ArticleStore.store
| StockStore = require './stock_store.coffee'
ArticleStore = new StockStore(
sortKey: 'character_sum'
descKeys:
character_sum: true
view_count: true
modelKey: 'article'
)
module.exports = ArticleStore.store
|
Disable finish game on click | $ = require 'jquery'
FinishGame =
submitResults: (state) ->
window.onbeforeunload = ->
gameParams = {rounds: state.round.get('rounds').toJS()}
gameId = state.game.get('id')
$.ajax
url: "/games/#{gameId}/finish"
data: { game: gameParams }
method: 'PUT'
headers:
'X-CSRF-T... | $ = require 'jquery'
FinishGame =
submitResults: (state) ->
window.onbeforeunload = ->
$('#finish-game-button').html('Finishing Game...')
$('#finish-game-button').attr('disabled', true)
gameParams = {rounds: state.round.get('rounds').toJS()}
gameId = state.game.get('id')
$.ajax
url: "/g... |
Call super so we get an id | #= require trix/utilities/object
class Trix.Attachment extends Trix.Object
constructor: (@file) ->
| #= require trix/utilities/object
class Trix.Attachment extends Trix.Object
constructor: (@file) ->
super
|
Add watch on questions, so that scores are updated in real time | 'use strict'
angular.module('ccApp.controllers')
.controller 'MainCtrl', ($scope, _, questions, scores) ->
questionsByCategory = _.groupBy questions, (question) -> question.tags[0]
$scope.questions = questions
$scope.questionGroups = questionsByCategory
$scope.sections = _.keys(questionsByCategory)
$scope... | 'use strict'
angular.module('ccApp.controllers')
.controller 'MainCtrl', ($scope, _, questions, scores) ->
questionsByCategory = _.groupBy questions, (question) -> question.tags[0]
$scope.questions = questions
$scope.questionGroups = questionsByCategory
$scope.sections = _.keys(questionsByCategory)
$scope... |
Use pre-compiled parser when available | PEG = require 'pegjs'
{fs} = require 'atom'
grammarSrc = fs.readFileSync(require.resolve('./snippet-body.pegjs'), 'utf8')
module.exports = PEG.buildParser(grammarSrc, trackLineAndColumn: true)
| try
parser = require './snippet-body'
catch
{fs} = require 'atom'
PEG = require 'pegjs'
grammarSrc = fs.readFileSync(require.resolve('./snippet-body.pegjs'), 'utf8')
parser = PEG.buildParser(grammarSrc, trackLineAndColumn: true)
module.exports = parser
|
Use ?= to assign deferred requires | module.exports =
config:
autocompleteBrackets:
type: 'boolean'
default: true
autocompleteSmartQuotes:
type: 'boolean'
default: true
wrapSelectionsInBrackets:
type: 'boolean'
default: true
activate: ->
atom.workspace.observeTextEditors (editor) ->
editorElem... | BracketMatcherView = null
BracketMatcher = null
module.exports =
config:
autocompleteBrackets:
type: 'boolean'
default: true
autocompleteSmartQuotes:
type: 'boolean'
default: true
wrapSelectionsInBrackets:
type: 'boolean'
default: true
activate: ->
atom.workspac... |
Add breadcrumb methods in router | class Water.TreesController extends Backbone.Router
routes:
"/tree/*path": "fetch_tree"
"/blob/*path": "fetch_blob"
"*anything": "root"
fetch_tree: (path) ->
@fetcher.fetch("trees", path)
fetch_blob: (path) ->
@fetcher.fetch("blobs", path)
root: () ->
@fetcher.fetch("trees", "")
... | # Takes care of routing.
# Relays data to breadcrumbs and tree_fetcher models
class Water.TreesController extends Backbone.Router
initialize: (params) =>
@fetcher = params.fetcher
@breadcrumbs = params.breadcrumbs
routes:
"/tree/*path": "fetch_tree"
"/blob/*path": "fetch_blob"
"*anything": "ro... |
Add copiright and license terms | module = angular.module("taigaProject", [])
| ###
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino Garcia <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán Merino <bameda@dbarragan.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
... |
Remove JSONString property when displaying JSON | class Utils
getHTMLTitleFromHistoryFragment: (fragment) ->
_.capitalize(fragment.split('\/').join(' '))
stringJSON: (object) ->
JSON.stringify object, null, ' '
viewJSON: (object) ->
vex.dialog.alert
contentCSS:
width: 800
message: "<pre>... | class Utils
getHTMLTitleFromHistoryFragment: (fragment) ->
_.capitalize(fragment.split('\/').join(' '))
stringJSON: (object) ->
JSON.stringify object, null, ' '
viewJSON: (object) ->
objectClone = _.extend {}, object
delete objectClone.JSONString
vex.dialog.aler... |
Change holding request JS to select scans regardless of holding status div id | $ ->
scan_request_option_id = '#entire_no'
scan_request_container_class = '#holding-request-option-offsite-scan'
# Select scan request if any of the text inputs have a value
$(document).on 'keypress', scan_request_container_class + ' fieldset input', ->
$(this).closest('fieldset').prev('label').find('input'... | $ ->
scan_request_option_id = '#entire_no'
scan_request_container_class = '[id^=holding-request-option][id$=-scan]'
# Select scan request if any of the text inputs have a value
$(document).on 'keypress', scan_request_container_class + ' fieldset input', ->
$(this).closest('fieldset').prev('label').find('inp... |
Add description for config setting | commandDisposable = null
grammarListView = null
grammarStatusView = null
module.exports =
config:
showOnRightSideOfStatusBar:
type: 'boolean'
default: true
activate: ->
commandDisposable = atom.commands.add('atom-text-editor', 'grammar-selector:show', createGrammarListView)
deactivate: ->
... | commandDisposable = null
grammarListView = null
grammarStatusView = null
module.exports =
config:
showOnRightSideOfStatusBar:
type: 'boolean'
default: true
description: 'Show the active pane item\'s langauge on the right side of Atom\'s status bar, instead of the left.'
activate: ->
comm... |
Fix syntax error in export | module.exports = s =
# Convenience method: wrap services in complete middleware stack
# accepts {serviceName: serviceDef}
# returns {serviceName: serviceDef} (wrapped)
create: (defs, jargon=[], policy=[], resolvers={}) ->
services = s.process defs, jargon
withPolicy = s.applyPolicy services, policy
... | module.exports = s =
# Convenience method: wrap services in complete middleware stack
# accepts {serviceName: serviceDef}
# returns {serviceName: serviceDef} (wrapped)
create: (defs, jargon=[], policy=[], resolvers={}) ->
services = s.process defs, jargon
withPolicy = s.applyPolicy services, policy
... |
Fix calling callback after writing of every file. | 'use strict'
async = require 'async'
sysPath = require 'path'
inflection = require 'inflection'
GeneratedFile = require './generated_file'
getGeneratedFilesPaths = (sourceFile, joinConfig) ->
sourceFileJoinConfig = joinConfig[inflection.pluralize sourceFile.type] or {}
Object.keys(sourceFileJoinConfig).filter (ge... | 'use strict'
async = require 'async'
sysPath = require 'path'
inflection = require 'inflection'
GeneratedFile = require './generated_file'
getGeneratedFilesPaths = (sourceFile, joinConfig) ->
sourceFileJoinConfig = joinConfig[inflection.pluralize sourceFile.type] or {}
Object.keys(sourceFileJoinConfig).filter (ge... |
Implement docker based latex compilation. | spawn = require("child_process").spawn
exec = require("child_process").exec
logger = require "logger-sharelatex"
module.exports = DockerRunner =
_docker: 'docker'
_baseCommand: ['run', '--rm=true', '-t', '-v', '$COMPILE_DIR:/source', '--name=texlive-$PROJECT_ID', 'texlive']
run: (project_id, command, directory... | spawn = require("child_process").spawn
exec = require("child_process").exec
logger = require "logger-sharelatex"
Settings = require "settings-sharelatex"
module.exports = DockerRunner =
_docker: 'docker'
_baseCommand: ['run', '--rm=true', '-t', '-v', '$COMPILE_DIR:/source', '--name=texlive-$PROJECT_ID']
run: ... |
Fix tests:, rm non-existant migration. | # Add new migrations here.
# I wasn't able to get automatic path globed `require` to work with gulp.
migrations = [
require "./01_base"
require "./02_add_initial_values"
]
module.exports =
migrations: migrations
update: (data) ->
for m in migrations
if m.update
data = m.update(data)
data
... | # Add new migrations here.
# I wasn't able to get automatic path globed `require` to work with gulp.
migrations = [
require "./01_base"
]
module.exports =
migrations: migrations
update: (data) ->
for m in migrations
if m.update
data = m.update(data)
data
latestVersion: ->
@lastMigrat... |
Handle all type of calling for the app, you can either use router or applicationManager | class LoginAppsController extends AppController
KD.registerAppClass this,
name : "Login"
route : [
'/:name?/Login'
'/:name?/Redeem'
'/:name?/Register'
'/:name?/Recover'
'/:name?/ResendToken'
]
hiddenHandle : yes
labels : ['Redeem', 'Register', 'R... | class LoginAppsController extends AppController
KD.registerAppClass this,
name : "Login"
route : [
'/:name?/Login'
'/:name?/Redeem'
'/:name?/Register'
'/:name?/Recover'
'/:name?/ResendToken'
]
hiddenHandle : yes
labels : ['Redeem', 'Register', 'R... |
Use stitchRequire stitch identifier in test helper | app = require '../../test.js'
_ = require 'underscore'
module.exports =
Backbone: app.Backbone
chai: require 'chai'
require: (path) ->
app.require path
| app = require '../../test.js'
_ = require 'underscore'
module.exports =
Backbone: app.Backbone
chai: require 'chai'
require: (path) ->
app.stitchRequire path
|
Add authorization check on admin route. | ETahi.AdminRoute = ETahi.AuthorizedRoute.extend
actions:
viewUserDetails: (user) ->
@controllerFor('adminJournalUser').set('model', user)
@render 'userDetailOverlay',
into: 'application'
outlet: 'overlay'
controller: 'adminJournalUser'
didTransition: ->
$('html').att... | ETahi.AdminRoute = ETahi.AuthorizedRoute.extend
beforeModel: ->
Ember.$.ajax '/admin/journals/authorization',
headers:
'Tahi-Authorization-Check': true
actions:
viewUserDetails: (user) ->
@controllerFor('adminJournalUser').set('model', user)
@render 'userDetailOverlay',
in... |
Use jQuery "on" for event hook. | $ ->
$('#currency').change ->
$.ajax(
type: 'POST'
url: $(this).data('href')
data:
currency: $(this).val()
).done ->
window.location.reload()
| $ ->
$('#currency').on 'change', ->
$.ajax(
type: 'POST'
url: $(this).data('href')
data:
currency: $(this).val()
).done ->
window.location.reload()
|
Add a validation checker for time entry | TimeEntry = require '../../models/time_entry'
should = require 'should'
makeT = (offset = 10) ->
t = new TimeEntry
start: new Date() - 5
end: new Date() - offset
duration: 60 * 60
message: 'message goes here'
userId: 'someuserID'
projectId: 'someprojectID'
describe 'TimeEntry Model', ->
it... | TimeEntry = require '../../models/time_entry'
should = require 'should'
makeT = (offset = 10) ->
t = new TimeEntry
start: new Date() - 5
end: new Date() - offset
message: 'message goes here'
userId: 'someuserID'
projectId: 'someprojectID'
describe 'TimeEntry Model', ->
it 'should be able to cr... |
Update node-webkit version for builder | module.exports = (grunt) ->
grunt.initConfig
nodewebkit:
options:
build_dir: './builds'
version: '0.8.3'
mac: true
win: true
linux32: false
linux64: false
src: [ './src/**/*' ]
grunt.loadNpmTasks 'grunt-node-webkit-builder'
grunt.registerTask 'defau... | module.exports = (grunt) ->
grunt.initConfig
nodewebkit:
options:
build_dir: './builds'
version: '0.8.4'
mac: true
win: true
linux32: false
linux64: false
src: [ './src/**/*' ]
grunt.loadNpmTasks 'grunt-node-webkit-builder'
grunt.registerTask 'defau... |
Add keybindings for win32 and linux | # Keybindings require three things to be fully defined: A selector that is
# matched against the focused element, the keystroke and the command to
# execute.
#
# Below is a basic keybinding which registers on all platforms by applying to
# the root workspace element.
# For more detailed documentation see
# https://ato... | # Keybindings require three things to be fully defined: A selector that is
# matched against the focused element, the keystroke and the command to
# execute.
#
# Below is a basic keybinding which registers on all platforms by applying to
# the root workspace element.
# For more detailed documentation see
# https://ato... |
Fix undefined username in Windows | vorpal = require 'vorpal'
chalk = vorpal().chalk
_ = require 'underscore'
awkward = vorpal()
.delimiter process.env.USER+'@awk'
.localStorage 'awkward@iostreamer'
.history 'awkward@iostreamer/history'
global.chalk = chalk
global.awkward = awkward
global._ = _
require('./terminal/main')(awkward)
... | vorpal = require 'vorpal'
chalk = vorpal().chalk
_ = require 'underscore'
os = require 'os'
user = process.env.USER
user = process.env.USERNAME if (os.platform() is "win32")
awkward = vorpal()
.delimiter user + '@awk'
.localStorage 'awkward@iostreamer'
.history 'awkward@iostreamer/history'
globa... |
Add post hook endpoint and console logging | # Description:
# Listens for ac webhooks and post in chat
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# None
#
# Notes:
# None
#
# Author:
# digitalsadhu
module.exports = (robot) ->
robot.router.get "/hubot/ac-webhooks", (req, res) ->
robot.send "ac webhooks url hit!" | # Description:
# Listens for ac webhooks and post in chat
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# None
#
# Notes:
# None
#
# Author:
# digitalsadhu
module.exports = (robot) ->
robot.router.post "/hubot/ac-webhooks", (req, res) ->
console.log req.body
user = {}
user.r... |
Simplify loading indicator for now | React = require 'react'
module.exports = React.createClass
displayName: 'LoadingIndicator'
render: ->
<span {...@props} className="loading-indicator">
<span>•</span>
<span>•</span>
<span>•</span>
</span>
| React = require 'react'
module.exports = React.createClass
displayName: 'LoadingIndicator'
render: ->
# TODO
<i className="fa fa-spin fa-spinner"></i>
|
Use small pills for the income and expenses report. | DotLedger.module 'Views.Reports.IncomeAndExpenses', ->
class @Filter extends Backbone.Marionette.ItemView
template: 'reports/income_and_expenses/filter'
className: 'nav nav-pills nav-justified'
tagName: 'ul'
events:
'click .period a': 'clickPeriod'
onRender: ->
@$el.find(".period.p... | DotLedger.module 'Views.Reports.IncomeAndExpenses', ->
class @Filter extends Backbone.Marionette.ItemView
template: 'reports/income_and_expenses/filter'
className: 'nav nav-small nav-pills'
tagName: 'ul'
events:
'click .period a': 'clickPeriod'
onRender: ->
@$el.find(".period.perio... |
Fix paths for interactive subject requests | Spine = require 'spine'
Api = require 'zooniverse/lib/api'
User = require 'zooniverse/lib/models/user'
class InteractiveSubject extends Spine.Model
@configure 'InteractiveSubject', 'redshift', 'color', 'subject', 'classification', 'type'
@fetch: ({random=false, limit, user=false}) =>
url = @url(random, limit,... | Spine = require 'spine'
Api = require 'zooniverse/lib/api'
User = require 'zooniverse/lib/models/user'
class InteractiveSubject extends Spine.Model
@configure 'InteractiveSubject', 'redshift', 'color', 'subject', 'classification', 'type'
@fetch: ({random=false, limit, user=false}) =>
url = @url(random, limit,... |
Fix the double callback call on docker timeout. | spawn = require("child_process").spawn
logger = require "logger-sharelatex"
Settings = require "settings-sharelatex"
module.exports = DockerRunner =
_docker: Settings.clsi?.docker?.binary or 'docker'
_baseCommand: ['run', '--rm=true', '-t', '-v', '$COMPILE_DIR:/source', '--name=texlive-$PROJECT_ID']
run: (proj... | spawn = require("child_process").spawn
logger = require "logger-sharelatex"
Settings = require "settings-sharelatex"
module.exports = DockerRunner =
_docker: Settings.clsi?.docker?.binary or 'docker'
_baseCommand: ['run', '--rm=true', '-t', '-v', '$COMPILE_DIR:/source', '--name=texlive-$PROJECT_ID']
run: (proj... |
Remove event properties now setup by default | Space.messaging.define Space.messaging.Event, 'Space.accounts',
UserCreated: {
sourceId: Guid
timestamp: Date
username: Username
email: EmailAddress
password: Password
}
UserLoggedIn: {
sourceId: Guid
timestamp: Date
via: String
}
UserLoginFailed: {
sourceId: Guid
ti... | Space.messaging.define Space.messaging.Event, 'Space.accounts',
UserCreated: {
username: Username
email: EmailAddress
password: Password
}
UserLoggedIn: {
via: String
}
UserLoginFailed: {
via: String
error: String
}
|
Make sure there is a conversations variable | class ChatConversationListController extends CommonChatController
constructor:->
super
@getListView().on 'moveToIndexRequested', @bound 'moveItemToIndex'
addItem:(data)->
# Make sure there is one conversation with same channel name
{conversation, chatChannel} = data
for chat in @itemsOrdered
... | class ChatConversationListController extends CommonChatController
constructor:->
super
@getListView().on 'moveToIndexRequested', @bound 'moveItemToIndex'
addItem:(data)->
# Make sure there is one conversation with same channel name
{conversation, chatChannel} = data
for chat in @itemsOrdered
... |
Rewrite labels in context-menu and menu | # See https://atom.io/docs/latest/creating-a-package#menus for more details
'context-menu':
'.overlayer':
'Rename coffee-refactor': 'coffee-refactor:rename'
'menu': [
{
'label': 'Packages'
'submenu': [
'label': 'coffee-refactor'
'submenu': [
{ 'label': 'Rename', 'command': 'coffee... | # See https://atom.io/docs/latest/creating-a-package#menus for more details
'context-menu':
'.overlayer':
'Rename Coffee Refactor': 'coffee-refactor:rename'
'menu': [
'label': 'Packages'
'submenu': [
'label': 'Coffee Refactor'
'submenu': [
'label': 'Rename'
'command': 'coffee-refactor:r... |
Add optimist to parse arguments and build a media data structure | fs = require 'fs'
upnp = require 'upnp-server'
Tag = require('taglib').Tag
mediaServer = upnp.createDevice 'MediaServer', 'Bragi', (err, device, msg) ->
throw err if err
device.start (err) ->
throw err if err
fs.readdir dir, (err, files) ->
for file in files
try
... | argv = require('optimist')
.usage('Usage: $0 -c [directory]')
.demand('c')
.alias('c', 'content')
.describe('c', 'Share the content of directory')
.argv
dir = argv.c
fs = require 'fs'
Tag = require('taglib').Tag
upnp = require 'upnp-device'
# If all keys in array are the same, return the value,
... |
Add parent type as argument of callback |
isFunction = require 'is-function'
isObjectOrArray = require 'is-object'
isArray = require 'is-array'
###
when passed an object, returns an array of its keys.
when passed an array, returns an array of its indexes.
arrayify({a: 'aa', b: 'bb', c: 'cc'})
-> ['a', 'b', 'c']
arrayify(['one', 'two', 'three'])... |
isFunction = require 'is-function'
isObjectOrArray = require 'is-object'
isArray = require 'is-array'
###
when passed an object, returns an array of its keys.
when passed an array, returns an array of its indexes.
arrayify({a: 'aa', b: 'bb', c: 'cc'})
-> ['a', 'b', 'c']
arrayify(['one', 'two', 'three'])... |
Allow Items collection to be pageable | _ = require 'underscore'
sd = require('sharify').data
Backbone = require 'backbone'
Item = require '../models/item.coffee'
module.exports = class Items extends Backbone.Collection
url: -> "#{sd.ARTSY_URL}/api/v1/set/#{@id}/items"
model: (attrs, options) ->
heuristicType = (attrs) ->
... | _ = require 'underscore'
sd = require('sharify').data
Backbone = require 'backbone'
Item = require '../models/item.coffee'
PageableCollection = require 'backbone-pageable'
# Collection of Items for an OrderedSet
module.exports = class Items extends Pageable... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.