Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Use _.bind instead of Function.prototype.bind | routeClasses = ->
ctrl = Router.current()
_.chain([ctrl._layout._template, ctrl.lookupTemplate()])
.compact()
.invoke('toLowerCase')
.value()
BodyClass =
settings:
element: 'body'
classes: []
config: (opts) ->
_.extend(@settings, opts)
return this
add: (fn) ->
unless Match.... | routeClasses = ->
ctrl = Router.current()
_.chain([ctrl._layout._template, ctrl.lookupTemplate()])
.compact()
.invoke('toLowerCase')
.value()
BodyClass =
settings:
element: 'body'
classes: []
config: (opts) ->
_.extend(@settings, opts)
return this
add: (fn) ->
unless Match.... |
Fix resolution for single-segment path-relative URLs | urllite = require '../core'
require './normalize'
{URL} = urllite
oldParse = URL.parse
copyProps = (target, source, props...) ->
target[prop] = source[prop] for prop in props
target
URL.parse = (raw, opts) ->
if base = opts?.base
delete opts.base
url = oldParse raw, opts
if base then url.resolve bas... | urllite = require '../core'
require './normalize'
{URL} = urllite
oldParse = URL.parse
copyProps = (target, source, props...) ->
target[prop] = source[prop] for prop in props
target
URL.parse = (raw, opts) ->
if base = opts?.base
delete opts.base
url = oldParse raw, opts
if base then url.resolve bas... |
Move menu location to Edit > Lines > Sort | 'menu': [
{
'label': 'Packages'
'submenu': [
'label': 'Sort Lines'
'submenu': [
{ 'label': 'Sort', 'command': 'sort-lines:sort' }
]
]
}
]
| 'menu': [
{
'label': 'Edit'
'submenu': [
'label': 'Lines'
'submenu': [
{ 'label': 'Sort', 'command': 'sort-lines:sort' }
]
]
}
]
|
Add overwrite parameter to install command | parser = require 'nomnom'
judge = require '../judge'
module.exports = (argv) ->
parser.command 'install'
.callback (opts) ->
judge.install process.cwd(), opts[1], (err) ->
throw err if err
parser.command 'run'
.callback (opts) ->
judge.run opts[1], process.cwd(), opts[2], opts._[3..], (err) ->
throw er... | parser = require 'nomnom'
judge = require '../judge'
module.exports = (argv) ->
parser.command 'install'
.option 'overwrite',
flag: true
.callback (opts) ->
judge.install process.cwd(), opts[1], opts.overwrite, (err) ->
throw err if err
parser.command 'run'
.callback (opts) ->
judge.run opts[1], proces... |
Make tooltips work on ios | # Initialize all namespaces
class SwanKiosk
@Interpreters: {}
@Components: {}
@Config: {}
@Store: {}
@Controllers:
_find: (name) ->
_.find this, (value, key) ->
key.split('Controller')[0].toLowerCase() == name.toLowerCase()
@create: (klass, args) ->
new klass args
_i... | # Initialize all namespaces
class SwanKiosk
@Interpreters: {}
@Components: {}
@Config: {}
@Store: {}
@Controllers:
_find: (name) ->
_.find this, (value, key) ->
key.split('Controller')[0].toLowerCase() == name.toLowerCase()
@create: (klass, args) ->
new klass args
_i... |
Handle errors on /try, rather than appearing to 'Load' forever. | $ ->
$('textarea').keydown (event) =>
if (event.keyCode == 10 or event.keyCode == 13) and event.ctrlKey
$('#result').text("Loading...")
$.ajax {
"url": "/jsontest",
"type": "POST",
"data": JSON.stringify({
"language": "ruby",
"code": $('textarea').val()
... | $ ->
$('textarea').keydown (event) =>
if (event.keyCode == 10 or event.keyCode == 13) and event.ctrlKey
$('#result').text("Loading...")
$.ajax {
"url": "/jsontest",
"type": "POST",
"data": JSON.stringify({
"language": "ruby",
"code": $('textarea').val()
... |
Return to 'Everything' when none of languages are selected | $ ->
projects = $('#projects').clone()
languages = []
$('#languages a').click (e) ->
clicked_language = $(this).data().language
unless clicked_language?
$('#languages li').removeClass('disabled')
$('#projects').html(projects.find('.project'))
projects = $('#projects').clone()
$('... | $ ->
projects = $('#projects').clone()
languages = []
$('#languages a').click (e) ->
clicked_language = $(this).data().language
unless clicked_language?
resetLanguage()
return
unless e.ctrlKey or e.metaKey
languages = [].concat(clicked_language)
else
unless clicked_langu... |
Switch this to a straight up say | Redis = require 'redis'
Url = require 'url'
POO_TRACKER_KEY = "poops"
POO_LATEST_KEY = "poops:latest_message"
info = Url.parse process.env.POO_REDIS_URL or "redis://localhost:6379/0"
redis_client = Redis.createClient(info.port, info.hostname)
redis_client.auth info.auth.split(":")[1] if info.auth
module.exports = (r... | Redis = require 'redis'
Url = require 'url'
POO_TRACKER_KEY = "poops"
POO_LATEST_KEY = "poops:latest_message"
info = Url.parse process.env.POO_REDIS_URL or "redis://localhost:6379/0"
redis_client = Redis.createClient(info.port, info.hostname)
redis_client.auth info.auth.split(":")[1] if info.auth
module.exports = (r... |
Fix indicator index test by adding them to themes | assert = require('chai').assert
helpers = require '../helpers'
request = require('request')
async = require('async')
url = require('url')
_ = require('underscore')
suite('Indicator index')
test("With a series of indicators, I should see their titles", (done) ->
helpers.createIndicatorModels([
{
title: 'in... | assert = require('chai').assert
helpers = require '../helpers'
request = require('request')
async = require('async')
url = require('url')
_ = require('underscore')
suite('Indicator index')
test("With a series of indicators, I should see their titles", (done) ->
themeAttributes = [{
title: 'Theme 1'
external... |
Update my local subject's ID | Spine = require 'Spine'
Classification = require 'models/Classification'
class Subject extends Spine.Model
@configure 'Subject', 'image', 'audio', 'latitude', 'longitude', 'location', 'habitat', 'datetime'
@next: ->
subjects = Subject.all()
random = Math.floor Math.random() * subjects.length
subjects[r... | Spine = require 'Spine'
Classification = require 'models/Classification'
class Subject extends Spine.Model
@configure 'Subject', 'image', 'audio', 'latitude', 'longitude', 'location', 'habitat', 'captured'
@next: ->
subjects = Subject.all()
random = Math.floor Math.random() * subjects.length
subjects[r... |
Use Redux Devtools Chrome extension. | Redux = require 'redux'
promiseMiddleware = require 'redux-promise-middleware'
thunkMiddleware = require 'redux-thunk'
Router = require 'react-router'
createHistory = require 'history/lib/createMemoryHistory' # aliased in webpack
ReduxRouter = require 'redux-simple-router'
routes = require './views/routes.coffee'
red... | Redux = require 'redux'
promiseMiddleware = require 'redux-promise-middleware'
thunkMiddleware = require 'redux-thunk'
Router = require 'react-router'
createHistory = require 'history/lib/createMemoryHistory' # aliased in webpack
ReduxRouter = require 'redux-simple-router'
routes = require './views/routes.coffee'
util... |
Use radio buttons for export type selection as there is no bulk export resource yet. | define [
'./core'
], (c) ->
class ExportType extends c.Backbone.View
tagName: 'label'
className: 'checkbox'
render: ->
title = @model.get('title') or 'untitled'
@$el.html("<input type=checkbox name=export-type-check id=export-type-check-#{ title } chec... | define [
'./core'
], (c) ->
class ExportType extends c.Backbone.View
tagName: 'label'
className: 'radio'
render: ->
title = @model.get('title') or 'untitled'
@$el.html("<input type=radio name=export-type-radio id=export-type-radio-#{ title } /> #{ titl... |
Make an https get to github using env auth token | # Description
# A hubot script that shows who has the longest github streak in your org
#
# Configuration:
# LIST_OF_ENV_VARS_TO_SET
# HUBOT_ORG_ACCESS_TOKEN
#
# Commands:
# streak ladder - <Gets a list of the longest github commit streaks in your org>
#
# Notes:
# An access token is required by the github ap... | # Description
# A hubot script that shows who has the longest github streak in your org
#
# Configuration:
# LIST_OF_ENV_VARS_TO_SET
# HUBOT_ORG_ACCESS_TOKEN
#
# Commands:
# streak ladder - <Gets a list of the longest github commit streaks in your org>
#
# Notes:
# An access token is required by the github ap... |
Allow form to take an onSubmit argument | Promise = require 'bluebird-q'
Serializer = require '../../../../components/form/serializer.coffee'
module.exports = ($el) ->
$submit = $el.find('button')
$errors = $el.find('.js-form-errors')
label = $submit.text()
$el.on 'submit', (e) ->
e.preventDefault()
serializer = new Serializer $el
$sub... | Promise = require 'bluebird-q'
Serializer = require '../../../../components/form/serializer.coffee'
module.exports = ($el, onSubmit) ->
$submit = $el.find('button')
$errors = $el.find('.js-form-errors')
label = $submit.text()
$el.on 'submit', (e) ->
e.preventDefault()
serializer = new Serializer $el... |
Use complete_exercise_count to determine status | React = require 'react'
BS = require 'react-bootstrap'
EventRow = require './event-row'
_ = require 'underscore'
isStepComplete = (step) -> step.is_completed
module.exports = React.createClass
displayName: 'ReadingRow'
propTypes:
event: React.PropTypes.object.isRequired
courseId: React.PropTypes... | React = require 'react'
BS = require 'react-bootstrap'
EventRow = require './event-row'
_ = require 'underscore'
isStepComplete = (step) -> step.is_completed
module.exports = React.createClass
displayName: 'ReadingRow'
propTypes:
event: React.PropTypes.object.isRequired
courseId: React.PropTypes... |
Correct coffeescript in previous commit | $ ->
$("#new-space-basic-info input#space_public").on 'click', ->
checked = $(this).attr('checked') == 'checked'
$("#new-space-webconf-area").toggle(!checked)
| $ ->
$("#new-space-basic-info input#space_public").on 'click', ->
$("#new-space-webconf-area").toggle(! $(this).is(':checked'))
|
Fix body class check to avoid initialize Visualization or Story classes in templates different to show or edit | window.App ||= {}
App.Visualization = require './visualization.js'
App.Story = require './story.js'
App.Trix = require 'script!trix'
$(document).ready ->
$body = $('body')
# visualizations
if $body.hasClass 'visualizations'
# /visualizations/:id
# /visualizations/:id/edit
appVisua... | window.App ||= {}
App.Visualization = require './visualization.js'
App.Story = require './story.js'
App.Trix = require 'script!trix'
$(document).ready ->
$body = $('body')
# visualizations
if $body.hasClass('visualizations') and ($body.hasClass('show') or $body.hasClass('edit'))
# /visual... |
Add plugin origin on created markers | {CompositeDisposable} = require 'atom'
module.exports =
class MinimapPigmentsBinding
constructor: ({@editor, @minimap, @colorBuffer}) ->
@displayedMarkers = []
@decorationsByMarkerId = {}
@subscriptionsByMarkerId = {}
@subscriptions = new CompositeDisposable
@colorBuffer.initialize().then => @u... | {CompositeDisposable} = require 'atom'
module.exports =
class MinimapPigmentsBinding
constructor: ({@editor, @minimap, @colorBuffer}) ->
@displayedMarkers = []
@decorationsByMarkerId = {}
@subscriptionsByMarkerId = {}
@subscriptions = new CompositeDisposable
@colorBuffer.initialize().then => @u... |
Rename command to compositCommand in command interpreter | fs = require 'fs'
PEG = require 'pegjs'
module.exports =
class CommandInterpreter
constructor: ->
@parser = PEG.buildParser(fs.read(require.resolve 'command-interpreter/commands.pegjs'))
eval: (editor, string) ->
command = @parser.parse(string)
@lastRelativeAddress = command if command.isRelativeAddre... | fs = require 'fs'
PEG = require 'pegjs'
module.exports =
class CommandInterpreter
constructor: ->
@parser = PEG.buildParser(fs.read(require.resolve 'command-interpreter/commands.pegjs'))
eval: (editor, string) ->
compositeCommand = @parser.parse(string)
@lastRelativeAddress = compositeCommand if compo... |
Add .get() and .expire() methods to Biskoto | define ->
class Biskoto
@get: (name) ->
if document.cookie
cookies = decodeURIComponent(document.cookie).split(/;\s/g)
for cookie in cookies
if cookie.indexOf(name) is 0
return cookie.split('=')[1]
return null
return Biskoto
| define ->
class Biskoto
encode = encodeURIComponent
decode = decodeURIComponent
@get: (name) ->
if document.cookie
cookies = decode(document.cookie).split(/;\s/g)
for cookie in cookies
if cookie.indexOf(name) is 0
return cookie.split('=')[1]
return null... |
Add random chance line to RoC chart HEXDEV-168 | H2O.PredictOutput = (_, _go, prediction) ->
{ frame, model } = prediction
_isBinomial = signal prediction.model_category is 'Binomial'
_isMultinomial = signal prediction.model_category is 'Multinomial'
_isRegression = signal prediction.model_category is 'Regression'
_isClustering = signal prediction.model_cat... | H2O.PredictOutput = (_, _go, prediction) ->
{ frame, model } = prediction
_isBinomial = signal prediction.model_category is 'Binomial'
_isMultinomial = signal prediction.model_category is 'Multinomial'
_isRegression = signal prediction.model_category is 'Regression'
_isClustering = signal prediction.model_cat... |
Fix the reduce function. Yet again... | class @VoteController extends RouteController
waitOn: ->
q = {}
if filterType = @params.filterType
q.type = filterType
if filterTag = @params.filterTag
q.tags = filterTag
Meteor.subscribe('proposals-min', q)
after: -> document.title = "Vote | Reversim Summit 2014"
tempalte: 'vote'
... | class @VoteController extends RouteController
waitOn: ->
q = {}
if filterType = @params.filterType
q.type = filterType
if filterTag = @params.filterTag
q.tags = filterTag
Meteor.subscribe('proposals-min', q)
after: -> document.title = "Vote | Reversim Summit 2014"
tempalte: 'vote'
... |
Reduce overhead DIVs in layout | window.$ = window.jQuery = require('jquery')
require('semantic-ui-css/semantic')
React = require('react/addons')
ReactDOM = require('react-dom')
reactRouter = require('react-router')
Header = require('./header')
CodeEditor = require('./CodeEditor')
Documentation = require('./Documentation')
Master = require('./Master... | window.$ = window.jQuery = require('jquery')
require('semantic-ui-css/semantic')
React = require('react/addons')
ReactDOM = require('react-dom')
reactRouter = require('react-router')
Header = require('./header')
CodeEditor = require('./CodeEditor')
Documentation = require('./Documentation')
Master = require('./Master... |
Remove redundant text attribute condition | Trix.config.textAttributes =
bold:
tagName: "strong"
inheritable: true
parser: (element) ->
return false if /H\d$/.test(element.tagName) or element.tagName is "BR"
style = window.getComputedStyle(element)
style["fontWeight"] is "bold" or style["fontWeight"] >= 600
italic:
tagName:... | Trix.config.textAttributes =
bold:
tagName: "strong"
inheritable: true
parser: (element) ->
style = window.getComputedStyle(element)
style["fontWeight"] is "bold" or style["fontWeight"] >= 600
italic:
tagName: "em"
inheritable: true
parser: (element) ->
style = window.getC... |
Add test for compiler errors on require()d files | # Error Formating
# ---------------
# Ensure that errors of different kinds (lexer, parser and compiler) are shown
# in a consistent way.
{prettyErrorMessage} = CoffeeScript.helpers
assertErrorFormat = (code, expectedErrorFormat) ->
throws (-> CoffeeScript.compile code), (err) ->
message = prettyErrorMessage e... | # Error Formating
# ---------------
# Ensure that errors of different kinds (lexer, parser and compiler) are shown
# in a consistent way.
{prettyErrorMessage} = CoffeeScript.helpers
assertErrorFormat = (code, expectedErrorFormat) ->
throws (-> CoffeeScript.run code), (err) ->
message = prettyErrorMessage err, ... |
Add delete to matcher contorller | App.MatchersShowController = Em.ObjectController.extend
needs: ['transactions']
syncTransactions: (->
categoryTransactions = @get('model.transactions')
transactionsController = @get 'controllers.transactions'
transactionsController.set 'model', categoryTransactions
Em.debug "#{this} syncTransactio... | App.MatchersShowController = Em.ObjectController.extend
needs: ['transactions']
syncTransactions: (->
categoryTransactions = @get('model.transactions')
transactionsController = @get 'controllers.transactions'
transactionsController.set 'model', categoryTransactions
Em.debug "#{this} syncTransactio... |
Add category system type attribute | App.Category = App.Model.extend
id: Ember.attr()
name: Ember.attr()
count: Ember.attr(Number)
total: Ember.attr(Number)
transactions: Ember.hasMany 'App.Transaction',
key: 'transaction_ids'
matchers: Ember.hasMany 'App.Matcher',
key: 'matcher_id'
App.Category.url = "/categories"
App.Category.adapter... | App.Category = App.Model.extend
id: Ember.attr()
name: Ember.attr()
system_type: Ember.attr()
count: Ember.attr(Number)
total: Ember.attr(Number)
transactions: Ember.hasMany 'App.Transaction',
key: 'transaction_ids'
matchers: Ember.hasMany 'App.Matcher',
key: 'matcher_id'
App.Category.url = "/cate... |
Use correct file name for s3 | { extend } = require 'underscore'
JSONPage = require '../../components/json_page'
resizer = require '../../components/resizer'
markdown = require '../../components/util/markdown'
page = new JSONPage name: 'gallery-partnerships'
@index = (req, res, next) ->
page.get()
.then (data) ->
res.render 'index', ex... | { extend } = require 'underscore'
JSONPage = require '../../components/json_page'
resizer = require '../../components/resizer'
markdown = require '../../components/util/markdown'
page = new JSONPage name: 'gallery-partnerships2'
@index = (req, res, next) ->
page.get()
.then (data) ->
res.render 'index', e... |
Make tests run with promise and non-promise package deactivate | DeprecationCopView = require '../lib/deprecation-cop-view'
describe "DeprecationCop", ->
[activationPromise, workspaceElement] = []
beforeEach ->
workspaceElement = atom.views.getView(atom.workspace)
activationPromise = atom.packages.activatePackage('deprecation-cop')
expect(atom.workspace.getActivePa... | DeprecationCopView = require '../lib/deprecation-cop-view'
describe "DeprecationCop", ->
[activationPromise, workspaceElement] = []
beforeEach ->
workspaceElement = atom.views.getView(atom.workspace)
activationPromise = atom.packages.activatePackage('deprecation-cop')
expect(atom.workspace.getActivePa... |
Refactor inquiry test using spies to be slightly more readable. | sinon = require 'sinon'
Backbone = require 'backbone'
ArtworkInquiry = require '../../models/artwork_inquiry'
describe 'ArtworkInquiry', ->
beforeEach ->
@inquiry = new ArtworkInquiry
describe '#send', ->
beforeEach ->
sinon.stub Backbone, 'sync'
.yieldsTo 'success'
.returns Promise.... | sinon = require 'sinon'
Backbone = require 'backbone'
ArtworkInquiry = require '../../models/artwork_inquiry'
describe 'ArtworkInquiry', ->
beforeEach ->
@inquiry = new ArtworkInquiry
describe '#send', ->
beforeEach ->
sinon.stub Backbone, 'sync'
.yieldsTo 'success'
.returns Promise.... |
Make it easy to disable caching. | observe = require './observe'
prototype =
autoRender: true
initialize: (object) ->
if object.constructor.name == 'Object' and @Model?
@model = new @Model object
else
@model = object
observe @model, @bindings, @
if @autoRender
@render object
cacheTemplate: ->
# Cache on p... | observe = require './observe'
prototype =
autoRender: true
initialize: (object) ->
if object.constructor.name == 'Object' and @Model?
@model = new @Model object
else
@model = object
observe @model, @bindings, @
if @autoRender
@render object
cacheTemplate: (el) ->
# Cache... |
Add compatibility for upcoming react support in minimap | {View, EditorView} = require 'atom'
module.exports = ->
highlightSelectedPackage = atom.packages.getLoadedPackage('highlight-selected')
minimapPackage = atom.packages.getLoadedPackage('minimap')
minimap = require (minimapPackage.path)
highlightSelected = require (highlightSelectedPackage.path)
HighlightedAr... | {View} = require 'atom'
module.exports = ->
highlightSelectedPackage = atom.packages.getLoadedPackage('highlight-selected')
minimapPackage = atom.packages.getLoadedPackage('minimap')
minimap = require (minimapPackage.path)
highlightSelected = require (highlightSelectedPackage.path)
HighlightedAreaView = req... |
Make the fact wheel in recently viewed facts responding to the mouse for now. | class RecentlyViewedFactView extends Backbone.Marionette.ItemView
tagName: 'li'
template: 'facts/recently_viewed_fact'
templateHelpers: =>
evidence_type: @options.evidence_type
triggers:
'click button': 'click'
ui:
factWheel: '.js-fact-wheel'
onRender: ->
@ui.factWheel.html @wheelView().... | class RecentlyViewedFactView extends Backbone.Marionette.ItemView
tagName: 'li'
template: 'facts/recently_viewed_fact'
templateHelpers: =>
evidence_type: @options.evidence_type
triggers:
'click button': 'click'
ui:
factWheel: '.js-fact-wheel'
onRender: ->
@ui.factWheel.html @wheelView().... |
Allow multiple IN sources for saving | noflo = require "noflo"
couch = require "couch-client"
class SaveObject extends noflo.Component
constructor: ->
@request = null
@database = "default"
@connection = null
@data = []
@inPorts =
in: new noflo.Port()
database: new noflo.Port()
... | noflo = require "noflo"
couch = require "couch-client"
class SaveObject extends noflo.Component
constructor: ->
@request = null
@database = "default"
@connection = null
@data = []
@inPorts =
in: new noflo.ArrayPort()
database: new noflo.Port()
... |
Update event to use new SoundManager.stopAll(config) | Entity = require 'models/Entity'
mediator = require 'mediator'
module.exports = class Event extends Entity
mediator.factory['Event'] = this
constructor: (x, y, width, height, owningLevel, settings) ->
# settings.physicsType = 'static'
# settings.isSensor = true
super x, y, width, height, ownin... | Entity = require 'models/Entity'
mediator = require 'mediator'
module.exports = class Event extends Entity
mediator.factory['Event'] = this
constructor: (x, y, width, height, owningLevel, settings) ->
# settings.physicsType = 'static'
# settings.isSensor = true
super x, y, width, height, ownin... |
Add logic that toggles the selection when the button is pressed | # 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/
$ ->
$('.update').on 'input', (event) ->
console.log event
$(this).parent().find('.update').val(this.va... | # 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/
$ ->
$('.update').on 'input', (event) ->
console.log event
$(this).parent().find('.update').val(this.va... |
Fix inability to dismiss "Results" attention grabber | class @Scenario extends Backbone.Model
apiSessionID: ->
key = App.settings.get('api_session_id')
return if key? then key else null
api_session_id: ->
@apiSessionID()
apiAttributes: ->
s = App.settings
data =
area_code: s.get('area_code')
end_year: s.get('end_year')
preset_s... | class @Scenario extends Backbone.Model
apiSessionID: ->
key = App.settings.get('api_session_id')
return if key? then key else null
api_session_id: =>
@apiSessionID()
apiAttributes: ->
s = App.settings
data =
area_code: s.get('area_code')
end_year: s.get('end_year')
preset_s... |
Handle loading classes in browser |
exports.ObjectTemplate = require './ObjectTemplate'
exports.TemplateConfig = require './TemplateConfig'
|
# load modules in CommonJS/Node.js environment, not needed in browser
if exports? && require?
exports.ObjectTemplate = require './ObjectTemplate'
exports.TemplateConfig = require './TemplateConfig'
|
Add arg props to app.react.Link | goog.provide 'app.react.Link'
class app.react.Link
###*
@param {app.Routes} routes
@param {app.react.Touch} touch
@constructor
###
constructor: (@routes, @touch) ->
###*
@param {este.Route} route
@param {string} text
@param {Object=} params
###
to: (route, text, params) ->
{a}... | goog.provide 'app.react.Link'
class app.react.Link
###*
@param {app.Routes} routes
@param {app.react.Touch} touch
@constructor
###
constructor: (@routes, @touch) ->
###*
@param {este.Route} route
@param {string} text
@param {Object=} urlParams
@param {Object=} props
###
to: (r... |
Make requests significantly rarer (more realistic) | class GameState
customers: []
agents: []
requestQueues: {}
chanceOfRequest: 0.02
tickables: []
tick: 0
money: 1000000
reputation: 0.5
agentSpawner: new AgentSpawner()
addAgent: (agent) ->
@agents.push(agent)
@tickables.push(agent)
fireAgent: (agent) ->
@agents.filter((item) ->
... | class GameState
customers: []
agents: []
requestQueues: {}
chanceOfRequest: 0.005
tickables: []
tick: 0
money: 1000000
reputation: 0.5
agentSpawner: new AgentSpawner()
addAgent: (agent) ->
@agents.push(agent)
@tickables.push(agent)
fireAgent: (agent) ->
@agents.filter((item) ->
... |
Set gitlabs scope to 'api', the only support scope. | config =
serverURL: 'https://gitlab.com'
identityPath: '/api/v3/user'
addAutopublishFields:
forLoggedInUser: ['services.gitlab']
forOtherUsers: ['services.gitlab.username']
Gitlab = new CustomOAuth 'gitlab', config
if Meteor.isServer
Meteor.startup ->
RocketChat.models.Settings.findById('API_Gitlab_URL').ob... | config =
serverURL: 'https://gitlab.com'
identityPath: '/api/v3/user'
scope: 'api'
addAutopublishFields:
forLoggedInUser: ['services.gitlab']
forOtherUsers: ['services.gitlab.username']
Gitlab = new CustomOAuth 'gitlab', config
if Meteor.isServer
Meteor.startup ->
RocketChat.models.Settings.findById('API_G... |
Reduce the animation duration more | # 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/
roundUpBy = (value, round_to) ->
return round_to * Math.ceil(value / round_to)
$ ->
animateMetric = $("... | # 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/
roundUpBy = (value, round_to) ->
return round_to * Math.ceil(value / round_to)
$ ->
animateMetric = $("... |
Document the abstract Cacheable class. | Impromptu = require './impromptu'
class Cacheable
constructor: (@impromptu, @name, @options) ->
run: (fn) => throw Impromptu.AbstractError
get: (fn) -> throw Impromptu.AbstractError
set: (fn) -> throw Impromptu.AbstractError
unset: (fn) -> throw Impromptu.AbstractError
# Expose `Cacheable`.
exports = module... | Impromptu = require './impromptu'
# An abstract class that manages how a method is cached.
class Cacheable
constructor: (@impromptu, @name, @options) ->
# The main method.
#
# Accepts a `fn` with a signature of `err, results`, where `results` is the
# cached value. Optionally updates the cache.
#
# Thi... |
Handle empty scoring lists properly PP-8 | Steam.ScoringListView = (_) ->
_items = do nodes$
#TODO ugly
_isLive = node$ yes
activateItem = (item) ->
for other in _items()
if other is item
other.isActive yes
else
other.isActive no
_.displayScoring item.data
createItem = (scoring) ->
#TODO replace with type ch... | Steam.ScoringListView = (_) ->
_items = do nodes$
_hasItems = lift$ _items, (items) -> items.length > 0
#TODO ugly
_isLive = node$ yes
activateItem = (item) ->
for other in _items()
if other is item
other.isActive yes
else
other.isActive no
_.displayScoring item.data
... |
Fix date with hours display | Template.date.helpers
Template.date.rendered = ->
template = @
$editor = template.$("input")
$editor.datepicker(
changeMonth: true
changeYear: true
dateFormat: "yy/mm/dd"
constrainInput: false
onSelect: (date) ->
$set = {}
$set[template.data.property] = date
editor = share.E... | Template.date.helpers
Template.date.rendered = ->
template = @
$editor = template.$("input")
$editor.datepicker(
changeMonth: true
changeYear: true
dateFormat: "yy/mm/dd"
constrainInput: false
onSelect: (date) ->
$set = {}
$set[template.data.property] = date
editor = share.E... |
Choose First h1 for File Title | ###
# # Write JSON File Tree
###
fs = require 'fs'
path = require 'path'
through = require 'through2'
log = require '../utils/log'
module.exports = (fileName, opts={}) ->
unless fileName
throw new PluginError("Render File Tree", "Missing fileName option")
filePrefix = opts.filePrefix or "window.#{opts.varNa... | ###
# # Write JSON File Tree
###
fs = require 'fs'
path = require 'path'
through = require 'through2'
_ = require 'lodash'
log = require '../utils/log'
module.exports = (fileName, opts={}) ->
unless fileName
throw new PluginError("Render File Tree", "Missing fileName option")
filePrefix = opts.filePrefix or... |
Optimize minimap update by removing a wrapper instead of all lines | {EditorView, ScrollView} = require 'atom'
module.exports =
class MinimapEditorView extends ScrollView
@content: ->
@div class: 'minimap-editor editor editor-colors', =>
@div class: 'scroll-view', outlet: 'scrollView', =>
@div class: 'lines', outlet: 'lines'
initialize: ->
super
update: (... | {EditorView, ScrollView, $} = require 'atom'
module.exports =
class MinimapEditorView extends ScrollView
@content: ->
@div class: 'minimap-editor editor editor-colors', =>
@div class: 'scroll-view', outlet: 'scrollView', =>
@div class: 'lines', outlet: 'lines', =>
@div class: 'lines-wrap... |
Fix permissions toggle label for new posts | Marbles.Views.PermissionsFieldsToggle = class PermissionsFieldsToggleView extends TentStatus.View
@template_name: 'permissions_fields_toggle'
@view_name: 'permissions_fields_toggle'
constructor: ->
super
@once 'ready', =>
setImmediate @bindEvents
@render()
context: (permissions = @parentVi... | Marbles.Views.PermissionsFieldsToggle = class PermissionsFieldsToggleView extends TentStatus.View
@template_name: 'permissions_fields_toggle'
@view_name: 'permissions_fields_toggle'
constructor: ->
super
@once 'ready', =>
setImmediate @bindEvents
@render()
context: (permissions) =>
per... |
Fix title bar appearance at smaller screen widths | class Views.Application extends View
@content: ->
@div id: 'application', class: 'container', =>
@div class: 'navbar navbar-fixed-top navbar-inverse', =>
@div class: 'navbar-inner', =>
@div class: 'container', =>
@a "Hyperarchy", class: 'brand', href: '/'
@ul class:... | class Views.Application extends View
@content: ->
@div id: 'application', =>
@div class: 'navbar navbar-fixed-top navbar-inverse', =>
@div class: 'navbar-inner', =>
@div class: 'container', =>
@a "Hyperarchy", class: 'brand', href: '/'
@ul class: 'nav pull-right', =... |
Fix stack trace processing to match refactored API PUBDEV-371 | H2O.StackTraceOutput = (_, _stackTrace) ->
_activeNode = signal null
createThread = (thread) ->
lines = split thread, '\n'
title: head lines
stackTrace: join (tail lines), '\n'
createNode = (node) ->
display = -> _activeNode self
self =
name: node._node
timestamp: new Date node... | H2O.StackTraceOutput = (_, _stackTrace) ->
_activeNode = signal null
createThread = (thread) ->
lines = split thread, '\n'
title: head lines
stackTrace: join (tail lines), '\n'
createNode = (node) ->
display = -> _activeNode self
self =
name: node.node
timestamp: new Date node.... |
Add comments to ConceptPanel for clarity of implementation | define [
'../core'
'./index'
'./search'
'tpl!templates/concept/panel.html'
], (c, index, search, templates...) ->
templates = c._.object ['panel'], templates
class ConceptSearch extends search.ConceptSearch
events:
'typeahead:autocompleted input': 'autocomplete'
a... | define [
'../core'
'./index'
'./search'
'tpl!templates/concept/panel.html'
], (c, index, search, templates...) ->
templates = c._.object ['panel'], templates
class ConceptSearch extends search.ConceptSearch
events:
'typeahead:autocompleted input': 'autocomplete'
a... |
Allow integration test looking up by instance name to be bypassed (if SQL Server Browser not available). | fs = require('fs')
instanceLookup = require('../../lib/instance-lookup')
getConfig = ->
server: JSON.parse(fs.readFileSync(process.env.HOME + '/.tedious/test-connection.json', 'utf8')).config.server
instanceName: JSON.parse(fs.readFileSync(process.env.HOME + '/.tedious/test-connection.json', 'utf8')).instanceName
... | fs = require('fs')
instanceLookup = require('../../lib/instance-lookup')
getConfig = ->
server: JSON.parse(fs.readFileSync(process.env.HOME + '/.tedious/test-connection.json', 'utf8')).config.server
instanceName: JSON.parse(fs.readFileSync(process.env.HOME + '/.tedious/test-connection.json', 'utf8')).instanceName
... |
Convert to using tabs so as to allow editor diversity. | Promise = require 'bluebird'
fs = Promise.promisifyAll require 'fs'
_ = require 'lodash'
module.exports = () ->
# For performance reasons, we'll do this asynchronously.
fs.readdirAsync('./controllers/').then (controllers) ->
#This probably isn't necessary: I wanted to parse t... | Promise = require 'bluebird'
fs = Promise.promisifyAll require 'fs'
_ = require 'lodash'
module.exports = () ->
# For performance reasons, we'll do this asynchronously.
fs.readdirAsync('./controllers/').then (controllers) ->
#This probably isn't necessary: I wanted to parse through and grab all these controlle... |
Fix sizeToContainer - actually set width | window.LC = window.LC ? {}
slice = Array.prototype.slice
LC.util =
last: (array, n = null) ->
if n
return slice.call(array, Math.max(array.length - n, 0))
else
return array[array.length - 1]
sizeToContainer: (canvas, callback = ->) ->
$canvas = $(canvas)
$container = $canvas.parent()... | window.LC = window.LC ? {}
slice = Array.prototype.slice
LC.util =
last: (array, n = null) ->
if n
return slice.call(array, Math.max(array.length - n, 0))
else
return array[array.length - 1]
sizeToContainer: (canvas, callback = ->) ->
$canvas = $(canvas)
$container = $canvas.parent()... |
Revert to multi-select version of subejct_viewer | BaseTool = window.Ubret.BaseTool or require('./base_tool')
class SubjectViewer extends BaseTool
name: 'Subject Viewer'
template:
"""
<ul>
<% for(i = 0; i < keys.length; i++) { %>
<li>
<%- keys[i] %>: <%- subject[keys[i]] %>
</li>
<% } %>
</ul>
"""
start: =>
... | BaseTool = window.Ubret.BaseTool or require('./base_tool')
class SubjectViewer extends BaseTool
constructor: (opts) ->
super
@count = 0
@div = d3.select(@selector)
@start()
start: =>
subjects = new Array
if @selectedElements.length isnt 0
subjects = @dimensions.uid.top(Infinity).fil... |
Remove console log message from decrease job priority button. | $(document).load ->
readyMenuToggle()
registerJobPriority()
$(document).on 'ready page:change', ->
readyMenuToggle()
registerJobPriority()
readyMenuToggle = ->
$('#menu-toggle').click (e) ->
e.preventDefault()
$('#wrapper').toggleClass 'toggled'
$('#menu-close').click (e) ->
e.preventDefault(... | $(document).load ->
readyMenuToggle()
registerJobPriority()
$(document).on 'ready page:change', ->
readyMenuToggle()
registerJobPriority()
readyMenuToggle = ->
$('#menu-toggle').click (e) ->
e.preventDefault()
$('#wrapper').toggleClass 'toggled'
$('#menu-close').click (e) ->
e.preventDefault(... |
Add test for multiple lines translation | googleTranslate = new practical.GoogleTranslate()
Tinytest.add 'Google Translate - should translate text' , (test)->
translation = googleTranslate.translate("My name is Brandon", "es")
expect(translation).to.be.an("Object")
expect(translation.translatedText).to.equal("Mi Nombre Es Brandon") | googleTranslate = new practical.GoogleTranslate()
Tinytest.add 'Google Translate - should translate text' , (test)->
translation = googleTranslate.translate("my name is Brandon", "es")
expect(translation).to.be.an("Object")
expect(translation.translatedText).to.equal("mi nombre es Brandon")
Tinytest.add 'Google... |
Update test with slightly cleaner and safer code | require 'should'
Base58 = require '..'
examples = require './examples'
describe 'Base58', ->
describe '.encode', ->
it 'encodes number to Base58 string', ->
for str, num of examples
Base58.encode(num).should.eql(str)
describe 'when passed a string only containing numbers', ->
it 'encod... | should = require 'should'
Base58 = require '..'
describe 'Base58', ->
beforeEach ->
@examples = require './examples' unless @examples?
should.exist(@examples)
describe '.encode', ->
it 'encodes number to Base58 string', ->
for str, num of @examples
Base58.encode(num).should.eql(str)
... |
Use catch rather than fail, as bluebird only supports catch | Q = require('q')
async = require('async')
Theme = require('../../models/theme').model
HeadlineService = require('../services/headline')
module.exports = class ThemePresenter
constructor: (@theme) ->
@populateIndicatorRecencyStats: (themes) ->
for theme in themes
theme.outOfDateIndicatorCount = 0
... | Q = require('q')
async = require('async')
Theme = require('../../models/theme').model
HeadlineService = require('../services/headline')
module.exports = class ThemePresenter
constructor: (@theme) ->
@populateIndicatorRecencyStats: (themes) ->
for theme in themes
theme.outOfDateIndicatorCount = 0
... |
Initialize slider on top element of slider | #= require partystreusel/base
#= require partystreusel/scroll_to
#= require jquery.cycle2
#= require jquery.cycle2.swipe
class Slider extends Partystreusel.Base
@className = 'Slider'
constructor: (el) ->
super
@initializeCycle()
initializeCycle: ->
# see for documenation and options:
# https://... | #= require partystreusel/base
#= require partystreusel/scroll_to
#= require jquery.cycle2
#= require jquery.cycle2.swipe
class Slider extends Partystreusel.Base
@className = 'Slider'
constructor: (el) ->
super
@slidelist = @$el.find('.slider__list')
@initializeCycle()
initializeCycle: ->
# see ... |
Make votes format a bit prettier: Add number formatting and BTS unit | angular.module("app").filter "formatVotes", () ->
(number) -> # TODO use real precision, not available in web wallet yet
return number / 100000
| angular.module("app").filter "formatVotes", ($filter) ->
(number) -> # TODO use real precision, not available in web wallet yet
return $filter('number')(number / 100000,0)+' BTS'
|
Work around CS identity map bug | {Serenade} = require './serenade'
{Cache} = require './cache'
{Associations} = require './associations'
{extend} = require './helpers'
class Serenade.Model
extend(@prototype, Serenade.Properties)
extend(@prototype, Associations)
@property: -> @prototype.property(arguments...)
@collection: -> @prototype.collec... | {Serenade} = require './serenade'
{Cache} = require './cache'
{Associations} = require './associations'
{extend} = require './helpers'
class Serenade.Model
extend(@prototype, Serenade.Properties)
extend(@prototype, Associations)
@property: -> @prototype.property(arguments...)
@collection: -> @prototype.collec... |
Update data file location to use https | config =
data_file_location: 'http://www.chimpandsee.org/identified-chimps/identified-species.json'
is_scientist: 'no' # This doesn't do anything yet.
speciesToTrack: ['chimpanzee', 'other-primate']
pairs = location.search.slice(1).split(',')
for pair in pairs
for key, value of pair
continue unless config.... | config =
data_file_location: 'https://www.chimpandsee.org/identified-chimps/identified-species.json'
is_scientist: 'no' # This doesn't do anything yet.
speciesToTrack: ['chimpanzee', 'other-primate']
pairs = location.search.slice(1).split(',')
for pair in pairs
for key, value of pair
continue unless config... |
Set Atom spell-check locales to en-US | "*":
core:
disabledPackages: [
"background-tips"
"exception-reporting"
"metrics"
"styleguide"
"timecop"
"welcome"
]
telemetryConsent: "no"
editor:
invisibles: {}
showIndentGuide: true
showInvisibles: true
"file-icons":
forceShow: true
onChanges: ... | "*":
core:
disabledPackages: [
"background-tips"
"exception-reporting"
"metrics"
"styleguide"
"timecop"
"welcome"
]
telemetryConsent: "no"
editor:
invisibles: {}
showIndentGuide: true
showInvisibles: true
"file-icons":
forceShow: true
onChanges: ... |
Update flatpickr input value if ng-model change | angular.module("admin.utils").directive "datepicker", ($window, $timeout) ->
require: "ngModel"
link: (scope, element, attrs, ngModel) ->
$timeout ->
flatpickr(element, Object.assign(
{},
$window.FLATPICKR_DATE_DEFAULT, {
... | angular.module("admin.utils").directive "datepicker", ($window, $timeout) ->
require: "ngModel"
link: (scope, element, attrs, ngModel) ->
$timeout ->
flapickrInstance = flatpickr(element, Object.assign(
{},
$window.FLATPICKR_DATE_DEFAULT, {
... |
Set to empty string instead of undefined | class Lanes.Components.Input extends Lanes.React.Component
mixins: [
Lanes.Components.Form.FieldMixin
]
formGroupClass: 'input'
propTypes:
unlabled: React.PropTypes.bool
getValue: ->
@refs.input.getValue()
renderEdit: (label) ->
colProps = _.omit(@props, 'nam... | class Lanes.Components.Input extends Lanes.React.Component
mixins: [
Lanes.Components.Form.FieldMixin
]
formGroupClass: 'input'
propTypes:
unlabled: React.PropTypes.bool
getValue: ->
@refs.input.getValue()
renderEdit: (label) ->
colProps = _.omit(@props, 'nam... |
Add static label in simple visualisation map. | class visualization.Simple
constructor: (@layer, @data, @options = {}) ->
# Build layer as wanted
buildLayerGroup: (widget, globalStyle = {}) ->
group = []
for zone in @data
zoneLayer = new L.GeoJSON(zone.shape, globalStyle)
widget._bindPopup(zoneLayer, zone)
group.push(zoneLayer)
... | class visualization.Simple
constructor: (@layer, @data, @options = {}) ->
# Build layer as wanted
buildLayerGroup: (widget, globalStyle = {}) ->
group = []
for zone in @data
zoneLayer = new L.GeoJSON(zone.shape, globalStyle)
zoneLayer.bindLabel(zone.name, globalStyle)
widget._bindPopup... |
Add .preview class for img attachments, since we display a preview | #= require trix/views/attachment_view
#= require trix/models/image_attachment
{defer, makeElement, measureElement} = Trix
class Trix.ImageAttachmentView extends Trix.AttachmentView
getPreloadOperation: ->
if @attachment.preloadOperation?.hasSucceeded()
@attachment.preloadOperation
else if @attachment.... | #= require trix/views/attachment_view
#= require trix/models/image_attachment
{defer, makeElement, measureElement} = Trix
class Trix.ImageAttachmentView extends Trix.AttachmentView
getPreloadOperation: ->
if @attachment.preloadOperation?.hasSucceeded()
@attachment.preloadOperation
else if @attachment.... |
Update dateCompleted and modified when completing task | Tasks = new Meteor.Collection("tasks")
Lists = new Meteor.Collection("lists")
Folders = new Meteor.Collection("folders")
if Meteor.isClient
Template.todos.tasks = ->
Tasks.find()
Template.todos.events
'click a.completeBox': (e) ->
Tasks.update this._id,
$set: completed: not @completed
Tem... | Tasks = new Meteor.Collection("tasks")
Lists = new Meteor.Collection("lists")
Folders = new Meteor.Collection("folders")
if Meteor.isClient
Template.todos.tasks = ->
Tasks.find()
Template.todos.events
'click a.completeBox': (e) ->
now = moment()
Tasks.update this._id,
$set:
c... |
Add warning logging when unusual things happen | # Object which holds the methods that can be called from the factlink core iframe
modalOpen = false
FactlinkJailRoot.annotatedSiteReceiver =
modalFrameReady: (featureToggles) ->
FactlinkJailRoot.can_haz = featureToggles
window.FACTLINK_ON_CORE_LOAD?()
openModalOverlay: ->
return if modalOpen
Fact... | # Object which holds the methods that can be called from the factlink core iframe
modalOpen = false
FactlinkJailRoot.annotatedSiteReceiver =
modalFrameReady: (featureToggles) ->
FactlinkJailRoot.can_haz = featureToggles
window.FACTLINK_ON_CORE_LOAD?()
openModalOverlay: ->
if modalOpen
console.e... |
Change timeout to 15 seconds | ### Configuration file
This file contains all the necessary options for running an instance of the
hog winrate calculator.
###
# Database and daemon settings
module.exports.docker =
socket: "/var/run/docker.sock"
runner:
image: "arbiter"
networkDisabled: true
memory: 50e6
timeout: 1e5
maxLen... | ### Configuration file
This file contains all the necessary options for running an instance of the
hog winrate calculator.
###
# Database and daemon settings
module.exports.docker =
socket: "/var/run/docker.sock"
runner:
image: "arbiter"
networkDisabled: true
memory: 50e6
timeout: 15e3
maxLe... |
Use proper relative paths in cache | path = require 'path'
CSON = require 'season'
fs = require 'fs-plus'
module.exports = (grunt) ->
{spawn} = require('./task-helpers')(grunt)
grunt.registerTask 'compile-packages-slug', 'Add package metadata information to to the main package.json file', ->
appDir = grunt.config.get('atom.appDir')
modulesD... | path = require 'path'
CSON = require 'season'
fs = require 'fs-plus'
module.exports = (grunt) ->
{spawn} = require('./task-helpers')(grunt)
grunt.registerTask 'compile-packages-slug', 'Add package metadata information to to the main package.json file', ->
appDir = grunt.config.get('atom.appDir')
modulesD... |
Allow click events to propagate for anchors with target="_blank" | #= require ./abstract_binding
class Batman.DOM.RouteBinding extends Batman.DOM.AbstractBinding
onAnchorTag: false
onlyObserve: Batman.BindingDefinitionOnlyObserve.Data
@accessor 'dispatcher', ->
@view.lookupKeypath('dispatcher') || Batman.App.get('current.dispatcher')
bind: ->
if @node.nodeName.toUpp... | #= require ./abstract_binding
class Batman.DOM.RouteBinding extends Batman.DOM.AbstractBinding
onAnchorTag: false
onlyObserve: Batman.BindingDefinitionOnlyObserve.Data
@accessor 'dispatcher', ->
@view.lookupKeypath('dispatcher') || Batman.App.get('current.dispatcher')
bind: ->
if @node.nodeName.toUpp... |
Fix collection names to show up in search results |
exports.site_docs =
index: (doc) ->
blocks = ['site_intro','site_home']
types = ['essay','scene','video','profile']
if doc.site and doc.type and types.indexOf(doc.type) >= 0 and doc.published is true
content = doc.title + ' ' + doc.intro + ' ' + doc.body
published = parseInt(doc.p... |
exports.site_docs =
index: (doc) ->
blocks = ['site_intro','site_home']
types = ['essay','scene','video','profile']
if doc.site and doc.type and types.indexOf(doc.type) >= 0 and doc.published is true
content = doc.title + ' ' + doc.intro + ' ' + doc.body
published = parseInt(doc.p... |
Convert number animation to use TweenJS | # Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
$ ->
animateMetric = $(".metric-box strong").each ->
$this = $(this)
jQuery(counter: 0).animate { ... | # Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
$ ->
animateMetric = $(".metric-box strong").each ->
$this = $(this)
starting_point = 0
$targe... |
Add image chooser for logo | class Skr.Screens.Locations extends Skr.Screens.Base
dataObjects:
location: ->
@props.location || new Skr.Models.Location
getInitialState: ->
commands: new Lanes.Screens.Commands(this, modelName: 'location')
render: ->
<LC.ScreenWrapper identifier="locations">
... | class Skr.Screens.Locations extends Skr.Screens.Base
dataObjects:
location: ->
@props.location || new Skr.Models.Location
getInitialState: ->
commands: new Lanes.Screens.Commands(this, modelName: 'location')
render: ->
<LC.ScreenWrapper identifier="locations">
... |
Hide test HTML on teardown, fix tests | assert = chai.assert
$ = Rye
suite 'Basic functionality', ->
test 'Rye()', ->
assert.instanceof Rye('div'), Rye, 'returns instance of Rye'
suite 'Querying', ->
test 'ID query', ->
el = $('#hello')
assert.lengthOf el, 1, 'result has length 1'
| assert = chai.assert
$ = Rye
setup ->
document.getElementById('test').style.display = 'block'
teardown ->
document.getElementById('test').style.display = 'none'
suite 'Basic functionality', ->
test 'Rye()', ->
assert.instanceOf Rye('div'), Rye, 'returns instance of Rye'
suite 'Querying', ->
... |
Move findContentView to page code | define (require) ->
subjects = require('cs!collections/subjects')
BaseView = require('cs!helpers/backbone/views/base')
MainPageView = require('cs!modules/main-page/main-page')
FindContentView = require('cs!modules/find-content/find-content')
template = require('hbs!./browse-content-template')
require('less!... | define (require) ->
subjects = require('cs!collections/subjects')
BaseView = require('cs!helpers/backbone/views/base')
MainPageView = require('cs!modules/main-page/main-page')
FindContentView = require('cs!modules/find-content/find-content')
template = require('hbs!./browse-content-template')
require('less!... |
Handle with Process-Arguments and tidy | class ParamHandler
all: (callback) ->
process = 'src/server --port 8000 --env development'
match = process.match /--[a-zA-Z]* ([a-zA-Z0-9]*)/g
payload = {}
match.map (found) ->
parse = found.match(/--([a-zA-Z]*)\s/)
payload[parse[1]] = found.replace parse[0], ''
callback payload
... | class ParamHandler
constructor: (@payload = {}) ->
getArguments: (process, callback) ->
match = process.argv.join(' ').match /--[a-zA-Z]* ([a-zA-Z0-9]*)/g
match.map (found) =>
parse = found.match(/--([a-zA-Z]*)\s/)
@payload[parse[1]] = found.replace parse[0], ''
callback @payload
module... |
Fix WebTerm to work correctly with multiple VMs | class WebTermController extends AppController
KD.registerAppClass this,
name : "WebTerm"
route : "/Develop"
multiple : yes
hiddenHandle : no
behavior : "application"
preCondition :
condition : (options, cb)->
KD.singletons.vmController.info (err, vm, info... | class WebTermController extends AppController
KD.registerAppClass this,
name : "WebTerm"
route : "/Develop"
multiple : yes
hiddenHandle : no
behavior : "application"
preCondition :
condition : (options, cb)->
{params} = options
vmName = params?.... |
Add Array::first and Array::last back | _ = require 'underscore'
traverse = require 'traverse'
KONFIG = {}
try
module.exports = KONFIG = JSON.parse process.env.KONFIG_JSON
catch err
console.error 'error: could not parse KONFIG_JSON environment variable'
console.error err
process.exit 1
traverse.forEach KONFIG, (node) ->
if val = process.env["KO... | _ = require 'underscore'
traverse = require 'traverse'
KONFIG = {}
do ->
unless 'first' of Array.prototype
Object.defineProperty Array.prototype, 'first',
get: -> this[0]
unless 'last' of Array.prototype
Object.defineProperty Array.prototype, 'last',
get: -> this[this.length-1]
try
module... |
Customize geojson markers based on dataset styles | # 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/
jQuery ->
console.log 'Page loaded!'
map = L.map('mapid').setView([40.75, -74.00], 12)
# OSM Tile l... | # 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/
jQuery ->
console.log 'Page loaded!'
if $('#mapid').length > 0
map = L.map('mapid').setView([40.7... |
Add external group to worker environment mapping | proxies = [
'koding-proxy-ap-s-e-1'
'koding-proxy-us-east-1'
'koding-proxy-eu-west-1'
'koding-proxy-us-west-2'
'koding-proxy-dev-us-e-1'
'koding-proxy-dev-us-e-1-v2'
]
envs = [
'dev'
'default'
'koding-latest'
'koding-monitor'
'koding-prod'
'koding-sandbox'
]
groupToEnv =
'webserver' : en... | proxies = [
'koding-proxy-ap-s-e-1'
'koding-proxy-us-east-1'
'koding-proxy-eu-west-1'
'koding-proxy-us-west-2'
'koding-proxy-dev-us-e-1'
'koding-proxy-dev-us-e-1-v2'
]
envs = [
'dev'
'default'
'koding-latest'
'koding-monitor'
'koding-prod'
'koding-sandbox'
]
groupToEnv =
'webserver' : en... |
Add a success message when saving a user | _ = require 'underscore'
View = require 'lib/view'
tpl = require 'templates/users/edit'
FormMixin = require 'views/base/mixins/form'
mediator = require('chaplin').mediator
module.exports = class EditUserView extends View
@mixin FormMixin
template: tpl
autoRender: yes
region: 'contactCard'
events:
'su... | _ = require 'underscore'
View = require 'lib/view'
tpl = require 'templates/users/edit'
FormMixin = require 'views/base/mixins/form'
mediator = require('chaplin').mediator
module.exports = class EditUserView extends View
@mixin FormMixin
template: tpl
autoRender: yes
region: 'contactCard'
events:
'su... |
Trim username for latest geolog | debug = require('debug') 'gc:geologs'
upsert = require '../db/upsert'
Promise = require 'bluebird'
module.exports = (db) ->
upsert: (data) ->
debug "upsert #{data.Code?.toLowerCase()}"
upsert db, 'logs', data
latest: Promise.coroutine (username) ->
debug "latest #{username}"
[c... | debug = require('debug') 'gc:geologs'
upsert = require '../db/upsert'
Promise = require 'bluebird'
module.exports = (db) ->
upsert: (data) ->
debug "upsert #{data.Code?.toLowerCase()}"
upsert db, 'logs', data
latest: Promise.coroutine (username) ->
debug "latest #{username}"
[c... |
Allow for accessing data with dot-notation in simple column case as well | React = require 'react'
deep = require 'deep-get-set'
module.exports = React.createClass
displayName: "SimpleTable"
propTypes:
columns: React.PropTypes.array
data: React.PropTypes.array
render: ->
columns = @props.columns.map (column) ->
if typeof column is "string"
<th key={column}>{... | React = require 'react'
deep = require 'deep-get-set'
module.exports = React.createClass
displayName: "SimpleTable"
propTypes:
columns: React.PropTypes.array
data: React.PropTypes.array
render: ->
columns = @props.columns.map (column) ->
if typeof column is "string"
<th key={column}>{... |
Switch to edit mode even with a hashtag in the URL | # Ctrl-e switches to edit mode
$(window).keydown (event) ->
if event.ctrlKey && String.fromCharCode(event.keyCode) == "E"
href = window.location.href.replace(/\.html/, '')
href = href.replace(/\/index$/, '/')
window.location = href
| # Ctrl-e switches to edit mode
$(window).keydown (event) ->
if event.ctrlKey && String.fromCharCode(event.keyCode) == "E"
href = window.location.href.replace(/\.html(#.*)?/, '')
href = href.replace(/\/index$/, '/')
window.location = href
|
Add css for no src image | #--[ MEDIA SELECTED ]--#
$(document).on "dblclick", ".mediaModalContainer img.selectable", (event) ->
event.preventDefault()
mediaModalContainer = $(event.target).parents(".mediaModalContainer")
mediaSrc = $(event.target).attr('src')
mediaId = $(event.target).data('id')
inputId = '#' + mediaModalContainer.da... | #--[ MEDIA SELECTED ]--#
$(document).on "dblclick", ".mediaModalContainer img.selectable", (event) ->
event.preventDefault()
mediaModalContainer = $(event.target).parents(".mediaModalContainer")
mediaSrc = $(event.target).attr('src')
mediaId = $(event.target).data('id')
inputId = '#' + mediaModalContainer.da... |
Update projects on oryx pro | [
{
title: "Spyns"
group: "Development"
paths: [
"~/Development/spyns"
]
}
{
title: "CSI-702: Homework02 Instructor Attempt"
group: "Mason Fall 2017"
paths: [
"~/Documents/work/teaching/2017_Spring_Semester/CSI-702_High_Performance_Computing/assignments/homework02-instructo... | [
{
title: "CDS-411 Instructors"
group: "CDS-411"
paths: [
"~/Courses/CDS-411/instructors"
]
}
{
title: "Spyns"
group: "Development"
paths: [
"~/Development/spyns"
]
}
{
title: "CSI-702 Spr17: Homework02 Instructor Attempt"
group: "CSI-702"
paths: [
... |
Use correct interval for polling | namespace 'SensuDashboard.Collections', (exports) ->
class exports.Base extends Backbone.Collection
longPolling: false
intervalSeconds: 10
startLongPolling: (intervalSeconds) =>
@longPolling = true
if intervalSeconds
@intervalSeconds = @intervalSeconds
@executeLongPolling()
... | namespace 'SensuDashboard.Collections', (exports) ->
class exports.Base extends Backbone.Collection
longPolling: false
intervalSeconds: 10
startLongPolling: (intervalSeconds) =>
@longPolling = true
@intervalSeconds = intervalSeconds if intervalSeconds
@executeLongPolling()
stopLo... |
Add new msg posting to IndexController | App.IndexController = Ember.ArrayController.extend
needs: ["application"]
currentUser: Ember.computed.alias("controllers.application.currentUser")
itemController: "RoomUserStateItem"
| App.IndexController = Ember.ArrayController.extend
needs: ["application"]
currentUser: Ember.computed.alias("controllers.application.currentUser")
itemController: "RoomUserStateItem"
detectMessageType: (msgTxt)->
if msgTxt.match("\n")
"paste"
else
"text"
actions:
postMessage: (msgT... |
Store ValidatableForm object on DOM element | #= require comply/config
#= require_tree .
$ -> $('[data-validate-model]').each -> new Comply.ValidatableForm $(this)
| #= require comply/config
#= require_tree .
$ ->
$('[data-validate-model]').each ->
$(this).data('comply-form', new Comply.ValidatableForm($(this)))
|
Add $watch for Cart.current in CartCtrl | Sprangular.controller "CartCtrl", (
$scope,
Cart,
Account,
Status,
Angularytics,
Env
) ->
$scope.user = Account.user
$scope.cart = Cart.current
$scope.status = Status
$scope.currencySymbol = Env.currency.symbol
$scope.removeAdjustment = (adjustment) ->
Angularytics.trackEvent("Cart", "Coupon... | Sprangular.controller "CartCtrl", (
$scope,
Cart,
Account,
Status,
Angularytics,
Env
) ->
$scope.user = Account.user
$scope.status = Status
$scope.currencySymbol = Env.currency.symbol
$scope.$watch (-> Cart.current), (newOrder) ->
$scope.cart = newOrder
$scope.removeAdjustment = (adjustment... |
Revert "intentionally failed the konacha test" | #= require application
#= require frontend
describe 'StartConversationView', ->
it 'initial state', ->
view = new window.StartConversationView
view.render()
content = view.$('.js-message-textarea').val()
content.should.equal "Check out this Henk!"
| #= require application
#= require frontend
describe 'StartConversationView', ->
it 'initial state', ->
view = new window.StartConversationView
view.render()
content = view.$('.js-message-textarea').val()
content.should.equal "Check out this Factlink!"
|
Add plugin origin to created decorations | {CompositeDisposable} = require 'event-kit'
module.exports =
class MinimapSelectionView
decorations: []
constructor: (@minimap) ->
editor = @minimap.getTextEditor()
@subscriptions = new CompositeDisposable
@subscriptions.add editor.onDidAddCursor @handleSelection
@subscriptions.add editor.onDidC... | {CompositeDisposable} = require 'event-kit'
module.exports =
class MinimapSelectionView
decorations: []
constructor: (@minimap) ->
editor = @minimap.getTextEditor()
@subscriptions = new CompositeDisposable
@subscriptions.add editor.onDidAddCursor @handleSelection
@subscriptions.add editor.onDidC... |
Set grammar data attr on link | {View} = require 'atom'
# View to show the grammar name in the status bar.
module.exports =
class GrammarStatusView extends View
@content: ->
@div class: 'grammar-status', =>
@a href: '#', class: 'inline-block', outlet: 'grammarLink'
initialize: (@statusBar) ->
@subscribe @statusBar, 'active-buffer-... | {View} = require 'atom'
# View to show the grammar name in the status bar.
module.exports =
class GrammarStatusView extends View
@content: ->
@div class: 'grammar-status', =>
@a href: '#', class: 'inline-block', outlet: 'grammarLink'
initialize: (@statusBar) ->
@subscribe @statusBar, 'active-buffer-... |
Work on RequireJS Jasmine test. | describe "RequireJS", ->
it "check that the RequireJS object is present in the global namespace", ->
expect(true).toBe true
| describe "RequireJS", ->
it "check that the RequireJS object is present in the global namespace", ->
expect RequireJS.toEqual(jasmine.any(Object))
expect window.RequireJS.toEqual(jasmine.any(Object))
it "check that requirejs(), require(), and define() are not in the global namespace", ->
... |
Enable commands only when a file pane is active | GitHubFile = require './github-file'
module.exports =
activate: ->
return unless project.getRepo()?
rootView.command 'github:open', ->
if itemPath = rootView.getActivePaneItem()?.getPath?()
GitHubFile.fromPath(itemPath).open()
rootView.command 'github:blame', ->
if itemPath = rootV... | GitHubFile = require './github-file'
module.exports =
activate: ->
return unless project.getRepo()?
rootView.eachPane (pane) ->
pane.command 'github:open', ->
if itemPath = rootView.getActivePaneItem()?.getPath?()
GitHubFile.fromPath(itemPath).open()
pane.command 'github:blam... |
Add tracking to logged out cta | Cookies = require 'cookies-js'
module.exports = ->
$el = $('.lo-cta')
unless Cookies.get('lo-cta')
$el.addClass 'lo-cta--visible'
$el.on 'click', '.lo-cta__close', (e) ->
$el.removeClass 'lo-cta--visible'
# Cookie expires in 1 day
Cookies.set 'lo-cta', true, { expires: 86400000 } | Cookies = require 'cookies-js'
analytics = require '../../lib/analytics.coffee'
module.exports = ->
$el = $('.lo-cta')
unless Cookies.get('lo-cta')
$el.addClass 'lo-cta--visible'
$el.on 'click', '.lo-cta__close', (e) ->
$el.removeClass 'lo-cta--visible'
analytics.track.click 'Clicked on Learn... |
Use absolute path as URI | path = require 'path'
archive = require 'ls-archive'
{File} = require 'pathwatcher'
fs = require 'fs-plus'
Serializable = require 'serializable'
module.exports=
class ArchiveEditor extends Serializable
atom.deserializers.add(this)
@activate: ->
atom.project.registerOpener (filePath) ->
new ArchiveEditor... | path = require 'path'
archive = require 'ls-archive'
{File} = require 'pathwatcher'
fs = require 'fs-plus'
Serializable = require 'serializable'
module.exports=
class ArchiveEditor extends Serializable
atom.deserializers.add(this)
@activate: ->
atom.project.registerOpener (filePath) ->
new ArchiveEditor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.