Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Improve coffeescript using unless attribute | $ ->
if $('#setting_show_map').length
$this = $('#setting_show_map')
if $this.is(':checked')
else
$('.map-settings').hide()
$this.on 'click', (e) ->
if $this.is(':checked')
$('.map-settings').slideDown()
else
$('.map-settings').slideUp()
| $ ->
if $('#setting_show_map').length
$this = $('#setting_show_map')
unless $this.is(':checked')
$('.map-settings').hide()
$this.on 'click', (e) ->
if $this.is(':checked')
$('.map-settings').slideDown()
else
$('.map-settings').slideUp()
|
Fix bad if statement sending doc open into infinite loop | define [
"base"
], (App) ->
App.controller "HistoryV2DiffController", ($scope, ide, event_tracking) ->
$scope.restoreState =
inflight: false
error: false
$scope.restoreDeletedFile = () ->
pathname = $scope.history.selection.pathname
return if !pathname?
version = $scope.history.selection.docs[path... | define [
"base"
], (App) ->
App.controller "HistoryV2DiffController", ($scope, ide, event_tracking) ->
$scope.restoreState =
inflight: false
error: false
$scope.restoreDeletedFile = () ->
pathname = $scope.history.selection.pathname
return if !pathname?
version = $scope.history.selection.docs[path... |
Use regex to check for 'mailto:' link | define (require) ->
$ = require('jquery')
Backbone = require('backbone')
router = require('cs!router')
analytics = require('cs!helpers/handlers/analytics') # Setup Analytics Handler
# The root URI prefixed on all non-external AJAX and Backbone URIs
root = '/'
init = (options = {}) ->
# Append /test ... | define (require) ->
$ = require('jquery')
Backbone = require('backbone')
router = require('cs!router')
analytics = require('cs!helpers/handlers/analytics') # Setup Analytics Handler
# The root URI prefixed on all non-external AJAX and Backbone URIs
root = '/'
init = (options = {}) ->
# Append /test ... |
Recompile vendor css on bootstrap var changes | g = module.parent.exports
g.task "watch", ->
g.s.listen 35729, (err) ->
return console.log(err) if err
g.watch "bower.json", ["vendor"]
g.watch ["fonts/**/*", "web/vendor/**/fonts/*"], ["fonts"]
g.watch "images/**/*", ["images"]
g.watch "scripts/**/*.coffee", ["scripts"]
g.watch "styles/**/*... | g = module.parent.exports
g.task "watch", ->
g.s.listen 35729, (err) ->
return console.log(err) if err
g.watch "bower.json", ["vendor"]
g.watch ["fonts/**/*", "web/vendor/**/fonts/*"], ["fonts"]
g.watch "images/**/*", ["images"]
g.watch "scripts/**/*.coffee", ["scripts"]
g.watch "styles/**/*... |
Remove log to task pdf url | angular.module('doubtfire.units.states.tasks.viewer.directives.task-sheet-view', [])
.directive('taskSheetView', ->
restrict: 'E'
templateUrl: 'units/states/tasks/viewer/directives/task-sheet-view/task-sheet-view.tpl.html'
scope:
task: '='
unit: '='
controller: ($scope, $timeout, TaskFeedback, taskServ... | angular.module('doubtfire.units.states.tasks.viewer.directives.task-sheet-view', [])
.directive('taskSheetView', ->
restrict: 'E'
templateUrl: 'units/states/tasks/viewer/directives/task-sheet-view/task-sheet-view.tpl.html'
scope:
task: '='
unit: '='
controller: ($scope, $timeout, TaskFeedback, taskServ... |
Update the Account PayPal Response for New View | $(".paypal-status").html "<%= escape_javascript(render :partial => 'devise/registrations/verified_status', :formats => [ :html ]) %>"
$(".verified-status-tag").html "<%= escape_javascript(render :partial => 'shared/verified_status_tag', :formats => [ :html ]) %>"
$(".modal").removeClass "paypal-confirm-modal" if $(".mo... | $(".account-status-paypal").html "<%= escape_javascript(render :partial => 'devise/registrations/verified_status', :formats => [ :html ]) %>"
$(".account-status-linked").html "<%= escape_javascript(render :partial => 'users/club_live_status', :formats => [ :html ]) %>"
$(".verified-status-tag").html "<%= escape_javascr... |
Fix OPTIONS accumulation on OPTIONS requests | _ = require 'lodash'
module.exports = (options) ->
(req, res, next) ->
if not _.isArray options
options = [options]
options.push 'OPTIONS'
res.header 'Access-Control-Allow-Methods', options.join ", "
res.header 'Access-Control-Allow-Headers', 'Content-Type'
res... | _ = require 'lodash'
module.exports = (options) ->
if not _.isArray options
options = [options]
options.push 'OPTIONS'
(req, res, next) ->
res.header 'Access-Control-Allow-Methods', options.join ", "
res.header 'Access-Control-Allow-Headers', 'Content-Type'
res.header 'Acce... |
Allow empty pre- or postmatch | App.CwbResultTableController = Em.Controller.extend
needs: ['resultTable']
# We get the actual page of results from the resultTableController; this
# controller is only responsible for doing CWB-specific formatting of
# those results
resultPageBinding: 'controllers.resultTable.content'
arrangedContent: (... | App.CwbResultTableController = Em.Controller.extend
needs: ['resultTable']
# We get the actual page of results from the resultTableController; this
# controller is only responsible for doing CWB-specific formatting of
# those results
resultPageBinding: 'controllers.resultTable.content'
arrangedContent: (... |
Use new API for gulp-iconfont | #--------------------------------------------------------
# Requirements
#--------------------------------------------------------
gulp = require 'gulp'
plugins = require('gulp-load-plugins')()
config = require "../config.coffee"
#--------------------------------------------------------
# Icon Font
#------... | #--------------------------------------------------------
# Requirements
#--------------------------------------------------------
gulp = require 'gulp'
plugins = require('gulp-load-plugins')()
config = require "../config.coffee"
#--------------------------------------------------------
# Icon Font
#------... |
Remove yourself from chat list. | class IDE.ChatParticipantView extends JView
constructor: (options = {}, data) ->
options.cssClass = 'participant-view'
super options, data
participantData = @getData()
participantName = participantData.nickname
@avatar = new AvatarView
origin : participantData.nickname
size ... | class IDE.ChatParticipantView extends JView
constructor: (options = {}, data) ->
options.cssClass = 'participant-view'
super options, data
participantData = @getData()
participantName = participantData.nickname
@avatar = new AvatarView
origin : participantData.nickname
size ... |
Remove rendering logic from PanelView | Message = require './message'
class PanelView extends HTMLElement
initialize:(@linter) ->
@id = 'linter-panel'
render: (messages) ->
messages.forEach (message) =>
if @linter.views.scope is 'file'
return unless message.currentFile
if message.currentFile and message.position
p = ... | Message = require './message'
class PanelView extends HTMLElement
attachedCallback:(@linter) ->
@id = 'linter-panel'
module.exports = document.registerElement('linter-panel-view', {prototype: PanelView.prototype}) |
Use fallback also when element is undefined. | {parseString} = require 'xml2js'
exports.xmlFix = (xml) ->
if not xml.match /\<root\>/
xml = "<root>#{xml}</root>"
if not xml.match /\?xml/
xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>#{xml}"
xml
exports.xmlTransform = (xml, callback) ->
parseString xml, callback
exports.xmlVal = (elem, attribNa... | {parseString} = require 'xml2js'
exports.xmlFix = (xml) ->
if not xml.match /\<root\>/
xml = "<root>#{xml}</root>"
if not xml.match /\?xml/
xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>#{xml}"
xml
exports.xmlTransform = (xml, callback) ->
parseString xml, callback
exports.xmlVal = (elem, attribNa... |
Fix bug where username incorrectly passed to findOneByUsername. Also adds arugment validation. | Meteor.methods
addUserToRoom: (data) ->
fromId = Meteor.userId()
# console.log '[methods] addUserToRoom -> '.green, 'fromId:', fromId, 'data:', data
room = RocketChat.models.Rooms.findOneById data.rid
# if room.username isnt Meteor.user().username and room.t is 'c'
if room.t is 'c' and room.u?.username isn... | Meteor.methods
addUserToRoom: (data) ->
fromId = Meteor.userId()
console.log '[methods] addUserToRoom -> '.green, 'data:', data
unless Match.test data?.rid, String
throw new Meteor.Error 'invalid-rid'
unless Match.test data?.username, String
throw new Meteor.Error 'invalid-username'
room = RocketCha... |
Make it easier to test | siteEngine: "jekyll"
siteLocalDir: "/Users/krainboltgreene/code/organization/blankjekyll.github.io"
siteDraftsDir: "_drafts/"
sitePostsDir: "_posts/"
siteImagesDir: "/"
siteUrl: "http://blankjekyll.github.io"
frontMatter: """
---
layout: <layout>
title: "<title>"
summary: ""
date: <date>
authors:
- "Kurtis Rainbolt-G... | siteEngine: "jekyll"
siteLocalDir: "/Users/krainboltgreene/code/krainboltgreene/blankjekyll"
siteDraftsDir: "_drafts/"
sitePostsDir: "_posts/"
siteImagesDir: "/"
siteUrl: "http://blankjekyll.github.io"
frontMatter: """
---
layout: <layout>
title: "<title>"
summary: ""
date: <date>
authors:
- "Kurtis Rainbolt-Greene"
... |
Fix recentlyUpdatedSongs route is not highlighted. | goog.provide 'app.react.Header'
class app.react.Header
###*
@param {app.Routes} routes
@param {app.react.Link} link
@param {app.users.Store} usersStore
@constructor
###
constructor: (routes, link, usersStore) ->
{header,nav} = React.DOM
@component = React.createFactory React.createClass... | goog.provide 'app.react.Header'
class app.react.Header
###*
@param {app.Routes} routes
@param {app.react.Link} link
@param {app.users.Store} usersStore
@constructor
###
constructor: (routes, link, usersStore) ->
{header,nav} = React.DOM
@component = React.createFactory React.createClass... |
Switch to simply using build | # default - message + brief help
gulp = require "gulp"
runSequence = require "run-sequence"
gulp.task "default", (cb) ->
console.log('Building BokehJS for developer mode ...')
runSequence(["scripts", "styles"], "install", "watch", cb)
| # default - message + brief help
gulp = require "gulp"
runSequence = require "run-sequence"
gulp.task "default", (cb) ->
console.log('Building BokehJS for developer mode ...')
runSequence("build", "install", "watch", cb)
|
Remove ramda-repl - no longer used | packages: [
"advanced-open-file"
"atom-beautify"
"atom-elixir"
"atom-elixir-formatter"
"atom-react-native-autocomplete"
"auto-indent"
"auto-update-packages"
"autocomplete-modules"
"busy-signal"
"color-picker"
"elm-format"
"elmjutsu"
"emmet-simplified"
"expand-region"
"file-icons"
"git-di... | packages: [
"advanced-open-file"
"atom-beautify"
"atom-elixir"
"atom-elixir-formatter"
"atom-react-native-autocomplete"
"auto-indent"
"auto-update-packages"
"autocomplete-modules"
"busy-signal"
"color-picker"
"elm-format"
"elmjutsu"
"emmet-simplified"
"expand-region"
"file-icons"
"git-di... |
Fix up new jasmine tests | xdescribe 'CombinedOpenEnded', ->
beforeEach ->
spyOn Logger, 'log'
# load up some fixtures
loadFixtures 'combined-open-ended.html'
@element = $('.combined-open-ended')
describe 'constructor', ->
beforeEach ->
@combined = new CombinedOpenEnded @element
it 'set the element', -... | describe 'CombinedOpenEnded', ->
beforeEach ->
spyOn Logger, 'log'
# load up some fixtures
loadFixtures 'combined-open-ended.html'
@element = $('.combined-open-ended')
describe 'constructor', ->
beforeEach ->
@combined = new CombinedOpenEnded @element
it 'set the element', ->
e... |
Add tooltip with title and description | $(document).on "turbolinks:load", ->
$('div.calendar').calendar()
$('.calendar_range_start').calendar
endCalendar: $('.calendar_range_end')
$('.calendar_range_end').calendar
startCalendar: $('.calendar_range_start')
$('.ui.accordion').accordion()
$('.ui.dropdown').dropdown
action: 'hide'
$('#... | $(document).on "turbolinks:load", ->
$('div.calendar').calendar()
$('.calendar_range_start').calendar
endCalendar: $('.calendar_range_end')
$('.calendar_range_end').calendar
startCalendar: $('.calendar_range_start')
$('.ui.accordion').accordion()
$('.ui.dropdown').dropdown
action: 'hide'
$('#... |
Fix incorrect results if detect-indent detects no indentation | fs = require 'fs'
editorconfig = require 'editorconfig'
detectIndent = require 'detect-indent'
module.exports = (filePath, callback) ->
editorconfig.parse(filePath)
.then (editorconfigProperties) ->
result = {}
fs.readFile filePath, 'utf8', (err, fileContents) ->
return callback err if err
indentStyle =... | fs = require 'fs'
editorconfig = require 'editorconfig'
detectIndent = require 'detect-indent'
module.exports = (filePath, callback) ->
editorconfig.parse(filePath)
.then (editorconfigProperties) ->
result = {}
fs.readFile filePath, 'utf8', (err, fileContents) ->
return callback err if err
indentStyle =... |
Add commands description to help | program = require 'commander'
GitHubApi = require 'github'
pkg = require './../package'
Config = require './config'
Commands = require './commands'
Initializer = require './initializer'
exports.run = ->
program
.version(pkg.version)
.option('-c, --config [file]', 'specify .pending-pr f... | program = require 'commander'
GitHubApi = require 'github'
pkg = require './../package'
Config = require './config'
Commands = require './commands'
Initializer = require './initializer'
exports.run = ->
program
.version(pkg.version)
.option('-c, --config [file]', 'specify .pending-pr f... |
Add loading section to payment screen | Neighborly.Projects = {} if Neighborly.Projects is undefined
Neighborly.Projects.Backers = {} if Neighborly.Projects.Backers is undefined
Neighborly.Projects.Backers.Edit =
modules: -> [Neighborly.CustomTooltip]
init: Backbone.View.extend
el: '.create-backer-page'
events:
'click .faqs a': 'openFaqTe... | Neighborly.Projects = {} if Neighborly.Projects is undefined
Neighborly.Projects.Backers = {} if Neighborly.Projects.Backers is undefined
Neighborly.Projects.Backers.Edit =
modules: -> [Neighborly.CustomTooltip]
init: Backbone.View.extend
el: '.create-backer-page'
events:
'click .faqs a': 'openFaqTe... |
Use done(error) instead using expect(..). | _ = require 'underscore'
Mapping = require '../lib/mapping'
SphereClient = require 'sphere-node-client'
Config = require '../config'
fs = require 'fs'
jasmine.getEnv().defaultTimeoutInterval = 10000
describe 'integration tests', ->
beforeEach ->
@sphere = new SphereClient Config
@mapping = new Mapping Confi... | _ = require 'underscore'
Mapping = require '../lib/mapping'
SphereClient = require 'sphere-node-client'
Config = require '../config'
fs = require 'fs'
jasmine.getEnv().defaultTimeoutInterval = 10000
describe 'integration tests', ->
beforeEach ->
@sphere = new SphereClient Config
@mapping = new Mapping Confi... |
Add JS affix to order summary | Neighborly.Payment = Backbone.View.extend
el: '.payment'
initialize: ->
_.bindAll this, 'showContent'
this.$('.methods input').click (e) =>
this.showContent(e)
this.$('.methods input:first').click()
showContent: (e)->
this.$('.payment-method-option').removeClass('selected')
$(e.current... | Neighborly.Payment = Backbone.View.extend
el: '.payment'
initialize: ->
_.bindAll this, 'showContent'
this.$('.methods input').click (e) =>
this.showContent(e)
this.$('.methods input:first').click()
showContent: (e)->
this.$('.payment-method-option').removeClass('selected')
$(e.current... |
Fix potential infinite loop when an editor has no selection | {CompositeDisposable} = require 'event-kit'
module.exports =
class MinimapSelectionView
decorations: []
constructor: (@minimap) ->
editor = @minimap.getTextEditor()
@subscriptions = new CompositeDisposable
@subscriptions.add editor.onDidAddCursor @handleSelection
@subscriptions.add editor.onDidC... | {CompositeDisposable} = require 'event-kit'
module.exports =
class MinimapSelectionView
decorations: []
constructor: (@minimap) ->
editor = @minimap.getTextEditor()
@subscriptions = new CompositeDisposable
@subscriptions.add editor.onDidAddCursor @handleSelection
@subscriptions.add editor.onDidC... |
Remove console.logs from product detail controller | angular.module('kassa').controller('ProductDetailCtrl', [
'$scope'
'ProductService'
($scope, Product)->
STATE_FAILED = 0
STATE_SAVED = 1
STATE_SAVING = 2
originalProduct = null
equal = angular.equals
changed = (product)-> !equal(originalProduct, product)
cancel = ->
#copy to pr... | angular.module('kassa').controller('ProductDetailCtrl', [
'$scope'
'ProductService'
($scope, Product)->
STATE_FAILED = 0
STATE_SAVED = 1
STATE_SAVING = 2
originalProduct = null
equal = angular.equals
changed = (product)-> !equal(originalProduct, product)
cancel = ->
#copy to pr... |
Validate email uniqueness and password | bcrypt = require 'bcrypt'
crypto = require 'crypto'
mongoose = require 'mongoose'
db = require '../lib/database'
Schema = mongoose.Schema
userSchema = new Schema
name:
type: String
required: true
email:
type: String
required: true
lowercase: true
trim: true
unique: true
password:
... | bcrypt = require 'bcrypt'
crypto = require 'crypto'
mongoose = require 'mongoose'
uniqueValidator = require 'mongoose-unique-validator'
db = require '../lib/database'
Schema = mongoose.Schema
userSchema = new Schema
name:
type: String
required: true
email:
type: String
required: true
lowerca... |
Validate only known types are set as props | React = require 'react'
BS = require 'react-bootstrap'
MESSAGES = {
student: [
<p key='s1'>Tutor shows your weakest topics so you can practice to improve.</p>
<p key='s2'>Try to get all of your topics to green!</p>
]
teacher: [
<p key='t1'>Tutor shows the weakest topics for each period.</p>
... | React = require 'react'
BS = require 'react-bootstrap'
MESSAGES = {
student: [
<p key='s1'>Tutor shows your weakest topics so you can practice to improve.</p>
<p key='s2'>Try to get all of your topics to green!</p>
]
teacher: [
<p key='t1'>Tutor shows the weakest topics for each period.</p>
... |
Add support for recently viewed artwork rail on homepage | module.exports = """
query($showHeroUnits: Boolean!) {
home_page {
artwork_modules(
max_rails: 6,
order: [
ACTIVE_BIDS,
RECOMMENDED_WORKS,
FOLLOWED_ARTISTS,
RELATED_ARTISTS,
FOLLOWED_GALLERIES,
SAVED_WORKS,
LIVE_AUCTIONS,
... | module.exports = """
query($showHeroUnits: Boolean!) {
home_page {
artwork_modules(
max_rails: 7,
order: [
ACTIVE_BIDS,
RECENTLY_VIEWED_WORKS
RECOMMENDED_WORKS,
FOLLOWED_ARTISTS,
RELATED_ARTISTS,
FOLLOWED_GALLERIES,
SAVED_... |
Add default { template } delimiters. | # The Rivets namespace.
Rivets =
# Binder definitions, publicly accessible on `module.binders`. Can be
# overridden globally or local to a `Rivets.View` instance.
binders: {}
# Component definitions, publicly accessible on `module.components`. Can be
# overridden globally or local to a `Rivets.View` instance... | # The Rivets namespace.
Rivets =
# Binder definitions, publicly accessible on `module.binders`. Can be
# overridden globally or local to a `Rivets.View` instance.
binders: {}
# Component definitions, publicly accessible on `module.components`. Can be
# overridden globally or local to a `Rivets.View` instance... |
Add -H option to fix broken symbolic links error | class FSFolder extends FSFile
fetchContents:(callback)->
# @emit "fs.fetchContents.started"
# @kiteController.run
# toDo : "ls"
# withArgs :
# command : @path
# , (err, response)=>
# if err
# warn err
# @emit "fs.fetchContents.finished", err
# else
... | class FSFolder extends FSFile
fetchContents:(callback)->
# @emit "fs.fetchContents.started"
# @kiteController.run
# toDo : "ls"
# withArgs :
# command : @path
# , (err, response)=>
# if err
# warn err
# @emit "fs.fetchContents.finished", err
# else
... |
Use atom.workspace.open() for specs to make them less flaky | About = require '../lib/about'
{$} = require 'atom-space-pen-views'
describe "About", ->
workspaceElement = null
beforeEach ->
workspaceElement = atom.views.getView(atom.workspace)
waitsForPromise ->
atom.packages.activatePackage('about')
describe "when the about:about-atom command is triggered"... | About = require '../lib/about'
{$} = require 'atom-space-pen-views'
describe "About", ->
workspaceElement = null
beforeEach ->
workspaceElement = atom.views.getView(atom.workspace)
waitsForPromise ->
atom.packages.activatePackage('about')
describe "when the about:about-atom command is triggered"... |
Fix decorations not destroyed on deactivation | {CompositeDisposable} = require 'atom'
module.exports =
class MinimapPigmentsBinding
constructor: ({@editor, @minimap, @colorBuffer}) ->
@displayedMarkers = []
@subscriptions = new CompositeDisposable
@colorBuffer.initialize().then => @updateMarkers()
@subscriptions.add @colorBuffer.onDidUpdateColo... | {CompositeDisposable} = require 'atom'
module.exports =
class MinimapPigmentsBinding
constructor: ({@editor, @minimap, @colorBuffer}) ->
@displayedMarkers = []
@subscriptions = new CompositeDisposable
@colorBuffer.initialize().then => @updateMarkers()
@subscriptions.add @colorBuffer.onDidUpdateColo... |
Reformat the indent pattern regexes | # Much of the following is derived from: https://github.com/atom/language-csharp/blob/fba368a8397e298fa78679b4ee0a542b2474c150/scoped-properties/language-csharp.cson
'.source.powershell':
'editor':
'commentStart': '# '
'foldEndPattern': '^\\s*\\}|^\\s*\\]|^\\s*\\)'
'increaseIndentPattern': '(?x)\n\t\t^ .*... | # Much of the following is derived from: https://github.com/atom/language-csharp/blob/fba368a8397e298fa78679b4ee0a542b2474c150/scoped-properties/language-csharp.cson
'.source.powershell':
'editor':
'commentStart': '# '
'foldEndPattern': '^\\s*\\}|^\\s*\\]|^\\s*\\)'
'increaseIndentPattern': '(?x)
^ .... |
Change html margin when the sidebar opens to compensate for change in | scrollbarWidth = 0
FactlinkJailRoot.loaded_promise.then ->
# Create the measurement nod; see http://davidwalsh.name/detect-scrollbar-width
scrollDiv = document.createElement("div");
$(scrollDiv).css(
width: "100px"
height: "100px"
overflow: "scroll"
position: "absolute"
top: "-9999px"
)
do... | scrollbarWidth = 0
FactlinkJailRoot.loaded_promise.then ->
# Create the measurement nod; see http://davidwalsh.name/detect-scrollbar-width
scrollDiv = document.createElement("div");
$(scrollDiv).css(
width: "100px"
height: "100px"
overflow: "scroll"
position: "absolute"
top: "-9999px"
)
do... |
Switch to Atom default theme | "*":
core:
telemetryConsent: "limited"
themes: [
"one-light-ui"
"atom-light-syntax"
]
editor:
fontFamily: "Menlo"
invisibles: {}
softWrap: true
"exception-reporting":
userId: "0f9c4bca-c1e4-c885-1374-c2dd26290ade"
"spell-check": {}
tabs:
addNewTabsAtEnd: true
welc... | "*":
core:
telemetryConsent: "limited"
editor:
fontFamily: "Menlo"
invisibles: {}
softWrap: true
"exception-reporting":
userId: "0f9c4bca-c1e4-c885-1374-c2dd26290ade"
"spell-check": {}
tabs:
addNewTabsAtEnd: true
welcome:
showOnStartup: false
|
Add a bit of documentation | # Copyright 2012 The Apache Software Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | # Copyright 2012 The Apache Software Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... |
Add config as alias for configure | behaviours = {}
share.attach = attach = (behaviour, args...) ->
check behaviour, Match.OneOf Function, String
if Match.test behaviour, String
options = behaviours[behaviour].options
behaviour = behaviours[behaviour].behaviour
if Match.test behaviour, Function
context =
collection: @
opt... | behaviours = {}
share.attach = attach = (behaviour, args...) ->
check behaviour, Match.OneOf Function, String
if Match.test behaviour, String
options = behaviours[behaviour].options
behaviour = behaviours[behaviour].behaviour
if Match.test behaviour, Function
context =
collection: @
opt... |
Monitor event loop by looking for skew | seconds = 1000
module.exports = EventLoopMonitor =
monitor: (logger) ->
interval = setInterval () ->
EventLoopMonitor.Delay()
, 1 * seconds
Metrics = require "./metrics"
Metrics.registerDestructor () ->
clearInterval(interval)
Delay: () ->
Metrics = require "./metrics"
t1 = process.hrtime()
setI... | module.exports = EventLoopMonitor =
monitor: (logger, interval = 1000, log_threshold = 100) ->
Metrics = require "./metrics"
previous = Date.now()
intervalId = setInterval () ->
now = Date.now()
offset = now - previous - interval
if offset > log_threshold
logger.warn {offset: offset}, "slow event... |
Update meta tags instead of reimplementing ujs functionality | #This patches jquery_ujs, such that it grabs csrf token from localStorage
#instead of from the meta tag.
# Make sure that every Ajax request sends the CSRF token
$.rails.CSRFProtection = (xhr) ->
token = safeLocalStorage.factlink_csrf_token
if token
xhr.setRequestHeader('X-CSRF-Token', token)
# making sure th... | #This patches jquery_ujs, such that it grabs csrf token from localStorage
#instead of from the meta tag.
updateRailsCsrfMetaTags = ->
if !$('meta[name=csrf-token]').length
$('<meta name="csrf-token">').appendTo(document.head)
$('<meta name="csrf-param">').appendTo(document.head)
$('meta[name=csrf-token]').... |
Rearrange cs2/gd1/wd1 in outcomes report if progress seems out of order | utils = require 'core/utils'
RootView = require 'views/core/RootView'
module.exports = class OutcomesReportResultView extends RootView
id: 'admin-outcomes-report-result-view'
template: require 'templates/admin/outcome-report-result-view'
events:
'click .back-btn': 'onClickBackButton'
'click .print-btn': ... | utils = require 'core/utils'
RootView = require 'views/core/RootView'
module.exports = class OutcomesReportResultView extends RootView
id: 'admin-outcomes-report-result-view'
template: require 'templates/admin/outcome-report-result-view'
events:
'click .back-btn': 'onClickBackButton'
'click .print-btn': ... |
Remove selection when added a discussion | FactlinkJailRoot.createFactFromSelection = (current_user_opinion) ->
success = ->
FactlinkJailRoot.createButton.hide()
FactlinkJailRoot.off 'modalOpened', success
selInfo =
text: window.document.getSelection().toString()
title: window.document.title
text = selInfo.text
siteUrl = FactlinkJailRo... | FactlinkJailRoot.createFactFromSelection = (current_user_opinion) ->
success = ->
window.document.getSelection().removeAllRanges()
FactlinkJailRoot.createButton.hide()
FactlinkJailRoot.off 'modalOpened', success
selInfo =
text: window.document.getSelection().toString()
title: window.document.ti... |
Extend list of supported file extensions | name: "Roff"
scopeName: "source.roff"
fileTypes: ["1"]
| name: "Roff"
scopeName: "source.roff"
fileTypes: [
"1", "1b", "1c", "1has", "1in", "1m", "1s", "1x",
"2",
"3", "3avl", "3bsm", "3c", "3in", "3m", "3qt", "3x",
"4",
"5",
"6",
"7", "7d", "7fs", "7i", "7ipp", "7m", "7p",
"8",
"9", "9e", "9f", "9p", "9s",
"chem",
"eqn",
"groff",
"man",
"mandoc",
"mdoc",
"me... |
Make image fixing happen on image load rather than document ready | $(document).ready ->
$('.person-headshot-actual').each ->
# Centre headshots vertically in their containers
container = $(this).parent()
hAdjust = (($(this).height() - container.height()) / 2) * (2/3)
$(this).css("top", -hAdjust)
| $(document).ready ->
$('.person-headshot-actual').each ->
$('.person-headshot-actual').load ->
# Centre headshots vertically in their containers
container = $(this).parent()
hAdjust = (($(this).height() - container.height()) / 2) * (2/3)
$(this).css("top", -hAdjust)
|
Add extremely critical culture to the cow. | # Description:
# A cow's gonna be a cow.
#
# Commands:
# hubot moo* - Reply w/ moo
module.exports = (robot) ->
robot.hear /\bmo{2,}\b/i, (msg) ->
if msg.envelope.room == "1s_and_0s"
robot.messageHipchat "MOOOOOOOOOOOOOOOOO"
else
if !msg.envelope.room
msg.send "This incident will be re... | # Description:
# A cow's gonna be a cow.
#
# Commands:
# hubot moo* - Reply w/ moo
module.exports = (robot) ->
robot.hear /\bmo{2,}\b/i, (msg) ->
if msg.envelope.room == "1s_and_0s"
robot.messageHipchat "MOOOOOOOOOOOOOOOOO"
else
if !msg.envelope.room
msg.send "This incident will be re... |
Improve how params and routes are looked up | express = require 'express'
stylus = require 'stylus'
assets = require 'connect-assets'
app = express.createServer()
app.use assets()
app.set 'view engine', 'jade'
app.get '/', (req, resp) -> resp.render 'index'
app.get '/:filename.:extension', (req, resp) ->
content = req.param['content']
if (content and conten... | express = require 'express'
stylus = require 'stylus'
assets = require 'connect-assets'
app = express.createServer()
app.use assets()
app.set 'view engine', 'jade'
app.get '/', (req, resp) -> resp.render 'index'
app.get '/:filename.:extension', (req, resp) ->
content = req.param['content']
if (content and conten... |
Make sure that we set record and not a promise on controller | require 'routes/route'
require 'models/job'
TravisRoute = Travis.Route
Route = TravisRoute.extend
serialize: (model, params) ->
id = if model.get then model.get('id') else model
{ job_id: id }
setupController: (controller, model) ->
if model && !model.get
model = @store.recordForId('job', mode... | require 'routes/route'
require 'models/job'
TravisRoute = Travis.Route
Route = TravisRoute.extend
serialize: (model, params) ->
id = if model.get then model.get('id') else model
{ job_id: id }
setupController: (controller, model) ->
if model && !model.get
model = @store.recordForId('job', mode... |
Use deleted/dirty status for panel class | # @cjsx React.DOM
@Posts = React.createClass(
getInitialState: ->
{ posts: [] }
fetchPosts: ->
$.get("/api/posts").done(@handleSuccess).fail(@handleError)
handleSuccess: (response) ->
@setState(posts: response.posts)
handleError: ->
alert("Could not load posts")
componentWillMount: ->
... | # @cjsx React.DOM
@Posts = React.createClass(
getInitialState: ->
{ posts: [] }
fetchPosts: ->
$.get("/api/posts").done(@handleSuccess).fail(@handleError)
handleSuccess: (response) ->
@setState(posts: response.posts)
handleError: ->
alert("Could not load posts")
componentWillMount: ->
... |
Change absolute path of line 17 | # Description:
# Produces a random gangnam style gif
#
# Dependencies:
# None
# Configuration:
# None
#
# Commands:
# hubot oppa gangnam style - Return random gif from gifbin.com
#
# Author:
# EnriqueVidal
gifs = [
"http://i1.kym-cdn.com/photos/images/original/000/370/936/cb3.gif",
"http://i3.kym-cdn.com... | # Description:
# Produces a random gangnam style gif
#
# Dependencies:
# None
# Configuration:
# None
#
# Commands:
# hubot oppa gangnam style - Return random gif from gifbin.com
#
# Author:
# EnriqueVidal
gifs = [
"http://i1.kym-cdn.com/photos/images/original/000/370/936/cb3.gif",
"http://i3.kym-cdn.com... |
Update user setting values while the slider is changed, then redraw scene | ### define
./abstract_setting_view : AbstractSettingView
underscore : _
###
class SliderSettingView extends AbstractSettingView
className : "slider-setting-view row"
template : _.template("""
<div class="col-sm-5">
<%= displayName %>
</div>
<div class="col-sm-3 no-gutter v-center">
<div... | ### define
./abstract_setting_view : AbstractSettingView
underscore : _
app : app
###
class SliderSettingView extends AbstractSettingView
className : "slider-setting-view row"
template : _.template("""
<div class="col-sm-5">
<%= displayName %>
</div>
<div class="col-sm-3 no-gutter v-center">
... |
Add tests for graph saving and loading | if typeof process isnt 'undefined' and process.execPath and process.execPath.match /node|iojs/
chai = require 'chai' unless chai
noflo = require '../src/lib/NoFlo.coffee'
browser = false
else
noflo = require 'noflo'
browser = true
describe 'NoFlo interface', ->
it 'should be able to tell whether it is runn... | if typeof process isnt 'undefined' and process.execPath and process.execPath.match /node|iojs/
chai = require 'chai' unless chai
noflo = require '../src/lib/NoFlo.coffee'
path = require('path')
browser = false
else
noflo = require 'noflo'
browser = true
describe 'NoFlo interface', ->
it 'should be able t... |
Append (friendly) iframe to body if possible | ###
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... | ###
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... |
Make node path even smarter | module.exports = class Organization
constructor: (org, @api) ->
@orgName = if typeof org is "object" then org.name else org
node: (path, cb) -> @api.get @apiPath(path), {}, cb
apiPath: (path) -> "/#{encodeURIComponent(@orgName)}/#{path}" | module.exports = class Organization
constructor: (org, @api) ->
@orgName = if typeof org is "object" then org.name else org
node: (path, cb) ->
@api.get @apiPath(path), {}, cb
apiPath: (path) ->
path = path.path || path.name if typeof path is "object"
"/#{encodeURIComponent(@orgName)}/#{path}" |
Load event-palette extension in defaultConfig | requireExtension 'autocomplete'
requireExtension 'strip-trailing-whitespace'
requireExtension 'fuzzy-finder'
requireExtension 'tree-view'
requireExtension 'command-panel'
requireExtension 'keybindings-view'
requireExtension 'snippets'
requireExtension 'status-bar'
requireExtension 'wrap-guide'
requireExtension 'markdow... | requireExtension 'event-palette'
requireExtension 'autocomplete'
requireExtension 'strip-trailing-whitespace'
requireExtension 'fuzzy-finder'
requireExtension 'tree-view'
requireExtension 'command-panel'
requireExtension 'keybindings-view'
requireExtension 'snippets'
requireExtension 'status-bar'
requireExtension 'wrap... |
Improve readability of config schema | module.exports =
enableShellEscape:
type: 'boolean'
default: false
moveResultToSourceDirectory:
description: 'Ensures that the output file produced by a successful build
is stored together with the TeX document that produced it.'
type: 'boolean'
default: true
openResultAfterBuild:
ty... | module.exports =
customEngine:
description: 'Enter command for custom LaTeX engine. Overrides Engine.'
type: 'string'
default: ''
enableShellEscape:
type: 'boolean'
default: false
engine:
description: 'Select standard LaTeX engine'
type: 'string'
default: 'pdflatex'
enum: ['p... |
Add password field to User model | App.User = DS.Model.extend
firstName: DS.attr("string")
lastName: DS.attr("string")
email: DS.attr("string")
role: DS.attr("string")
App.CurrentUser = App.User.extend({})
App.Room = DS.Model.extend
name: DS.attr("string")
App.Message = DS.Model.extend
body: DS.attr("string")
type: DS.attr("strin... | App.User = DS.Model.extend
firstName: DS.attr("string")
lastName: DS.attr("string")
email: DS.attr("string")
role: DS.attr("string")
password: DS.attr("string")
App.CurrentUser = App.User.extend({})
App.Room = DS.Model.extend
name: DS.attr("string")
App.Message = DS.Model.extend
body: DS.attr("st... |
Add isAdmin to User model | App.User = DS.Model.extend
firstName: DS.attr("string")
lastName: DS.attr("string")
email: DS.attr("string")
role: DS.attr("string")
password: DS.attr("string")
color: DS.attr("string")
borderStyle: (->
"border-left: 0.2em solid #{@get("color")};"
).property("color")
fontColor: (->
"colo... | App.User = DS.Model.extend
firstName: DS.attr("string")
lastName: DS.attr("string")
email: DS.attr("string")
role: DS.attr("string")
password: DS.attr("string")
color: DS.attr("string")
isAdmin: (->
@get("role") == "admin"
).property("role")
borderStyle: (->
"border-left: 0.2em solid #{... |
Add a root attribute for the selected language | $ = require 'jqueryify'
translate = require 't7e'
enUs = require '../translations/en_us'
DEFAULT = '$DEFAULT'
class LanguagePicker
@DEFAULT = DEFAULT
languages:
'English': DEFAULT
'Polski': 'pl_pl'
el: null
className: 'language-picker'
constructor: ->
preferredLanguage = localStorage.preferre... | $ = require 'jqueryify'
translate = require 't7e'
enUs = require '../translations/en_us'
HTML = $(document.body.parentNode)
DEFAULT = '$DEFAULT'
class LanguagePicker
@DEFAULT = DEFAULT
languages:
'English': DEFAULT
'Polski': 'pl_pl'
el: null
className: 'language-picker'
constructor: ->
prefe... |
Change the jquery_ujs load path. | #= require turbolinks
#= require jquery3
#= require ./jquery_ujs
#= require lodash
#= require i18n
#= require_self
#= require_tree ./tao
window.tao = {}
| #= require turbolinks
#= require jquery3
#= require jquery_ujs
#= require lodash
#= require i18n
#= require_self
#= require_tree ./tao
window.tao = {}
|
Disable annotation if there's a factlink button | rightClick = (event=window.event) ->
if event.which
event.which == 3
else if event.button
event.button == 2
else
false
Factlink.textSelected = (e) ->
Factlink.getSelectionInfo().text?.length > 1
timeout = null
annotating = false
Factlink.startAnnotating = ->
return if annotating
annotating =... | rightClick = (event=window.event) ->
if event.which
event.which == 3
else if event.button
event.button == 2
else
false
Factlink.textSelected = (e) ->
Factlink.getSelectionInfo().text?.length > 1
timeout = null
annotating = false
Factlink.startAnnotating = ->
return if annotating
annotating =... |
Use redirect_uri when impersonating uri | @App.controller 'UserController', ($stateParams, $window, MnoeUsers) ->
'ngInject'
vm = this
# Get the user
MnoeUsers.get($stateParams.userId).then(
(response) ->
vm.user = response
)
vm.impersonateUser = () ->
if vm.user
url = '/mnoe/impersonate/user/' + vm.user.id
$window.locat... | @App.controller 'UserController', ($stateParams, $window, MnoeUsers) ->
'ngInject'
vm = this
# Get the user
MnoeUsers.get($stateParams.userId).then(
(response) ->
vm.user = response
)
vm.impersonateUser = () ->
if vm.user
redirect = window.encodeURIComponent("#{location.pathname}#{loca... |
Patch `window.it` to raise error on pending tests | # Stub jQuery.cookie
@stubCookies =
csrftoken: 'stubCSRFToken'
jQuery.cookie = (key, value) =>
if value?
@stubCookies[key] = value
else
@stubCookies[key]
| # Stub jQuery.cookie
@stubCookies =
csrftoken: 'stubCSRFToken'
jQuery.cookie = (key, value) =>
if value?
@stubCookies[key] = value
else
@stubCookies[key]
# Path Jasmine's `it` method to raise an error when the test is not defined.
# This is helpful when writing the specs first before writing the test.
@... |
Implement sample GET /user endpoint to prevent console error | express = require 'express'
courses = require './courses'
lessons = require './lessons'
gadgets = require './gadgets'
assets = require './assets'
sandbox = require './sandbox'
_ = require 'underscore'
module.exports = (data) ->
_.defaults data.course,
progress: {}
assetUrlTemplate: '/static/<%= id %>'
api... | express = require 'express'
courses = require './courses'
lessons = require './lessons'
gadgets = require './gadgets'
assets = require './assets'
sandbox = require './sandbox'
_ = require 'underscore'
module.exports = (data) ->
_.defaults data.course,
progress: {}
assetUrlTemplate: '/static/<%= id %>'
api... |
Read an env var and print it | # Description
# A hubot script that shows who has the longest github streak in your org
#
# Configuration:
# LIST_OF_ENV_VARS_TO_SET
# HUBOT_ORG_ACCESS_TOKEN
#
# Commands:
# streak ladder - <Gets a list of the longest github commit streaks in your org>
#
# Notes:
# An access token is required by the github ap... | # Description
# A hubot script that shows who has the longest github streak in your org
#
# Configuration:
# LIST_OF_ENV_VARS_TO_SET
# HUBOT_ORG_ACCESS_TOKEN
#
# Commands:
# streak ladder - <Gets a list of the longest github commit streaks in your org>
#
# Notes:
# An access token is required by the github ap... |
Send utcOffset to all users | Meteor.publish 'activeUsers', ->
unless this.userId
return this.ready()
console.log '[publish] activeUsers'.green
Meteor.users.find
username:
$exists: 1
status:
$in: ['online', 'away', 'busy']
,
fields:
username: 1
status: 1
| Meteor.publish 'activeUsers', ->
unless this.userId
return this.ready()
console.log '[publish] activeUsers'.green
Meteor.users.find
username:
$exists: 1
status:
$in: ['online', 'away', 'busy']
,
fields:
username: 1
status: 1
utcOffset: 1
|
Remove load and activate methods from ThemePackage | AtomPackage = require './atom-package'
Package = require './package'
### Internal: Loads and resolves packages. ###
module.exports =
class ThemePackage extends AtomPackage
getType: -> 'theme'
getStylesheetType: -> 'theme'
enable: ->
atom.config.unshiftAtKeyPath('core.themes', @metadata.name)
disable: ... | Q = require 'q'
AtomPackage = require './atom-package'
Package = require './package'
### Internal: Loads and resolves packages. ###
module.exports =
class ThemePackage extends AtomPackage
getType: -> 'theme'
getStylesheetType: -> 'theme'
enable: ->
atom.config.unshiftAtKeyPath('core.themes', @metadata.na... |
Support switching side of tabs | module.exports = NordAtomUiVerticalTabs =
activate: (state) ->
deactivate: ->
| selfName = 'nord-atom-ui-vertical-tabs'
setDirection = (isLeft) ->
panes = document.querySelectorAll('atom-pane')
for pane, i in panes
pane.style.flexDirection = if isLeft then 'row' else 'row-reverse'
atom.config.onDidChange(selfName + '.isLeftTab', (isLeft) ->
setDirection(isLeft['newValue']);
)
module.e... |
Improve failCases report in ESM test | import printMsg from './print-msg.coffee'
export default (testResults) ->
total = 0
success = 0
fail = 0
failCases = []
printMsg('summary')
for result in testResults
total += result.total
success += result.success
fail += result.fail
if result.failCases.length > 0
failCases.push result.failCases
c... | import printMsg from './print-msg.coffee'
export default (testResults) ->
total = 0
success = 0
fail = 0
failCasesList = []
printMsg('summary')
for result in testResults
total += result.total
success += result.success
fail += result.fail
if result.failCases.length > 0
failCasesList.push {
jobDes... |
Make noideadog a little less aggressive | # Description:
# Displays a "I Have No Idea What I'm Doing" image
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot no idea
#
# Notes:
# No idea...
#
# Author:
# Brian Shumate <brian@couchbase.com>
noidea = "http://i.imgur.com/hmTeehN.jpg"
module.exports = (robot) ->
robot.hear /(... | # Description:
# Displays a "I Have No Idea What I'm Doing" image
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot no idea
#
# Notes:
# No idea...
#
# Author:
# Brian Shumate <brian@couchbase.com>
noidea = "http://i.imgur.com/hmTeehN.jpg"
module.exports = (robot) ->
robot.hear /(... |
Clean module on formatter helpeR. | "use strict"
((NS) ->
# Filename: helpers/formatter_helper.coffee
NS = NS or {}
isInBrowser = typeof module is 'undefined' and typeof window isnt 'undefined'
# Default confifuration of the formaters.
format =
currency: '0,0.00'
date: 'L'
dateTime: 'LLL'
# Container for all the formaters.... | "use strict"
# Default confifuration of the formaters.
format =
currency: '0,0.00'
date: 'L'
dateTime: 'LLL'
# Container for all the formaters.
formaters = {}
#Update the configuration or the formater with the configuration given in option.
formaters.configure = (options) ->
_.extend(format, options)
#Form... |
Fix Instant timer signature not valid | # Public:
module.exports =
class Instant
### Public ###
prepare: ->
finished: -> true
nextTime: -> 0
| # Public:
module.exports =
class Instant
### Public ###
prepare: ->
finished: -> true
nextTime: 0
|
Hide comments box when showing index | App.LegislationAllegations =
toggle_comments: ->
$('.draft-allegation').toggleClass('comments-on');
show_comments: ->
$('.draft-allegation').addClass('comments-on');
initialize: ->
$('.js-toggle-allegations .draft-panel').on
click: (e) ->
e.preventDefault();
e.stopPropag... | App.LegislationAllegations =
toggle_comments: ->
$('.draft-allegation').toggleClass('comments-on');
$('#comments-box').html('').hide()
show_comments: ->
$('.draft-allegation').addClass('comments-on');
initialize: ->
$('.js-toggle-allegations .draft-panel').on
click: (e) ->
e.p... |
Use mm fallback for gravatar when running on localhost | # FIXME : render runs on every data change in account object which leads to a flash on avatarview. Sinan 08/2012
class AvatarView extends LinkView
constructor:(options = {},data)->
options.cssClass or= ""
options.size or=
width : 50
height : 50
options.cssClass = "... | # FIXME : render runs on every data change in account object which leads to a flash on avatarview. Sinan 08/2012
class AvatarView extends LinkView
constructor:(options = {},data)->
options.cssClass or= ""
options.size or=
width : 50
height : 50
options.cssClass = "... |
Remove attributes from data-view bindings. | #= require ./abstract_binding
class Batman.DOM.ViewBinding extends Batman.DOM.AbstractBinding
onlyObserve: Batman.BindingDefinitionOnlyObserve.Data
skipChildren: true
constructor: (definition) ->
@superview = definition.view
super
dataChange: (viewClassOrInstance) ->
@viewInstance?.removeFromSupe... | #= require ./abstract_binding
class Batman.DOM.ViewBinding extends Batman.DOM.AbstractBinding
onlyObserve: Batman.BindingDefinitionOnlyObserve.Data
skipChildren: true
constructor: (definition) ->
@superview = definition.view
super
dataChange: (viewClassOrInstance) ->
@viewInstance?.removeFromSupe... |
Fix username not being shown on reset password page | express = require 'express'
router = express.Router()
router.get '/resetPassword', (req, res) ->
if !req.user or !req.user.data.needsReset
return res.redirect "/"
res.render 'resetpassword',
error: req.flash 'error'
username: req.user.data.username
router.use (req, res, next) ->
if req.user and req... | express = require 'express'
router = express.Router()
router.get '/resetPassword', (req, res) ->
if !req.user or !req.user.data.needsReset
return res.redirect "/"
res.render 'resetpassword',
error: req.flash 'error'
user: req.user.data.username
router.use (req, res, next) ->
if req.user and req.use... |
Add ESM test for 3 lang mods | ###
Run tests for each module: numbo, enUS, zhCN, zhTW.
This file is usable after compiling to mjs.
Do not work in Rollup or Babel.
###
###* @type {Data} See data structure in all-data.coffee ###
import allData from './data/all-data.mjs'
import numbo from '../esm/numbo.mjs'
import langs from './shared/langs.coffee'
i... | ###
Run tests for each module: numbo, enUS, zhCN, zhTW.
This file is usable after compiling to mjs.
Do not work in Rollup or Babel.
###
###* @type {Data} See data structure in all-data.coffee ###
import allData from './data/all-data.mjs'
import numbo from '../esm/numbo.mjs'
import enUS from '../esm/en-us.mjs'
import z... |
Add commented example for express favicon. | goog.provide 'server.Middleware'
class server.Middleware
###*
@param {Function} compression
@param {Function} favicon
@param {Function} bodyParser
@param {Function} methodOverride
@constructor
###
constructor: (@compression, @favicon, @bodyParser, @methodOverride) ->
use: (app) ->
app... | goog.provide 'server.Middleware'
class server.Middleware
###*
@param {Function} compression
@param {Function} favicon
@param {Function} bodyParser
@param {Function} methodOverride
@constructor
###
constructor: (@compression, @favicon, @bodyParser, @methodOverride) ->
use: (app) ->
app... |
Fix slack API return error. | # Description:
# A way to interact with the Stamp URI.
#
# Commands:
# hubot stamp me <keyword> - The Original. Queries Stamp Images for <keyword> and returns a stamp image.
# hubot stamp list - Show a list of keywords.
stamps = JSON.parse(process.env.HUBOT_STAMPS)
module.exports = (robot) ->
robot.re... | # Description:
# A way to interact with the Stamp URI.
#
# Commands:
# hubot stamp me <keyword> - The Original. Queries Stamp Images for <keyword> and returns a stamp image.
# hubot stamp list - Show a list of keywords.
stamps = JSON.parse(process.env.HUBOT_STAMPS)
module.exports = (robot) ->
robot.re... |
Update prompt tests to use new error message. | should = require 'should'
environment = require './shared/environment'
Impromptu = require('../lib/impromptu').constructor
promptTests = require './shared/prompt'
describe 'Prompt Files', ->
describe 'Sample', ->
tests = promptTests 'sample',
expectedPrompt: "\x1b[42m\x1b[37m user@host \x1b[0m\x1b[44m\x1b[... | should = require 'should'
environment = require './shared/environment'
Impromptu = require('../lib/impromptu').constructor
promptTests = require './shared/prompt'
describe 'Prompt Files', ->
describe 'Sample', ->
tests = promptTests 'sample',
expectedPrompt: "\x1b[42m\x1b[37m user@host \x1b[0m\x1b[44m\x1b[... |
Allow numbers in GitHub usernames. | # Github Credentials allows you to map your user against your GitHub user.
# This is specifically in order to work with apps that have GitHub Oauth users.
#
# who do you know - List all the users with github logins tracked by Hubot
# i am `maddox` - map your user to the github login `maddox`
# who am i - reveal your ma... | # Github Credentials allows you to map your user against your GitHub user.
# This is specifically in order to work with apps that have GitHub Oauth users.
#
# who do you know - List all the users with github logins tracked by Hubot
# i am `maddox` - map your user to the github login `maddox`
# who am i - reveal your ma... |
Fix up the message sent back with the status | # Description:
# Get the CI status reported to GitHub for a repo and pull request
#
# Dependencies:
# "githubot": "0.4.x"
#
# Configuration:
# HUBOT_GITHUB_TOKEN
# HUBOT_GITHUB_USER
# HUBOT_GITHUB_API
#
# Commands:
# hubot repo show <repo> - shows activity of repository
#
# Notes:
# HUBOT_GITHUB_API allow... | # Description:
# Get the CI status reported to GitHub for a repo and pull request
#
# Dependencies:
# "githubot": "0.4.x"
#
# Configuration:
# HUBOT_GITHUB_TOKEN
# HUBOT_GITHUB_USER
# HUBOT_GITHUB_API
#
# Commands:
# hubot repo show <repo> - shows activity of repository
#
# Notes:
# HUBOT_GITHUB_API allow... |
Remove `Flash` from todos when finished | class @Todos
_this = null;
constructor: (@name) ->
_this = @
@initBtnListeners()
initBtnListeners: ->
$('.done-todo').on('click', @doneClicked)
doneClicked: (e) ->
$this = $(this)
doneURL = $this.attr('href')
e.preventDefault()
e.stopImmediatePropagation()
$spinner = $(... | class @Todos
_this = null;
constructor: (@name) ->
_this = @
@initBtnListeners()
initBtnListeners: ->
$('.done-todo').on('click', @doneClicked)
doneClicked: (e) ->
$this = $(this)
doneURL = $this.attr('href')
e.preventDefault()
e.stopImmediatePropagation()
$spinner = $(... |
Use pjs directory for PaperScript | # Exports an object that defines
# all of the configuration needed by the projects'
# depended-on grunt tasks.
#
# You can familiarize yourself with all of Lineman's defaults by checking out the parent file:
# https://github.com/testdouble/lineman/blob/master/config/application.coffee
module.exports = require(proces... | # Exports an object that defines
# all of the configuration needed by the projects'
# depended-on grunt tasks.
#
# You can familiarize yourself with all of Lineman's defaults by checking out the parent file:
# https://github.com/testdouble/lineman/blob/master/config/application.coffee
module.exports = require(proces... |
Switch build status image URL to SVG. | @Travis.Urls =
plainTextLog: (id) ->
"#{Travis.config.api_endpoint}/jobs/#{id}/log.txt?deansi=true"
githubPullRequest: (slug, pullRequestNumber) ->
"https://github.com/#{slug}/pull/#{pullRequestNumber}"
githubCommit: (slug, sha) ->
"https://github.com/#{slug}/commit/#{sha}"
githubRepo: (slug) ->
... | @Travis.Urls =
plainTextLog: (id) ->
"#{Travis.config.api_endpoint}/jobs/#{id}/log.txt?deansi=true"
githubPullRequest: (slug, pullRequestNumber) ->
"https://github.com/#{slug}/pull/#{pullRequestNumber}"
githubCommit: (slug, sha) ->
"https://github.com/#{slug}/commit/#{sha}"
githubRepo: (slug) ->
... |
Use node module bin for cljmt | "use strict"
path = require('path')
Beautifier = require('../beautifier')
module.exports = class ClojureBeautifier extends Beautifier
name: "Clojure Beautifier"
link: "https://github.com/snoe/node-cljfmt"
options: {
Clojure: true
}
beautify: (text, language, options) ->
formatPath = path.resolve(_... | "use strict"
path = require('path')
Beautifier = require('../beautifier')
module.exports = class ClojureBeautifier extends Beautifier
name: "Clojure Beautifier"
link: "https://github.com/snoe/node-cljfmt"
options: {
Clojure: true
}
beautify: (text, language, options) ->
formatPath = path.resolve(_... |
Load badge counts async and only if needed | define ['jquery'], ($) ->
$(document).ready ->
if ENV.badge_counts
for type, unread of ENV.badge_counts
if unread > 0
type = "grades" if type is "submissions"
$badge = $("<b/>").text(unread).addClass("nav-badge")
$("#section-tabs .#{type}").append($badge)
| if ENV.badge_counts
require.ensure [], () ->
$ = require('jquery')
$ ->
for type, unread of ENV.badge_counts
if unread > 0
type = "grades" if type is "submissions"
$badge = $("<b/>").text(unread).addClass("nav-badge")
$("#section-tabs .#{type}").append($badge)
, '... |
Add Caching of Ship Detail Models | SitsApp.Routers.Ships = Backbone.Router.extend(
routes:
"(/)(#)": "index"
"ships/detail/:id(/)": "detail"
index: ->
console.log('router.index')
view = new SitsApp.Views.ShipsIndex { collection: SitsApp.ships, className: "col-md-12" }
$('#shipListRow').html(view.render().$el)
detail: (id) ->
vie... | SitsApp.Routers.Ships = Backbone.Router.extend(
routes:
"(/)(#)": "index"
"ships/detail/:id(/)": "detail"
index: ->
console.log('router.index')
indexView = new SitsApp.Views.ShipsIndex { collection: SitsApp.ships, className: "col-md-12" }
$('#shipListRow').html(indexView.render().$el)
detail: (id)... |
Create user task gets app config for mongo use | require('../../initializers/mongo')()
User = require('../../models/user').model
readline = require 'readline'
rl = readline.createInterface(
input: process.stdin
output: process.stdout
terminal: false
)
console.log "## Create user ##"
console.log "Enter name:"
rl.once('line', (name)->
console.log "Enter ema... | require('../../initializers/config').initialize()
require('../../initializers/mongo')()
User = require('../../models/user').model
readline = require 'readline'
rl = readline.createInterface(
input: process.stdin
output: process.stdout
terminal: false
)
console.log "## Create user ##"
console.log "Enter name:"
... |
Add precision test based on @roryokane's code | husl = require '../husl.coffee'
snapshot = ->
samples = {}
digits = '0123456789abcdef'
# Take 16 ^ 3 = 4096 samples
for r in digits
for g in digits
for b in digits
hex = '#' + r + r + g + g + b + b
rgb = husl._conv.hex.rgb hex
xyz = husl._conv.rgb.xyz rgb
luv = husl.... | husl = require '../husl.coffee'
digits = '0123456789abcdef'
snapshot = ->
samples = {}
# Take 16 ^ 3 = 4096 samples
for r in digits
for g in digits
for b in digits
hex = '#' + r + r + g + g + b + b
rgb = husl._conv.hex.rgb hex
xyz = husl._conv.rgb.xyz rgb
luv = husl._c... |
Allow groups to be limited by a number of groups | noflo = require 'noflo'
class Group extends noflo.Component
constructor: ->
@groups = []
@newGroups = []
@inPorts =
in: new noflo.ArrayPort
group: new noflo.ArrayPort
@outPorts =
out: new noflo.Port
@inPorts.in.on 'connect', () =>
@outPorts.out.beginGroup group for group... | noflo = require 'noflo'
class Group extends noflo.Component
constructor: ->
@groups = []
@newGroups = []
@threshold = null # How many groups to be saved?
@inPorts =
in: new noflo.ArrayPort
group: new noflo.ArrayPort
threshold: new noflo.Port
@outPorts =
out: new noflo.Por... |
Use a selector in call to $().on to allow delegation of events | $(document).ready ->
$(".vote-form").on 'ajax:success', (event, xhr, status) ->
$(this).parent().find('.vote-count').html(xhr.count)
$(this).replaceWith(xhr.content)
$(".vote-form").on 'ajax:error', (event, xhr, status) ->
# TODO: handle error on vote submit
console.log event
console.log xhr
... | $(document).ready ->
$(".vote-controls").on 'ajax:success', '.vote-form', (event, xhr, status) ->
$(this).parent().find('.vote-count').html(xhr.count)
$(this).replaceWith(xhr.content)
$(".vote-form").on 'ajax:error', (event, xhr, status) ->
# TODO: handle error on vote submit
console.log event
... |
Rename commands in package main | GitHubFile = require './github-file'
module.exports =
activate: ->
return unless atom.project.getRepo()?
atom.workspaceView.eachPane (pane) ->
pane.command 'github:file', ->
if itemPath = getActivePath()
GitHubFile.fromPath(itemPath).open()
pane.command 'github:blame', ->
... | GitHubFile = require './github-file'
module.exports =
activate: ->
return unless atom.project.getRepo()?
atom.workspaceView.eachPane (pane) ->
pane.command 'open-on-github:file', ->
if itemPath = getActivePath()
GitHubFile.fromPath(itemPath).open()
pane.command 'open-on-githu... |
Improve merge strategy for one way sync | import UserEvents from '/imports/collections/userEvents.coffee'
import Incidents from '/imports/collections/incidentReports.coffee'
import Articles from '/imports/collections/articles.coffee'
module.exports = (url)->
url = process.env.ONE_WAY_SYNC_URL + "/api/events-incidents-articles"
console.log("syncing from: "... | import UserEvents from '/imports/collections/userEvents.coffee'
import Incidents from '/imports/collections/incidentReports.coffee'
import Articles from '/imports/collections/articles.coffee'
module.exports = (url)->
url = process.env.ONE_WAY_SYNC_URL + "/api/events-incidents-articles"
console.log("syncing from: "... |
Move click function to method | kd = require 'kd'
CustomLinkView = require '../customlinkview'
trackEvent = require 'app/util/trackEvent'
module.exports = class ComputePlansModalFooterLink extends CustomLinkView
constructor: (options = {}, data) ->
options.href or= '/Pricing'
options.click = ->
trackEvent 'Upgra... | kd = require 'kd'
trackEvent = require 'app/util/trackEvent'
CustomLinkView = require '../customlinkview'
module.exports = class ComputePlansModalFooterLink extends CustomLinkView
constructor: (options = {}, data) ->
options.href or= '/Pricing'
super options, data
click: ->
t... |
Support fenced yaml code blocks | extensionsByFenceName =
'bash': 'sh'
'coffee': 'coffee'
'coffeescript': 'coffee'
'coffee-script': 'coffee'
'css': 'css'
'go': 'go'
'html': 'html'
'java': 'java'
'javascript': 'js'
'js': 'js'
'json': 'json'
'less': 'less'
'mustache': 'mustache'
'objc': 'm'
'objective-c': 'm'
'python': 'py... | extensionsByFenceName =
'bash': 'sh'
'coffee': 'coffee'
'coffeescript': 'coffee'
'coffee-script': 'coffee'
'css': 'css'
'go': 'go'
'html': 'html'
'java': 'java'
'javascript': 'js'
'js': 'js'
'json': 'json'
'less': 'less'
'mustache': 'mustache'
'objc': 'm'
'objective-c': 'm'
'python': 'py... |
Use correct name for the description. | {expect} = require "chai"
utils = require "../../utils"
{Collections} = utils.require "base"
Jitter = utils.require("models/transforms/jitter").Model
describe "step_interpolator_transform module", ->
source = {start: 0, end: 10}
target = {start: 20, end: 80}
generate_jitter = ->
new Jitter({
width: 1... | {expect} = require "chai"
utils = require "../../utils"
{Collections} = utils.require "base"
Jitter = utils.require("models/transforms/jitter").Model
describe "Jitter transform module", ->
source = {start: 0, end: 10}
target = {start: 20, end: 80}
generate_jitter = ->
new Jitter({
width: 1,
mea... |
Add methods to find or retrieve all students | {CrudConfig, makeSimpleStore, extendConfig} = require './helpers'
_ = require 'underscore'
PerformanceConfig = {
exports:
getStudentOfTask: (courseId, taskId) ->
performances = @_get(courseId)
students = _.chain(performances)
.pluck('students')
.flatten(true)
.value()
#... | {CrudConfig, makeSimpleStore, extendConfig} = require './helpers'
_ = require 'underscore'
allStudents = (performances) ->
_.chain(performances)
.pluck('students')
.flatten(true)
.value()
PerformanceConfig = {
exports:
getStudent: (courseId, roleId) ->
students = allStudents @_get(courseId)... |
Set chatops width to 675 | Meteor.startup ->
RocketChat.callbacks.add 'enter-room', ->
#if Meteor.user()?.services?.github?.id or Meteor.user()?.services?.gitlab?.id
# console.log 'Adding chatops to tabbar'
# RocketChat.TabBar.addButton
# id: 'chatops-button'
# i18nTitle: 'rocketchat-chatops:Chatops_Title'
# icon: 'icon-code'
... | Meteor.startup ->
RocketChat.callbacks.add 'enter-room', ->
#if Meteor.user()?.services?.github?.id or Meteor.user()?.services?.gitlab?.id
# console.log 'Adding chatops to tabbar'
# RocketChat.TabBar.addButton
# id: 'chatops-button'
# i18nTitle: 'rocketchat-chatops:Chatops_Title'
# icon: 'icon-code'
... |
Add list-select to Selection menu | # See https://atom.io/docs/latest/hacking-atom-package-word-count#menus for more details
# TODO: Do we really want these in the context menu? Might be too much clutter.
'context-menu':
'atom-text-editor': [
{
'label': 'Select List Element'
'command': 'list-edit:select'
}
{
'label': 'Cut ... | # See https://atom.io/docs/latest/hacking-atom-package-word-count#menus for more details
# TODO: Do we really want these in the context menu? Might be too much clutter.
'context-menu':
'atom-text-editor': [
{
'label': 'Select List Element'
'command': 'list-edit:select'
}
{
'label': 'Cut ... |
Fix typo in description for Python | module.exports = {
name: "Python"
namespace: "python"
scope: ['source.python']
###
Supported Grammars
###
grammars: [
"Python"
]
###
Supported extensions
###
extensions: [
"py"
]
options:
max_line_length:
type: 'integer'
default: 79
description: "set maximum... | module.exports = {
name: "Python"
namespace: "python"
scope: ['source.python']
###
Supported Grammars
###
grammars: [
"Python"
]
###
Supported extensions
###
extensions: [
"py"
]
options:
max_line_length:
type: 'integer'
default: 79
description: "set maximum... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.