Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Add route for knowing the IP where the bot is host | # Description:
# A simple interaction with the built in HTTP Daemon
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# None
#
# URLS:
# /hubot/version
# /hubot/ping
# /hubot/time
# /hubot/info
spawn = require('child_process').spawn
module.exports = (robot) ->
robot.router.get "/hubo... | # Description:
# A simple interaction with the built in HTTP Daemon
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# None
#
# URLS:
# /hubot/version
# /hubot/ping
# /hubot/time
# /hubot/info
# /hubot/ip
spawn = require('child_process').spawn
module.exports = (robot) ->
robot.rou... |
Allow CompositeDisposable to be constructed with multiple disposables | # Public: An object that aggregates multiple {Disposable} instances together
# into a single disposable, so they can all be disposed as a group.
module.exports =
class CompositeDisposable
disposed: false
constructor: ->
@disposables = []
# Public: Add a disposable to be disposed when the composite is dispos... | # Public: An object that aggregates multiple {Disposable} instances together
# into a single disposable, so they can all be disposed as a group.
module.exports =
class CompositeDisposable
disposed: false
# Public: Construct an instance, optionally with one or more
constructor: ->
@disposables = []
@add(d... |
Compress block, and add TODO comment | Opener = require '../opener'
module.exports =
class AtomPdfOpener extends Opener
open: (filePath, texPath, lineNumber, callback) ->
# Opens PDF in a new pane -- requires pdf-view module
openPanes = atom.workspace.getPaneItems()
for pane in openPanes
if pane.filePath is filePath
# File is al... | Opener = require '../opener'
module.exports =
class AtomPdfOpener extends Opener
open: (filePath, texPath, lineNumber, callback) ->
# Opens PDF in a new pane -- requires pdf-view module
openPanes = atom.workspace.getPaneItems()
for pane in openPanes
# File is already open in another pane
retu... |
Remove all the subs from MessageRegistry | Helpers = require('./helpers')
{CompositeDisposable, Emitter} = require 'atom'
class MessageRegistry
constructor: (@linter)->
@messages = new Map()
@emitter = new Emitter
@subscriptions = new CompositeDisposable
@subscriptions.add atom.workspace.onDidChangeActivePaneItem =>
@messages.forEach (m... | Helpers = require('./helpers')
{Emitter} = require 'atom'
class MessageRegistry
constructor: (@linter)->
@messages = new Map()
@emitter = new Emitter
set: (linter, messages) ->
Helpers.validateMessages(messages)
@classifyMessages(messages)
@messages.set(linter, messages)
@emitter.emit 'did... |
Create new model method insertOrUpsert based on _id | RocketChat.models._Base = class
_baseName: ->
return 'rocketchat_'
_initModel: (name) ->
check name, String
@model = new Mongo.Collection @_baseName() + name
find: ->
return @model.find.apply @model, arguments
findOne: ->
return @model.findOne.apply @model, arguments
insert: ->
return @model.inser... | RocketChat.models._Base = class
_baseName: ->
return 'rocketchat_'
_initModel: (name) ->
check name, String
@model = new Mongo.Collection @_baseName() + name
find: ->
return @model.find.apply @model, arguments
findOne: ->
return @model.findOne.apply @model, arguments
insert: ->
return @model.inser... |
Remove requires to prep for consolidation into work-app | require 'appirio-tech-ng-ui-components'
require 'appirio-tech-ng-api-services'
require './scripts/ap-file-upload.module'
require './scripts/file.controller'
require './scripts/file.directive'
require './scripts/file.service'
require './scripts/on-file-changed.directive'
require './scripts/uploaded-files.directive'
req... | require './scripts/ap-file-upload.module'
require './scripts/file.controller'
require './scripts/file.directive'
require './scripts/file.service'
require './scripts/on-file-changed.directive'
require './scripts/uploaded-files.directive'
require './scripts/uploader.controller'
require './scripts/uploader.directive'
req... |
Add fittext to asset pipeline | #= require "vendor/jquery-1.7.1.min" | #= require "vendor/jquery-1.7.1.min"
#= require "vendor/plugins/jquery.fittext.js" |
Fix IE 9/10 host_ready event | setTimeout ->
if /^(interactive|complete)$/.test(document.readyState)
FactlinkJailRoot.host_ready_promise.resolve()
else
document.addEventListener('DOMContentLoaded', -> FactlinkJailRoot.host_ready_promise.resolve())
if 'complete' == document.readyState
FactlinkJailRoot.host_loaded_promise.resolve()... | setTimeout ->
ok =
loaded: true
interactive: !(document.documentMode < 11)
complete: true
if ok[document.readyState]
FactlinkJailRoot.host_ready_promise.resolve()
else
document.addEventListener('DOMContentLoaded', -> FactlinkJailRoot.host_ready_promise.resolve())
if 'complete' == document... |
Allow loading iframe tools from labs.intermine. | deps = ['angular', './routes', 'angular-route', 'angular-ui', 'angular-ui-select2',
'./filters', './services', './directives', './controllers']
modules = [
'ngRoute',
'steps.controllers',
'steps.services',
'steps.filters',
'steps.directives',
'ui.bootstrap',
'ui.select2']
$providers = [
'$rout... | deps = ['angular', './routes', 'angular-route', 'angular-ui', 'angular-ui-select2',
'./filters', './services', './directives', './controllers']
modules = [
'ngRoute',
'steps.controllers',
'steps.services',
'steps.filters',
'steps.directives',
'ui.bootstrap',
'ui.select2']
$providers = [
'$rout... |
Add formatNumber using current chapter number | wait = ->
$.getJSON(window.location.pathname + '/wait', ->
$.get window.location.pathname + '.js', (html)->
$('#book').html html
initMathJax()
wait()
).fail -> wait()
initMathJax = ->
$('#mathJaxJS').remove()
delete MathJax
script = document.createElement( 'script' )
script.id = 'mat... | wait = ->
$.getJSON(window.location.pathname + '/wait', ->
$.get window.location.pathname + '.js', (html)->
$('#book').html html
initMathJax()
wait()
).fail -> wait()
initMathJax = ->
$('#mathJaxJS').remove()
delete MathJax
chapter_number = $('.chapter').attr('data-number')
script = ... |
Increase default font size a bit | "*":
"exception-reporting":
userId: "30e6f2d0-42d3-ab77-4984-dde4c431f019"
welcome:
showOnStartup: false
core:
projectHome: "/Users/randy/src"
audioBeep: false
excludeVcsIgnoredPaths: false
editor:
invisibles: {}
fontFamily: "Hack"
showIndentGuide: true
autosave:
enabled: t... | "*":
"exception-reporting":
userId: "30e6f2d0-42d3-ab77-4984-dde4c431f019"
welcome:
showOnStartup: false
core:
projectHome: "/Users/randy/src"
audioBeep: false
excludeVcsIgnoredPaths: false
editor:
invisibles: {}
fontFamily: "Hack"
showIndentGuide: true
fontSize: 15
autosav... |
Fix reading time for flash messages. | Wheelmap.FlashMessageView = Ember.View.extend
template: Ember.Handlebars.compile('{{ view.content.message }}')
classNameBindings: [':flash', 'content.type', ':fade', 'fadeIn:in']
fadeIn: false
didInsertElement: ()->
Ember.run.next @, 'toggleProperty', 'fadeIn'
Ember.run.later @, 'toggleProperty', 'fade... | Wheelmap.FlashMessageView = Ember.View.extend
template: Ember.Handlebars.compile('{{ view.content.message }}')
classNameBindings: [':flash', 'content.type', ':fade', 'fadeIn:in']
fadeIn: false
didInsertElement: ()->
Ember.run.next @, 'toggleProperty', 'fadeIn'
Ember.run.later @, 'toggleProperty', 'fade... |
Remove PromiseRenderer from subject default button | React = require 'react'
talkClient = require 'panoptes-client/lib/talk-client'
PromiseRenderer = require '../../components/promise-renderer'
SingleSubmitButton = require '../../components/single-submit-button'
DEFAULT_BOARD_TITLE = 'Notes' # Name of board to put subject comments
DEFAULT_BOARD_DESCRIPTION = ... | React = require 'react'
talkClient = require 'panoptes-client/lib/talk-client'
SingleSubmitButton = require '../../components/single-submit-button'
DEFAULT_BOARD_TITLE = 'Notes' # Name of board to put subject comments
DEFAULT_BOARD_DESCRIPTION = 'General comment threads about individual subjects'
module.e... |
Add open and close states by mouse over and leave | 'use strict'
class Pocket
constructor: ->
element = document.createElement 'div'
element.classList.add 'pocket'
element.innerText = 'Pocket'
document.body.appendChild element
pocket = new Pocket()
| 'use strict'
class Pocket
State:
OPEN: 'open'
CLOSE: 'close'
state: null
constructor: ->
@state = @State.CLOSE
element = document.createElement 'div'
element.classList.add 'pocket'
element.innerText = 'Pocket'
element.addEventListener 'mouseover', @onMouseOver.bind(@)
element.... |
Fix class name problem with divs | Spine = require('spine')
class Dashboard extends Spine.Controller
constructor: ->
super
@render()
tools: []
channels: []
count: 0
render: =>
@html require('views/dashboard')() if @el.html
addTool: (tool) ->
@tools.push tool
@channels.push tool.channel
createTool: (className) ->
... | Spine = require('spine')
class Dashboard extends Spine.Controller
constructor: ->
super
@render()
tools: []
channels: []
count: 0
render: =>
@html require('views/dashboard')() if @el.html
addTool: (tool) ->
@tools.push tool
@channels.push tool.channel
createTool: (className) ->
... |
Use cmd-p to toggle command-palette | # Your keymap
#
# Atom keymaps work similarly to stylesheets. Just as stylesheets use selectors
# to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts.
#
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
#
# Here's an exa... | 'atom-text-editor[data-grammar="text xml"]:not([mini])':
'tab': 'emmet:expand-abbreviation-with-tab'
'.platform-darwin':
'cmd-p': 'command-palette:toggle'
|
Comment out, still not working | if Meteor.isClient
if Package.ui
Handlebars = Package.ui.Handlebars
Handlebars.registerHelper 't9n', (x, prefix='') ->
T9n.get(x, prefix)
class T9n
@get: (x, prefix='') ->
_get(x, prefix)
@map: (language, map) ->
if not i18n.map[language]
i18n.map[language] = {}
_extend(i18n.map[la... | if Meteor.isClient
if Package.ui
Handlebars = Package.ui.Handlebars
Handlebars.registerHelper 't9n', (x, prefix='') ->
T9n.get(x, prefix)
class T9n
@get: (x, prefix='') ->
_get(x, prefix)
@map: (language, map) ->
if not i18n.map[language]
i18n.map[language] = {}
_extend(i18n.map[la... |
Remove need for buffer in `ensureSingleTrailingNewline` | {Subscriber} = require 'emissary'
module.exports =
class Whitespace
Subscriber.includeInto(this)
constructor: ->
atom.workspace.eachEditor (editor) =>
@handleEditorEvents(editor)
destroy: ->
@unsubscribe()
handleEditorEvents: (editor) ->
@subscribe editor, 'will-be-saved', =>
editor.... | {Subscriber} = require 'emissary'
module.exports =
class Whitespace
Subscriber.includeInto(this)
constructor: ->
atom.workspace.eachEditor (editor) =>
@handleEditorEvents(editor)
destroy: ->
@unsubscribe()
handleEditorEvents: (editor) ->
@subscribe editor, 'will-be-saved', =>
editor.... |
Reset sticky component before clicking back button on browser | App.FoundationExtras =
initialize: ->
$(document).foundation()
$(window).trigger "load.zf.sticky"
$(window).trigger "resize"
clearSticky = ->
$("[data-sticky]").foundation("destroy") if $("[data-sticky]").length
$(document).on("page:before-unload", clearSticky)
| App.FoundationExtras =
initialize: ->
$(document).foundation()
$(window).trigger "load.zf.sticky"
$(window).trigger "resize"
clearSticky = ->
$("[data-sticky]").foundation("destroy") if $("[data-sticky]").length
$(document).on("page:before-unload", clearSticky)
window.addEventListene... |
Revert "Added template helpers for capitalized translation" | class TourStepBox extends Backbone.Marionette.ItemView
className: 'white-well tour-block'
events:
'click .next-step': 'next'
next: ->
next_button = @$el.find('.next-step')
if next_button and next_button.data('disable-with')
next_button.addClass('disabled').text(next_button.data('disable-with'... | class TourStepBox extends Backbone.Marionette.ItemView
className: 'white-well tour-block'
events:
'click .next-step': 'next'
next: ->
next_button = @$el.find('.next-step')
if next_button and next_button.data('disable-with')
next_button.addClass('disabled').text(next_button.data('disable-with'... |
Fix ManagedAttachment method forwarding and set file property | #= require trix/models/attachment
class Trix.ManagedAttachment
# Forward all Attachment methods
for own name, value of Trix.Attachment.prototype when name isnt "constructor" and typeof value is "function"
do (name, value) =>
@::[name] = -> @attachment[name].call(@attachment, arguments)
constructor: (@... | #= require trix/models/attachment
class Trix.ManagedAttachment
# Forward all Attachment methods
for own name, value of Trix.Attachment.prototype when name isnt "constructor" and typeof value is "function"
do (name, value) =>
@::[name] = -> @attachment[name].apply(@attachment, arguments)
constructor: (... |
Set true to options.droppable for IDETabHandleView | kd = require 'kd'
KDTabHandleView = kd.TabHandleView
module.exports = class IDETabHandleView extends KDTabHandleView
constructor: (options = {}, data) ->
options.bind = 'dragstart'
super options, data
dragStart: (event) ->
## FF hack.
event.originalEvent.dataTransfer.setData 't... | kd = require 'kd'
KDTabHandleView = kd.TabHandleView
module.exports = class IDETabHandleView extends KDTabHandleView
constructor: (options = {}, data) ->
options.droppable ?= yes
options.bind = 'dragstart'
super options, data
dragStart: (event) ->
## FF hack.
event.ori... |
Make "spec" reporter the default for mocha | module.exports = (grunt) ->
# Configuration
grunt.initConfig
# Package information
pkg: grunt.file.readJSON "package.json"
# Coffeescript compilation
coffee:
glob_to_multiple:
expand: true
cwd: "src/"
src: ["*.coffee"]
dest: "lib/"
ext: ".js"
opti... | module.exports = (grunt) ->
# Configuration
grunt.initConfig
# Package information
pkg: grunt.file.readJSON "package.json"
# Coffeescript compilation
coffee:
glob_to_multiple:
expand: true
cwd: "src/"
src: ["*.coffee"]
dest: "lib/"
ext: ".js"
opti... |
Add flag for having special behavior when filtering nodes only once. | Wheelmap.ToolbarController = Ember.Controller.extend
statusFilters: ['yes', 'limited', 'no', 'unknown']
actions:
toggleFilter: (wheelchair)->
statusFilters = @get('statusFilters')
if statusFilters.contains(wheelchair)
statusFilters.removeObject(wheelchair)
else
statusFilters.... | Wheelmap.ToolbarController = Ember.Controller.extend
statusFilters: ['yes', 'limited', 'no', 'unknown']
_extraFilter: false # Flag for executing special status filter behavior only once
actions:
toggleFilter: (wheelchair)->
statusFilters = @get('statusFilters')
if !@_extraFilter && statusFilters... |
Clear promoCode when form submitted | Sprangular.directive 'promoForm', ->
restrict: 'E'
templateUrl: 'promos/form.html'
scope:
order: '='
controller: ($scope, Cart, Checkout, Angularytics) ->
$scope.showPromoEntry = false
$scope.promoCode = ''
$scope.save = ->
Cart.current.promoCode = $scope.promoCode
Angularytics.trac... | Sprangular.directive 'promoForm', ->
restrict: 'E'
templateUrl: 'promos/form.html'
scope:
order: '='
controller: ($scope, Cart, Checkout, Angularytics) ->
$scope.showPromoEntry = false
$scope.promoCode = ''
$scope.save = ->
Angularytics.trackEvent("Cart", "Coupon added", $scope.promoCode)... |
Remove auth token from task alignment csv upload | angular.module("doubtfire.api.models.task-alignment", [])
.factory("TaskAlignment", (resourcePlus, DoubtfireConstants, currentUser, $window) ->
TaskAlignment = {}
TaskAlignment.taskAlignmentCSVUploadUrl = (unit, project_id) ->
if project_id?
"#{DoubtfireConstants.API_URL}/units/#{unit.id}/learning_alignm... | angular.module("doubtfire.api.models.task-alignment", [])
.factory("TaskAlignment", (resourcePlus, DoubtfireConstants, currentUser, $window) ->
TaskAlignment = {}
TaskAlignment.taskAlignmentCSVUploadUrl = (unit, project_id) ->
if project_id?
"#{DoubtfireConstants.API_URL}/units/#{unit.id}/learning_alignm... |
Fix tests broken with last changes in Atom | Minimap = require '../lib/minimap'
{WorkspaceView} = require 'atom'
describe "Minimap", ->
beforeEach ->
runs ->
atom.workspaceView = new WorkspaceView
atom.config.set 'minimap.autoToggle', true
waitsForPromise ->
atom.workspaceView.open('sample.js')
runs ->
atom.workspaceView.... | Minimap = require '../lib/minimap'
{WorkspaceView} = require 'atom'
describe "Minimap", ->
beforeEach ->
runs ->
atom.workspaceView = new WorkspaceView
atom.config.set 'minimap.autoToggle', true
waitsForPromise ->
atom.workspaceView.open('sample.js')
runs ->
atom.workspaceView.... |
Fix to isFunction require statement |
isFunction = require 'is-function'
isObjectOrArray = require 'is-object'
isArray = require 'is-array'
###
when passed an object, returns an array of its keys.
when passed an array, returns an array of its indexes.
arrayify({a: 'aa', b: 'bb', c: 'cc'})
-> ['a', 'b', 'c']
arrayify(['one', 'two', 'three'])... |
isObjectOrArray = require 'is-object'
isArray = require 'is-array'
isFunction = require 'is-function'
###
when passed an object, returns an array of its keys.
when passed an array, returns an array of its indexes.
arrayify({a: 'aa', b: 'bb', c: 'cc'})
-> ['a', 'b', 'c']
arrayify(['one', 'two', 't... |
Fix issue calling Base.prototype.emit without any payload (data). | class Base
emitter: null
configure: (@emitter) ->
getEmitter: -> @emitter
emit: (event, data) ->
return unless @emitter
data.event = event unless data.event
@emitter.emit event, data
log: (level, module, text) ->
@emit "logger.#{level}.#{module}", level: level, module: module, text: text,... | class Base
emitter: null
configure: (@emitter) ->
getEmitter: -> @emitter
emit: (event, data) ->
return unless @emitter
data = {} unless data
data.event = event unless data.event
@emitter.emit event, data
log: (level, module, text) ->
@emit "logger.#{level}.#{module}", level: level, m... |
Add description for config setting | GitDiffView = require './git-diff-view'
DiffListView = null
diffListView = null
toggleDiffList = ->
DiffListView ?= require './diff-list-view'
diffListView ?= new DiffListView()
diffListView.toggle()
module.exports =
config:
showIconsInEditorGutter:
type: 'boolean'
default: false
activate: ... | GitDiffView = require './git-diff-view'
DiffListView = null
diffListView = null
toggleDiffList = ->
DiffListView ?= require './diff-list-view'
diffListView ?= new DiffListView()
diffListView.toggle()
module.exports =
config:
showIconsInEditorGutter:
type: 'boolean'
default: false
descrip... |
Call .dispose() on deactivate instead of .off() | SpellCheckView = null
module.exports =
config:
grammars:
type: 'array'
default: [
'source.gfm'
'text.git-commit'
'text.plain'
'text.plain.null-grammar'
]
activate: ->
@editorSubscription = atom.workspace.observeTextEditors(addViewToEditor)
deactivate: -... | SpellCheckView = null
module.exports =
config:
grammars:
type: 'array'
default: [
'source.gfm'
'text.git-commit'
'text.plain'
'text.plain.null-grammar'
]
activate: ->
@disposable = atom.workspace.observeTextEditors(addViewToEditor)
deactivate: ->
@d... |
Update tooltip after loadFromOrigin finished | class AppLinkView extends LinkView
constructor:(options = {}, data)->
options.tooltip =
title : data.body
placement : "above"
delayIn : 120
offset : 1
super options, data
# FIXME GG, Need to implement AppIsDeleted
data.on? "AppIsDeleted", =>
@destroy()
pista... | class AppLinkView extends LinkView
constructor:(options = {}, data)->
super options, data
# FIXME something wrong with setTooltip
@on "OriginLoadComplete", (data)=>
log data
@setTooltip
title : data.body
placement : "above"
delayIn : 120
offset : 1
... |
Add some warning notes about ajaxBeforeSend | # jQuery already provides a handful of global AJAX events. However,
# there is no global version of `beforeSend`, so `ajaxBeforeSend` is
# added to complement it.
#
# Reference: http://docs.jquery.com/Ajax_Events
return unless $.ajaxSetup
$.ajaxSetup
beforeSend: (xhr, settings) ->
return unless settings.global
... | # Implements global `ajaxBeforeSend` event.
#
# jQuery already provides a handful of global AJAX events. However,
# there is no global version of `beforeSend`, so `ajaxBeforeSend` is
# added to complement it.
#
# Reference: http://docs.jquery.com/Ajax_Events
# Skip for Zepto which doesn't have ajaxSetup but does alrea... |
Replace inline pistachio string with a KDCustomHTMLView. | class NavigationMachineItem extends JView
{Running, Stopped} = Machine.State
stateClasses = ''
stateClasses += "#{state.toLowerCase()} " for state in Object.keys Machine.State
constructor:(options = {}, data)->
machine = data
@alias = machine.getName()
path ... | class NavigationMachineItem extends JView
{Running, Stopped} = Machine.State
stateClasses = ''
stateClasses += "#{state.toLowerCase()} " for state in Object.keys Machine.State
constructor:(options = {}, data)->
machine = data
@alias = machine.getName()
path ... |
Kill the unnecessary explicit call to initialize since new already does that for us. |
class window.Cartilage.Application
@Collections: {}
@Models: {}
@Routers: {}
@Views: {}
@sharedInstance: null
@launch: ->
@sharedInstance = new @
@sharedInstance.initialize()
@hijackLinks()
@hijackLinks: ->
if Backbone.history and Backbone.history._hasPushState
$(document).deleg... |
class window.Cartilage.Application
@Collections: {}
@Models: {}
@Routers: {}
@Views: {}
@sharedInstance: null
@launch: ->
@sharedInstance = new @
@hijackLinks()
@hijackLinks: ->
if Backbone.history and Backbone.history._hasPushState
$(document).delegate "a", "click", (event) ->
... |
Use fs.extension instead of regex | fs = require 'fs'
Theme = require 'theme'
module.exports =
class AtomTheme extends Theme
loadStylesheet: (stylesheetPath)->
@stylesheets[stylesheetPath] = fs.read(stylesheetPath)
load: ->
if /\.css$/.test(@path)
@loadStylesheet @path
else
metadataPath = fs.resolveExtension(fs.join(@path, ... | fs = require 'fs'
Theme = require 'theme'
module.exports =
class AtomTheme extends Theme
loadStylesheet: (stylesheetPath)->
@stylesheets[stylesheetPath] = fs.read(stylesheetPath)
load: ->
if fs.extension(@path) is '.css'
@loadStylesheet(@path)
else
metadataPath = fs.resolveExtension(fs.jo... |
Fix pass msg in nm |
lifecycle = require './hdp/lifecycle'
module.exports = []
module.exports.push 'histi/actions/hdp_yarn'
module.exports.push (ctx) ->
require('./hdp_yarn').configure ctx
module.exports.push (ctx, next) ->
@name 'HDP Hadoop NM # Start'
lifecycle.nm_start ctx, (err, started) ->
next err, if started then ctx.O... |
lifecycle = require './hdp/lifecycle'
module.exports = []
module.exports.push 'histi/actions/hdp_yarn'
module.exports.push (ctx) ->
require('./hdp_yarn').configure ctx
module.exports.push (ctx, next) ->
@name 'HDP Hadoop NM # Start'
lifecycle.nm_start ctx, (err, started) ->
next err, if started then ctx.O... |
Add base query to send to BaseX REST server | express = require 'express'
router = express.Router()
# Search
router.get '/search', (req, res) ->
res.render 'search/results', (
title: req.config.title
query: req.query.q
)
module.exports = router
| express = require 'express'
xmler = require 'node-xmler'
router = express.Router()
# Search
router.get '/search', (req, res) ->
if req.query.q
# TODO: Build query and send to BaseX REST server
query = new xmler.Element 'query'
text = new xmler.Element 'text', req.query.q
query.addElement text
res... |
Update help text subject mentioning syntax options | React = require 'react'
module?.exports = React.createClass
displayName: 'TalkCommentHelp'
render: ->
<div className="talk-comment-help">
<h1>Guide to commenting on talk</h1>
<p>Talk comments are written in <a href='http://daringfireball.net/projects/markdown/basics'>markdown</a></p>
<p>Ment... | React = require 'react'
module?.exports = React.createClass
displayName: 'TalkCommentHelp'
render: ->
<div className="talk-comment-help">
<h1>Guide to commenting on talk</h1>
<p>Talk comments are written in <a href='http://daringfireball.net/projects/markdown/basics'>markdown</a></p>
<p>Ment... |
Fix error on closed socket | net = require 'net'
server = (comp) ->
net.createServer (socket) ->
sendEvent = (event) ->
socket.write JSON.stringify(event) + "\n"
stopListening = comp.events.onValue sendEvent
for event in comp.seedRecords()
sendEvent event
socket.on 'end', ->
do stopListening
module.exports ... | net = require 'net'
server = (comp) ->
net.createServer (socket) ->
sendEvent = (event) ->
try
socket.write JSON.stringify(event) + "\n"
catch error
do stopListening
stopListening = comp.events.onValue sendEvent
for event in comp.seedRecords()
sendEvent event
sock... |
Watch by default, add "gulp nowatch" variant | gulp = require 'gulp'
# Browserify
browserify = require 'browserify'
source = require 'vinyl-source-stream'
gulp.task 'build', ->
browserify('./OperationalTransform.coffee', extensions: ['.coffee'], standalone: 'OperationalTransform')
.bundle()
.pipe source 'OperationalTransform.js'
.pipe gulp... | gulp = require 'gulp'
# Browserify
browserify = require 'browserify'
source = require 'vinyl-source-stream'
gulp.task 'build', ->
browserify('./OperationalTransform.coffee', extensions: ['.coffee'], standalone: 'OperationalTransform')
.bundle()
.pipe source 'OperationalTransform.js'
.pipe gulp... |
Add PoC register API method | module.exports =
activate: ->
return
# deactivate: ->
provideBuildService: ->
register: (name, details) ->
console.log(name)
| module.exports =
activate: ->
@commands = atom.commands.add 'atom-workspace',
'gluon:build': =>
fn() if fn = @builders[Object.keys(@builders)?[0]]
deactivate: ->
@commands.dispose()
provideBuildService: ->
register: (name, details) =>
@builders ?= {}
@builders[name] = detai... |
Add null grammar to defaults | SpellCheckView = null
module.exports =
configDefaults:
grammars: [
'source.gfm'
'text.git-commit'
'text.plain'
]
activate: ->
@editorSubscription = atom.workspaceView.eachEditorView(addViewToEditor)
deactivate: ->
@editorSubscription?.off()
addViewToEditor = (editorView) ->
... | SpellCheckView = null
module.exports =
configDefaults:
grammars: [
'source.gfm'
'text.git-commit'
'text.plain'
'text.plain.null-grammar'
]
activate: ->
@editorSubscription = atom.workspaceView.eachEditorView(addViewToEditor)
deactivate: ->
@editorSubscription?.off()
add... |
Fix typo in local var names for setting the iframe source | Mercury.PageEditor::setFrameSource = (url)->
newPath = "#{path}?_=#{new Date().getTime()}"
@iframe.get(0).contentWindow.document.location.href = newPath
class CMSimple.Editor extends Spine.Controller
el: 'body'
constructor: (@current_page)->
super()
@setCurrentPage(@current_page)
@initializeMercury... | Mercury.PageEditor::setFrameSource = (url)->
newUrl = "#{url}?_=#{new Date().getTime()}"
@iframe.get(0).contentWindow.document.location.href = newUrl
class CMSimple.Editor extends Spine.Controller
el: 'body'
constructor: (@current_page)->
super()
@setCurrentPage(@current_page)
@initializeMercury()
... |
Test for visualisation edit box save-on-close | assert = chai.assert
createAndShowVisualisationViewForOptions = (options) ->
view = new Backbone.Views.ReportEditVisualisationView(options)
view.render()
$('#test-container').html(view.el)
return view
suite('ReportEditVisualisationView')
test("Shows the given indicator title", ->
indicatorTitle = "my lovel... | assert = chai.assert
createAndShowVisualisationViewForOptions = (options) ->
view = new Backbone.Views.ReportEditVisualisationView(options)
view.render()
$('#test-container').html(view.el)
return view
suite('ReportEditVisualisationView')
test("Shows the given indicator title", ->
indicatorTitle = "my lovel... |
Add Windows & Linux key bindings | # 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... |
Set active: true on registration | Meteor.methods
registerUser: (formData) ->
userData =
email: formData.email
password: formData.pass
userId = Accounts.createUser userData
Meteor.users.update userId,
$set:
name: formData.name
if userData.email
Accounts.sendVerificationEmail(userId, userData.email);
| Meteor.methods
registerUser: (formData) ->
userData =
email: formData.email
password: formData.pass
userId = Accounts.createUser userData
Meteor.users.update userId,
$set:
name: formData.name
active: true
if userData.email
Accounts.sendVerificationEmail(userId, userData.email);
|
Change regex that determines whether a link is to an image | module.exports = class Util
# Return true if uri string is a URI to an image
@isImageUri: (uri) ->
uri.match(/^https?\:\/\/.*\.(jpeg|jpg|gif|png)$/i)?
# Merge input objects into one object
@merge = (xs...) ->
tap = (o, fn) -> fn(o); o
if xs?.length > 0
tap {}, (m) -> m[k] = v for k, v of x f... | module.exports = class Util
# Return true if uri string is a URI to an image
@isImageUri: (uri) ->
uri.match(/^https?\:\/\/.*[\.|=](jpeg|jpg|gif|png)$/i)?
# Merge input objects into one object
@merge = (xs...) ->
tap = (o, fn) -> fn(o); o
if xs?.length > 0
tap {}, (m) -> m[k] = v for k, v of... |
Add test for modifying the global API after subclassing. | require './setup'
db = null
describe 'api', ->
afterEach ->
Ento.object.api(undefined)
describe 'mock', ->
beforeEach ->
db = { foo: 200 }
Ento.object.api(db)
it 'api is accessible in model', ->
Model = Ento()
expect(Model.api()).eql db
it 'api is accessible in instance'... | require './setup'
db = null
describe 'api', ->
afterEach ->
Ento.object.api(undefined)
describe 'mock', ->
beforeEach ->
db = { foo: 200 }
Ento.object.api(db)
it 'api is accessible in model', ->
Model = Ento()
expect(Model.api()).eql db
it 'api is accessible in instance'... |
Make client/facts/new support asynchronous user loading | class window.ClientController
constructor: (@annotatedSiteEnvoy) ->
showFact: (fact_id) ->
@_renderDiscussion new Fact id: fact_id
showNewFact: (params={}) =>
fact = new Fact
displaystring: params.displaystring
url: params.url
site_title: params.site_title
if FactlinkApp.signedIn()... | class window.ClientController
constructor: (@annotatedSiteEnvoy) ->
showFact: (fact_id) ->
@_renderDiscussion new Fact id: fact_id
showNewFact: (params={}) =>
fact = new Fact
displaystring: params.displaystring
url: params.url
site_title: params.site_title
if FactlinkApp.signedIn()... |
Fix display line breaks test | moduleFor 'helper:displayLineBreaks', 'Unit: Display line breaks',
setup: -> setupApp()
teardown: -> ETahi.reset()
test "#displayLineBreaks", ->
fn = Em.Handlebars.helpers.displayLineBreaks._rawFunction
equal fn("Tahi\nis\ncool").string, "Tahi<br>is<br>cool"
equal fn("").string, ""
| module 'helper:displayLineBreaks', 'Unit: Display line breaks',
setup: -> setupApp()
teardown: -> ETahi.reset()
test "#displayLineBreaks", ->
fn = Em.Handlebars.helpers.displayLineBreaks._rawFunction
equal fn("Tahi\nis\ncool").string, "Tahi<br>is<br>cool"
equal fn("").string, ""
|
Build coffee files in source subdirs | module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
coffee:
glob_to_multiple:
expand: true
cwd: 'src'
src: ['*.coffee']
dest: 'lib'
ext: '.js'
coffeelint:
options:
max_line_length:
level: 'ignore'
... | module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
coffee:
glob_to_multiple:
expand: true
cwd: 'src'
src: ['**/*.coffee']
dest: 'lib'
ext: '.js'
coffeelint:
options:
max_line_length:
level: 'ignore'
... |
Add a common refresh function | class Fustrate.GenericPage
constructor: (@root) ->
@_reloadUIElements()
@addEventListeners()
@initialize()
addEventListeners: ->
# Once the interface is loaded and the event listeners are active, run any
# other tasks.
initialize: ->
_reloadUIElements: =>
@fields = {}
@buttons = {}
... | class Fustrate.GenericPage
constructor: (@root) ->
@_reloadUIElements()
@addEventListeners()
@initialize()
addEventListeners: ->
# Once the interface is loaded and the event listeners are active, run any
# other tasks.
initialize: ->
_reloadUIElements: =>
@fields = {}
@buttons = {}
... |
Remove rodapé da distribuição por unidade orçamentária | angular.module('InescApp').directive 'uoGraph', ['$filter', ($filter) ->
columns = [
{ sTitle: 'Entidade Orçamentária', bSortable: false }
{ sTitle: 'Orçamento Autorizado', bSortable: false, sClass: 'currency' }
{ sTitle: 'Percentual do total', bSortable: false, sClass: 'percentual' }
{ sTitle: 'Orçam... | angular.module('InescApp').directive 'uoGraph', ['$filter', ($filter) ->
columns = [
{ sTitle: 'Entidade Orçamentária', bSortable: false }
{ sTitle: 'Orçamento Autorizado', bSortable: false, sClass: 'currency' }
{ sTitle: 'Percentual do total', bSortable: false, sClass: 'percentual' }
{ sTitle: 'Orçam... |
Make the "x" button work by going back. | 'use strict'
app.controller 'asset/view', [
'$scope', 'displayService', 'asset',
($scope, display, asset) ->
$scope.asset = asset
display.title = asset.displayName
$scope.volume = asset.volume
$scope.hasThumbnail = (asset.format.type == 'image' || asset.format.type == 'video' && asset.duration && !... | 'use strict'
app.controller 'asset/view', [
'$scope', 'displayService', 'asset',
($scope, display, asset) ->
$scope.close = ->
window.history.back()
$scope.asset = asset
display.title = asset.displayName
$scope.volume = asset.volume
$scope.hasThumbnail = (asset.format.type == 'image' || a... |
Add deprected warnings to old options | mozilla = require('source-map')
module.exports = (old) ->
opts = { }
map = { }
for name, value of old
if name == 'map'
if value == 'inline'
map.inline = true
else if typeof(value) == 'string'
map.prev = value
else if value instanceof mozilla.SourceMapConsumer
map.... | mozilla = require('source-map')
deprected = (from, to) ->
console.warn(
"Option #{ from } is deprected and will be deleted in PostCSS 1.1.\n" +
"Use map: { #{ to } } instead.")
module.exports = (old) ->
opts = { }
map = { }
for name, value of old
if name == 'map'
if value == 'inline'
... |
Add comments to clientside code | class Water.TreeView extends Backbone.View
initialize: () ->
@model.on("change:data", @render_tree)
@model.on("start_fetch", @render_loading)
render_tree: () =>
$("#indicator").hide()
@$el.hide()
@$el.html @model.get("data")
@$el.fadeIn("slow")
render_loading: () =>
loading_ind... | class Water.TreeView extends Backbone.View
initialize: () ->
# Bind to events in the model
@model.on("change:data", @render_tree)
@model.on("start_fetch", @render_loading)
# Re-renders the tree whenever the data in the model changes
render_tree: () =>
# Hide the activity indicator
$("#indic... |
Use more generic core.excludeVcsIgnoredPaths config key | _ = require 'underscore'
BufferedProcess = require 'buffered-process'
module.exports =
class LoadPathsTask
constructor: (@callback) ->
start: ->
rootPath = project.getPath()
ignoredNames = config.get('fuzzyFinder.ignoredNames') ? []
ignoredNames = ignoredNames.concat(config.get('core.ignoredNames') ? ... | _ = require 'underscore'
BufferedProcess = require 'buffered-process'
module.exports =
class LoadPathsTask
constructor: (@callback) ->
start: ->
rootPath = project.getPath()
ignoredNames = config.get('fuzzyFinder.ignoredNames') ? []
ignoredNames = ignoredNames.concat(config.get('core.ignoredNames') ? ... |
Read mongodb connection from config. |
express = require 'express'
stylus = require 'stylus'
assets = require 'connect-assets'
mongoose = require 'mongoose'
#### Basic application initialization
# Create app instance.
app = express()
# Define Port
app.port = process.env.PORT or process.env.VMC_APP_PORT or 3000
# Config module exports has `setEnvironme... |
express = require 'express'
stylus = require 'stylus'
assets = require 'connect-assets'
mongoose = require 'mongoose'
#### Basic application initialization
# Create app instance.
app = express()
# Define Port
app.port = process.env.PORT or process.env.VMC_APP_PORT or 3000
# Config module exports has `setEnvironme... |
Remove focus when calling 'show' twice | FactlinkApp.module "Overlay", (Overlay, FactlinkApp, Backbone, Marionette, $, _) ->
$overlay_elements = $('<div class="overlay"></div><div class="overlay-transparent"></div>')
.appendTo('body')
$focus_el = null
Overlay.show = ($el) ->
$overlay_elements.fadeIn 'fast'
$focus_el = $el
$focus_el?.a... | FactlinkApp.module "Overlay", (Overlay, FactlinkApp, Backbone, Marionette, $, _) ->
$overlay_elements = $('<div class="overlay"></div><div class="overlay-transparent"></div>')
.appendTo('body')
$focus_el = null
Overlay.show = ($el) ->
$overlay_elements.fadeIn 'fast'
Overlay.removeFocus()
$focus... |
Make conditions easier to read | App.BudgetEditAssociations =
set_text: (response)->
$(".js-budget-show-administrators-list").text(response["administrators"])
$(".js-budget-show-valuators-list").text(response["valuators"])
$(".js-budget-show-trackers-list").text(response["trackers"])
initialize: ->
$(".js-budget-list-checkbox-use... | App.BudgetEditAssociations =
set_text: (response)->
$(".js-budget-show-administrators-list").text(response["administrators"])
$(".js-budget-show-valuators-list").text(response["valuators"])
$(".js-budget-show-trackers-list").text(response["trackers"])
initialize: ->
$(".js-budget-list-checkbox-use... |
Add missing id to paper test data. | moduleFor 'view:paperEdit', 'Unit: paperEditView',
teardown: ->
ETahi.VisualEditorService.create.restore()
ETahi.reset()
setup: ->
paper = Ember.Object.create
title: ''
shortTitle: 'Does not matter'
body: 'hello'
sinon.stub(ETahi.VisualEditorService, 'create').returns
enabl... | moduleFor 'view:paperEdit', 'Unit: paperEditView',
teardown: ->
ETahi.VisualEditorService.create.restore()
ETahi.reset()
setup: ->
paper = Ember.Object.create
id: 5
title: ''
shortTitle: 'Does not matter'
body: 'hello'
sinon.stub(ETahi.VisualEditorService, 'create').returns... |
Exclude VCS ignored paths in Atom | "*":
"exception-reporting":
userId: "1f6d8ded-d27b-39e5-b84e-95714f424379"
welcome:
showOnStartup: false
core:
projectHome: "/Users/Richard/Dropbox/Projects"
themes: [
"one-dark-ui"
"base16-tomorrow-dark-theme"
]
disabledPackages: [
"relative-numbers"
"timecop"
... | "*":
"exception-reporting":
userId: "1f6d8ded-d27b-39e5-b84e-95714f424379"
welcome:
showOnStartup: false
core:
projectHome: "/Users/Richard/Dropbox/Projects"
themes: [
"one-dark-ui"
"base16-tomorrow-dark-theme"
]
disabledPackages: [
"relative-numbers"
"timecop"
... |
Disable some Atom packages by default | "*":
core:
disabledPackages: [
"background-tips"
"exception-reporting"
"metrics"
"welcome"
]
editor:
invisibles: {}
showIndentGuide: true
showInvisibles: true
fontFamily: "Source Code Pro"
| "*":
core:
disabledPackages: [
"background-tips"
"exception-reporting"
"metrics"
"styleguide"
"timecop"
"welcome"
]
editor:
invisibles: {}
showIndentGuide: true
showInvisibles: true
fontFamily: "Source Code Pro"
|
Disable loading after no more results | Backbone = require 'backbone'
mediator = require '../../../lib/mediator.coffee'
template = -> require('../templates/partials/_channel_groups.jade') arguments...
class ProfileView extends Backbone.View
loading: false
disabled: false
threshold: -500
page: 2
initialize: ->
@timer = setInterval @maybeLoad, ... | Backbone = require 'backbone'
mediator = require '../../../lib/mediator.coffee'
template = -> require('../templates/partials/_channel_groups.jade') arguments...
class ProfileView extends Backbone.View
loading: false
disabled: false
threshold: -500
page: 2
initialize: ->
@timer = setInterval @maybeLoad, ... |
Allow touch devices to dismiss flash bar | $(document)
.on("click", ".flash-bar-show", ->
$(this).removeClass("flash-bar-show")
)
| $(document)
.on("click touchstart", ".flash-bar-show", ->
$(this).removeClass("flash-bar-show")
)
|
Remove unessessary old commented code | _ = require "underscore"
Transform = require "./transform"
class Jitter extends Transform.Model
initialize: (attrs, options) ->
super(attrs, options)
defaults: ->
return _.extend({}, super(), {
width: 1
})
compute: (x) ->
# Apply the transform to a single value
return(x + ((Math.rando... | _ = require "underscore"
Transform = require "./transform"
class Jitter extends Transform.Model
initialize: (attrs, options) ->
super(attrs, options)
defaults: ->
return _.extend({}, super(), {
width: 1
})
compute: (x) ->
# Apply the transform to a single value
return(x + ((Math.rando... |
Drop the minimum Serrano version to >= 2.0.24 | define [
'./cilantro/core'
'./cilantro/changelog'
'./cilantro/models'
'./cilantro/structs'
'./cilantro/ui'
], (c, changelog, models, structs, ui) ->
c.changelog = changelog
c.models = models
c.structs = structs
c.ui = ui
# Defines the minimum version of Serrano that this versio... | define [
'./cilantro/core'
'./cilantro/changelog'
'./cilantro/models'
'./cilantro/structs'
'./cilantro/ui'
], (c, changelog, models, structs, ui) ->
c.changelog = changelog
c.models = models
c.structs = structs
c.ui = ui
# Defines the minimum version of Serrano that this versio... |
Switch back to dark themes | "*":
autosave:
enabled: true
core:
audioBeep: false
themes: [
"one-light-ui"
"one-light-syntax"
]
projectHome: "/Users/randy/src"
editor:
fontFamily: "Hack"
fontSize: 19
invisibles: {}
showIndentGuide: true
tabType: "soft"
emmet: {}
"exception-reporting":
... | "*":
autosave:
enabled: true
core:
audioBeep: false
]
projectHome: "/Users/randy/src"
editor:
fontFamily: "Hack"
fontSize: 19
invisibles: {}
showIndentGuide: true
tabType: "soft"
emmet: {}
"exception-reporting":
userId: "30e6f2d0-42d3-ab77-4984-dde4c431f019"
"expand-r... |
Fix TerminalPane until we support for multiple vms | class TerminalPane extends Pane
constructor: (options = {}, data) ->
options.cssClass = "terminal-pane terminal"
options.delay ?= 0
super options, data
@createWebTermView()
@webterm.on "WebTermConnected", (@remote) =>
@emit "WebtermCreated"
@onWebTermConnected()
createWebTer... | class TerminalPane extends Pane
constructor: (options = {}, data) ->
options.cssClass = "terminal-pane terminal"
options.delay ?= 0
super options, data
@createWebTermView()
createWebTermView: ->
KD.singletons.vmController.fetchDefaultVm (err, vm)=>
@webterm = new WebTe... |
Add warning advising of no WiFi on Pi 2 | deviceTypesCommon = require '@resin.io/device-types/common'
{ networkOptions, commonImg, instructions } = deviceTypesCommon
module.exports =
version: 1
slug: 'raspberry-pi2'
aliases: [ 'raspberrypi2' ]
name: 'Raspberry Pi 2'
arch: 'armv7hf'
state: 'released'
instructions: commonImg.instructions
gettingStarted... | deviceTypesCommon = require '@resin.io/device-types/common'
{ networkOptions, commonImg, instructions } = deviceTypesCommon
module.exports =
version: 1
slug: 'raspberry-pi2'
aliases: [ 'raspberrypi2' ]
name: 'Raspberry Pi 2'
arch: 'armv7hf'
state: 'released'
imageDownloadAlerts: [
{
type: 'warning'
mes... |
Fix bug with JS error from dropdowns in filter area | class @Breakpoints
instance = null;
class BreakpointInstance
BREAKPOINTS = ["xs", "sm", "md", "lg"]
constructor: ->
@setup()
setup: ->
allDeviceSelector = BREAKPOINTS.map (breakpoint) ->
".device-#{breakpoint}"
return if $(allDeviceSelector.join(",")).length
# Create... | class @Breakpoints
instance = null;
class BreakpointInstance
BREAKPOINTS = ["xs", "sm", "md", "lg"]
constructor: ->
@setup()
setup: ->
allDeviceSelector = BREAKPOINTS.map (breakpoint) ->
".device-#{breakpoint}"
return if $(allDeviceSelector.join(",")).length
# Create ... |
Add context inside scope: used to specify display |
OFNShared.directive "questionMarkWithTooltip", ($tooltip)->
# We use the $tooltip service from Angular foundation to give us boilerplate
# Subsequently we patch the scope, template and restrictions
tooltip = $tooltip 'questionMarkWithTooltip', 'questionMarkWithTooltip', 'click'
tooltip.scope =
variant: "="... |
OFNShared.directive "questionMarkWithTooltip", ($tooltip)->
# We use the $tooltip service from Angular foundation to give us boilerplate
# Subsequently we patch the scope, template and restrictions
tooltip = $tooltip 'questionMarkWithTooltip', 'questionMarkWithTooltip', 'click'
tooltip.scope =
context: "="... |
Add first draft for better presentation of info popups in responsive toolbar. | Wheelmap.StatusFilterButtonComponent = Wheelmap.WheelchairPopoverComponent.extend
tagName: 'button'
classNameBindings: [':btn', 'isActive:active', ':btn-info', 'wheelchair']
wheelchair: null
activeFilters: null
template: Ember.Handlebars.compile('<span></span>')
popoverOptions:
trigger: 'hover'
pla... | Wheelmap.StatusFilterButtonComponent = Wheelmap.WheelchairPopoverComponent.extend
tagName: 'button'
classNameBindings: [':btn', 'isActive:active', ':btn-info', 'wheelchair']
wheelchair: null
activeFilters: null
template: Ember.Handlebars.compile('<span></span>')
popoverOptions:
trigger: 'hover'
pla... |
Add ctrl-n,p emacs bindings for next, previous | ".autocomplete-plus input.hidden-input":
"tab": "autocomplete-plus:confirm"
"down": "autocomplete-plus:select-next"
"up": "autocomplete-plus:select-previous"
"escape": "autocomplete-plus:cancel"
".editor":
"ctrl-shift-space": "autocomplete-plus:activate"
| ".autocomplete-plus input.hidden-input":
"tab": "autocomplete-plus:confirm"
"down": "autocomplete-plus:select-next"
"ctrl-n": "autocomplete-plus:select-next"
"up": "autocomplete-plus:select-previous"
"ctrl-p": "autocomplete-plus:select-previous"
"escape": "autocomplete-plus:cancel"
".editor":
"ctrl-shift... |
Make it visible by default for testing fastly | class MainChatPanel extends JView
constructor:->
super
cssClass : 'main-chat-panel'
@registerSingleton "chatPanel", @, yes
@conversationList = new ChatConversationListView
@conversationListController = new ChatConversationListController
view : @conversationList
viewAppended:->
@a... | class MainChatPanel extends JView
constructor:->
super
cssClass : 'main-chat-panel visible'
@registerSingleton "chatPanel", @, yes
@conversationList = new ChatConversationListView
@conversationListController = new ChatConversationListController
view : @conversationList
viewAppended:-... |
Add some comments and logging to the cam parser. | sys = require 'sys'
fs = require 'fs'
xml2js = require 'xml2js'
_ = require 'underscore'
URL = require 'url'
mongoose = require 'mongoose'
parser = new xml2js.Parser()
parser.addListener 'end', (result) ->
Camera = new mongoose.Schema
name: String
url: String
loc:
x: Number
... | sys = require 'sys'
fs = require 'fs'
xml2js = require 'xml2js'
_ = require 'underscore'
URL = require 'url'
mongoose = require 'mongoose'
parser = new xml2js.Parser()
parser.addListener 'end', (result) ->
# Define the mongoose schema
Camera = new mongoose.Schema
name: String
url: String
... |
Remove require directive from component JS | #= require jquery
$(document).on 'uic:domchange', (e) ->
$(e.target).find('[data-toggle="markdown-readonly"]').each (_, el) ->
$el = $(el)
$el.html(marked(decodeURIComponent($el.data('markdown'))))
$el.show()
| $(document).on 'uic:domchange', (e) ->
$(e.target).find('[data-toggle="markdown-readonly"]').each (_, el) ->
$el = $(el)
$el.html(marked(decodeURIComponent($el.data('markdown'))))
$el.show()
|
Add method to update pagination | class Fustrate.GenericTable extends Fustrate.GenericPage
@blankRow: null
table: null
initialize: =>
super
@reloadTable()
reloadTable: ->
sortRows: (rows, sortFunction = ->) ->
([sortFunction(row), row] for row in rows)
.sort (x, y) -> if x[0] == y[0] then 0 else x[0] > y[0]
.map (r... | class Fustrate.GenericTable extends Fustrate.GenericPage
@blankRow: null
table: null
initialize: =>
super
@reloadTable()
reloadTable: ->
sortRows: (rows, sortFunction = ->) ->
([sortFunction(row), row] for row in rows)
.sort (x, y) -> if x[0] == y[0] then 0 else x[0] > y[0]
.map (r... |
Correct package menu label to show Term 3 instead of Term 2 | # See https://atom.io/docs/latest/creating-a-package#menus for more details
# 'context-menu':
# '.overlayer':
# 'Open terminal here': 'term:open'
'menu': [
'label': 'Packages'
'submenu': [
'label': 'Term 2'
'submenu': [
{'label': 'Open New Terminal in New Tab', 'command': 'term3:open'}
... | # See https://atom.io/docs/latest/creating-a-package#menus for more details
# 'context-menu':
# '.overlayer':
# 'Open terminal here': 'term:open'
'menu': [
'label': 'Packages'
'submenu': [
'label': 'Term 3'
'submenu': [
{'label': 'Open New Terminal in New Tab', 'command': 'term3:open'}
... |
Add auth handler to remove session data when sign out | Ember.Application.initializer
name: 'session'
after: 'ember-auth-load'
initialize: (container, application) ->
Dashboard.Session = Ember.Object.extend(
init: ->
auth = container.lookup 'auth:main'
auth.addHandler 'signInSuccess', ->
sessionStorage.setItem('authToken', auth.g... | Ember.Application.initializer
name: 'session'
after: 'ember-auth-load'
initialize: (container, application) ->
Dashboard.Session = Ember.Object.extend(
init: ->
auth = container.lookup 'auth:main'
auth.addHandler 'signInSuccess', ->
sessionStorage.setItem('authToken', auth.g... |
Update .ctags pattern for unpacking | asar = require 'asar'
fs = require 'fs'
path = require 'path'
module.exports = (grunt) ->
{cp, rm} = require('./task-helpers')(grunt)
grunt.registerTask 'generate-asar', 'Generate asar archive for the app', ->
done = @async()
unpack = [
'*.node'
'ctags-darwin'
'ctags-linux'
'ctags... | asar = require 'asar'
fs = require 'fs'
path = require 'path'
module.exports = (grunt) ->
{cp, rm} = require('./task-helpers')(grunt)
grunt.registerTask 'generate-asar', 'Generate asar archive for the app', ->
done = @async()
unpack = [
'*.node'
'*.ctags'
'ctags-darwin'
'ctags-lin... |
Split track initial turn on function body | kd = require 'kd'
nick = require 'app/util/nick'
Tracker = require 'app/util/tracker'
module.exports = (machine) ->
return unless analytics
return unless typeof analytics.user is 'function'
{ initialTurnOn } = analytics.user().traits()
return if initialTurnOn
initialTurnOn = yes
analytics.iden... | kd = require 'kd'
nick = require 'app/util/nick'
Tracker = require 'app/util/tracker'
module.exports = (machine) ->
return unless analytics
return unless typeof analytics.user is 'function'
{ initialTurnOn } = analytics.user().traits()
return if initialTurnOn
initialTurnOn = yes
analytics.iden... |
Remove session from cookie set option | class @MixingpanelCookies
constructor: ()->
@_loadCookies()
@cookieDefOpts =
domain: null
path: null
expires_at: null
_loadCookies: ->
for cookie_token in document.cookie.split("; ")
[key, value] = cookie_token.split("=")
@[key] = value
set: (key, value, opts = {})->
... | class @MixingpanelCookies
constructor: ()->
@_loadCookies()
@cookieDefOpts =
domain: null
path: null
expires_at: null
_loadCookies: ->
for cookie_token in document.cookie.split("; ")
[key, value] = cookie_token.split("=")
@[key] = value
set: (key, value, opts = {})->
... |
Update configuration schema to reflect that we expect an array of BibTeX file names. | BibtexProvider = require "./provider"
module.exports =
config:
bibtex:
type: 'string'
default: ''
scope:
type: 'string'
default: '.source.gfm'
resultTemplate:
type: 'string'
default: '@[key]'
activate: ->
@provider = new BibtexProvider()
deactivate: ->
@p... | BibtexProvider = require "./provider"
module.exports =
config:
bibtex:
type: 'array'
default: []
items:
type: 'string'
scope:
type: 'string'
default: '.source.gfm'
resultTemplate:
type: 'string'
default: '@[key]'
activate: ->
@provider = new Bibtex... |
Fix facebook images to make sure they are squares | root = exports ? this
root.User = class User
@findOne: (idOrName) ->
data = Meteor.users.findOne(idOrName)
if not data
data = Meteor.users.findOne({'profile.name': new RegExp('^' + idOrName + '$', 'i')})
new User(data)
@current: ->
Meteor.userId() and new User(Meteor.user())
constructor: ... | root = exports ? this
root.User = class User
@findOne: (idOrName) ->
data = Meteor.users.findOne(idOrName)
if not data
data = Meteor.users.findOne({'profile.name': new RegExp('^' + idOrName + '$', 'i')})
new User(data)
@current: ->
Meteor.userId() and new User(Meteor.user())
constructor: ... |
Mark visible toggle switch as hidden from screen readers | define [
"base"
], (App) ->
App.directive "toggleSwitch", () ->
restrict: "E"
scope:
description: "@"
labelFalse: "@"
labelTrue: "@"
ngModel: "="
template: """
<fieldset class="toggle-switch">
<legend class="sr-only">{{description}}</legend>
<input
type="radio"
... | define [
"base"
], (App) ->
App.directive "toggleSwitch", () ->
restrict: "E"
scope:
description: "@"
labelFalse: "@"
labelTrue: "@"
ngModel: "="
template: """
<fieldset class="toggle-switch">
<legend class="sr-only">{{description}}</legend>
<input
type="radio"
... |
Add option to set a style for the map and hide the terrain options | define('base_layer', [], ->
class BaseLayer
@render: (map, opts={}) ->
terrain = L.mapbox.tileLayer('unepwcmc.l8gj1ihl')
satellite = L.mapbox.tileLayer('unepwcmc.lac5fjl1')
L.control.layers({
"<span data-layer='Terrain'>Terrain</span>": terrain,
"<span data-layer='Satellite'>Sa... | define('base_layer', [], ->
class BaseLayer
@render: (map, opts={}) ->
terrain = L.mapbox.tileLayer('unepwcmc.l8gj1ihl')
satellite = L.mapbox.tileLayer('unepwcmc.lac5fjl1')
marine = L.mapbox.styleLayer('mapbox://styles/unepwcmc/cj63iq5m04i142rl0481raoxj')
# add Terrain/Satellite button
... |
Use services to access injected data arrays | angular.module("admin.subscriptions").controller "SubscriptionController", ($scope, Subscription, SubscriptionForm, customers, schedules, paymentMethods, shippingMethods) ->
$scope.subscription = new Subscription()
$scope.errors = null
$scope.save = null
$scope.customers = customers
$scope.schedules = schedul... | angular.module("admin.subscriptions").controller "SubscriptionController", ($scope, Subscription, SubscriptionForm, Customers, Schedules, PaymentMethods, ShippingMethods) ->
$scope.subscription = new Subscription()
$scope.errors = null
$scope.save = null
$scope.customers = Customers.all
$scope.schedules = Sch... |
Fix profile avatar component: Don't render until profile fetch has been attempted | Marbles.Views.ProfileAvatar = class ProfileAvatarView extends Marbles.Views.ProfileComponent
@template_name: '_profile_avatar'
@view_name: 'profile_avatar'
constructor: ->
super
@on 'ready', @checkImageMortality
@render()
checkImageMortality: =>
img = Marbles.DOM.querySelector('img', @el)
... | Marbles.Views.ProfileAvatar = class ProfileAvatarView extends Marbles.Views.ProfileComponent
@template_name: '_profile_avatar'
@view_name: 'profile_avatar'
constructor: ->
super
@on 'ready', @checkImageMortality
checkImageMortality: =>
img = Marbles.DOM.querySelector('img', @el)
unless img.co... |
Add a rooms param to notify method to notify in multiple rooms | path = require('path')
class HubotSensor
constructor: (@freq, active = true) ->
@_id = null
@room = process.env.HUBOT_SENSORS_ROOM
@setup() if active
setup: () ->
@enable()
check: () ->
fire: () ->
notify: (text) ->
@robot.messageRoom @room, text
name: () ->
@constructor.name
... | path = require('path')
class HubotSensor
constructor: (@freq, active = true) ->
@_id = null
@room = process.env.HUBOT_SENSORS_ROOM
@setup() if active
setup: () ->
@enable()
check: () ->
fire: () ->
notify: (text, rooms = [@room]) ->
@robot.messageRoom(room, text) for room in [].conca... |
Fix default supported file types | Form = require('multiparty').Form
createWriteStream = require('fs').createWriteStream
hash = require('crypto').createHash
rand = require('crypto').pseudoRandomBytes
JFUM = module.exports = (opts) ->
opts ?= {}
@tmpDir = opts.tmpDir or require('os').tmpdir()
@minFileSize = opts.minFileSize or 1
@maxFileSize = ... | Form = require('multiparty').Form
createWriteStream = require('fs').createWriteStream
hash = require('crypto').createHash
rand = require('crypto').pseudoRandomBytes
JFUM = module.exports = (opts) ->
opts ?= {}
@tmpDir = opts.tmpDir or require('os').tmpdir()
@minFileSize = opts.minFileSize or 1
@maxFileSize = ... |
Fix gravatar to show mystery man if no email is present | #= require gravtastic
angular.module('kassa').directive('gravatar', [
'$parse'
($parse)->
linker = ($scope, $element, $attrs)->
email = size = null
setGravatarSrc = (email, size)->
if email?
$element.attr('src', Gravtastic(email, default: 'mm', size: (size ||= 22)))
updateE... | #= require gravtastic
angular.module('kassa').directive('gravatar', [
'$parse'
($parse)->
linker = ($scope, $element, $attrs)->
email = size = null
setGravatarSrc = (email, size)->
email = "" unless email?
$element.attr('src', Gravtastic(email, default: 'mm', size: (size ||= 22)))
... |
Fix live updating for discussions | angular.module('loomioApp').factory 'MessageChannelService', ($http, Records, CommentModel, EventModel) ->
new class MessageChannelService
subscribeSuccess: (subscription, onMessageReceived) ->
PrivatePub.sign(subscription)
console.log 'subscribed to channel:', subscription.channel
PrivatePub.su... | angular.module('loomioApp').factory 'MessageChannelService', ($http, Records, CommentModel, EventModel) ->
new class MessageChannelService
subscribeSuccess: (subscription, onMessageReceived) ->
PrivatePub.sign(subscription)
console.log 'subscribed to channel:', subscription.channel
PrivatePub.su... |
Add documentation for Analytics Payload Loader | ((url)->
# Section 1
iframe = document.createElement('iframe')
iframe.src = "javascript:false"
iframe.title = ""
# iframe.role = "presentation" # a11y
(iframe.frameElement or iframe).style.cssText = "width: 0; height: 0; border: 0"
where = document.getElementsByTagName('script')
where = where[where.len... | ###
Analytics Payload Loader
This is the `analytics.js` file that loads the actual Analytics payload. It
utilizes the Friendly iFrames (FiF) technique in order to load the JavaScript
library without blocking the `window.onload` event.
@see http://goo.gl/VLDc3F More information on FiF technique
###
((url)->
# Sectio... |
Fix content not saved from codeview | init = ->
$("[data-provider='summernote']").summernote
height: 300
maximumImageFileSize: 262144 # 256KB
toolbar: [
['style', ['style']],
['font', ['bold', 'italic', 'underline', 'clear']],
['fontname', ['fontname']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
... | init = ->
$("[data-provider='summernote']").summernote
height: 300
maximumImageFileSize: 262144 # 256KB
callbacks: onBlurCodeview: -> $(this).val $(this).summernote('code') # Fix content not saved from codeview issue
toolbar: [
['style', ['style']],
['font', ['bold', 'italic', 'underline',... |
Add api search song route. | goog.provide 'app.Routes'
goog.require 'este.Routes'
class app.Routes extends este.Routes
###*
@param {app.user.Store} userStore
@constructor
@extends {este.Routes}
###
constructor: (userStore) ->
@home = @route '/'
@about = @route '/about'
@songs = @route '/songs'
@recentlyUpdatedS... | goog.provide 'app.Routes'
goog.require 'este.Routes'
class app.Routes extends este.Routes
###*
@param {app.user.Store} userStore
@constructor
@extends {este.Routes}
###
constructor: (userStore) ->
@home = @route '/'
@about = @route '/about'
@songs = @route '/songs'
@recentlyUpdatedS... |
Sort files by modification time | Flow.Browser = (_) ->
_docs = signals []
_hasDocs = lift _docs, (docs) -> docs.length > 0
createDocView = ([ type, id, doc ]) ->
_title = signal doc.title
_date = signal new Date doc.modifiedDate
_fromNow = lift _date, Flow.Util.fromNow
load = ->
_.loadNotebook id, doc
purge = ->
... | Flow.Browser = (_) ->
_docs = signals []
_sortedDocs = lift _docs, (docs) ->
sortBy docs, (doc) -> -doc.date().getTime()
_hasDocs = lift _docs, (docs) -> docs.length > 0
createDocView = ([ type, id, doc ]) ->
_title = signal doc.title
_date = signal new Date doc.modifiedDate
_fromNow = lift _... |
Revert "Redirect / to /event_searches/new." | Pancakes.ApplicationRoute = Ember.Route.extend
renderTemplate: (controller, model) ->
@_super(controller, model)
@render 'study_locations',
into: 'application',
outlet: 'studyLocations',
controller: 'studyLocations'
setupController: (controller) ->
@_super(controller)
@controlle... | Pancakes.ApplicationRoute = Ember.Route.extend
renderTemplate: (controller, model) ->
@_super(controller, model)
@render 'study_locations',
into: 'application',
outlet: 'studyLocations',
controller: 'studyLocations'
setupController: (controller) ->
@_super(controller)
@controlle... |
Fix regression when downloading a specific URL. | {open} = require 'io/file'
class Downloader
constructor: (@url, @file, @callback) ->
@_downloader = Cc["@mozilla.org/network/downloader;1"].createInstance()
@_ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService)
@_downloader.QueryInterface Ci.nsIDownloader
@_downloader.ini... | {open} = require 'io/file'
class Downloader
constructor: (@url, @file, @callback) ->
@_downloader = Cc["@mozilla.org/network/downloader;1"].createInstance()
@_ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService)
@_downloader.QueryInterface Ci.nsIDownloader
@_downloader.ini... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.