Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Use session storage instead of local storage | Backbone.Factlink ||= {}
class Backbone.Factlink.LocalStorageTextModel extends Backbone.Model
constructor: (attributes, options) ->
super
@set 'text', localStorage?[options.key] ? ''
@on 'change:text', (model, value) ->
localStorage[options.key] = value if localStorage?
| Backbone.Factlink ||= {}
class Backbone.Factlink.LocalStorageTextModel extends Backbone.Model
constructor: (attributes, options) ->
super
@set 'text', sessionStorage?[options.key] ? ''
@on 'change:text', (model, value) ->
sessionStorage[options.key] = value if sessionStorage?
|
Send metric data once client is logged in | kd = require 'kd'
KDObject = kd.Object
remote = require('app/remote').getInstance()
module.exports = class DatadogMetrics extends KDObject
@buffer = kd.utils.dict()
@collect = (name, state, count = 1) ->
key = "#{name}:#{state}"
@buffer[key] ?= 0
@buffer[key] += count
@send = ->
return if... | kd = require 'kd'
KDObject = kd.Object
remote = require('app/remote').getInstance()
module.exports = class DatadogMetrics extends KDObject
@buffer = kd.utils.dict()
@collect = (name, state, count = 1) ->
key = "#{name}:#{state}"
@buffer[key] ?= 0
@buffer[key] += count
@send = ->
return if... |
Add parens for model counts | Steam.FrameView = (_, _frame) ->
createCompatibleModelItem = (model) ->
key: model.key
algorithm: model.model_algorithm
category: model.model_category
responseColumnName: model.response_column_name
createColumnItem = (name) -> name: name
loadCompatibleModels = ->
_.switchToModels type: 'comp... | Steam.FrameView = (_, _frame) ->
createCompatibleModelItem = (model) ->
key: model.key
algorithm: model.model_algorithm
category: model.model_category
responseColumnName: model.response_column_name
createColumnItem = (name) -> name: name
loadCompatibleModels = ->
_.switchToModels type: 'comp... |
Add ignore files to tree view | "*":
"exception-reporting":
userId: "41cbedc9-3477-568d-cd05-8df535ad8564"
welcome:
showOnStartup: false
core:
projectHome: "/Users/joseangel/Workspace"
themes: [
"one-dark-ui"
"monokai"
]
editor:
invisibles: {}
tabLength: 4
"one-dark-ui": {}
"atom-beautify":
_ana... | "*":
"exception-reporting":
userId: "41cbedc9-3477-568d-cd05-8df535ad8564"
welcome:
showOnStartup: false
core:
projectHome: "/Users/joseangel/Workspace"
themes: [
"one-dark-ui"
"monokai"
]
editor:
invisibles: {}
tabLength: 4
"one-dark-ui": {}
"atom-beautify":
_ana... |
Fix a bug where the download menu wouldn't appear | show_download_menu = ->
$("#download-menu").slideDown duration: 200
setTimeout hide_download_menu, 20000
$("#download-link").html "cancel"
return
hide_download_menu = ->
$("#download-menu").slideUp duration: 200
$("#download-link").html "download"
return
toggle_download_menu = ->
if $("#download-link").... | @show_download_menu = ->
$("#download-menu").slideDown duration: 200
setTimeout hide_download_menu, 20000
$("#download-link").html "cancel"
return
@hide_download_menu = ->
$("#download-menu").slideUp duration: 200
$("#download-link").html "download"
return
@toggle_download_menu = ->
if $("#download-link... |
Use https for pivotal plugin | NotificationPlugin = require "../../notification-plugin"
class PivotalTracker extends NotificationPlugin
stacktraceLines = (stacktrace) ->
("#{line.file}:#{line.lineNumber} - #{line.method}" for line in stacktrace when line.inProject)
@receiveEvent: (config, event) ->
# Build the request
params =
... | NotificationPlugin = require "../../notification-plugin"
class PivotalTracker extends NotificationPlugin
stacktraceLines = (stacktrace) ->
("#{line.file}:#{line.lineNumber} - #{line.method}" for line in stacktrace when line.inProject)
@receiveEvent: (config, event) ->
# Build the request
params =
... |
Make process() a static method on batch client | # # Kissmetrics Batch
class BatchKissmetricsClient
@HOST: 'api.kissmetrics.com'
@HTTP_METHOD: 'POST'
constructor: (@options) ->
@queue = options.queue
@_validate_queue @queue
add: (timestamp, data) ->
data.timestamp = timestamp
@_transformData data
@queue.add data
get: ->
@queue.g... | # # Kissmetrics Batch
class BatchKissmetricsClient
@HOST: 'api.kissmetrics.com'
@HTTP_METHOD: 'POST'
@process: (apiKey) ->
queue = @get()
constructor: (@options) ->
@queue = options.queue
@_validate_queue @queue
add: (timestamp, data) ->
data.timestamp = timestamp
@_transformData data
... |
Put in correct form for the CoffeeScript to make JS | {expect} = require "chai"
utils = require "../../utils"
{Collections} = utils.require "base"
describe "step_interpolator_transform module", ->
source = {start: 0, end: 10}
target = {start: 20, end: 80}
generate_jitter = ->
Collections("Jitter").create
width: 1
center: 0
distribution: 'uni... | {expect} = require "chai"
utils = require "../../utils"
{Collections} = utils.require "base"
describe "step_interpolator_transform module", ->
source = {start: 0, end: 10}
target = {start: 20, end: 80}
generate_jitter = ->
Collections("Jitter").create
width: 1
center: 0
distribution: 'uni... |
Fix error if filename matches an existing branch | git = require '../git'
StatusView = require '../views/status-view'
Path = require 'path'
gitCheckoutCurrentFile = ->
currentFile = atom.project.getRepo().relativize atom.workspace.getActiveEditor()?.getPath()
git(
['checkout', currentFile],
(data) -> new StatusView(type: 'success', message: data.toString()... | git = require '../git'
StatusView = require '../views/status-view'
Path = require 'path'
gitCheckoutCurrentFile = ->
currentFile = atom.project.getRepo().relativize atom.workspace.getActiveEditor()?.getPath()
git(
['checkout', '--', currentFile],
(data) -> new StatusView(type: 'success', message: data.toSt... |
Fix issue in class methods for Scaffold | scaffolt = require 'scaffolt'
_s = require 'underscore.string'
module.exports = class Scaffold
@generate: ->
scaffold = new Scaffold
scaffold.generate arguments...
@destroy: ->
scaffold = new Scaffold
scaffold.destroy arguments...
generate: (name = '', callback = ->) ->
scaffolt @className... | scaffolt = require 'scaffolt'
_s = require 'underscore.string'
module.exports = class Scaffold
@generate: ->
scaffold = new @constructor
scaffold.generate arguments...
@destroy: ->
scaffold = new @constructor
scaffold.destroy arguments...
generate: (name = '', callback = ->) ->
scaffolt @c... |
Comment explaining teaching period state | angular.module('doubtfire.admin.states.teachingperiods', [])
#
# Convenors of a unit(s) can see a list of all the units they convene
# in this view and make changes to those units.
#
# Users with an Administrator system role can create new units.
#
.config((headerServiceProvider) ->
teachingPeriodsAdminViewStateData... | angular.module('doubtfire.admin.states.teachingperiods', [])
#
# Users with an Administrator system role can create new Teaching Periods.
#
.config((headerServiceProvider) ->
teachingPeriodsAdminViewStateData =
url: "/admin/teachingperiods"
views:
main:
controller: "AdministerTeachingPeriodsSta... |
Remove unused classes and outlets | {$$$, View} = require 'atom'
# Displays the keybindings for a package namespace
module.exports =
class PackageKeymapView extends View
@content: ->
@section =>
@div class: 'section-heading icon icon-keyboard', 'Keybindings'
@table outlet: 'keymapTable', class: 'package-keymap-table table native-key-bi... | {$$$, View} = require 'atom'
# Displays the keybindings for a package namespace
module.exports =
class PackageKeymapView extends View
@content: ->
@section =>
@div class: 'section-heading icon icon-keyboard', 'Keybindings'
@table class: 'package-keymap-table table native-key-bindings text', tabindex:... |
Remove `~/Labs/Utils` from Atom-FS's project entry | [
{
title: ".atom"
paths: [
"~/.atom"
]
devMode: true
}
{
title: ".files"
paths: [
"~/.files"
]
devMode: true
}
{
title: "language-roff"
paths: [
"~/Labs/language-roff"
]
devMode: true
}
{
title: "file-icons"
paths: [
"~/Labs/file-icons"
]
devMode: true
}
{
title: ... | [
{
title: ".atom"
paths: [
"~/.atom"
]
devMode: true
}
{
title: ".files"
paths: [
"~/.files"
]
devMode: true
}
{
title: "language-roff"
paths: [
"~/Labs/language-roff"
]
devMode: true
}
{
title: "file-icons"
paths: [
"~/Labs/file-icons"
]
devMode: true
}
{
title: ... |
Use View's native subscribeEvent method | define [
"jquery"
"chaplin"
"views/base/view"
"lib/utils"
"templates/menu"
], ($, Chaplin, View, utils, template) ->
"use strict"
class MenuView extends View
el: "#menu"
template: template
autoRender: true
events:
"click #common_menu a": "navigate"
"click #logout": "logout"
... | define [
"jquery"
"chaplin"
"views/base/view"
"lib/utils"
"templates/menu"
], ($, Chaplin, View, utils, template) ->
"use strict"
class MenuView extends View
el: "#menu"
template: template
autoRender: true
events:
"click #common_menu a": "navigate"
"click #logout": "logout"
... |
Add 'Create Route' to menu | # See https://atom.io/docs/latest/hacking-atom-package-word-count#menus for more details
'context-menu':
'.tree-view .directory > .header': [
{
label: 'SysAngular',
submenu: [
{
label: 'Create Module',
command: 'atom-sys-angular:generate-module'
},
{
... | # See https://atom.io/docs/latest/hacking-atom-package-word-count#menus for more details
'context-menu':
'.tree-view .directory > .header': [
{
label: 'SysAngular',
submenu: [
{
label: 'Create Module',
command: 'atom-sys-angular:generate-module'
},
{
... |
Fix so tooltip property is actually displayed | React = require 'react'
BS = require 'react-bootstrap'
module.exports = React.createClass
displayName: 'Icon'
propTypes:
type: React.PropTypes.string
className: React.PropTypes.string
tooltip: React.PropTypes.string
render: ->
classes = ['tutor-icon', 'fa', "fa-#{@props.type}"]
cla... | React = require 'react'
BS = require 'react-bootstrap'
module.exports = React.createClass
displayName: 'Icon'
propTypes:
type: React.PropTypes.string
className: React.PropTypes.string
tooltip: React.PropTypes.string
tooltipProps: React.PropTypes.object
getDefaultProps: ->
tooltipPro... |
Add some shortcuts to atom | 'atom-text-editor':
'ctrl-y': 'editor:delete-line'
| 'atom-text-editor':
'ctrl-y': 'editor:delete-line'
'alt-j': 'find-and-replace:select-next'
'alt-shift-J': 'find-and-replace:select-all'
|
Use text note instead of alert | {View} = require 'atom-space-pen-views'
SettingsPanel = require './settings-panel'
module.exports =
class GeneralPanel extends View
@content: ->
@div =>
@form class: 'general-panel section', =>
@div outlet: "loadingElement", class: 'alert alert-info loading-area icon icon-hourglass', "Loading setti... | {View} = require 'atom-space-pen-views'
SettingsPanel = require './settings-panel'
module.exports =
class GeneralPanel extends View
@content: ->
@div =>
@form class: 'general-panel section', =>
@div outlet: "loadingElement", class: 'alert alert-info loading-area icon icon-hourglass', "Loading setti... |
Call the attach hooks after adding a view to a panel. | {CompositeDisposable} = require 'event-kit'
class PanelElement extends HTMLElement
createdCallback: ->
@subscriptions = new CompositeDisposable
getModel: -> @model
setModel: (@model) ->
@appendChild(@model.getItemView())
@subscriptions.add @model.onDidChangeVisible(@visibleChanged.bind(this))
@... | {CompositeDisposable} = require 'event-kit'
{callAttachHooks} = require './space-pen-extensions'
class PanelElement extends HTMLElement
createdCallback: ->
@subscriptions = new CompositeDisposable
getModel: -> @model
setModel: (@model) ->
view = @model.getItemView()
@appendChild(view)
callAttac... |
Add test case for multi bytes chars | expect = require('chai').expect
parser = require '../dist/parser'
describe 'TagDataParser', ->
describe '#parse()', ->
it 'returns a tag data object', ->
expect(parser.parse('ruby:2.1.2 rails:3.x,4.x')).to.deep.equal([
{
name: 'ruby'
versions: ['2.1.2']
}
{
... | expect = require('chai').expect
parser = require '../dist/parser'
describe 'TagDataParser', ->
describe '#parse()', ->
it 'returns a tag data object', ->
expect(parser.parse('ruby:2.1.2 rails:3.x,4.x')).to.deep.equal([
{
name: 'ruby'
versions: ['2.1.2']
}
{
... |
Add support for reading BUNDLE_PATH env var, for Meteor app bundles | fs = Npm.require 'fs'
path = Npm.require 'path'
sass = Npm.require 'node-sass'
share.MailerUtils =
joinUrl: (base, path) ->
# Remove any trailing slashes
base = base.replace(/\/$/, '')
# Add front slash if not exist already
unless /^\//.test(path)
path = '/' + path
return base + path
... | fs = Npm.require 'fs'
path = Npm.require 'path'
sass = Npm.require 'node-sass'
if process.env.BUNDLE_PATH
# BUNDLE_PATH = /var/www/app/bundle
ROOT = path.join(process.env.BUNDLE_PATH, 'programs', 'server', 'assets', 'app')
else
# PWD = /lookback-emailjobs/app
ROOT = path.join(process.env.PWD, 'private')
share... |
Revert "Add -H option to fix broken symbolic links error" | class FSFolder extends FSFile
fetchContents:(callback)->
# @emit "fs.fetchContents.started"
# @kiteController.run
# toDo : "ls"
# withArgs :
# command : @path
# , (err, response)=>
# if err
# warn err
# @emit "fs.fetchContents.finished", err
# else
... | class FSFolder extends FSFile
fetchContents:(callback)->
# @emit "fs.fetchContents.started"
# @kiteController.run
# toDo : "ls"
# withArgs :
# command : @path
# , (err, response)=>
# if err
# warn err
# @emit "fs.fetchContents.finished", err
# else
... |
Improve error handling in FlexibilityOrder | class @FlexibilityOrder
constructor: (@element) ->
# pass
url: (path) ->
"#{ App.scenario.url_path() }/flexibility_order/#{ path }"
update: (order) =>
$.ajax
url: @url('set'),
type: 'POST',
data:
flexibility_order:
order: order,
scenario_id: App.scenario... | class @FlexibilityOrder
constructor: (@element) ->
@lastGood = null
url: (path) ->
"#{ App.scenario.url_path() }/flexibility_order/#{ path }"
update: (sortable) =>
options = sortable.toArray()
$.ajax
url: @url('set'),
type: 'POST',
data:
flexibility_order:
or... |
Increase font size in Atom | "*":
"atom-beautify":
css:
indent_size: 2
general:
_analyticsUserId: "8bfc3dc2-e55f-4b45-93b6-8b516d108dab"
html:
indent_size: 2
js:
indent_size: 2
"atom-package-deps":
ignored: []
core:
disabledPackages: [
"metrics"
"welcome"
"language-javascript"... | "*":
"atom-beautify":
css:
indent_size: 2
general:
_analyticsUserId: "8bfc3dc2-e55f-4b45-93b6-8b516d108dab"
html:
indent_size: 2
js:
indent_size: 2
"atom-package-deps":
ignored: []
core:
disabledPackages: [
"metrics"
"welcome"
"language-javascript"... |
Return true when aborting, since we are pretending that we loaded a route. | window.addBackboneHistoryCallbacksForDiscussionModal = ->
old_navigate = Backbone.History.prototype.navigate
Backbone.History.prototype.navigate = (fragment) ->
fragment = @getFragment(fragment || '') # copied from Backbone
FactlinkApp.DiscussionModalOnFrontend.setBackgroundPageUrl(fragment)
old_navig... | window.addBackboneHistoryCallbacksForDiscussionModal = ->
old_navigate = Backbone.History.prototype.navigate
Backbone.History.prototype.navigate = (fragment) ->
fragment = @getFragment(fragment || '') # copied from Backbone
FactlinkApp.DiscussionModalOnFrontend.setBackgroundPageUrl(fragment)
old_navig... |
Fix the flash when logging in | Organization = require '../../models/organization'
crypto = require 'crypto'
hexDigest = (string)->
sha = crypto.createHash('sha256');
sha.update('awesome')
sha.digest('hex')
routes = (app) ->
app.get '/login', (req, res) ->
res.render "#{__dirname}/views/login",
title: 'Login',
stylesheet: 'l... | Organization = require '../../models/organization'
crypto = require 'crypto'
hexDigest = (string)->
sha = crypto.createHash('sha256');
sha.update('awesome')
sha.digest('hex')
routes = (app) ->
app.get '/login', (req, res) ->
res.render "#{__dirname}/views/login",
title: 'Login',
stylesheet: 'l... |
Set uglify option 'keep_fname' true | gulp = require 'gulp'
babel = require 'gulp-babel'
uglify = require 'gulp-uglify'
gulp.task 'build', (done)->
gulp.src 'src/dfa.js'
.pipe babel({presets:['env']})
.pipe uglify()
.pipe gulp.dest('.')
| gulp = require 'gulp'
babel = require 'gulp-babel'
uglify = require 'gulp-uglify'
gulp.task 'build', (done)->
gulp.src 'src/dfa.js'
.pipe babel({presets:['env']})
.pipe uglify({ keep_fnames: true })
.pipe gulp.dest('.')
|
Fix problem with ddp connection from some urls | if Meteor.isServer
url = Npm.require('url')
RocketChat.settings.get 'Site_Url', (key, value) ->
if value?.trim() isnt ''
__meteor_runtime_config__.ROOT_URL = value
__meteor_runtime_config__.DDP_DEFAULT_CONNECTION_URL = value
if Meteor.absoluteUrl.defaultOptions?.rootUrl?
Meteor.absoluteUrl.defaultOptions.ro... | if Meteor.isServer
url = Npm.require('url')
RocketChat.settings.get 'Site_Url', (key, value) ->
if value?.trim() isnt ''
__meteor_runtime_config__.ROOT_URL = value
if Meteor.absoluteUrl.defaultOptions?.rootUrl?
Meteor.absoluteUrl.defaultOptions.rootUrl = value
if Meteor.isServer
RocketChat.hostname = u... |
Fix a few adapter issues. | {Robot, Adapter, TextMessage, EnterMessage, LeaveMessage, Response} = require 'hubot'
DotNetServer = require './dotnet'
class DotNet extends Adapter
send: (envelope, strings...) ->
@server.sendChat envelope.message.client, str for str in strings
emote: (envelope, strings...) ->
@server.sendEmote envelo... | {Robot, Adapter, TextMessage, EnterMessage, LeaveMessage, Response} = require 'hubot'
DotNetServer = require './server'
class DotNet extends Adapter
constructor: ->
@port = process.env.HUBOT_DOTNET_PORT || 8880
send: (envelope, strings...) ->
@server.sendChat envelope.message.client, str for str in s... |
Reduce verbosity of programmer excuses | # Description:
# Hubot will handle your bug reports now
#
# Dependencies:
# "scraper": "0.0.9"
#
# Configuration:
# None
#
# Commands:
#
# Author:
# capoferro (shamelessly copied from rrix's archer.coffee)
scraper = require 'scraper'
action = (msg) ->
options = {
'uri': 'http://programmerexcuses.com'... | # Description:
# Hubot will handle your bug reports now
#
# Dependencies:
# "scraper": "0.0.9"
#
# Configuration:
# None
#
# Commands:
#
# Author:
# capoferro (shamelessly copied from rrix's archer.coffee)
scraper = require 'scraper'
action = (msg) ->
options = {
'uri': 'http://programmerexcuses.com'... |
Fix dialogmanager only working in debug mode | mediator = require 'mediator'
module.exports = class DialogManager
constructor: ->
@source = document.getElementById 'dialog-template'
@template = Handlebars.compile(@source.innerText)
mediator.dialogManager = @
showDialog: (data, callback) =>
result = $ @template(data)
that = this
result... | mediator = require 'mediator'
module.exports = class DialogManager
constructor: ->
@source = document.getElementById 'dialog-template'
@template = Handlebars.compile(@source.innerText)
@canvas = document.getElementById 'game-canvas'
mediator.dialogManager = @
showDialog: (data, callback) =>
re... |
Add comments on missing definitions. |
# dom.d.ts: https://github.com/Microsoft/TypeScript/blob/master/src/lib/dom.generated.d.ts
# this fix is needed because these definitions are absent from typescript's official lib.d.ts and are used in dom.d.ts.
fix =
"""
interface ArrayBufferView {}
declare var ArrayBufferView: {}
interface ArrayBuffer {}
declare v... |
# dom.d.ts: https://github.com/Microsoft/TypeScript/blob/master/src/lib/dom.generated.d.ts
# This fix is needed because these definitions are absent from typescript's official lib.d.ts and are used in dom.d.ts.
# 06 march 2015: these definitions can actually be found in :
# https://github.com/Microsoft/TypeScript/bl... |
Make replace keymap work in all contexts | 'body':
'meta-F': 'project-find:show'
'meta-f': 'find-and-replace:show'
'.editor':
'alt-meta-f': 'find-and-replace:show-replace'
'meta-g': 'find-and-replace:find-next'
'meta-G': 'find-and-replace:find-previous'
'meta-e': 'find-and-replace:use-selection-as-find-pattern'
'.find-and-replace':
'meta-enter... | 'body':
'meta-F': 'project-find:show'
'meta-f': 'find-and-replace:show'
'alt-meta-f': 'find-and-replace:show-replace'
'.editor':
'meta-g': 'find-and-replace:find-next'
'meta-G': 'find-and-replace:find-previous'
'meta-e': 'find-and-replace:use-selection-as-find-pattern'
'.find-and-replace':
'meta-enter'... |
Switch source urls on again | exports.config =
# See http://brunch.io/#documentation for docs.
files:
javascripts:
joinTo:
'javascripts/app.js': /^app/
'javascripts/vendor.js': /^vendor/
'test/javascripts/test.js': /^test[\\/](?!vendor)/
'test/javascripts/test-vendor.js': /^test[\\/](?=vendor)/
or... | exports.config =
# See http://brunch.io/#documentation for docs.
files:
javascripts:
joinTo:
'javascripts/app.js': /^app/
'javascripts/vendor.js': /^vendor/
'test/javascripts/test.js': /^test[\\/](?!vendor)/
'test/javascripts/test-vendor.js': /^test[\\/](?=vendor)/
or... |
Add some temporary logging to debug intermittent spec failure. | Keymap = require 'keymap'
$ = require 'jquery'
_ = require 'underscore'
require 'underscore-extensions'
module.exports =
class App
keymap: null
windows: null
tabText: null
constructor: (@loadPath, nativeMethods)->
@windows = []
@setUpKeymap()
@tabText = " "
setUpKeymap: ->
@keymap = new Ke... | Keymap = require 'keymap'
$ = require 'jquery'
_ = require 'underscore'
require 'underscore-extensions'
module.exports =
class App
keymap: null
windows: null
tabText: null
constructor: (@loadPath, nativeMethods)->
@windows = []
@setUpKeymap()
@tabText = " "
setUpKeymap: ->
@keymap = new Ke... |
Allow PanelElements to be instantiated with markup | {CompositeDisposable} = require 'event-kit'
{callAttachHooks} = require './space-pen-extensions'
class PanelElement extends HTMLElement
createdCallback: ->
@subscriptions = new CompositeDisposable
initialize: (@model) ->
@appendChild(@getItemView())
@classList.add(@model.getClassName().split(' ')...)... | {CompositeDisposable} = require 'event-kit'
{callAttachHooks} = require './space-pen-extensions'
Panel = require './panel'
class PanelElement extends HTMLElement
createdCallback: ->
@subscriptions = new CompositeDisposable
initialize: (@model) ->
@appendChild(@getItemView())
@classList.add(@model.get... |
Fix error when calling application executor from packaged app | Reflux = require 'reflux'
Actions = require '../actions/database'
Common = require '../common/application'
Executor = new (require('remote').require('../browser/application-executor.coffee'))
cache =
loading: false
connections: []
Store = Reflux.createStore(
init: ->
@listenToMany(Actions)
onCreateConnec... | Reflux = require 'reflux'
Actions = require '../actions/database'
Common = require '../common/application'
Executor = new (require('remote').require('../browser/application-executor'))
cache =
loading: false
connections: []
Store = Reflux.createStore(
init: ->
@listenToMany(Actions)
onCreateConnection: (... |
Use shorthand array creation for levels | mainModule = angular.module 'meducationFrontEnd'
syllabusItemsControllerFunction = ($scope, syllabusItemsService) ->
levels = [0 ,1, 2, 3, 4]
$scope.init = ->
$scope.items = syllabusItemsService.query()
$scope.showSelect = (level) ->
level?.children?.length > 0
$scope.updateMeshHeadingIds = ->
... | mainModule = angular.module 'meducationFrontEnd'
syllabusItemsControllerFunction = ($scope, syllabusItemsService) ->
levels = [0..4]
$scope.init = ->
$scope.items = syllabusItemsService.query()
$scope.showSelect = (level) ->
level?.children?.length > 0
$scope.updateMeshHeadingIds = ->
$scope.me... |
Include stack for uncaught exceptions | {userAgent, taskPath} = process.env
handler = null
setupGlobals = ->
global.attachEvent = ->
console =
warn: -> emit 'task:warn', arguments...
log: -> emit 'task:log', arguments...
error: -> emit 'task:error', arguments...
trace: ->
global.__defineGetter__ 'console', -> console
global.document... | {userAgent, taskPath} = process.env
handler = null
setupGlobals = ->
global.attachEvent = ->
console =
warn: -> emit 'task:warn', arguments...
log: -> emit 'task:log', arguments...
error: -> emit 'task:error', arguments...
trace: ->
global.__defineGetter__ 'console', -> console
global.document... |
Remove debugging messages for Travis CI. | {Client} = require "mysql"
fs = require "fs"
context =
compiler: require "../../lib/compiler"
object: { id: 1, rgt: 1, lft: 2, permalink: "home" }
reflector: (callback) ->
configuration = JSON.parse fs.readFileSync("#{__dirname}/../../configuration.json", "utf8")
mysql = configuration.databases.mysql
... | {Client} = require "mysql"
fs = require "fs"
context =
compiler: require "../../lib/compiler"
object: { id: 1, rgt: 1, lft: 2, permalink: "home" }
reflector: (callback) ->
configuration = JSON.parse fs.readFileSync("#{__dirname}/../../configuration.json", "utf8")
mysql = configuration.databases.mysql
... |
Add outdent for ) and } | '.source.xq':
'editor':
'commentStart': '(: '
'commentEnd': ' :)'
'increaseIndentPattern': '[\\({]\\s*$|<[^>]+>\\s*$|(then|return)\\s*$|let.*:=\\s*$'
'decreaseIndentPattern': '^\\s*</[^>]+>' | '.source.xq':
'editor':
'commentStart': '(: '
'commentEnd': ' :)'
'increaseIndentPattern': '[\\({]\\s*$|<[^>]+>\\s*$|(then|return)\\s*$|let.*:=\\s*$'
'decreaseIndentPattern': '^\\s*[)}]|^\\s*</[^>]+>' |
Add animationSteps option and set to 45 | angular
.module("Poll")
.controller "ResultController", ["$scope", "$interval", "Pusher", ($scope, $interval, Pusher) ->
$scope.ctx = $('canvas')[0].getContext("2d")
$scope.chartData = []
$scope.chartOptions = {
responsive: true
showTooltips: false
}
$scope.updateCha... | angular
.module("Poll")
.controller "ResultController", ["$scope", "$interval", "Pusher", ($scope, $interval, Pusher) ->
$scope.ctx = $('canvas')[0].getContext("2d")
$scope.chartData = []
$scope.chartOptions = {
responsive: true
showTooltips: false
animationSteps: 45
... |
Remove default tests that have no bearing | chai = require 'chai'
sinon = require 'sinon'
chai.use require 'sinon-chai'
expect = chai.expect
describe 'forecast', ->
beforeEach ->
@robot =
respond: sinon.spy()
hear: sinon.spy()
require('../src/forecast')(@robot)
it 'registers a respond listener', ->
expect(@robot.respond).to.have.b... | chai = require 'chai'
sinon = require 'sinon'
chai.use require 'sinon-chai'
expect = chai.expect
describe 'forecast', ->
beforeEach ->
@robot =
respond: sinon.spy()
hear: sinon.spy()
require('../src/forecast')(@robot)
|
Add tag support to data generator | "use strict"
ObjectID = require('mongodb').ObjectID
Moniker = require('moniker')
rand = (min, max) -> Math.floor (Math.random() * (max - min + 1) + min)
lisence = [
"CC BY-NC-ND 3.0 NO"
"CC BY-NC 3.0 NO"
"CC BY-ND 3.0 NO"
"CC BY 3.0 NO"
]
provider = [
"DNT"
"NRK"
"TURAPP"
]
module.exports = (num) ->
... | "use strict"
ObjectID = require('mongodb').ObjectID
Moniker = require('moniker')
rand = (min, max) -> Math.floor (Math.random() * (max - min + 1) + min)
lisence = [
"CC BY-NC-ND 3.0 NO"
"CC BY-NC 3.0 NO"
"CC BY-ND 3.0 NO"
"CC BY 3.0 NO"
]
provider = [
"DNT"
"NRK"
"TURAPP"
]
tags = [
'Sted'
'Hytte... |
Remove unneeded dependency from Placeholder | define [ "outer", "js/vendor/jquery.placeholder" ], () ->
$("input, textarea").placeholder()
| define [ "js/vendor/jquery.placeholder" ], () ->
$("input, textarea").placeholder()
|
Add bower config to gruntfile | module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
coffee:
compile:
files:
'drop.js': 'drop.coffee'
'docs/welcome/js/welcome.js': 'docs/welcome/coffee/welcome.coffee'
watch:
coffee:
files: ['*.coffee', 'sass/*', 'docs/**/*... | module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
coffee:
compile:
files:
'drop.js': 'drop.coffee'
'docs/welcome/js/welcome.js': 'docs/welcome/coffee/welcome.coffee'
watch:
coffee:
files: ['*.coffee', 'sass/*', 'docs/**/*... |
Fix TypeError: object is not a function | # Description:
# Allows Hubot to do mathematics.
#
# Dependencies:
# "mathjs": ">= 0.16.0"
#
# Configuration:
# None
#
# Commands:
# hubot calculate <expression> - Calculate the given math expression.
# hubot convert <expression> in <units> - Convert expression to given units.
#
# Author:
# canadianveggie
... | # Description:
# Allows Hubot to do mathematics.
#
# Dependencies:
# "mathjs": ">= 0.16.0"
#
# Configuration:
# None
#
# Commands:
# hubot calculate <expression> - Calculate the given math expression.
# hubot convert <expression> in <units> - Convert expression to given units.
#
# Author:
# canadianveggie
... |
Allow pagerduty to de-dupe events. | NotificationPlugin = require "../../notification-plugin"
class PagerDuty extends NotificationPlugin
pagerDutyDetails = (event) ->
details =
message : event.trigger.message
project : event.project.name
class : event.error.exceptionClass
url : event.error.url
stackTrace : event.error.... | NotificationPlugin = require "../../notification-plugin"
class PagerDuty extends NotificationPlugin
pagerDutyDetails = (event) ->
details =
message : event.trigger.message
project : event.project.name
class : event.error.exceptionClass
url : event.error.url
stackTrace : event.error.... |
Add Resolve: entries to the context menu. | # See https://atom.io/docs/latest/creating-a-package#menus for more details
'context-menu':
'.overlayer':
'Enable merge-conflicts': 'merge-conflicts:toggle'
'menu': [
{
'label': 'Packages'
'submenu': [
'label': 'merge-conflicts'
'submenu': [
{ 'label': 'Toggle', 'command': 'merge-... | # See https://atom.io/docs/latest/creating-a-package#menus for more details
'context-menu':
'.conflicted':
'Resolve: Current': 'merge-conflicts:accept-current'
'Resolve: Ours': 'merge-conflicts:accept-ours'
'Resolve: Theirs': 'merge-conflicts:accept-theirs'
'Resolve: Ours Then Theirs': 'merge-conflict... |
Enable test for plain argument | el = @elvis
describe 'el.backbone.model', ->
# it 'can handle basic bindings', ->
# model = new Backbone.Model(foo: 'bar')
# element = el('div', el.bind(model, 'foo'))
# expect(element.innerHTML).to.equal('bar')
# model.set(foo: 'quux')
# expect(element.innerHTML).to.equal('quux')
it 'can hand... | el = @elvis
describe 'el.backbone.model', ->
it 'can handle basic bindings', ->
model = new Backbone.Model(foo: 'bar')
element = el('div', el.bind(model, 'foo'))
expect(element.innerHTML).to.equal('bar')
model.set(foo: 'quux')
expect(element.innerHTML).to.equal('quux')
it 'can handle binding i... |
Fix bug where toolbars wheelchair status button tooltips were not displayed. | Wheelmap.StatusFilterButtonComponent = Wheelmap.WheelchairPopoverComponent.extend
tagName: 'button'
classNameBindings: [':btn', 'isActive:active', ':btn-info', 'wheelchair']
wheelchair: null
activeFilters: null
init: ()->
@_super()
popoverOptions:
trigger: 'hover'
placement: () ->
if win... | Wheelmap.StatusFilterButtonComponent = Wheelmap.WheelchairPopoverComponent.extend
tagName: 'button'
classNameBindings: [':btn', 'isActive:active', ':btn-info', 'wheelchair']
wheelchair: null
activeFilters: null
init: ()->
@_super()
popoverOptions:
trigger: 'hover'
placement: () ->
if win... |
Disable all Atom autocomplete packages | "*":
core:
disabledPackages: [
"archive-view"
"background-tips"
"dev-live-reload"
"welcome"
"update-package-dependencies"
"timecop"
"exception-reporting"
"image-view"
"metrics"
"open-on-github"
"release-notes"
"styleguide"
"autocomplete... | "*":
core:
disabledPackages: [
"archive-view"
"background-tips"
"dev-live-reload"
"welcome"
"update-package-dependencies"
"timecop"
"exception-reporting"
"image-view"
"metrics"
"open-on-github"
"release-notes"
"styleguide"
"autocomplete... |
Add key binding for chmod package | 'atom-workspace':
'ctrl-cmd-r': 'tree-view:reveal-active-file'
'ctrl-cmd-t': 'window:run-package-specs'
'ctrl-shift-alt-t': 'custom:open-todo-list'
'atom-text-editor':
'ctrl-shift-a': 'asciidoc-preview:toggle'
'.platform-darwin atom-workspace':
'ctrl-"': 'toggle-quotes:toggle'
'alt-cmd-n': 'advanced-open-fi... | 'atom-workspace':
'ctrl-cmd-r': 'tree-view:reveal-active-file'
'ctrl-cmd-t': 'window:run-package-specs'
'ctrl-shift-alt-t': 'custom:open-todo-list'
'atom-text-editor':
'ctrl-shift-a': 'asciidoc-preview:toggle'
'.platform-darwin atom-workspace':
'ctrl-"': 'toggle-quotes:toggle'
'alt-cmd-n': 'advanced-open-fi... |
Use real name instead of username in parens | React = require 'react'
EnrollButton = require '../students/enroll_button'
InlineUsers = React.createClass(
displayName: 'InlineUsers'
render: ->
key = @props.title + '_' + @props.role
last_user_index = @props.users.length - 1
user_list = @props.users.map (user, index) ->
link = ... | React = require 'react'
EnrollButton = require '../students/enroll_button'
InlineUsers = React.createClass(
displayName: 'InlineUsers'
render: ->
key = @props.title + '_' + @props.role
last_user_index = @props.users.length - 1
user_list = @props.users.map (user, index) ->
link = ... |
Test update tracking of Mount | assert = (require 'chai').assert
Mount = require '../src/Mount'
{Todo, TodoList, NewTodo, TodoApp} = require './fixtures/components'
todos = [
{ title: 'Go to town' }
{ title: 'Buy some food' }
]
describe 'Mount', ->
app = null
beforeEach ->
elem = document.createElement('div')
document.body.appendC... | _ = require 'lodash'
assert = (require 'chai').assert
Mount = require '../src/Mount'
{Todo, TodoList, NewTodo, TodoApp} = require './fixtures/components'
todos = [
{ title: 'Go to town' }
{ title: 'Buy some food' }
]
todos2 = [
{ title: 'foo' }
{ title: 'bar' }
{ title: 'baz' }
]
describe 'Mount', ->
ap... |
Add tests for path inclusion | fs = require 'fs'
path = require 'path'
PathScanner = require '../lib/path-scanner'
describe "PathScanner", ->
describe "a non-git directory with many files", ->
rootPath = fs.realpathSync("spec/fixtures/many-files")
it 'lists all non-hidden files', ->
scanner = new PathScanner(rootPath)
sca... | fs = require 'fs'
path = require 'path'
PathScanner = require '../lib/path-scanner'
describe "PathScanner", ->
describe "a non-git directory with many files", ->
rootPath = fs.realpathSync("spec/fixtures/many-files")
it 'lists all non-hidden files', ->
scanner = new PathScanner(rootPath)
sca... |
Add pending as a status type | mongoose = require 'mongoose'
chrono = require 'chrono-node'
db = require '../lib/database'
Schema = mongoose.Schema
entrySchema = new Schema
title:
type: String
required: yes
description: String
slug:
type: String
status:
type: String
enum: ['hidden', 'draft', 'live']
required: yes
... | mongoose = require 'mongoose'
chrono = require 'chrono-node'
db = require '../lib/database'
Schema = mongoose.Schema
entrySchema = new Schema
title:
type: String
required: yes
description: String
slug:
type: String
status:
type: String
enum: ['hidden', 'draft', 'live', 'pending']
requ... |
Update fetched data with yet to sync data |
Backbone.backendSync = Backbone.sync
Backbone.sync = (method, model, options) ->
url = _.result(model, 'url')
if method is 'read'
if navigator.onLine
# Store the fetched result also in our local cache
Backbone.backendSync(arguments...).then (data) ->
localStorage[url] = JSON.stringify(data... |
Backbone.backendSync = Backbone.sync
Backbone.sync = (method, model, options) ->
url = _.result(model, 'url')
synclist = JSON.parse(localStorage['toSync'] || '[]')
if method is 'read'
getData = (method, model, options) ->
defer = $.Deferred()
if navigator.onLine
# Store the fetched re... |
Hide if slug is koding | class GroupAvatar extends JView
constructor:(options = {}, data)->
options.cssClass = 'group-avatar-drop'
groupsController = KD.getSingleton 'groupsController'
super options, groupsController.getCurrentGroupData()
groupsController.on 'GroupChanged', @bound 'render'
render:(slug, group)->
if ... | class GroupAvatar extends JView
constructor:(options = {}, data)->
options.cssClass = 'group-avatar-drop hidden'
groupsController = KD.getSingleton 'groupsController'
super options, groupsController.getCurrentGroupData()
groupsController.on 'GroupChanged', @bound 'render'
render:(slug, group)->
... |
Add current timestamp to filename | uploadChunk = (blob, url, filename, chunk, chunks) ->
xhr = new XMLHttpRequest
xhr.open 'POST', url, false
xhr.onerror = -> throw new Error 'error while uploading'
formData = new FormData
formData.append 'name', filename
formData.append 'chunk', chunk
formData.append 'chunks', chunks
for... | uploadChunk = (blob, url, filename, chunk, chunks) ->
xhr = new XMLHttpRequest
xhr.open 'POST', url, false
xhr.onerror = -> throw new Error 'error while uploading'
formData = new FormData
formData.append 'name', filename
formData.append 'chunk', chunk
formData.append 'chunks', chunks
for... |
Fix method bind problems in phantomjs | class ObjectLogger
constructor:(@className, @defaultLevel = 'info')->
@log = loglevel.createLogger(@className, @defaultLevel)
@callStack = []
@log.enter = @enter.bind(@, 'debug')
@log.fineEnter = @enter.bind(@, 'fine')
@log.return = @return.bind(@, 'debug')
@log.fineReturn = @return.bind(@... | class ObjectLogger
constructor:(@className, @defaultLevel = 'info')->
@log = loglevel.createLogger(@className, @defaultLevel)
@callStack = []
@log.enter = @bindMethod(@enter, 'debug')
@log.fineEnter = @bindMethod(@enter, 'fine')
@log.return = @bindMethod(@return, 'debug')
@log.fineReturn =... |
Update view helpers to work with my fixed brunch-handlebars plugin | Chaplin = require 'chaplin'
# Application-specific view helpers
# http://handlebarsjs.com/#helpers
# --------------------------------
# Map helpers
# -----------
# Make 'with' behave a little more mustachey.
Handlebars.registerHelper 'with', (context, options) ->
if not context or Handlebars.Utils.isEmpty context
... | Chaplin = require 'chaplin'
Handlebars = require 'Handlebars' unless Handlebars?
# Application-specific view helpers
# http://handlebarsjs.com/#helpers
# --------------------------------
# Map helpers
# -----------
# Make 'with' behave a little more mustachey.
Handlebars.registerHelper 'with', (context, options) ->
... |
Set proper value to seconds if it passed 60 | 'use strict'
@start = (limit) ->
window.startDate = new Date().getTime()
window.seconds = 0
window.minutes = 0
window.limit = limit
window.timerID = setInterval(timeCounter, 1000)
return
@stop = ->
clearInterval timerID
return
timeCounter = ->
if seconds >= limit
stop()
return
time = new... | 'use strict'
@start = (limit) ->
window.startDate = new Date().getTime()
window.elapsedSeconds = 0
window.seconds = 0
window.minutes = 0
window.limit = limit
window.timerID = setInterval(timeCounter, 1000)
return
@stop = ->
clearInterval timerID
return
timeCounter = ->
if elapsedSeconds >= limit
... |
Trim remove_delay down closer to transition duration | FactlinkJailRoot.showShouldSelectTextNotification = ->
showNotification
message: 'To create an annotation, select a statement and click the Factlink button.'
type_classes: 'fl-message-icon-add'
FactlinkJailRoot.showLoadedNotification = ->
showNotification
message: 'Factlink is loaded!'
type_classes... | FactlinkJailRoot.showShouldSelectTextNotification = ->
showNotification
message: 'To create an annotation, select a statement and click the Factlink button.'
type_classes: 'fl-message-icon-add'
FactlinkJailRoot.showLoadedNotification = ->
showNotification
message: 'Factlink is loaded!'
type_classes... |
Fix regression: Deleting items from the pallete doesn't replace them. | PaletteStore = require './palette-store'
GraphStore = require './graph-store'
nodeActions = Reflux.createActions(
[
"nodesChanged"
]
)
nodeStore = Reflux.createStore
listenables: [nodeActions]
init: ->
@nodes = []
@paletteItemHasNodes = false
@selectedPaletteItem... | PaletteStore = require './palette-store'
GraphActions = require '../actions/graph-actions'
nodeActions = Reflux.createActions(
[
"nodesChanged"
]
)
nodeStore = Reflux.createStore
listenables: [nodeActions]
init: ->
@nodes = []
@paletteItemHasNodes = false
@selected... |
Use treeController's delegate as FinderController since there is no more FinderController singleton | class FSFolder extends FSFile
fetchContents:(callback, dontWatch=yes)->
{ treeController } = @getOptions()
@emit "fs.job.started"
@vmController.run
method : 'fs.readDirectory'
vmName : @vmName
withArgs :
onChange : if dontWatch then null else (change)=>
FSHe... | class FSFolder extends FSFile
fetchContents:(callback, dontWatch=yes)->
{ treeController } = @getOptions()
@emit "fs.job.started"
@vmController.run
method : 'fs.readDirectory'
vmName : @vmName
withArgs :
onChange : if dontWatch then null else (change)=>
FSHe... |
Remove required Parse causing error on question delete | Parse = require 'parse'
Sort = require 'sortablejs'
{updateSortOrder} = require '../../imports/helpers'
{Question} = require '../../imports/models'
Template.questions.onCreated ->
@fetched = new ReactiveVar false
@survey = @data.survey
@questions = @data.questions
@form = @data.form
instance = @
@form.getQ... | Sort = require 'sortablejs'
{updateSortOrder} = require '../../imports/helpers'
{Question} = require '../../imports/models'
Template.questions.onCreated ->
@fetched = new ReactiveVar false
@survey = @data.survey
@questions = @data.questions
@form = @data.form
instance = @
@form.getQuestions(true, @question... |
Use preferred way of testing computed properties | #= require test_helper
emq.globalize()
ETahi.setupForTesting()
ETahi.injectTestHelpers()
ETahi.Resolver = Ember.DefaultResolver.extend namespace: ETahi
setResolver ETahi.Resolver.create()
ETahi.setupForTesting()
moduleForModel 'paper', 'Unit: Paper Model'
moduleForModel 'user', 'Unit: User Model'
test 'displayTitle... | #= require test_helper
emq.globalize()
ETahi.injectTestHelpers()
ETahi.Resolver = Ember.DefaultResolver.extend namespace: ETahi
setResolver ETahi.__container__
ETahi.setupForTesting()
moduleForModel 'paper', 'Unit: Paper Model',
needs: ['model:user', 'model:declaration', 'model:figure', 'model:journal', 'model:pha... |
Add default walk and watch options. | require 'postmortem/register'
path = require 'path'
# Ensure local node_modules bin is on the front of $PATH
binPath = path.join process.cwd(), 'node_modules/', '.bin'
process.env.PATH = ([binPath].concat process.env.PATH.split ':').join ':'
global.cp = require './cp'
global.exec = require 'executive'
globa... | require 'postmortem/register'
require 'vigil'
path = require 'path'
# Ensure local node_modules bin is on the front of $PATH
binPath = path.join process.cwd(), 'node_modules/', '.bin'
process.env.PATH = ([binPath].concat process.env.PATH.split ':').join ':'
global.cp = require './cp'
global.exec = require '... |
Revert to the last working test | selenium = require 'selenium-webdriver'
chai = require 'chai'
chai.use require 'chai-as-promised'
expect = chai.expect
before ->
@driver = new selenium.Builder()
.withCapabilities(selenium.Capabilities.phantomjs())
.build()
@driver.getWindowHandle()
after ->
@driver.quit()
describe 'Totodoo App', ->
@timeou... | selenium = require 'selenium-webdriver'
chai = require 'chai'
chai.use require 'chai-as-promised'
expect = chai.expect
before ->
@driver = new selenium.Builder()
.withCapabilities(selenium.Capabilities.phantomjs())
.build()
@driver.getWindowHandle()
after ->
@driver.quit()
describe 'Totodoo App', ->
@timeou... |
Add partial refactor of filters. | angular.module('greenmine.filters.common', []).
filter('onlyVisible', ->
return (input) ->
return _.filter input, (item) ->
return item.__hidden != true
).
filter('truncate', ->
return (input, num) ->
num = 25 if num == undefined
return _.s... | angular.module('greenmine.filters.common', []).
filter('onlyVisible', ->
return (input) ->
return _.filter input, (item) ->
return item.__hidden != true
).
filter('truncate', ->
return (input, num) ->
num = 25 if num == undefined
return _.s... |
Change ci-env-detection from "workstation" to "CI" | gutil = require 'gulp-util'
child_process = require 'child_process'
module.exports = (name, command, callback = ->) ->
child_process.exec(
command
(error, stdout, stderr) ->
if error and error.code
customError =
message: "Failed: #{name}"
gutil.log stdout
guti... | gutil = require 'gulp-util'
child_process = require 'child_process'
module.exports = (name, command, callback = ->) ->
child_process.exec(
command
(error, stdout, stderr) ->
if error and error.code
customError =
message: "Failed: #{name}"
gutil.log stdout
guti... |
Remove plus sign (+) in URL query string while per_page switching | class ActiveAdmin.PerPage
constructor: (@options, @element)->
@$element = $(@element)
@_init()
@_bind()
_init: ->
@$params = @_queryParams()
_bind: ->
@$element.change =>
@$params['per_page'] = @$element.val()
delete @$params['page']
location.search = $.param(@$params)
_... | class ActiveAdmin.PerPage
constructor: (@options, @element)->
@$element = $(@element)
@_init()
@_bind()
_init: ->
@$params = @_queryParams()
_bind: ->
@$element.change =>
@$params['per_page'] = @$element.val()
delete @$params['page']
location.search = $.param(@$params)
_... |
Change default shortcut to 'alt-shift-a' | # 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... |
Add short hand for api.user collection | EventEmitter = require('events').EventEmitter
MongoClient = require('mongodb').MongoClient
inherits = require('util').inherits
Mongo = (uri) ->
EventEmitter.call @
new MongoClient.connect uri, (err, database) =>
throw err if err
@db = database
for col in ['arrangementer', 'bilder', 'grupper', 'område... | EventEmitter = require('events').EventEmitter
MongoClient = require('mongodb').MongoClient
inherits = require('util').inherits
Mongo = (uri) ->
EventEmitter.call @
new MongoClient.connect uri, (err, database) =>
throw err if err
@db = database
for col in ['arrangementer', 'bilder', 'grupper', 'område... |
Hide previous button in update index view controller | class @UpdateIndexViewController extends @UpdateViewController
navigation:
nextRoute: "/update/seed"
previousRoute: "/onboarding/device/plug"
previousParams: {animateIntro: no}
localizablePageSubtitle: "update.index.important_notice"
navigatePrevious: ->
ledger.app.setExecutionMode(ledger.app.Mo... | class @UpdateIndexViewController extends @UpdateViewController
navigation:
nextRoute: "/update/seed"
#previousRoute: "/onboarding/device/plug"
previousParams: {animateIntro: no}
localizablePageSubtitle: "update.index.important_notice"
navigatePrevious: ->
ledger.app.setExecutionMode(ledger.app.M... |
Use css class 'hide' instead of jQuery show/hide methods to prevent jQuery weirdness. | class window.EvidenceBottomView extends Backbone.Marionette.ItemView
className: 'evidence-bottom bottom-base'
template: 'facts/bottom_base'
triggers:
'click .js-sub-comments-link': 'toggleSubCommentsList'
ui:
subCommentsLink: '.js-sub-comments-link'
subCommentsContainer: '.js-sub-comments-co... | class window.EvidenceBottomView extends Backbone.Marionette.ItemView
className: 'evidence-bottom bottom-base'
template: 'facts/bottom_base'
triggers:
'click .js-sub-comments-link': 'toggleSubCommentsList'
ui:
subCommentsLink: '.js-sub-comments-link'
subCommentsContainer: '.js-sub-comments-co... |
Fix redirect path after loggin out | module.exports =
new: (req, res) ->
res.render('sessions/new')
create: (passport) ->
->
passport.authenticate 'local',
successRedirect: '/'
failureRedirect: '/login'
successFlash: 'You have successfully logged in!'
failureFlash: true
destroy: (req, res) ->
req.l... | module.exports =
new: (req, res) ->
res.render('sessions/new')
create: (passport) ->
->
passport.authenticate 'local',
successRedirect: '/'
failureRedirect: '/login'
successFlash: 'You have successfully logged in!'
failureFlash: true
destroy: (req, res) ->
req.l... |
Revert the timeout change in the docker runner | 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... |
Use raw strings instead of buffers | # @Compiler-Output "../Dist/ExceptedWrite.js"
EventEmitter = require('events').EventEmitter
Promise = require('a-promise')
Buffer = require('buffer').Buffer
class ExpectedWrite extends EventEmitter
constructor: (@stream) ->
super
@status = true
@expected = null
@callback = null
@data = stdout: n... | # @Compiler-Output "../Dist/ExceptedWrite.js"
EventEmitter = require('events').EventEmitter
Promise = require('a-promise')
Buffer = require('buffer').Buffer
class ExpectedWrite extends EventEmitter
constructor: (@stream) ->
super
@status = true
@expected = null
@callback = null
@data = stdout: '... |
Add minimal-ui for iOS Safari. | goog.provide 'server.react.App'
class server.react.App
###*
@constructor
###
constructor: ->
{html,head,meta,title,link,body} = React.DOM
@create = React.createClass
render: ->
html lang: 'en',
head null,
meta charSet: 'utf-8'
meta name: 'viewport', c... | goog.provide 'server.react.App'
class server.react.App
###*
@constructor
###
constructor: ->
{html,head,meta,title,link,body} = React.DOM
@create = React.createClass
render: ->
html lang: 'en',
head null,
meta charSet: 'utf-8'
# NOTE(steida): http://w... |
Replace property with method to improve intelligibility | module.exports =
isLoggedIn: (req, res, next) ->
if req.user
next()
else
req.flash 'error', 'You must be logged in!'
res.redirect '/login'
isNotLoggedIn: (req, res, next) ->
if req.user
req.flash 'error', 'You are already logged in!'
res.redirect '/'
else
next() | module.exports =
isLoggedIn: (req, res, next) ->
if req.isAuthenticated()
next()
else
req.flash 'error', 'You must be logged in!'
res.redirect '/login'
isNotLoggedIn: (req, res, next) ->
if req.isAuthenticated()
req.flash 'error', 'You are already logged in!'
res.redirect ... |
Add itself as a global on rootView | {_, $, $$, View} = require 'atom'
module.exports =
class StatusBarView extends View
@content: ->
@div class: 'status-bar tool-panel panel-bottom', =>
@div outlet: 'rightPanel', class: 'status-bar-right pull-right'
@div outlet: 'leftPanel', class: 'status-bar-left'
initialize: ->
@bufferSubscri... | {_, $, $$, View} = require 'atom'
module.exports =
class StatusBarView extends View
@content: ->
@div class: 'status-bar tool-panel panel-bottom', =>
@div outlet: 'rightPanel', class: 'status-bar-right pull-right'
@div outlet: 'leftPanel', class: 'status-bar-left'
initialize: ->
atom.rootView.... |
Remove percentage values from chart output | Template.chart.helpers
nonNumberDataColumnSpec: ->
for spec in @header.slice(1)
if spec.chartType isnt "number"
return spec
reactivityHack: ->
_.defer =>
$chart = $(".chart[data-id='" + @_id + "']")
$chart.empty()
$chartContainer = $("<div class='chart-container'></div>")
... | Template.chart.helpers
nonNumberDataColumnSpec: ->
for spec in @header.slice(1)
if spec.chartType isnt "number"
return spec
reactivityHack: ->
_.defer =>
$chart = $(".chart[data-id='" + @_id + "']")
$chart.empty()
$chartContainer = $("<div class='chart-container'></div>")
... |
Make "don't check github ip in development" work | AppConfig = require('../initializers/config')
Deploy = require('../lib/deploy')
range_check = require('range_check')
tagRefersToServer = (tag, serverName) ->
return new RegExp("^#{serverName}").test(tag)
getIpFromRequest = (req) ->
req.connection.remoteAddress
GITHUB_IP_RANGE = "192.30.252.0/22"
ipIsFromGithub ... | AppConfig = require('../initializers/config')
Deploy = require('../lib/deploy')
range_check = require('range_check')
tagRefersToServer = (tag, serverName) ->
return new RegExp("^#{serverName}").test(tag)
getIpFromRequest = (req) ->
req.connection.remoteAddress
GITHUB_IP_RANGE = "192.30.252.0/22"
ipIsFromGithub ... |
Use actual ellipsis unicode character for truncation. | Hummingbird.TruncateTextComponent = Ember.Component.extend
expanded: false
isTruncated: (->
@get('text').length > @get('length') + 10
).property('text', 'length')
truncatedText: (->
if @get('isTruncated') and not @get('expanded')
jQuery.trim(@get('text')).substring(0, @get('length')).trim(this) ... | Hummingbird.TruncateTextComponent = Ember.Component.extend
expanded: false
isTruncated: (->
@get('text').length > @get('length') + 10
).property('text', 'length')
truncatedText: (->
if @get('isTruncated') and not @get('expanded')
jQuery.trim(@get('text')).substring(0, @get('length')).trim(this) ... |
Fix tiny bug in ignores | path = require 'path'
fs = require 'fs-plus'
_ = require 'underscore-plus'
module.exports =
class PathFinder
railsRootPathChildren: ['app', 'config', 'lib']
ignores: /(?:\/.git\/|\.keep$|\.DS_Store$|\.eot$|\.otf$|\.ttf$|\.woff$|\.png$|\.svg$|\.jpg$|\.gif$|\.mp4$|\.eps$|\.psd$)/
constructor: (currentPath) ->
... | path = require 'path'
fs = require 'fs-plus'
_ = require 'underscore-plus'
module.exports =
class PathFinder
railsRootPathChildren: ['app', 'config', 'lib']
ignores: /(?:\/.git\/|\.(?:git)?keep$|\.DS_Store$|\.eot$|\.otf$|\.ttf$|\.woff$|\.png$|\.svg$|\.jpg$|\.gif$|\.mp4$|\.eps$|\.psd$)/
constructor: (currentPat... |
Disable landing page on pro for now | `import Ember from 'ember'`
Location = Ember.HistoryLocation.extend
init: ->
@_super.apply this, arguments
if auth = @get('auth')
# location's getURL is first called before we even
# get to routes, so autoSignIn won't be called in
# such case
auth.autoSignIn() unless auth.get('signed... | `import Ember from 'ember'`
`import config from 'travis/config/environment'`
Location = Ember.HistoryLocation.extend
init: ->
@_super.apply this, arguments
if auth = @get('auth')
# location's getURL is first called before we even
# get to routes, so autoSignIn won't be called in
# such cas... |
Disable default Google Maps controls | jQuery ->
myOptions =
center: new google.maps.LatLng(-34.397, 150.644)
zoom: 8
mapTypeId: google.maps.MapTypeId.ROADMAP
map = new google.maps.Map(document.getElementById("centermap"), myOptions)
| $ ->
myOptions =
center: new google.maps.LatLng(-34.397, 150.644)
zoom: 8
disableDefaultUI: true
mapTypeId: google.maps.MapTypeId.ROADMAP
map = new google.maps.Map(document.getElementById("centermap"), myOptions)
|
Use correct textmate package names | RootView = require 'root-view'
Editor = require 'editor'
ChildProcess = require 'child_process'
describe "link package", ->
[editor] = []
beforeEach ->
atom.activatePackage('javascript.tmbundle', sync: true)
atom.activatePackage('hyperlink-helper.tmbundle', sync: true)
window.rootView = new RootView
... | RootView = require 'root-view'
Editor = require 'editor'
ChildProcess = require 'child_process'
describe "link package", ->
[editor] = []
beforeEach ->
atom.activatePackage('javascript-tmbundle', sync: true)
atom.activatePackage('hyperlink-helper-tmbundle', sync: true)
window.rootView = new RootView
... |
Fix issue where chosen wouldn't update if bound selected value changed elsewhere | ETahi.ChosenView = Ember.Select.extend
multiple: false
width: '200px'
disableSearchThreshold: 0
searchContains: true
attributeBindings:['multiple', 'width', 'disableSearchThreshold', 'searchContains', 'data-placeholder']
changeAction: null
change: ->
action = @get('changeAction')
@get('controller... | ETahi.ChosenView = Ember.Select.extend
multiple: false
width: '200px'
disableSearchThreshold: 0
searchContains: true
attributeBindings:['multiple', 'width', 'disableSearchThreshold', 'searchContains', 'data-placeholder']
changeAction: null
change: ->
action = @get('changeAction')
@get('controller... |
Hide atom python test panel on Atom opening. | {$, ScrollView} = require 'atom-space-pen-views'
module.exports =
class AtomPythonTestView extends ScrollView
message: ''
maximized: false
@content: ->
@div class: 'atom-python-test-view native-key-bindings', outlet: 'atomTestView', tabindex: -1, overflow: "auto", =>
@div class: 'btn-tool... | {$, ScrollView} = require 'atom-space-pen-views'
module.exports =
class AtomPythonTestView extends ScrollView
message: ''
maximized: false
@content: ->
@div class: 'atom-python-test-view native-key-bindings', outlet: 'atomTestView', tabindex: -1, overflow: "auto", =>
@div class: 'btn-tool... |
Use `Account.reload` instead of `init` | Sprangular.controller 'AccountCtrl', ($scope, $location, $routeParams, Status, Account) ->
Status.pageTitle = 'My Account'
user = Account.user
$scope.editing = false
$scope.user = user
refreshAccount = ->
Account.init().then ->
user = Account.user
user.password = ''
user.password_conf... | Sprangular.controller 'AccountCtrl', ($scope, $location, $routeParams, Status, Account) ->
Status.pageTitle = 'My Account'
user = Account.user
$scope.editing = false
$scope.user = user
refreshAccount = ->
Account.reload().then ->
user = Account.user
user.password = ''
user.password_co... |
Correct poorly named private method | 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... | ETahi.InlineEditBodyPartComponent = Em.Component.extend
editing: false
snapshot: []
confirmDelete: false
createSnapshot: (->
@set('snapshot', Em.copy(@get('block'), true))
).observes('editing')
hasContent: (->
@get('block').any(@_isNotEmpty)
).property('block.@each.value')
hasNoContent: Em.co... |
Fix user name in log | logger = require 'winston'
Visualizer = require('../model/visualizer').Visualizer
authorisation = require './authorisation'
utils = require '../utils'
exports.getAllVisualizers = ->
# Must be admin
if not authorisation.inGroup 'admin', this.authenticated
utils.logAndSetResponse this, 403, "User #{this.authenti... | logger = require 'winston'
Visualizer = require('../model/visualizer').Visualizer
authorisation = require './authorisation'
utils = require '../utils'
exports.getAllVisualizers = ->
# Must be admin
if not authorisation.inGroup 'admin', this.authenticated
utils.logAndSetResponse this, 403, "User #{this.authenti... |
Update Datastream view to ItemView | class Workbench.Views.DatastreamShowView extends Backbone.View
template: JST["workbench/templates/datastream"]
tagName: "li"
className: "datastream"
initialize: ->
@renderDeferred = $.Deferred()
@chartView = new Workbench.Views.DatastreamChartView
model: @model
@latestView = new Workbench.... | class Workbench.Views.DatastreamShowView extends Backbone.Marionette.ItemView
template: "workbench/templates/datastream"
tagName: "li"
className: "datastream"
initialize: ->
@renderDeferred = $.Deferred()
@chartView = new Workbench.Views.DatastreamChartView
model: @model
@latestView = new ... |
Fix "don't dismiss pairing progress dialog when displaying success" | class @WalletPairingProgressDialogViewController extends DialogViewController
view:
contentContainer: "#content_container"
onAfterRender: ->
super
# launch request
@_request = @params.request
@_request?.onComplete (screen, error) =>
@_request = null
if screen?
dialog = new ... | class @WalletPairingProgressDialogViewController extends DialogViewController
view:
contentContainer: "#content_container"
onAfterRender: ->
super
# launch request
@_request = @params.request
@_request?.onComplete (screen, error) =>
@_request = null
@dismiss () =>
if screen... |
Configure $http service for Rails | angular.module("hyperadmin", [ "ui.router" ])
| angular.module("hyperadmin", [ "ui.router" ])
.config ($httpProvider) ->
authToken = $("meta[name=\"csrf-token\"]").attr("content")
$httpProvider.defaults.headers.common["X-CSRF-TOKEN"] = authToken
$httpProvider.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest"
$httpProvider.defaults.head... |
Add "startProgress" parameter to start to show progress bar. | kd = require 'kd'
KDButtonView = kd.ButtonView
KDProgressBarView = kd.ProgressBarView
KDCustomHTMLView = kd.CustomHTMLView
module.exports = class ButtonViewWithProgressBar extends KDCustomHTMLView
constructor: (options = {}, data) ->
super options, data
o = @getOptions(... | kd = require 'kd'
KDButtonView = kd.ButtonView
KDProgressBarView = kd.ProgressBarView
KDCustomHTMLView = kd.CustomHTMLView
module.exports = class ButtonViewWithProgressBar extends KDCustomHTMLView
constructor: (options = {}, data) ->
super options, data
o = @getOptions... |
Change keymap selector (fixes alt-enter override in OSX) | # 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.