Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Add integration test for HEAD /CloudHealthCheck | request = require 'supertest'
assert = require 'assert'
req = request require '../../coffee/server'
describe '/CloudHealthCheck', ->
it 'should return OK for MongoDB and Redis', (done) ->
req.get '/CloudHealthCheck'
.expect 200
.expect (res) ->
assert.deepEqual res.body, message: 'Syste... | request = require 'supertest'
assert = require 'assert'
req = request require '../../coffee/server'
describe '/CloudHealthCheck', ->
it 'should return 200 OK for GET request', (done) ->
req.get '/CloudHealthCheck'
.expect 200
.expect (res) ->
assert.deepEqual res.body, message: 'System ... |
Use properties instead of local variables | expect = require('chai').expect
fs = require('fs')
Parser = require('../lib/parser')
describe 'Parser', ->
dummy = fs.createReadStream('./test/fixtures/dummy.html')
parser = new Parser(dummy)
it 'lists available years', (done) ->
parser.getYears (err, years) ->
expect(err).to.be.null
expe... | expect = require('chai').expect
fs = require('fs')
Parser = require('../lib/parser')
describe 'Parser', ->
beforeEach ->
@dummy = fs.createReadStream('./test/fixtures/dummy.html')
@parser = new Parser(@dummy)
it 'lists available years', (done) ->
@parser.getYears (err, years) ->
expect(err... |
Remove window handling in catch block | try
require '../src/window'
Atom = require '../src/atom'
window.atom = new Atom()
window.atom.show() unless atom.getLoadSettings().exitWhenDone
{runSpecSuite} = require './jasmine-helper'
document.title = "Spec Suite"
runSpecSuite './spec-suite'
catch error
unless atom.getLoadSettings().exitWhenDone
... | try
require '../src/window'
Atom = require '../src/atom'
window.atom = new Atom()
window.atom.show() unless atom.getLoadSettings().exitWhenDone
{runSpecSuite} = require './jasmine-helper'
document.title = "Spec Suite"
runSpecSuite './spec-suite'
catch error
if atom?.getLoadSettings().exitWhenDone
a... |
Split to the right when opening preview | {CompositeDisposable} = require 'atom'
RestructuredPreviewView = require './restructured-preview-view'
url = require 'url'
module.exports = RestructuredPreview =
restructuredPreviewView: null
modalPanel: null
subscriptions: null
activate: (state) ->
@subscriptions = new CompositeDisposable
@subscripti... | {CompositeDisposable} = require 'atom'
RestructuredPreviewView = require './restructured-preview-view'
url = require 'url'
module.exports = RestructuredPreview =
restructuredPreviewView: null
modalPanel: null
subscriptions: null
activate: (state) ->
@subscriptions = new CompositeDisposable
@subscripti... |
Synchronize percentage for new progress bars | App.Forms =
disableEnter: ->
$('form.js-enter-disabled').on('keyup keypress', (event) ->
if event.which == 13
e.preventDefault()
)
submitOnChange: ->
$('.js-submit-on-change').unbind('change').on('change', ->
$(this).closest('form').submit()
false
)
toggleLink: ->
... | App.Forms =
disableEnter: ->
$('form.js-enter-disabled').on('keyup keypress', (event) ->
if event.which == 13
e.preventDefault()
)
submitOnChange: ->
$('.js-submit-on-change').unbind('change').on('change', ->
$(this).closest('form').submit()
false
)
toggleLink: ->
... |
Add autoset and dependent methods to select inputs. | jQuery ->
$(".clickable").live "click", (e) ->
window.location.href = $(this).find("a.primary-link").attr("href")
$(".collapsible")
.hover ->
$(this).find(".collapse").slideDown()
, ->
$(this).find(".collapse").slideUp()
.find(".collapse").hide()
$(":input.date").dateinput
format... | jQuery ->
# Crude way to make large blocks .clickable by definiting a.primary-link in them
$(".clickable").live "click", (e) ->
window.location.href = $(this).find("a.primary-link").attr("href")
# When .collapsible item is hovered in/out the .collapse elements inside
# expand and collapse
$(".collapsible... |
Add Atom snippet for Ruby curly braces block | ".source.ruby":
"Hashrocket":
prefix: "="
body: " => "
"Context block":
prefix: "context"
body: """
context "$1" do
$2
end
"""
"Test block":
prefix: "test"
body: """
test "$1" do
$2
end
"""
".source.coffee":
"Describe block":
prefix:... | ".source.ruby":
"Hashrocket":
prefix: "="
body: " => "
"Curly braces block":
prefix: "{"
body: "{ |${1:variable}| $2 "
"Context block":
prefix: "context"
body: """
context "$1" do
$2
end
"""
"Test block":
prefix: "test"
body: """
test "$1" do
... |
Add "Click to practice" tooltip to practice buttons | React = require 'react'
BS = require 'react-bootstrap'
ChapterSectionType = require './chapter-section-type'
module.exports = React.createClass
displayName: 'LearningGuideProgressBar'
propTypes:
section: ChapterSectionType.isRequired
onPractice: React.PropTypes.func
render: ->
{section, chapter, ... | React = require 'react'
BS = require 'react-bootstrap'
ChapterSectionType = require './chapter-section-type'
module.exports = React.createClass
displayName: 'LearningGuideProgressBar'
propTypes:
section: ChapterSectionType.isRequired
onPractice: React.PropTypes.func
render: ->
{section, chapter, ... |
Fix notification window not hiding on start | #= require dashing.js
#= require_tree ./lib
#= require_tree ./dashing
#= require_tree ../../widgets
Dashing.on 'ready', ->
Dashing.widget_margins ||= [5, 5]
Dashing.widget_base_dimensions ||= [300, 360]
Dashing.numColumns ||= 4
contentWidth = (Dashing.widget_base_dimensions[0] + Dashing.widget_margins[0] * 2)... | #= require dashing.js
#= require_tree ./lib
#= require_tree ./dashing
#= require_tree ../../widgets
$ ->
Dashing.widget_margins ||= [5, 5]
Dashing.widget_base_dimensions ||= [300, 360]
Dashing.numColumns ||= 4
contentWidth = (Dashing.widget_base_dimensions[0] + Dashing.widget_margins[0] * 2) * Dashing.numColu... |
Add traling breakline to case where errors come in a array | # Parses a structure of errors that came from the server
angular.module("admin.utils").factory "ErrorsParser", ->
new class ErrorsParser
toString: (errors, defaultContent = "") =>
return defaultContent unless errors?
errorsString = ""
if errors.length > 0
# it is an array of errors
... | # Parses a structure of errors that came from the server
angular.module("admin.utils").factory "ErrorsParser", ->
new class ErrorsParser
toString: (errors, defaultContent = "") =>
return defaultContent unless errors?
errorsString = ""
if errors.length > 0
# it is an array of errors
... |
Add $scope.user to address-form directive | Sprangular.directive 'addressForm', ->
restrict: 'E'
templateUrl: 'addresses/form.html'
scope:
address: '='
countries: '='
disabled: '='
submitted: '='
controller: ($scope) ->
$scope.selectedCountry = null
$scope.hasErrors = false
$scope.$watchGroup ['address.firstname', 'address.la... | Sprangular.directive 'addressForm', ->
restrict: 'E'
templateUrl: 'addresses/form.html'
scope:
address: '='
countries: '='
disabled: '='
submitted: '='
controller: ($scope, Account) ->
$scope.user = Account.user
$scope.selectedCountry = null
$scope.hasErrors = false
$scope.$watc... |
Add possibility to show N content with the same data tab | $ ->
hashTabs = ->
_element: ""
element: (element) ->
this._element = element
updateTab: (updateHash=true)->
this.updateTabLink()
this.updateTabContainer()
$('body').scrollTop(0)
if updateHash
this.updateURLHash()
updateTabLink: ->
this._element.parent().... | $ ->
hashTabs = ->
_element: ""
element: (element) ->
this._element = element
updateTab: (updateHash=true)->
this.updateTabLink()
this.updateTabContainer()
$('body').scrollTop(0)
if updateHash
this.updateURLHash()
updateTabLink: ->
this._element.parent().... |
Make empty pie chart appear on proposal page | angular.module('loomioApp').controller 'ProposalPieChartController', ($scope) ->
$scope.pieChartData = [
{ value : 0, color : "#90D490" },
{ value : 0, color : "#F0BB67" },
{ value : 0, color : "#D49090" },
{ value : 0, color : "#dd0000"}
]
$scope.pieChartOptions =
animation: false
segme... | angular.module('loomioApp').controller 'ProposalPieChartController', ($scope) ->
$scope.pieChartData = [
{ value : 0, color : "#90D490" },
{ value : 0, color : "#F0BB67" },
{ value : 0, color : "#D49090" },
{ value : 0, color : "#dd0000" },
{ value : 0, color : "#cccccc" }
]
$scope.pieChartO... |
Fix ng-model attribute update for task def selector | angular.module('doubtfire.tasks.task-definition-selector',[])
#
# A switch that that the selection of a specified task definition
# Only handles task definition - not tasks in a project
#
.directive('taskDefinitionSelector', ->
replace: true
restrict: 'E'
templateUrl: 'tasks/task-definition-selector/task-definit... | angular.module('doubtfire.tasks.task-definition-selector',[])
#
# A switch that that the selection of a specified task definition
# Only handles task definition - not tasks in a project
#
.directive('taskDefinitionSelector', ->
replace: true
restrict: 'E'
templateUrl: 'tasks/task-definition-selector/task-definit... |
Set DDP_DEFAULT_CONNECTION_URL to the same value of ROOT_URL | 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 = ur... | 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... |
Document title changes to notify teachers of requesters - like twitter and gmail | @Curri.RequestsNumber =
poll: ->
setTimeout @request, 10000
request: ->
$.ajax
url: $('#requesters_link').attr('href')
dataType: 'JSON'
success: Curri.RequestsNumber.updateRequesters
updateRequesters: (data) ->
$requestsLink = $('#requesters_link')
reqLimit = $requestsLink.data... | @Curri.RequestsNumber =
poll: ->
setTimeout @request, 10000
request: ->
$.ajax
url: $('#requesters_link').attr('href')
dataType: 'JSON'
success: Curri.RequestsNumber.updateRequesters
updateRequesters: (data) ->
$requestsLink = $('#requesters_link')
reqLimit = $requestsLink.data... |
Remove link to placeholder 'Mainspace' recent activity feed | React = require 'react/addons'
Router = require 'react-router'
RouteHandler = Router.RouteHandler
Link = Router.Link
DidYouKnowHandler = require './did_you_know_handler'
MainspaceHandler = require './mainspace_handler'
PlagiarismHandler = require './plagiarism_handler'
RecentActivityHandler = Re... | React = require 'react/addons'
Router = require 'react-router'
RouteHandler = Router.RouteHandler
Link = Router.Link
DidYouKnowHandler = require './did_you_know_handler'
MainspaceHandler = require './mainspace_handler'
PlagiarismHandler = require './plagiarism_handler'
RecentActivityHandler = Re... |
Fix url normalization for Windows | mkdirp = require 'mkdirp'
fs = require 'fs'
#
# Convenient method for writing a file on
# a path that might not exist. This function
# will create all folders provided in the
# path to the file.
#
#
# writeToFile('/tmp/hi/folder/file.js', "console.log('hi')")
#
# will create a file at /tmp/hi/folder/file.js with... | mkdirp = require 'mkdirp'
fs = require 'fs'
#
# Convenient method for writing a file on
# a path that might not exist. This function
# will create all folders provided in the
# path to the file.
#
#
# writeToFile('/tmp/hi/folder/file.js', "console.log('hi')")
#
# will create a file at /tmp/hi/folder/... |
Add note about horribly bad test | PreviewOpener = require '../../lib/openers/preview-opener'
describe "PreviewOpener", ->
describe "open", ->
it "invokes the callback with an exit code equal to `1` because the file is not found", ->
exitCode = null
opener = new PreviewOpener()
opener.open 'dummy-file-name.pdf', (code) -> exitCo... | PreviewOpener = require '../../lib/openers/preview-opener'
describe "PreviewOpener", ->
describe "open", ->
# FIXME: Horrible test. Needs to be fixed, or removed entirely.
it "invokes the callback with an exit code equal to `1` because the file is not found", ->
exitCode = null
opener = new Previ... |
Set the correct page number on the toolbar controller | App.CorpusResultRoute = Em.Route.extend
model: (params) ->
{search_id: searchId, page_no: @pageNo} = params
# Get the search model subclass for the search engine used by the current
# corpus and find the record with the given search_id
searchModelClass = @controllerFor('corpus').get('searchModelClas... | App.CorpusResultRoute = Em.Route.extend
model: (params) ->
{search_id: searchId, page_no: @pageNo} = params
# Get the search model subclass for the search engine used by the current
# corpus and find the record with the given search_id
searchModelClass = @controllerFor('corpus').get('searchModelClas... |
Fix autoredirect when login failed. | Wheelmap.ApplicationRoute = Ember.Route.extend
signedIn: false
beforeModel: (transition)->
signUrl = $.cookie('sign_url')
if signUrl?
transition.abort()
$.cookie('sign_url', null)
window.location.hash = signUrl
actions:
authenticate: (transition)->
self = @
unless se... | Wheelmap.ApplicationRoute = Ember.Route.extend
signedIn: false
beforeModel: (transition)->
signUrl = $.cookie('sign_url')
data = JSON.parse $.cookie("flash")
if signUrl? && !data.error && !data.alert && !data.notice
transition.abort()
$.cookie('sign_url', null)
window.location.hash ... |
Remove non-mandatory check from filter function | minimatch = require 'minimatch'
module.exports = (env, callback) ->
filter = (contents, pattern) ->
list(contents).filter (entry) ->
if pattern? then minimatch(entry.filename, pattern) else true
list = (contents) ->
entries = []
for key, value of contents._
switch key
when 'dire... | minimatch = require 'minimatch'
module.exports = (env, callback) ->
filter = (contents, pattern) ->
list(contents).filter (entry) ->
minimatch(entry.filename, pattern)
list = (contents) ->
entries = []
for key, value of contents._
switch key
when 'directories'
subcontent... |
Add an example of setLivePathConsumer() | StreamServer = require './stream_server'
Bits = require './bits'
logger = require './logger'
Bits.set_warning_fatal true
logger.setLevel logger.LEVEL_INFO
streamServer = new StreamServer
process.on 'SIGINT', =>
console.log 'Got SIGINT'
streamServer.stop ->
process.kill process.pid, 'SIGTERM'
process.on 'unc... | url = require 'url'
StreamServer = require './stream_server'
Bits = require './bits'
logger = require './logger'
Bits.set_warning_fatal true
logger.setLevel logger.LEVEL_INFO
streamServer = new StreamServer
streamServer.setLivePathConsumer (uri, callback) ->
pathname = url.parse(uri).pathname[1..]
isAuthorized ... |
Use 3000 if PORT not defined | # modules
express = require("express");
app = express();
colors = require 'colors'
db = require './models/db'
http = require './services/http'
logger = require './services/logger'
# config
net = require './config/networking'
# DATABASE
# --------
do db.syncSchemas
# EXPRESS BOOTSTRAP
# -----------------
# add middl... | # modules
express = require("express");
app = express();
colors = require 'colors'
db = require './models/db'
http = require './services/http'
logger = require './services/logger'
# config
net = require './config/networking'
# DATABASE
# --------
do db.syncSchemas
# EXPRESS BOOTSTRAP
# -----------------
# add middl... |
Add text in chosen select | $ ->
# enable chosen js
$('.chosen-select').chosen
no_results_text: 'No results matched'
width: '400px'
placeholder_text_multiple: 'Select languages...'
| $ ->
# enable chosen js
$('.chosen-select').chosen
no_results_text: 'No results matched'
width: '400px'
placeholder_text_multiple: 'Select languages you can read and speak'
|
Return all users on small clouds. | class Cloudsdale.Collections.CloudsUsers extends Backbone.Collection
model: Cloudsdale.Models.User
url: -> "/v1/#{@topic.type}s/#{@topic.id}/users/online.json"
topic: 'cloud'
initialize: (args,options) ->
args ||= {}
options ||= {}
@topic = options.topic
this
cachedFetch: (options) -... | class Cloudsdale.Collections.CloudsUsers extends Backbone.Collection
model: Cloudsdale.Models.User
url: ->
if @topic.get('member_count') > 100
return "/v1/#{@topic.type}s/#{@topic.id}/users/online.json"
else
return "/v1/#{@topic.type}s/#{@topic.id}/users.json"
topic: 'cloud'
initialize: (... |
Fix check for Topic in FavouriteTopicCollection | class window.FavouriteTopicButtonView extends ActionButtonView
mini: true
onRender: -> @updateButton()
initialize: ->
@bindTo @model, 'change', @updateButton, @
@user = currentUser
templateHelpers: =>
disabled_label: Factlink.Global.t.favourite.capitalize()
disable_label: Factlink.Global.t.u... | class window.FavouriteTopicButtonView extends ActionButtonView
mini: true
onRender: -> @updateButton()
initialize: ->
@bindTo @model, 'change', @updateButton, @
@user = currentUser
templateHelpers: =>
disabled_label: Factlink.Global.t.favourite.capitalize()
disable_label: Factlink.Global.t.u... |
Stop selecting the js output | 'use strict'
{
setupEditors
setupSamples
setupCompilers
setupRunButton
saveProgram
loadProgram
} = window.viz
grid = null
run = (editors, compiler) ->
saveProgram editors
playfield = new bef.Playfield()
playfield.fromString editors.source.getValue(), 16, 10
lazyRuntime = new bef.LazyRuntime()
lazyRunt... | 'use strict'
{
setupEditors
setupSamples
setupCompilers
setupRunButton
saveProgram
loadProgram
} = window.viz
grid = null
run = (editors, compiler) ->
saveProgram editors
playfield = new bef.Playfield()
playfield.fromString editors.source.getValue(), 16, 10
lazyRuntime = new bef.LazyRuntime()
lazyRunt... |
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:-... |
Enable Learn page's section expansion just in big screens | Neighborly.Static ?= {}
Neighborly.Static.Learn =
init: Backbone.View.extend
el: '.learn-page'
initialize: ->
$('.expand-section').click (event) ->
event.preventDefault()
$(this).parents('.main-section').find('.section-content').slideToggle 500, =>
elem = $(this).find('.expan... | Neighborly.Static ?= {}
Neighborly.Static.Learn =
init: Backbone.View.extend
el: '.learn-page'
initialize: ->
if window.innerWidth < 1000
$('.main-section').localScroll duration: 600
else
$('.expand-section').click this.expand_section
expand_section: (event) ->
event.p... |
Fix boundary not working correctly | class BoundaryComponent
BoundarySystem =
add: (engine) ->
@engine = engine
@boundaries = engine.e 'boundary', 'pos'
@entities = engine.e 'blob', 'pos'
update: (delta) ->
return if not @boundaries.length > 0
boundary = @boundaries[0].c 'pos' # TODO Only 1st object is used; should be changed
... | class BoundaryComponent
BoundarySystem =
add: (engine) ->
@engine = engine
@boundaries = engine.e 'boundary', 'pos'
@entities = engine.e 'blob', 'pos'
update: (delta) ->
return if not @boundaries.length > 0
boundary = @boundaries[0].c 'pos' # TODO Only 1st object is used; should be changed
... |
Add active class to event view | Yossarian.EventView = Ember.View.extend
tagName: 'li'
attributeBindings: ['class']
mouseEnter: ->
@$().find('.info').addClass('open')
@$().find('.nivoSlider').data('nivoslider').stop()
mouseLeave: ->
@$().find('.info').removeClass('open')
@$().find('.nivoSlider').data('nivoslider').start()
| Yossarian.EventView = Ember.View.extend
tagName: 'li'
attributeBindings: ['class']
mouseEnter: ->
@$().find('.info').addClass('active')
@$().find('.nivoSlider').data('nivoslider').stop()
mouseLeave: ->
@$().find('.info').removeClass('active')
@$().find('.nivoSlider').data('nivoslider').start()... |
Add serializers for checkboxes arrays | Backbone = require 'backbone'
###
backbone.syphon configuration
==================================
###
module.exports = (Module, App, Backbone, Marionette, $, _) ->
Backbone.Syphon.KeySplitter = (key) ->
key.split '.'
Backbone.Syphon.KeyJoiner = (parentKey, childKey) ->
parentKey + '.' + childKey
| Backbone = require 'backbone'
###
backbone.syphon configuration
==================================
###
module.exports = (Module, App, Backbone, Marionette, $, _) ->
Backbone.Syphon.KeySplitter = (key) ->
key.split '.'
Backbone.Syphon.KeyJoiner = (parentKey, childKey) ->
parentKey + '.' + childKey
Ba... |
Change the From address when sending a submission email. Maybe that'd work... | Meteor.methods
weCanHelpEmail: (name, email, mind) ->
check([name, email, mind], [String])
Email.send
to: 'rs14team@googlegroups.com',
from: email,
subject: "Help #{name} make a proposal",
text: "#{mind}\n\nThank you, #{name} <#{email}>"
sendSubmitEmail: (p) ->
u = User.find(p.u... | Meteor.methods
weCanHelpEmail: (name, email, mind) ->
check([name, email, mind], [String])
Email.send
to: 'rs14team@googlegroups.com',
from: email,
subject: "Help #{name} make a proposal",
text: "#{mind}\n\nThank you, #{name} <#{email}>"
sendSubmitEmail: (p) ->
u = User.find(p.u... |
Update the minimum Serrano version that notifies in responses | define [
'../core'
'./base'
], (c, base) ->
class ExporterModel extends base.Model
class ExporterCollection extends base.Collection
model: ExporterModel
# Versions greater than or equal to this version are considered to
# support notification on completion.
minSe... | define [
'../core'
'./base'
], (c, base) ->
class ExporterModel extends base.Model
class ExporterCollection extends base.Collection
model: ExporterModel
# Versions greater than or equal to this version are considered to
# support notification on completion.
minSe... |
Change the Linux key binding to Ctrl+u | '.platform-darwin .editor':
'ctrl-shift-u': 'encoding-selector:show'
'.platform-win32 .editor':
'ctrl-shift-u': 'encoding-selector:show'
'.platform-linux .editor':
'ctrl-shift-u': 'encoding-selector:show'
| '.platform-darwin .editor':
'ctrl-shift-u': 'encoding-selector:show'
'.platform-win32 .editor':
'ctrl-shift-u': 'encoding-selector:show'
'.platform-linux .editor':
'ctrl-u': 'encoding-selector:show'
|
Reduce isLoggedIn() check using Coffee more beautifully | window.ActiveService = class ActiveService
constructor: ->
@user = null
setUser: (@user) ->
getUser: -> @user
isLoggedIn: -> !!(@user && @user.userId)
| window.ActiveService = class ActiveService
constructor: ->
@user = null
setUser: (@user) ->
getUser: -> @user
isLoggedIn: -> !!@user?.userId
|
Fix docs update notif not being displayed in some cases | #= require views/misc/notif
class app.views.Updates extends app.views.Notif
@className += ' _notif-news'
@defautOptions:
autoHide: 30000
init: ->
@lastUpdateTime = @getLastUpdateTime()
@updatedDocs = @getUpdatedDocs()
@updatedDisabledDocs = @getUpdatedDisabledDocs()
@show() if @updatedDocs.... | #= require views/misc/notif
class app.views.Updates extends app.views.Notif
@className += ' _notif-news'
@defautOptions:
autoHide: 30000
init: ->
@lastUpdateTime = @getLastUpdateTime()
@updatedDocs = @getUpdatedDocs()
@updatedDisabledDocs = @getUpdatedDisabledDocs()
@show() if @updatedDocs.... |
Add preliminary support for filters. | ###
# Walker:
# Traverses a JavaScript AST.
#
# class MyWalker extends Walker
#
# w = new MyWalker(ast)
# w.run()
#
###
module.exports = class Walker
constructor: (@root, @options) ->
@path = []
run: ->
@walk(@root)
walk: (node) =>
oldLength = @path.length
@path.push(node)
type... | ###
# Walker:
# Traverses a JavaScript AST.
#
# class MyWalker extends Walker
#
# w = new MyWalker(ast)
# w.run()
#
###
module.exports = class Walker
constructor: (@root, @options) ->
@path = []
run: ->
@walk(@root)
walk: (node) =>
oldLength = @path.length
@path.push(node)
type... |
Fix issue with atom removing trailing whitespace. | "*":
core:
themes: [
"atom-dark-ui"
"atom-dark-syntax"
]
editor:
backUpBeforeSaving: true
fontFamily: "inconsolata"
invisibles: {}
scrollPastEnd: true
showIndentGuide: true
showInvisibles: true
softWrap: true
tabLength: 4
"exception-reporting":
userId: "025b... | "*":
core:
themes: [
"atom-dark-ui"
"atom-dark-syntax"
]
editor:
backUpBeforeSaving: true
fontFamily: "inconsolata"
invisibles: {}
scrollPastEnd: true
showIndentGuide: true
showInvisibles: true
softWrap: true
tabLength: 4
"exception-reporting":
userId: "025b... |
Use stripe public key from env on the client-side. | config =
mailchimp:
action: '//digitalcoachingnetwork.us11.list-manage.com/subscribe/post?u=68d703ae770920ff4a8b715e2&id=a3577a5ba4'
mongo:
connectionString: process.env.MONGOLAB_URI || 'localhost/dcn'
adminEmail: 'info@digitalcoachingnetwork.com'
trello:
# id of the Trello list to insert new cl... | config =
mailchimp:
action: '//digitalcoachingnetwork.us11.list-manage.com/subscribe/post?u=68d703ae770920ff4a8b715e2&id=a3577a5ba4'
mongo:
connectionString: process.env.MONGOLAB_URI || 'localhost/dcn'
adminEmail: 'info@digitalcoachingnetwork.com'
trello:
# id of the Trello list to insert new cl... |
Switch auth for group set csv uploads and downloads | angular.module("doubtfire.api.models.group-set", [])
.factory("GroupSet", (resourcePlus, DoubtfireConstants, currentUser, $window) ->
GroupSet = resourcePlus "/units/:unit_id/group_sets/:id", { id: "@id", unit_id: "@unit_id" }
GroupSet.groupCSVUploadUrl = (unit, group_set) ->
"#{DoubtfireConstants.API_URL}/uni... | angular.module("doubtfire.api.models.group-set", [])
.factory("GroupSet", (resourcePlus, DoubtfireConstants, fileDownloaderService) ->
GroupSet = resourcePlus "/units/:unit_id/group_sets/:id", { id: "@id", unit_id: "@unit_id" }
GroupSet.groupCSVUploadUrl = (unit, group_set) ->
"#{DoubtfireConstants.API_URL}/un... |
Update to new root resource path | path = require 'path'
module.exports =
getAtomDirectory: ->
process.env.ATOM_HOME ? path.join(process.env.HOME, '.atom')
getResourcePath: ->
process.env.ATOM_RESOURCE_PATH ? '/Applications/Atom.app/Contents/Frameworks/Atom.framework/Resources'
getNodeUrl: ->
process.env.ATOM_NODE_URL ? 'https://gh-... | path = require 'path'
module.exports =
getAtomDirectory: ->
process.env.ATOM_HOME ? path.join(process.env.HOME, '.atom')
getResourcePath: ->
process.env.ATOM_RESOURCE_PATH ? '/Applications/Atom.app/Contents/Resources/app'
getNodeUrl: ->
process.env.ATOM_NODE_URL ? 'https://gh-contractor-zcbenz.s3.a... |
Update fixture path in compile cache spec | path = require 'path'
CSON = require 'season'
CoffeeCache = require 'coffee-cash'
babel = require '../src/babel'
CompileCache = require '../src/compile-cache'
describe "Compile Cache", ->
describe ".addPathToCache(filePath)", ->
it "adds the path to the correct CSON, CoffeeScript, or babel cache", ->
spyO... | path = require 'path'
CSON = require 'season'
CoffeeCache = require 'coffee-cash'
babel = require '../src/babel'
CompileCache = require '../src/compile-cache'
describe "Compile Cache", ->
describe ".addPathToCache(filePath)", ->
it "adds the path to the correct CSON, CoffeeScript, or babel cache", ->
spyO... |
Sort the roles uniformally on the dashboard | a = DS.attr
ETahi.LitePaper = DS.Model.extend
paper: DS.belongsTo('paper')
flow: DS.belongsTo('flow')
title: a('string')
shortTitle: a('string')
submitted: a('boolean')
roles: a()
displayTitle: (->
@get('title') || @get('shortTitle')
).property 'title', 'shortTitle'
roleList: (->
@get('role... | a = DS.attr
ETahi.LitePaper = DS.Model.extend
paper: DS.belongsTo('paper')
flow: DS.belongsTo('flow')
title: a('string')
shortTitle: a('string')
submitted: a('boolean')
roles: a()
displayTitle: (->
@get('title') || @get('shortTitle')
).property 'title', 'shortTitle'
roleList: (->
@get('role... |
Fix the test to use the correct websocket port | Front = require('../lib/front/front')
WebSocket = require('ws')
WebSocketServer = require('ws').Server
describe 'Front', ->
beforeEach ->
@front = new Front
it 'should initialize', ->
@front.start
it 'should start a WSS', ->
stub = new WebSocketServer({port: 3021, host: "0.0.0.0"});
stub.on 'co... | Front = require('../lib/front/front')
WebSocket = require('ws')
WebSocketServer = require('ws').Server
logger.set_levels 'development'
describe 'Front', ->
beforeEach ->
@front = new Front
it 'should initialize', ->
@front.start
it 'should start a WSS', ->
stub = new WebSocketServer({port: 3021, ho... |
Initialize was not so unnecessary -- used for rendering delete button when creating | class window.NDPFactRelationOrCommentBottomView extends Backbone.Marionette.Layout
className: 'ndp-evidenceish-bottom'
template: 'facts/evidence_bottom'
triggers:
'click .js-sub-comments-link': 'toggleSubCommentsList'
ui:
subCommentsLink: '.js-sub-comments-link'
subCommentsLinkContainer: ... | class window.NDPFactRelationOrCommentBottomView extends Backbone.Marionette.Layout
className: 'ndp-evidenceish-bottom'
template: 'facts/evidence_bottom'
triggers:
'click .js-sub-comments-link': 'toggleSubCommentsList'
ui:
subCommentsLink: '.js-sub-comments-link'
subCommentsLinkContainer: ... |
Check if anything in response.error has any content | class MagicWord.ValidatableForm
constructor: (@$form) ->
@inputs = @_inputs()
@model = @$form.data('validate-model')
@$button = @$form.find('[type=submit]')
@validationRoute = "/#{MagicWord.enginePath}/validations"
@$button.click @validateInputs
@$button.attr('disabl... | class MagicWord.ValidatableForm
constructor: (@$form) ->
@inputs = @_inputs()
@model = @$form.data('validate-model')
@$button = @$form.find('[type=submit]')
@validationRoute = "/#{MagicWord.enginePath}/validations"
@$button.click @validateInputs
@$button.attr('disabl... |
Revert "Revert "Indeed don't pass the fact but the collection"" | class window.NDPEvidenceCollection extends Backbone.Collection
initialize: (models, options) ->
@on 'change', @sort, @
@fact = options.fact
constructor: (models, options) ->
super
unless models and models.length > 0
@reset [
new OpinionatersEvidence({type: 'believe' }, fact: @fact),... | class window.NDPEvidenceCollection extends Backbone.Collection
initialize: (models, options) ->
@on 'change', @sort, @
@fact = options.fact
constructor: (models, options) ->
super
unless models and models.length > 0
@reset [
new OpinionatersEvidence {type: 'believe'}, collection: t... |
Update useragent and reword argument error message | ### Common variables and functions for bots ###
#require = patchRequire(global.require)
#utils = require('utils')
exports.userAgent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.40 Safari/537.31'
#argumentData = [{name:'argName1',default:'optionalArg'}, {name:'argName2',c... | ### Common variables and functions for bots ###
#require = patchRequire(global.require)
#utils = require('utils')
exports.userAgent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.5 Safari/537.36'
#argumentData = [{name:'argName1',default:'optionalArg'}, {name:'argName2',cs... |
Call slide out menu on button click. | class App
Routers: {}
Models: {}
Collections: {}
Views: {}
init: ->
window.flight = new Flight()
new @Routers.AppRouter
Backbone.history.start()
@Collections.Activities.fetch()
window.app = new App
`
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');
};
Str... | class App
Routers: {}
Models: {}
Collections: {}
Views: {}
init: ->
window.flight = new Flight()
new @Routers.AppRouter
Backbone.history.start()
@Collections.Activities.fetch()
$('#menu-button').click ->
flight.slideOutMenu()
window.app = new App
`
String.prototype.trim = fu... |
Remove id, created_at and updated_at from forms | angular.module("hyperadmin")
.controller "FormCtrl", ($scope, $state, Restangular, Flash) ->
@resource = { }
mode = $state.current.data.mode
if mode == "new"
method = "post"
target = "admin/#{$scope.resourceClass.plural}"
successMessage = "#{$scope.resourceClass.singular_human} created ... | angular.module("hyperadmin")
.controller "FormCtrl", ($scope, $state, Restangular, Flash) ->
@resource = { }
mode = $state.current.data.mode
if mode == "new"
method = "post"
target = "admin/#{$scope.resourceClass.plural}"
successMessage = "#{$scope.resourceClass.singular_human} created ... |
Remove response for non auth. | # Just a test script for testing custom commands
#
# Command(s):
# hubot ding — outputs test response
module.exports = (robot) ->
robot.respond /ding$/i, (msg) ->
if robot.auth.hasRole(msg.envelope.user, ['admin'])
msg.send "DONG!"
else
msg.send "Sorry #{msg.envelope.user.... | # Just a test script for testing custom commands
#
# Command(s):
# hubot ding — outputs test response
module.exports = (robot) ->
robot.respond /ding$/i, (msg) ->
if robot.auth.hasRole(msg.envelope.user, ['admin'])
msg.send "DONG!"
return
|
Remove unnecessary manual copying, add comments | applyDependencies = (services, resolver) ->
wrappedServices = {}
for serviceName, serviceDef of services
dependencies = {}
# we will create keys for any declared dependency types
# and have them map to resolved dependencies
for dependencyType of serviceDef.dependencies
# initialize sub-ob... | applyDependencies = (services, resolver) ->
wrappedServices = {}
for serviceName, serviceDef of services
dependencies = {}
# we will create keys for any declared dependency types
# and have them map to resolved dependencies
for dependencyType of serviceDef.dependencies
# initialize sub-ob... |
Remove extra event emission. add debug print. | define [
], () ->
class ReferencesSearchManager
constructor: (@ide, @$scope) ->
@$scope.$root._references = @state = keys: []
@$scope.$on 'document:closed', (e, doc) =>
if doc.doc_id
entity = @ide.fileTreeManager.findEntityById doc.doc_id
if entity?.name?.match /.*\.bib$/
@$scope.$emit '... | define [
], () ->
class ReferencesSearchManager
constructor: (@ide, @$scope) ->
@$scope.$root._references = @state = keys: []
@$scope.$on 'document:closed', (e, doc) =>
if doc.doc_id
entity = @ide.fileTreeManager.findEntityById doc.doc_id
if entity?.name?.match /.*\.bib$/
@indexReference... |
Bring back help output by default | fs = require 'fs'
path = require 'path'
spark = require 'commander'
commands = require './commands'
# Load our options and parse the command
spark.option('--location <path>', 'choose a file location [~/.sparkfile]', String, '~/.sparkfile')
spark.version require('../package.json').version
spark.command('*')
.de... | fs = require 'fs'
path = require 'path'
spark = require 'commander'
commands = require './commands'
# Load our options and parse the command
spark.option('--location <path>', 'choose a file location [~/.sparkfile]', String, '~/.sparkfile')
spark.version require('../package.json').version
spark.command('*')
.de... |
Fix campo eidtor preview flash | $(document).on 'shown.bs.tab', 'a[data-behavior~="preview"]', (e) ->
editor = $(this).closest('.campo-editor')
preview = editor.find('.tab-pane.preview')
textarea = editor.find('textarea')
preview.html('')
preview.css height: textarea.css('height')
$.ajax
url: '/preview'
data: { content: textarea.v... | $(document).on 'show.bs.tab', 'a[data-behavior~="preview"]', (e) ->
editor = $(this).closest('.campo-editor')
preview = editor.find('.tab-pane.preview')
textarea = editor.find('textarea')
preview.html('')
preview.css height: textarea.css('height')
$.ajax
url: '/preview'
data: { content: textarea.va... |
Add test for git clone. | expect = require('chai').expect
fs = require 'fs-extended'
Inotifyr = require '../'
describe 'inotifyr', ->
beforeEach ->
fs.ensureDirSync './test/fixtures'
afterEach ->
fs.deleteDirSync './test/fixtures'
it 'should watch a directory for file add events', (done) ->
watcher = new Inotifyr 'test/fix... | expect = require('chai').expect
fs = require 'fs-extended'
cp = require 'child_process'
{spawn, exec} = require 'child_process'
Inotifyr = require '../'
describe 'inotifyr', ->
beforeEach ->
fs.ensureDirSync './test/fixtures'
afterEach ->
fs.deleteDirSync './test/fixtures'
it 'should watch a directory... |
Change from pure to bootstrap | React = require('react')
Nav = require('components/Nav')
R = React.DOM
require('main.scss')
module.exports = React.createClass
render: ->
R.div {className: 'pure-g'},
R.nav {className: 'pure-u-1'},
new Nav(null),
@props.view
| React = require('react')
Nav = require('components/Nav')
R = React.DOM
require('main.scss')
module.exports = React.createClass
render: ->
R.div null,
R.nav null,
new Nav()
R.div {className: 'col-md-12'},
@props.view
|
Add create and update method | angular.module("doubtfire.api.models.teaching-period", [])
.factory("TeachingPeriod", (resourcePlus, api, currentUser, alertService) ->
resource = resourcePlus "/teaching_periods/:id", { id: "@id"}
data = { }
data.loadedPeriods = []
TeachingPeriod = {
query: () ->
if data.loadedPeriods.length == 0
... | angular.module("doubtfire.api.models.teaching-period", [])
.factory("TeachingPeriod", (resourcePlus, api, currentUser, alertService) ->
resource = resourcePlus "/teaching_periods/:id", { id: "@id"}
data = { }
data.loadedPeriods = []
TeachingPeriod = {
query: () ->
if data.loadedPeriods.length == 0
... |
Implement resizer that sets outer size of frame to inner control size |
class ControlIframe
constructor: ->
@el = document.createElement('iframe')
#need to append to outer document before we can access frame document.
FactlinkJailRoot.$factlinkCoreContainer.append(@el)
@$el = $(@el)
@doc = @el.contentWindow.document;
@doc.open()
#need doctype to avoid quirks ... |
class ControlIframe
constructor: ->
@el = document.createElement('iframe')
#need to append to outer document before we can access frame document.
FactlinkJailRoot.$factlinkCoreContainer.append(@el)
@$el = $(@el)
@doc = @el.contentWindow.document;
@doc.open()
#need doctype to avoid quirks ... |
Add prophet get use item (2) | {Panel} = ReactBootstrap
module.exports = React.createClass
render: ->
<div>
{
if @props.getShip? or @props.getItem?
<Panel>
{"#{@props.getShip.api_ship_type} 「#{@props.getShip.api_ship_name}」 #{@props.joinFleet}"}
</Panel>
else if @props.formationNum != 0
... | {Panel} = ReactBootstrap
module.exports = React.createClass
render: ->
<div>
{
if @props.getShip? or @props.getItem?
prepend = ""
if @props.getItem?.api_useitem_id is 68
prepend = "摸鱼成功! "
<Panel>
{prepend + "#{@props.getShip.api_ship_type} 「#{@p... |
Remove relativeTime helper and change format of display time | Em.Handlebars.helper 'relativeTime', (value, options)->
time = moment(value)
difference = moment().unix() - time.unix()
if difference > 31536000
time.format("MMM D, YYYY")
else if difference > 86400
time.format("MMM D")
else
time.fromNow(true)
Em.Handlebars.helper 'readableTime', (value, options... | Em.Handlebars.helper 'readableTime', (value, options)->
time = moment(value)
difference = moment().unix() - time.unix()
if difference > 31536000
time.format("h:mma, D MMM YYYY")
else
time.format("h:mma, D MMM")
|
Increase the height of the job list. | window.JobsListView = class JobsListView extends Backbone.View
events:
'click p.clear-all a': 'clearAll'
initialize: ->
@model.bind 'add', => this.render()
@model.bind 'remove', => this.render()
$(@el).append('<h2>Jobs List</h2>')
@list = $('<ul class="jobs-list" />').appendTo(@el)
$(@e... | window.JobsListView = class JobsListView extends Backbone.View
events:
'click p.clear-all a': 'clearAll'
initialize: ->
@model.bind 'add', => this.render()
@model.bind 'remove', => this.render()
$(@el).append('<h2>Jobs List</h2>')
@list = $('<ul class="jobs-list" />').appendTo(@el)
$(@e... |
Change map to TERRAIN. Don't save datatables state. | # This file uses the Garber-Irish method for allowing "per-page Javascript."
# I'm using the `gistyle` gem to handle the actual implementation of the pattern.
APP.init = ->
console.log "application"
APP.segments =
init: ->
$ ->
console.log "segments (controller)"
index: ->
$ ->
console.log ... | # This file uses the Garber-Irish method for allowing "per-page Javascript."
# I'm using the `gistyle` gem to handle the actual implementation of the pattern.
APP.init = ->
console.log "application"
APP.segments =
init: ->
$ ->
console.log "segments (controller)"
index: ->
$ ->
console.log ... |
Update navigation controller stack history management | class @NavigationController extends @ViewController
viewControllers: []
childViewControllerContentId: 'navigation_controller_content'
push: (viewController) ->
if @topViewController()?
@topViewController().onDetach()
@topViewController().parentViewController = undefined
@viewControllers.push... | class @NavigationController extends @ViewController
_historyLength: 1
viewControllers: []
childViewControllerContentId: 'navigation_controller_content'
push: (viewController) ->
if @topViewController()?
@topViewController().onDetach()
@topViewController().parentViewController = undefined
i... |
Fix remove callback for Chrome 43 | getChromeVersion = -> getChromeVersion.version ||= +navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)[2]
# A store able to keep persistently data with the chrome storage API
class @ledger.storage.ChromeStore extends ledger.storage.Store
# @see ledger.storage.Store#_raw_get
_raw_get: (keys, cb) ->
try
... | getChromeVersion = -> getChromeVersion.version ||= +navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)[2]
# A store able to keep persistently data with the chrome storage API
class @ledger.storage.ChromeStore extends ledger.storage.Store
# @see ledger.storage.Store#_raw_get
_raw_get: (keys, cb) ->
try
... |
Add Roxy Lead to Enums | angular.module 'gameDefinition.enums', []
.factory 'enums', () ->
origins:
illusionist: 'an illusionist'
hallucinist: 'a hallucinist'
hypnotist: 'a hypnotist'
leads:
none: undefined
jackie: 'Jackie'
employer: 'KB&S'
cop: 'Officer Dentley'
student: 'Ms. Denotto'
| angular.module 'gameDefinition.enums', []
.factory 'enums', () ->
origins:
illusionist: 'an illusionist'
hallucinist: 'a hallucinist'
hypnotist: 'a hypnotist'
leads:
none: undefined
jackie: 'Jackie'
employer: 'KB&S'
cop: 'Officer Dentley'
student: 'Ms. Denotto'... |
Call next autofill iteration before it starts loading again | getResponse = -> Screensmart.store.getState().response
delay = (ms, func) -> setTimeout func, ms
window.autofill = ->
delay 20, ->
unless getResponse().loading
lastQuestion = getResponse().questions[getResponse().questions.length - 1]
# Pick random option
options = lastQuestion.answerOptionSet... | getResponse = -> Screensmart.store.getState().response
delay = (ms, func) -> setTimeout func, ms
window.autofill = ->
delay 20, ->
autofill() unless getResponse().done
unless getResponse().loading
lastQuestion = getResponse().questions[getResponse().questions.length - 1]
# Pick random option
... |
Use binary icon for .woff and .DS_Store extensions | {View} = require 'space-pen'
$ = require 'jquery'
Git = require 'git'
fs = require 'fs'
module.exports =
class FileView extends View
@content: ({file} = {}) ->
@li class: 'file entry', =>
@span file.getBaseName(), class: 'name', outlet: 'fileName'
@span '', class: 'highlight'
file: null
initia... | {View} = require 'space-pen'
$ = require 'jquery'
Git = require 'git'
fs = require 'fs'
module.exports =
class FileView extends View
@content: ({file} = {}) ->
@li class: 'file entry', =>
@span file.getBaseName(), class: 'name', outlet: 'fileName'
@span '', class: 'highlight'
file: null
initia... |
Add help for adapter command. | # Description:
# Utility commands surrounding Hubot uptime.
#
# Commands:
# hubot ping - Reply with pong
# hubot echo <text> - Reply back with <text>
# hubot time - Reply with current time
# hubot die - End hubot process
module.exports = (robot) ->
robot.respond /PING$/i, (msg) ->
msg.send "PONG"
ro... | # Description:
# Utility commands surrounding Hubot uptime.
#
# Commands:
# hubot ping - Reply with pong
# hubot adapter - Reply with the adapter
# hubot echo <text> - Reply back with <text>
# hubot time - Reply with current time
# hubot die - End hubot process
module.exports = (robot) ->
robot.respond /... |
Allow commands to be any object | class Lanes.Screens.CommonComponents extends Lanes.React.Component
propTypes:
commands: React.PropTypes.instanceOf(Lanes.Screens.Commands).isRequired
errors: React.PropTypes.bool
networkActivity: React.PropTypes.bool
toolbarProps: React.PropTypes.object
ren... | class Lanes.Screens.CommonComponents extends Lanes.React.Component
propTypes:
commands: React.PropTypes.object.isRequired
errors: React.PropTypes.bool
networkActivity: React.PropTypes.bool
toolbarProps: React.PropTypes.object
render: ->
model = @pro... |
Fix wrong arrow in send mobile view controller | class @WalletSendMobileDialogViewController extends @DialogViewController
view:
mobileName: "#mobile_name"
cancel: ->
Api.callback_cancel 'send_payment', t('wallet.send.errors.cancelled')
@dismiss()
initialize: ->
super
@_request = ledger.m2fa.requestValidation(@params.transaction, @params.... | class @WalletSendMobileDialogViewController extends @DialogViewController
view:
mobileName: "#mobile_name"
cancel: ->
Api.callback_cancel 'send_payment', t('wallet.send.errors.cancelled')
@dismiss()
initialize: ->
super
@_request = ledger.m2fa.requestValidation(@params.transaction, @params.... |
Load / run scripts synchronously | fs = require "fs"
path = require "path"
module.exports = (robot, scripts) ->
scriptsPath = path.resolve(__dirname, "src")
fs.exists scriptsPath, (exists) ->
if exists
for script in fs.readdirSync(scriptsPath)
if scripts? and "*" not in scripts
robot.loadF... | fs = require 'fs'
path = require 'path'
module.exports = (robot, scripts) ->
scriptsPath = path.resolve(__dirname, 'src')
if fs.existsSync scriptsPath
for script in fs.readdirSync(scriptsPath).sort()
if scripts? and '*' not in scripts
robot.loadFile(scriptsPath, script) if s... |
Use title and not full path for slugify | fs = require('fs-extra-promise')
fm = require('fastmatter')
moment = require('moment')
markdown = require('marked')
glob = require('glob-promise')
Promise = require('bluebird')
S = require('string')
class Post
constructor: (post) ->
@post = post
body = fs.readFileSync @post, 'utf-8'
@matter = fm(body.toS... | fs = require('fs-extra-promise')
fm = require('fastmatter')
moment = require('moment')
markdown = require('marked')
glob = require('glob-promise')
Promise = require('bluebird')
S = require('string')
class Post
constructor: (post) ->
@post = post
body = fs.readFileSync @post, 'utf-8'
@matter = fm(body.toS... |
Split functionality for printing questions | Plugin = require 'plugin'
{tr} = require 'i18n'
exports.questions = questions = -> [
["stolen alcohol from my parents", true],
["cheated in a competition", false],
["eaten cake", false]
]
exports.indexToQuestion = (q) ->
"Never have I ever " + questions[q][0]
| Plugin = require 'plugin'
{tr} = require 'i18n'
exports.questions = questions = -> [
["stolen alcohol from my parents", true],
["cheated in a competition", false],
["eaten cake", false]
]
exports.indexToQuestion = (q) ->
stringToQuestion questions[q][0]
exports.stringToQuestion = stringToQuestion = (... |
Add Ruby snippet for context blocks | ".source.ruby":
"Hashrocket":
prefix: "="
body: " => "
"Test block":
prefix: "test"
body: """
test "$1" do
$2
end
"""
".source.coffee":
"Describe block":
prefix: "de"
body: """
describe "${1:description}", ->
${2:body}
"""
"It block":
prefi... | ".source.ruby":
"Hashrocket":
prefix: "="
body: " => "
"Context block":
prefix: "context"
body: """
context "$1" do
$2
end
"""
"Test block":
prefix: "test"
body: """
test "$1" do
$2
end
"""
".source.coffee":
"Describe block":
prefix:... |
Embed associated data in EventSearch. | #= require models/data_collector
adapter = if window.location.search.lastIndexOf('fixture') != -1
DS.FixtureAdapter.extend
latency: 250
else
DS.RESTAdapter.configure 'plurals',
event_search: 'event_searches'
DS.RESTAdapter.extend
... | #= require models/data_collector
#= require models/event_search
adapter = if window.location.search.lastIndexOf('fixture') != -1
DS.FixtureAdapter.extend
latency: 250
else
DS.RESTAdapter.configure 'plurals',
event_search: 'event_searches'
DS.RE... |
Fix incoming messages not being shown | Messages = new Meteor.Collection('messages')
irc = Meteor.require 'irc'
clients = {}
Meteor.publish 'channel', (channel, nick) ->
if channel && nick
listen channel, nick
Messages.find(channel : channel)
listen = (channel, nick) ->
console.log(channel, nick)
client = clients[nick] = new irc.C... | Messages = new Meteor.Collection('messages')
irc = Meteor.require 'irc'
clients = {}
Meteor.publish 'channel', (channel, nick) ->
if channel && nick
listen channel, nick
Messages.find(channel : channel)
listen = (channel, nick) ->
console.log(channel, nick)
client = clients[nick] = new irc.C... |
Fix SVG image sizing in Safari | # @cjsx React.DOM
React = require 'react'
# React.DOM doesn't include an SVG <image> tag
# (because of its namespaced `xlink:href` attribute, I think),
# so this fakes one by wrapping it in a <g>.
module.exports = React.createClass
displayName: 'SVGImage'
getDefaultProps: ->
src: ''
width: 0
height:... | # @cjsx React.DOM
React = require 'react'
# React.DOM doesn't include an SVG <image> tag
# (because of its namespaced `xlink:href` attribute, I think),
# so this fakes one by wrapping it in a <g>.
module.exports = React.createClass
displayName: 'SVGImage'
getDefaultProps: ->
src: ''
width: 0
height:... |
Fix WebTerm to work correctly with multiple VMs | class WebTermController extends AppController
KD.registerAppClass this,
name : "WebTerm"
route : "/Develop"
multiple : yes
hiddenHandle : no
behavior : "application"
preCondition :
condition : (options, cb)->
KD.singletons.vmController.info (err, vm, info... | class WebTermController extends AppController
KD.registerAppClass this,
name : "WebTerm"
route : "/Develop"
multiple : yes
hiddenHandle : no
behavior : "application"
preCondition :
condition : (options, cb)->
{params} = options
vmName = params?.... |
Disable atom auto-close with last tab | "*":
core:
audioBeep: false
disabledPackages: [
"language-clojure"
"language-go"
"language-java"
"language-perl"
"language-objective-c"
"language-property-list"
"metrics"
"open-on-github"
"package-generator"
"symbols-view"
"language-toml"
]... | "*":
core:
audioBeep: false
closeEmptyWindows: false
disabledPackages: [
"language-clojure"
"language-go"
"language-java"
"language-perl"
"language-objective-c"
"language-property-list"
"metrics"
"open-on-github"
"package-generator"
"symbols-view... |
Add httpd to list of log file types. | H2O.LogFileOutput = (_, _cloud, _nodeIndex, _fileType, _logFile) ->
_exception = signal null #TODO Display in .jade
_contents = signal ''
_nodes = signal []
_activeNode = signal null
_fileTypes = signal ['trace', 'debug', 'info', 'warn', 'error', 'fatal', 'stdout', 'stderr']
_activeFileType = signal null
... | H2O.LogFileOutput = (_, _cloud, _nodeIndex, _fileType, _logFile) ->
_exception = signal null #TODO Display in .jade
_contents = signal ''
_nodes = signal []
_activeNode = signal null
_fileTypes = signal ['trace', 'debug', 'info', 'warn', 'error', 'fatal', 'httpd', 'stdout', 'stderr']
_activeFileType = sign... |
Add route for waterpoint creation form | 'use strict'
angular
.module('taarifaWaterpointsApp', [
'ngResource',
'ngRoute',
'leaflet-directive',
'dynform'
])
.config ($routeProvider) ->
$routeProvider
.when '/',
templateUrl: 'views/main.html'
controller: 'MapCtrl'
.when '/waterpoints/edit/:id',
temp... | 'use strict'
angular
.module('taarifaWaterpointsApp', [
'ngResource',
'ngRoute',
'leaflet-directive',
'dynform'
])
.config ($routeProvider) ->
$routeProvider
.when '/',
templateUrl: 'views/main.html'
controller: 'MapCtrl'
.when '/waterpoints/edit/:id',
temp... |
Use path and context to retrieve the directory | "use strict"
Beautifier = require('./beautifier')
prettier = require("prettier")
module.exports = class Prettier extends Beautifier
name: "Prettier"
link: "https://github.com/prettier/prettier"
options: {
_:
tabWidth: "indent_size"
useTabs: ["indent_with_tabs", "indent_char", (indent_with_tabs, ... | "use strict"
Beautifier = require('./beautifier')
prettier = require("prettier")
path = require("path")
module.exports = class Prettier extends Beautifier
name: "Prettier"
link: "https://github.com/prettier/prettier"
options: {
_:
tabWidth: "indent_size"
useTabs: ["indent_with_tabs", "indent_cha... |
Use recursion to substitute text | module.exports =
class Substitution
global: false
constructor: (@findText, @replaceText, @options) ->
@findRegex = new RegExp(@findText, "g")
@global = 'g' in @options
perform: (editor) ->
{ buffer } = editor
selectedText = editor.getSelectedText()
selectionStartIndex = buffer.characterIndex... | module.exports =
class Substitution
global: false
constructor: (@findText, @replaceText, @options) ->
@findRegex = new RegExp(@findText)
@global = 'g' in @options
perform: (editor) ->
selectedText = editor.getSelectedText()
selectionStartIndex = editor.buffer.characterIndexForPosition(editor.get... |
Use the CollectionUtils difference for suggested channels | class SuggestedTopicsEmptyView extends Backbone.Marionette.ItemView
template:
text: "No suggestions available."
class SuggestedSiteTopicView extends Backbone.Marionette.ItemView
tagName: 'li'
template: "channels/suggested_channel"
events:
'click' : 'clickAdd'
clickAdd: ->
@model.withCurrentOrCr... | class SuggestedTopicsEmptyView extends Backbone.Marionette.ItemView
template:
text: "No suggestions available."
class SuggestedSiteTopicView extends Backbone.Marionette.ItemView
tagName: 'li'
template: "channels/suggested_channel"
events:
'click' : 'clickAdd'
clickAdd: ->
@model.withCurrentOrCr... |
Add example of use Directions | # Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
window.onload = ->
handler = Gmaps.build("Google")
handler.buildMap
provider: {}
... | # Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
#window.onload = ->
$(document).ready(->
handler = Gmaps.build("Google")
handler.buildM... |
Rename e variables to error | path = require 'path'
CSON = require 'season'
module.exports =
class Package
@build: (packagePath) ->
AtomPackage = require './atom-package'
ThemePackage = require './theme-package'
try
metadata = @loadMetadata(packagePath)
if metadata.theme
pack = new ThemePackage(packagePath, {meta... | path = require 'path'
CSON = require 'season'
module.exports =
class Package
@build: (packagePath) ->
AtomPackage = require './atom-package'
ThemePackage = require './theme-package'
try
metadata = @loadMetadata(packagePath)
if metadata.theme
pack = new ThemePackage(packagePath, {meta... |
Test HTML and CSS with PhantomJS | expect = require('chai').expect
phantom = require('phantom')
url = 'http://localhost:4567'
describe 'Load page: http://localhost:4567 and', ->
browser = null
testOpts =
title: 'MyWay!'
before ->
browser = new Browser()
return browser.visit url
it "is expected to have a title of '#{testOpts.titl... | expect = require('chai').expect
phantom = require('phantom')
visitUrl = (url, callback) ->
phantom.create (ph) ->
ph.createPage (pg) ->
pg.open url, (status) ->
callback(pg)
describe 'On page: http://localhost:4567 and', ->
page = null
before (done) ->
visitUrl 'http://localhost:4567', (p... |
Throw error if there is no MAC address | crypto = require 'crypto'
Reporter = require './reporter'
module.exports =
activate: ({sessionLength}) ->
if atom.config.get('metrics.userId')
@begin(sessionLength)
else
@getUserId (userId) -> atom.config.set('metrics.userId', userId)
@begin(sessionLength)
serialize: ->
sessionLength... | crypto = require 'crypto'
Reporter = require './reporter'
module.exports =
activate: ({sessionLength}) ->
if atom.config.get('metrics.userId')
@begin(sessionLength)
else
@getUserId (userId) -> atom.config.set('metrics.userId', userId)
@begin(sessionLength)
serialize: ->
sessionLength... |
Drop custom classes from Link | #
React = require 'react'
$ = React.createElement
Component = require './component'
class Link extends Component
@defaultProps =
href: '#'
role: 'link'
tabIndex: 0
focus: =>
React.findDOMNode(this).focus()
prepare: (props) ->
super props
props.classList.push 'm-focus' if @state.focus
... | #
React = require 'react'
$ = React.createElement
Component = require './component'
{BUTTON_LEFT, KEY_ENTER} = require './constants'
class Link extends Component
@defaultProps =
href: '#'
role: 'link'
tabIndex: 0
focus: =>
React.findDOMNode(this).focus()
prepare: (props) ->
super props
... |
Fix invalid copy in config | module.exports =
selector: ['.source.python']
id: 'aligner-python' # package name
config:
':-alignment':
title: 'Padding for =>'
description: 'Pad left or right of the character'
type: 'string'
enum: ['left', 'right']
default: 'right'
':-leftSpace':
title: 'Left space f... | module.exports =
selector: ['.source.python']
id: 'aligner-python' # package name
config:
':-alignment':
title: 'Padding for :'
description: 'Pad left or right of the character'
type: 'string'
enum: ['left', 'right']
default: 'right'
':-leftSpace':
title: 'Left space fo... |
Use robot.respond instead of robot.hear. | # Description:
# "Your very own Dimmerworld simulator."
#
# Dependencies:
# "cleverbot-node": "0.1.1"
#
# Configuration:
# None
#
# Commands:
# dimmer <input>
#
# Author:
# zachlatta
dimmer = require('cleverbot-node')
module.exports = (robot) ->
d = new dimmer()
robot.hear /^dimmer: (.*)/i, (msg) ->
... | # Description:
# "Your very own Dimmerworld simulator."
#
# Dependencies:
# "cleverbot-node": "0.1.1"
#
# Configuration:
# None
#
# Commands:
# dimmer <input>
#
# Author:
# zachlatta
dimmer = require('cleverbot-node')
module.exports = (robot) ->
d = new dimmer()
robot.respond /^dimmer/i, (msg) ->
dat... |
Load and merge defaults if available | fs = require "fs"
path = require "path"
env = (process.env.NODE_ENV or "development").toLowerCase()
if process.env.SHARELATEX_CONFIG?
possibleConfigFiles = [process.env.SHARELATEX_CONFIG]
else
possibleConfigFiles = [
process.cwd() + "/config/settings.#{env}.coffee"
path.normalize(__dirname + "/../../config/setti... | fs = require "fs"
path = require "path"
env = (process.env.NODE_ENV or "development").toLowerCase()
merge = (settings, defaults) ->
for key, value of settings
if typeof(value) == "object"
defaults[key] = merge(settings[key], defaults[key] or {})
else
defaults[key] = value
return defaults
defaultSettingsPa... |
Remove odd saving and restoring of cursor positions behaviour, code is now cleaner | toggleQuotes = (editor) ->
cursors = editor.getCursors()
positions = []
for cursor in cursors
do (cursor) ->
positions.push(position = cursor.getBufferPosition())
toggleQuoteAtPosition(editor, position)
# reset cursors to where they were - first destroy all, then add them back in
# at their... | toggleQuotes = (editor) ->
cursors = editor.getCursors()
for cursor in cursors
do (cursor) ->
position = cursor.getBufferPosition()
toggleQuoteAtPosition(editor, position)
cursor.setBufferPosition(position)
toggleQuoteAtPosition = (editor, position) ->
range = editor.displayBuffer.bufferRa... |
Fix for edited mult choice poll no options selected | angular.module('loomioApp').directive 'pollPollVoteForm', ->
scope: {stance: '='}
templateUrl: 'generated/components/poll/poll/vote_form/poll_poll_vote_form.html'
controller: ($scope, PollService, MentionService, KeyEventService) ->
$scope.vars = {}
multipleChoice = $scope.stance.poll().multipleChoice
... | angular.module('loomioApp').directive 'pollPollVoteForm', ->
scope: {stance: '='}
templateUrl: 'generated/components/poll/poll/vote_form/poll_poll_vote_form.html'
controller: ($scope, PollService, MentionService, KeyEventService) ->
$scope.vars = {}
$scope.pollOptionIdsChecked = {}
initForm = do ->
... |
Load / run scripts synchronously | fs = require 'fs'
path = require 'path'
module.exports = (robot, scripts) ->
scriptsPath = path.resolve(__dirname, 'src')
fs.exists scriptsPath, (exists) ->
if exists
for script in fs.readdirSync(scriptsPath)
if scripts? and '*' not in scripts
robot.loadF... | fs = require 'fs'
path = require 'path'
module.exports = (robot, scripts) ->
scriptsPath = path.resolve(__dirname, 'src')
if fs.existsSync scriptsPath
for script in fs.readdirSync(scriptsPath).sort()
if scripts? and '*' not in scripts
robot.loadFile(scriptsPath, script) if s... |
Call add instead of registerDeserializer | DeserializerManager = require '../src/deserializer-manager'
describe ".deserialize(state)", ->
deserializer = null
class Foo
@deserialize: ({name}) -> new Foo(name)
constructor: (@name) ->
beforeEach ->
deserializer = new DeserializerManager()
deserializer.registerDeserializer(Foo)
it "calls... | DeserializerManager = require '../src/deserializer-manager'
describe ".deserialize(state)", ->
deserializer = null
class Foo
@deserialize: ({name}) -> new Foo(name)
constructor: (@name) ->
beforeEach ->
deserializer = new DeserializerManager()
deserializer.add(Foo)
it "calls deserialize on t... |
Make integration test work in any environment | AWS = require('../../lib/aws')
config = new AWS.FileSystemConfig('configuration')
integration = (test, callback) ->
req = test.suite.parentSuite.service[test.suite.description]()
resp = null
runs ->
req.always (respObject) ->
resp = respObject
waitsFor ->
resp != null
runs ->
callback(resp)... | AWS = require('../../lib/aws')
config = new AWS.FileSystemConfig('configuration')
integration = (test, callback) ->
req = test.suite.parentSuite.service[test.suite.description]()
resp = null
runs ->
req.always (respObject) ->
resp = respObject
waitsFor ->
resp != null
runs ->
callback(resp)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.