Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Fix parseXFBML on update index | Neighborly.Projects = {} if Neighborly.Projects is undefined
Neighborly.Projects.Updates = {} if Neighborly.Projects.Updates is undefined
Neighborly.Projects.Updates.Index =
init: Backbone.View.extend _.extend(
el: '.updates'
events:
"ajax:success form#new_update": "onCreate"
"ajax:success .updat... | Neighborly.Projects = {} if Neighborly.Projects is undefined
Neighborly.Projects.Updates = {} if Neighborly.Projects.Updates is undefined
Neighborly.Projects.Updates.Index =
init: Backbone.View.extend _.extend(
el: '.updates'
events:
"ajax:success form#new_update": "onCreate"
"ajax:success .updat... |
Use proper path for upload. | {statusCreated, statusNoContent, statusOk} = require '../utils'
endpoint = (x) ->
"/site/#{x.siteId}/deploy"
byId = (x) ->
"#{endpoint x}/#{x.id ? x.deployId}"
upload = (x) ->
"#{byId x}/#{x.path}"
module.exports = (blueprints) ->
blueprints.deploy =
create:
url: endpoint
method: 'POST'... | {statusCreated, statusNoContent, statusOk} = require '../utils'
endpoint = (x) ->
"/site/#{x.siteId}/deploy"
byId = (x) ->
"#{endpoint x}/#{x.id ? x.deployId}"
upload = (x) ->
"#{byId x}/files/#{x.path}"
module.exports = (blueprints) ->
blueprints.deploy =
create:
url: endpoint
method: ... |
Add ignoreWhitespaceOnlyLines as disabled by default | Whitespace = require './whitespace'
module.exports =
configDefaults:
removeTrailingWhitespace: true
ignoreWhitespaceOnCurrentLine: true
ensureSingleTrailingNewline: true
activate: ->
@whitespace = new Whitespace()
deactivate: ->
@whitespace.destroy()
| Whitespace = require './whitespace'
module.exports =
configDefaults:
removeTrailingWhitespace: true
ignoreWhitespaceOnCurrentLine: true
ignoreWhitespaceOnlyLines: false
ensureSingleTrailingNewline: true
activate: ->
@whitespace = new Whitespace()
deactivate: ->
@whitespace.destroy()
|
Add date to ember comment serializers | ETahi.Comment = DS.Model.extend
commenter: DS.belongsTo('user')
body: DS.attr('string')
messageTask: DS.belongsTo('messageTask')
| ETahi.Comment = DS.Model.extend
commenter: DS.belongsTo('user')
body: DS.attr('string')
messageTask: DS.belongsTo('messageTask')
createdAt: DS.attr('string')
|
CHeck favourited topic on 'slug_title' | class window.FavouriteTopicButtonView extends ActionButtonView
mini: true
onRender: -> @updateButton()
initialize: ->
@user = currentUser
@bindTo @user.favourite_topics, 'add remove change', @updateButton, @
templateHelpers: =>
disabled_label: Factlink.Global.t.favourite.capitalize()
disable_... | class window.FavouriteTopicButtonView extends ActionButtonView
mini: true
onRender: -> @updateButton()
initialize: ->
@user = currentUser
@bindTo @user.favourite_topics, 'add remove change', @updateButton, @
templateHelpers: =>
disabled_label: Factlink.Global.t.favourite.capitalize()
disable_... |
Move journal detail saving to a common function | ETahi.JournalThumbnailController = Ember.ObjectController.extend
needs: ['application']
currentUser: Ember.computed.alias 'controllers.application.currentUser'
isEditing: (-> @get 'model.isDirty').property()
thumbnailId: (-> "journal-logo-#{@get 'model.id'}").property()
logoUploadUrl: (-> "/admin/journals/#{@... | ETahi.JournalThumbnailController = Ember.ObjectController.extend
needs: ['application']
currentUser: Ember.computed.alias 'controllers.application.currentUser'
isEditing: (-> @get 'model.isDirty').property()
thumbnailId: (-> "journal-logo-#{@get 'model.id'}").property()
logoUploadUrl: (-> "/admin/journals/#{@... |
Make the git path a configuration setting. | MergeConflictsView = require './merge-conflicts-view'
SideView = require './side-view'
NavigationView = require './navigation-view'
Conflict = require './conflict'
module.exports =
activate: (state) ->
atom.workspaceView.command "merge-conflicts:detect", ->
MergeConflictsView.detect()
deactivate: ->
... | MergeConflictsView = require './merge-conflicts-view'
SideView = require './side-view'
NavigationView = require './navigation-view'
Conflict = require './conflict'
module.exports =
activate: (state) ->
atom.workspaceView.command "merge-conflicts:detect", ->
MergeConflictsView.detect()
deactivate: ->
... |
Use the escaped regex as a stopgap solution | class Kandan.Plugins.MeAnnounce
@regex: /^\/me /
@init: ()->
Kandan.Modifiers.register @regex, (message, state)=>
message.content = message.content.replace @regex, "#{message.user.first_name} "
return Kandan.Helpers.Activities.build_from_base_template(message)
# Kandan.Plugins.register "Kandan.Pl... | class Kandan.Plugins.MeAnnounce
@regex: /^/me /
@init: ()->
Kandan.Modifiers.register @regex, (message, state)=>
message.content = message.content.replace @regex, "#{message.user.first_name} "
return Kandan.Helpers.Activities.build_from_base_template(message)
# Kandan.Plugins.register "Kanda... |
Set a default timeout of 5 seconds (instead of infinite). | module.exports = ->
@logger = require './logger'
@visit = (path) =>
@driver.get "#{@host}#{path}"
_Before = @Before
_After = @After
@_inFlow = (code, callback) ->
$.createFlow (flow) =>
flow.execute => code.call(@)
.then _.partial(callback, null),
(err) -> throw err
@Before = (c... | module.exports = ->
@logger = require './logger'
@timeout = 5000
@visit = (path) =>
@driver.get "#{@host}#{path}"
_Before = @Before
_After = @After
@_inFlow = (code, callback) ->
$.createFlow (flow) =>
flow.execute => code.call(@)
.then _.partial(callback, null),
(err) -> throw ... |
Replace dummy text with Mark workflow help text | module.exports = {
header: 'Help Mark Fields',
pages: [
{
pageNumber: 0,
text: "One Lorem ipsum dolor sit amet, posuere a mauris, nostra quam nonummy, facilisis amet neque. Ut lacus eros venenatis ipsum, erat ut turpis, aliquam metus vitae volutpat sit sed. Eros maecenas malesuada quam leo laoreet, ... | module.exports = {
header: 'Mark the fields to be transcribed',
pages: [
{
pageNumber: 0,
text: "The first step in crowdsourced transcription is to identify and mark the text that should be transcribed.
The scroll bar on the left displays all of the pages in each program. Start by locating the pag... |
Change error state check on model. | `import Ember from "ember";`
`import { EMPLOYEE_ROLES } from "t2-people/utils/constants";`
PersonEditController = Ember.ObjectController.extend
needs: ['application']
employeeRoles: EMPLOYEE_ROLES
actions:
save: (->
model = @get('model')
if model.get('errors')
model.send('becameValid')
... | `import Ember from "ember";`
`import { EMPLOYEE_ROLES } from "t2-people/utils/constants";`
PersonEditController = Ember.ObjectController.extend
needs: ['application']
employeeRoles: EMPLOYEE_ROLES
actions:
save: (->
model = @get('model')
if model.get('isError')
model.send('becameValid')
... |
Revert "update pdfjs to v1.8.188" | version = {
"pdfjs": "1.8.188"
"moment": "2.9.0"
"ace": "1.2.5"
}
module.exports = {
version: version
lib: (name) ->
if version[name]?
return "#{name}-#{version[name]}"
else
return "#{name}"
}
| version = {
"pdfjs": "1.7.225"
"moment": "2.9.0"
"ace": "1.2.5"
}
module.exports = {
version: version
lib: (name) ->
if version[name]?
return "#{name}-#{version[name]}"
else
return "#{name}"
}
|
Add two more pending tests. | describe 'Pending', ->
it 'Should test skipHeader option'
it 'Should test initWith option'
it 'Should embed plain JS files'
| describe 'Pending', ->
it 'Should test skipHeader option'
it 'Should test initWith option'
it 'Should embed plain JS files'
it 'Should take a logging callback'
it 'Should test verbose option'
|
Call Editor.insertText directly instead of creating a TextInput event | fs = require 'fs'
require 'benchmark-helper'
describe "Editor", ->
editor = null
beforeEach ->
window.rootViewParentSelector = '#jasmine-content'
window.startup()
editor = rootView.editor
afterEach ->
window.shutdown()
benchmark "inserting and deleting a character", ->
editor.hiddenInput... | fs = require 'fs'
require 'benchmark-helper'
describe "Editor", ->
editor = null
beforeEach ->
window.rootViewParentSelector = '#jasmine-content'
window.startup()
editor = rootView.editor
afterEach ->
window.shutdown()
benchmark "inserting and deleting a character", ->
editor.insertText(... |
Use busyboy package instead of body-parser | express = require 'express'
bodyParser = require('body-parser')
app = express()
port = process.env.PORT || 5000
app.use express.static __dirname
.use bodyParser.urlencoded {extended: true}
.use bodyParser.json()
require('./routes/routes.js')(app)
app.listen(port)
console.log "Listening on port #{port}"
| express = require 'express'
busyboy = require('connect-busboy')
app = express()
port = process.env.PORT || 5000
app.use express.static __dirname
.use busyboy()
require('./routes/routes.js')(app)
app.listen(port)
console.log "Listening on port #{port}"
|
Check for offset being set. | jQuery ->
if User.current().data_object.staff == true
scroll(0,$(".row.osu-purple").offset().top) | jQuery ->
if User.current().data_object.staff == true
scroll(0,$(".row.osu-purple").offset()?.top) |
Handle FB share link when thumbnail URL is relative | Template.blogShowBody.rendered = ->
# Hide draft posts from crawlers
if not @data.published
$('<meta>', { name: 'robots', content: 'noindex,nofollow' }).appendTo 'head'
# Twitter
base = "https://twitter.com/intent/tweet"
url = encodeURIComponent location.origin + location.pathname
author = @data.autho... | Template.blogShowBody.rendered = ->
# Hide draft posts from crawlers
if not @data.published
$('<meta>', { name: 'robots', content: 'noindex,nofollow' }).appendTo 'head'
# Twitter
base = "https://twitter.com/intent/tweet"
url = encodeURIComponent location.origin + location.pathname
author = @data.autho... |
Set default cursor pointer for TextButton | class CB.TextButton extends CB.Control
constructor: (frame) ->
super(frame)
@_labelView = new CB.LabelView()
@_labelView.frame = new CB.Rect(0, 0, 0, 0)
this.addSubview(@_labelView)
@property "readonly", "labelView"
sizeThatFits: (size) ->
return @labelView.sizeThatFits(size)
layoutSubvie... | class CB.TextButton extends CB.Control
constructor: (frame) ->
super(frame)
@_labelView = new CB.LabelView()
@_labelView.frame = new CB.Rect(0, 0, 0, 0)
this.addSubview(@_labelView)
@cursor = "pointer"
@property "readonly", "labelView"
@property "cursor",
set: (newPointer) ->
@_poi... |
Fix proposal outcome dropdown not showing up when citescop is selected | Species.DocumentTagLookup = Ember.Mixin.create
selectedProposalOutcome: null
selectedProposalOutcomeId: null
selectedReviewPhase: null
selectedReviewPhaseId: null
initDocumentTagsSelectors: ->
if @get('selectedProposalOutcomeId')
po = @get('controllers.documentTags.proposalOutcomes').findBy('id', @... | Species.DocumentTagLookup = Ember.Mixin.create
selectedProposalOutcome: null
selectedProposalOutcomeId: null
selectedReviewPhase: null
selectedReviewPhaseId: null
initDocumentTagsSelectors: ->
if @get('selectedProposalOutcomeId')
po = @get('controllers.documentTags.proposalOutcomes').findBy('id', @... |
Fix usage of parent.remote outside of client in client-pages. | class FactlinkAppClass extends Backbone.Marionette.Application
startAsSite: ->
@startSiteRegions()
@addInitializer @automaticLogoutInitializer
@addInitializer @notificationsInitializer
@addInitializer @scrollToTopInitializer
@linkTarget = '_self'
@addInitializer (options)->
new Profile... | class FactlinkAppClass extends Backbone.Marionette.Application
startAsSite: ->
@startSiteRegions()
@addInitializer @automaticLogoutInitializer
@addInitializer @notificationsInitializer
@addInitializer @scrollToTopInitializer
@linkTarget = '_self'
@addInitializer (options)->
new Profile... |
Establish a Convention for Using Reflection to Automate Instantiation | qbnApp = angular.module 'qbnApp', []
class Quality
constructor: (@name, @defaultValue) ->
initInstance: () ->
@value = @defaultValue
instantiate = (proto) ->
instance = Object.create proto
instance.initInstance()
return instance
class Storylet
constructor: (@title, @text, @choices) ->
class Choice
... | qbnApp = angular.module 'qbnApp', []
class Quality
constructor: (@name, @defaultValue) ->
instantiate = (proto) ->
instance = Object.create proto
for key, value of proto when /^default\w{2}/.test(key)
[_, first, rest] = /^default(\w)(\w*)/.exec(key)
newName = first.toLowerCase() + rest
instance[newN... |
Remove unnecessary function naming on comment form submit | angular.module('loomioApp').directive 'commentForm', ->
scope: {comment: '='}
restrict: 'E'
templateUrl: 'generated/components/thread_page/comment_form/comment_form.html'
replace: true
controller: ($scope, FormService, Records, CurrentUser) ->
group = $scope.comment.discussion().group()
discussion = $... | angular.module('loomioApp').directive 'commentForm', ->
scope: {comment: '='}
restrict: 'E'
templateUrl: 'generated/components/thread_page/comment_form/comment_form.html'
replace: true
controller: ($scope, FormService, Records, CurrentUser) ->
group = $scope.comment.discussion().group()
discussion = $... |
Put bower grunt task first | module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
coffee:
compile:
files:
'drop.js': 'drop.coffee'
'docs/welcome/js/welcome.js': 'docs/welcome/coffee/welcome.coffee'
watch:
coffee:
files: ['*.coffee', 'sass/*', 'docs/**/*... | module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
coffee:
compile:
files:
'drop.js': 'drop.coffee'
'docs/welcome/js/welcome.js': 'docs/welcome/coffee/welcome.coffee'
watch:
coffee:
files: ['*.coffee', 'sass/*', 'docs/**/*... |
Fix breaking tests due to new argument signature | Presenters = require "../lib/presenters"
helpers = require "./helpers"
describe "Presenters", ->
before ->
@prediction1 = new helpers.PredictionStub stopName: "Michigan & 29th Street"
@prediction2 = new helpers.PredictionStub {stopName: "Michigan & 28th Street", minutesFromNow: 1}
@allPredictions = [@pr... | Presenters = require "../lib/presenters"
helpers = require "./helpers"
describe "Presenters", ->
before ->
@prediction1 = new helpers.PredictionStub stopName: "Michigan & 29th Street"
@prediction2 = new helpers.PredictionStub {stopName: "Michigan & 28th Street", minutesFromNow: 1}
@allPredictions = [@pr... |
Include link to default image. | module.exports = [
{
"id": "1",
"title": ""
"image": ""
},
{
"id": "2",
"title": "Egg",
"image": "img/nodes/egg.png",
"metadata": {
"source": "internal",
"title": "Egg",
"link": "https://openclipart.org/detail/166320/egg",
"license": "public domain"
}
},
... | module.exports = [
{
"id": "1",
"title": ""
"image": "img/nodes/blank.png"
},
{
"id": "2",
"title": "Egg",
"image": "img/nodes/egg.png",
"metadata": {
"source": "internal",
"title": "Egg",
"link": "https://openclipart.org/detail/166320/egg",
"license": "public d... |
Hide spinner when data is loaded | {div, h1, h2, p, i, a} = React.DOM
window.AnnualReportUploads = class AnnualReportUploads extends React.Component
constructor: (props, context) ->
super(props, context)
@state = {
data: [],
pageName: props.pageName,
page: props.page,
sandboxEnabled: props.sandboxEnabled
adminUrl:... | {div, h1, h2, p, i, a} = React.DOM
window.AnnualReportUploads = class AnnualReportUploads extends React.Component
constructor: (props, context) ->
super(props, context)
@state = {
data: [],
pageName: props.pageName,
page: props.page,
sandboxEnabled: props.sandboxEnabled
adminUrl:... |
Update URL to the CoffeeScript site | # 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/
| # Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
|
Use unit function for returning alignments | angular.module('doubtfire.projects.states.dashboard.directives.task-dashboard.directives.task-outcomes-card', [])
#
# Describes more about ILO linkages between a task
#
.directive('taskOutcomesCard', ->
restrict: 'E'
templateUrl: 'projects/states/dashboard/directives/task-dashboard/directives/task-outcomes-card/tas... | angular.module('doubtfire.projects.states.dashboard.directives.task-dashboard.directives.task-outcomes-card', [])
#
# Describes more about ILO linkages between a task
#
.directive('taskOutcomesCard', ->
restrict: 'E'
templateUrl: 'projects/states/dashboard/directives/task-dashboard/directives/task-outcomes-card/tas... |
Select all works on simple order cycles edit interface | angular.module('admin.order_cycles').controller "AdminSimpleEditOrderCycleCtrl", ($scope, $location, OrderCycle, Enterprise, EnterpriseFee) ->
$scope.orderCycleId = ->
$location.absUrl().match(/\/admin\/order_cycles\/(\d+)/)[1]
$scope.enterprises = Enterprise.index()
$scope.enterprise_fees = EnterpriseFee.in... | angular.module('admin.order_cycles').controller "AdminSimpleEditOrderCycleCtrl", ($scope, $location, OrderCycle, Enterprise, EnterpriseFee) ->
$scope.orderCycleId = ->
$location.absUrl().match(/\/admin\/order_cycles\/(\d+)/)[1]
$scope.enterprises = Enterprise.index()
$scope.enterprise_fees = EnterpriseFee.in... |
Add more info in the gem whois response | # Whois for gems, because gem names are like domains in the 90's
#
# gem whois <gemname> - returns gem details if it exists
#
module.exports = (robot) ->
robot.respond /gem whois (.*)/i, (msg) ->
gemname = escape(msg.match[1])
msg.http("http://rubygems.org/api/v1/gems/#{gemname}.json")
.get() (err, res... | # Whois for gems, because gem names are like domains in the 90's
#
# gem whois <gemname> - returns gem details if it exists
#
module.exports = (robot) ->
robot.respond /gem whois (.*)/i, (msg) ->
gemname = escape(msg.match[1])
msg.http("http://rubygems.org/api/v1/gems/#{gemname}.json")
.get() (err, res... |
Use correct key in Metrics.timing | StatsD = require('lynx')
statsd = new StatsD('localhost', 8125, {on_error:->})
name = "unknown"
hostname = require('os').hostname()
buildKey = (key)-> "#{name}.#{hostname}.#{key}"
module.exports =
initialize: (_name) ->
name = _name
set : (key, value, sampleRate = 1)->
statsd.set buildKey(key), value, sampleR... | StatsD = require('lynx')
statsd = new StatsD('localhost', 8125, {on_error:->})
name = "unknown"
hostname = require('os').hostname()
buildKey = (key)-> "#{name}.#{hostname}.#{key}"
module.exports =
initialize: (_name) ->
name = _name
set : (key, value, sampleRate = 1)->
statsd.set buildKey(key), value, sampleR... |
Fix display of admin group side menu | angular.module("admin.enterprise_groups")
.controller "sideMenuCtrl", ($scope, SideMenu) ->
$scope.menu = SideMenu
$scope.select = SideMenu.select
$scope.menu.setItems [
{ name: 'Primary Details', icon_class: "icon-user" }
{ name: 'About', icon_class: "icon-pencil" }
{ name: 'Images', i... | angular.module("admin.enterprise_groups")
.controller "sideMenuCtrl", ($scope, SideMenu) ->
$scope.menu = SideMenu
$scope.select = SideMenu.select
$scope.menu.setItems [
{ name: 'Primary Details', icon_class: "icon-user" }
{ name: 'About', icon_class: "icon-pencil" }
{ name: 'Images', i... |
Update jade template plugin to conform with new template plugin structure |
async = require 'async'
jade = require 'jade'
fs = require 'fs'
{TemplatePlugin} = require './../templates'
class JadeTemplate extends TemplatePlugin
constructor: (@fn) ->
render: (locals, callback) ->
try
callback null, new Buffer @fn(locals)
catch error
callback error
JadeTemplate.fromFi... |
async = require 'async'
jade = require 'jade'
fs = require 'fs'
path = require 'path'
{TemplatePlugin} = require './../templates'
class JadeTemplate extends TemplatePlugin
constructor: (@fn) ->
render: (locals, callback) ->
try
callback null, new Buffer @fn(locals)
catch error
callback erro... |
Make no idea dog appear more often | # 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 /(... |
Use status header instead of status code | path = require 'path'
url = require 'url'
request = require 'request'
fs = require './fs'
TextMateTheme = require './text-mate-theme'
# Convert a TextMate theme to an Atom theme
module.exports =
class ThemeConverter
constructor: (@sourcePath, destinationPath) ->
@destinationPath = path.resolve(destinationPath)
... | path = require 'path'
url = require 'url'
request = require 'request'
fs = require './fs'
TextMateTheme = require './text-mate-theme'
# Convert a TextMate theme to an Atom theme
module.exports =
class ThemeConverter
constructor: (@sourcePath, destinationPath) ->
@destinationPath = path.resolve(destinationPath)
... |
Fix indentation; bootstrap carousels data | PartnerCategories = require '../../collections/partner_categories'
Backbone = require 'backbone'
Q = require 'bluebird-q'
PrimaryCarousel = require './components/primary_carousel/fetch'
CategoryCarousel = require './components/partner_cell_carousel/fetch'
_ = require 'underscore'
fetchCategories = (type) ->
categori... | _ = require 'underscore'
Q = require 'bluebird-q'
Backbone = require 'backbone'
PartnerCategories = require '../../collections/partner_categories'
PrimaryCarousel = require './components/primary_carousel/fetch'
CategoryCarousel = require './components/partner_cell_carousel/fetch'
fetchCategories = (type) ->
categori... |
Use crypto module for token generation | module.exports = ProjectTokenGenerator =
readOnlyToken: () ->
length = 12
tokenAlpha = 'bcdfghjkmnpqrstvwxyz'
result = ''
for _n in [1..length]
i = Math.floor(Math.floor(Math.random() * tokenAlpha.length))
result += tokenAlpha[i]
return result
readAndWriteToken: () ->
numerics = Math.random().toSt... | crypto = require 'crypto'
module.exports = ProjectTokenGenerator =
readOnlyToken: () ->
length = 12
tokenAlpha = 'bcdfghjkmnpqrstvwxyz'
result = ''
crypto.randomBytes(length).map( (a) -> result += tokenAlpha[a % tokenAlpha.length] )
return result
readAndWriteToken: () ->
numerics = Math.random().toStri... |
Return absolute paths from $native.traverseTree() | fs = require 'fs'
_ = require 'underscore'
module.exports =
loadPaths: (rootPath, ignoredNames, excludeGitIgnoredPaths) ->
if excludeGitIgnoredPaths
Git = require 'git'
repo = Git.open(rootPath, refreshOnWindowFocus: false)
paths = []
isIgnored = (path) ->
for segment in path.split('/'... | fs = require 'fs'
_ = require 'underscore'
module.exports =
loadPaths: (rootPath, ignoredNames, excludeGitIgnoredPaths) ->
if excludeGitIgnoredPaths
Git = require 'git'
repo = Git.open(rootPath, refreshOnWindowFocus: false)
paths = []
isIgnored = (path) ->
for segment in path.split('/'... |
Make typeahead a bit faster | define 'app/search', ['typeahead.bundle', 'app/p13n', 'app/settings'], (ta, p13n, settings) ->
lang = p13n.get_language()
engine = new Bloodhound
name: 'suggestions'
remote:
url: sm_settings.backend_url + "/search/?language=#{lang}&input=%QUERY"
ajax: settings.applyAjaxDe... | define 'app/search', ['typeahead.bundle', 'app/p13n', 'app/settings'], (ta, p13n, settings) ->
lang = p13n.get_language()
engine = new Bloodhound
name: 'suggestions'
remote:
url: sm_settings.backend_url + "/search/?language=#{lang}&page_size=5&input=%QUERY"
ajax: settings... |
Remove ES6 compat from Chrome-app source | require("./primitive")
require("./es6compat")
require("./es7compat")
require("./bbjscompat")
require("./bootbox-promise")
require("./windowcontroller")
MainController = require("./maincontroller")
MainController.instance.activate()
# List of boards
require("./peridotboard")
require("./wakayamarbboard")
require("./gr... | require("./primitive")
# require("./es6compat") # Chrome supports ES6!
require("./es7compat")
require("./bbjscompat")
require("./bootbox-promise")
require("./windowcontroller")
MainController = require("./maincontroller")
MainController.instance.activate()
# List of boards
require("./peridotboard")
require("./wakay... |
Add search with regex option tests to SearchModel spec | RootView = require 'root-view'
SearchModel = require 'search-in-buffer/lib/search-model'
describe 'SearchModel', ->
[goToLine, editor, subject, buffer] = []
beforeEach ->
window.rootView = new RootView
rootView.open('sample.js')
rootView.enableKeymap()
editor = rootView.getActiveView()
buffer ... | RootView = require 'root-view'
SearchModel = require 'search-in-buffer/lib/search-model'
describe 'SearchModel', ->
[goToLine, editor, subject, buffer] = []
beforeEach ->
window.rootView = new RootView
rootView.open('sample.js')
rootView.enableKeymap()
editor = rootView.getActiveView()
buffer ... |
Use a times symbol, not an x | $ ->
$('#reload-consts').on 'click', ReloadK
sources = Bacon.combineTemplate
history: GameState.history
position: GameState.historicalPosition
sources.onValue (x) ->
{history, position} = x
$('#history').empty()
prevElement = null
prevElementCount = 0
prevElementType = null
for ele... | $ ->
$('#reload-consts').on 'click', ReloadK
sources = Bacon.combineTemplate
history: GameState.history
position: GameState.historicalPosition
sources.onValue (x) ->
{history, position} = x
$('#history').empty()
prevElement = null
prevElementCount = 0
prevElementType = null
for ele... |
Test case for accepting object arguments | describe "Overloading functions", ->
overloadableFunc = null;
beforeEach ->
overloadableFunc = new Overloadable();
it "should not allow for passing incorrect arguments to 'overload' function", ->
expect( ->
overloadableFunc.overload()
).toThrow()
expect( ->
... | describe "Overloading functions", ->
overloadableFunc = null;
beforeEach ->
overloadableFunc = new Overloadable();
it "should not allow for passing incorrect arguments to 'overload' function", ->
expect( ->
overloadableFunc.overload()
).toThrow()
expect( ->
... |
Test d'existence avec un élément dans la base. | should = require('should')
async = require('async')
Client = require('../common/test/client').Client
app = require('../server')
client = new Client("http://localhost:8888/")
describe "Test section", ->
before (done) ->
app.listen(8888)
done()
after (done) ->
app.close()
don... | should = require('should')
async = require('async')
Client = require('../common/test/client').Client
app = require('../server')
client = new Client("http://localhost:8888/")
describe "Test section", ->
before (done) ->
app.listen(8888)
done()
after (done) ->
app.close()
don... |
Fix for back button being broken in web apps | root = this
root.calatrava ?= {}
calatrava = root.calatrava
# Hide all the sub-pages when first launching the app
$(document).ready ->
$('body > .container > .page').hide()
window.onpopstate = (event) ->
if event.state
tw.bridge.changePage event.state.page
| root = this
root.calatrava ?= {}
calatrava = root.calatrava
# Hide all the sub-pages when first launching the app
$(document).ready ->
$('body > .container > .page').hide()
window.onpopstate = (event) ->
if event.state
calatrava.bridge.changePage event.state.page
|
Test mocks (again...) out of sync. | #= require three.min
#= require roofpig/Pieces3D
mock_scene = { add: -> }
mock_settings = { hover: 1.0, colors: { to_draw: -> { real: true, color: 'red'} } }
describe "Pieces3D", ->
it ".make_stickers() creates Pieces3D.UBL, Pieces3D.UL, Pieces3D.F etc", ->
pieces = new Pieces3D(mock_scene, mock_settings)
... | #= require three.min
#= require roofpig/Pieces3D
mock_scene = { add: -> }
mock_settings = {
hover: 1.0,
colors: {
to_draw: -> { hovers: true, color: 'red'}
of: -> 'black'
}
}
describe "Pieces3D", ->
it ".make_stickers() creates Pieces3D.UBL, Pieces3D.UL, Pieces3D.F etc", ->
pieces = new Pieces3... |
Add SAT, salesforce, cck12 design projects | # Description:
# Receives Pivotal story activity and emits to pivotal-story-tagger
# when a new story is created
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# None
#
# URLS:
# '/hubot/pivotal-listener'
module.exports = (robot) ->
robot.router.post "/hubot/pivotal-listener", (req, res)... | # Description:
# Receives Pivotal story activity and emits to pivotal-story-tagger
# when a new story is created
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# None
#
# URLS:
# '/hubot/pivotal-listener'
module.exports = (robot) ->
robot.router.post "/hubot/pivotal-listener", (req, res)... |
Write files when you have both name and content | fs = require 'fs'
noflo = require '../../lib/NoFlo'
class WriteFile extends noflo.Component
constructor: ->
@data = null
@filename = null
@inPorts =
in: new noflo.Port
filename: new noflo.Port
@outPorts =
out: new noflo.Port
error: new noflo.Port
@inPorts.in.on 'data', (... | fs = require 'fs'
noflo = require '../../lib/NoFlo'
class WriteFile extends noflo.Component
constructor: ->
@data = null
@filename = null
@inPorts =
in: new noflo.Port
filename: new noflo.Port
@outPorts =
out: new noflo.Port
error: new noflo.Port
@inPorts.in.on 'data', (... |
Revise for json change in api | # Description:
# Deep thoght generator
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot thought - Get a random deep thought.
#
# Notes:
# None
#
# Author:
# @commadelimited
# Configures the plugin
module.exports = (robot) ->
# waits for the string "hubot deep" to occur
robot.respo... | # Description:
# Deep thoght generator
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot thought - Get a random deep thought.
#
# Notes:
# None
#
# Author:
# @commadelimited
# Configures the plugin
module.exports = (robot) ->
# waits for the string "hubot deep" to occur
robot.respo... |
Update shipping-rate-selection directive to handle error when retreiving rates | Sprangular.directive 'shippingRateSelection', ->
restrict: 'E'
templateUrl: 'shipping/rates.html'
scope:
order: '='
controller: ($scope, Cart) ->
$scope.loading = false
$scope.rates = []
$scope.$watch 'order.shipping_method_id', (shippingMethodId) ->
rate = _.find($scope.rates, (rate) -> ... | Sprangular.directive 'shippingRateSelection', ->
restrict: 'E'
templateUrl: 'shipping/rates.html'
scope:
order: '='
controller: ($scope, Cart) ->
$scope.loading = false
$scope.rates = []
$scope.$watch 'order.shipping_method_id', (shippingMethodId) ->
rate = _.find($scope.rates, (rate) -> ... |
Make usernames available in project overview so usernames can be shown. | Router.configure
layoutTemplate: 'layout'
loadingTemplate: 'loading'
notFoundTemplate: 'notFound'
waitOn: -> [Meteor.subscribe('projects'), Meteor.subscribe('notifications')]
Router.route '/projects/new',
name: 'projectNew'
waitOn: -> Meteor.subscribe 'usernames'
Router.route '/projects/:_id',
name: 'pr... | Router.configure
layoutTemplate: 'layout'
loadingTemplate: 'loading'
notFoundTemplate: 'notFound'
waitOn: -> [Meteor.subscribe('projects'),
Meteor.subscribe('notifications'),
Meteor.subscribe('usernames')]
Router.route '/projects/new', name: 'projectNew'
Router.route '/projects/:_i... |
Add test to ensure that aliases exist | module "PubSub"
require ["core/pubsub"], (pubsub) ->
test "simple on/fire", ->
memoValue = null
expectedMemo = "expected"
pubsub.on "stim", (memo) -> memoValue = memo
pubsub.fire "stim", expectedMemo
ok memoValue is expectedMemo, "responder function was invoked" | module "PubSub"
require ["core/pubsub"], (pubsub) ->
test "export aliases", ->
ok pubsub.on is pubsub.respondTo, "on and respondTo"
ok pubsub.off is pubsub.stopResponding, "off and stopResponding"
test "simple on/fire", ->
memoValue = null
expectedMemo = "expected"
pubsub.on "stim", (memo)... |
Add more static file types to be copied to public folder | path = require 'path'
glob = require('glob')
fs = require 'fs-extra'
async = require 'async'
parsePath = require 'parse-filepath'
_ = require 'underscore'
globPages = require './glob-pages'
module.exports = (program, cb) ->
{relativeDirectory, directory} = program
globPages directory, (err, pages) ->
# Asyn... | path = require 'path'
glob = require('glob')
fs = require 'fs-extra'
async = require 'async'
parsePath = require 'parse-filepath'
_ = require 'underscore'
globPages = require './glob-pages'
module.exports = (program, cb) ->
{relativeDirectory, directory} = program
globPages directory, (err, pages) ->
# Asyn... |
Update localstore's get function to actually retrieve the given element when specified | # ----------------------------------------------------------
#
# LocalStore (util)
# Serialize key,value into localstorage with cookies fallback
# for browsers that doesn't support localstorage.
#
# ----------------------------------------------------------
define ->
class LocalStore
@version = '0.0.1'
... | # ----------------------------------------------------------
#
# LocalStore (util)
# Serialize key,value into localstorage with cookies fallback
# for browsers that doesn't support localstorage.
#
# ----------------------------------------------------------
define ->
class LocalStore
@version = '0.0.1'
... |
Use https endpoint for Embedly oEmbed | _ = require 'underscore'
qs = require 'querystring'
moment = require 'moment'
Backbone = require 'backbone'
{ EMBEDLY_KEY } = require('sharify').data
{ crop, resize } = require '../resizer/index.coffee'
class Response extends Backbone.Model
resizeUrlFor: ->
resize @get('thumbnail_url'), arguments...
cropUrlFo... | _ = require 'underscore'
qs = require 'querystring'
moment = require 'moment'
Backbone = require 'backbone'
{ EMBEDLY_KEY } = require('sharify').data
{ crop, resize } = require '../resizer/index.coffee'
class Response extends Backbone.Model
resizeUrlFor: ->
resize @get('thumbnail_url'), arguments...
cropUrlFo... |
Access hash with hash.value in coffee | options = {}
options['font_size'] = 10
options['font_family'] = 'Arial'
console.log options
| options = {}
options.font_size = 10
options.font_family = 'Arial'
console.log options
|
Remove ability to deselect task from task list | angular.module('doubtfire.units.states.tasks.viewer.directives.unit-task-list', [])
.directive('unitTaskList', ->
restrict: 'E'
templateUrl: 'units/states/tasks/viewer/directives/unit-task-list/unit-task-list.tpl.html'
scope:
unit: '='
# Function to invoke to refresh tasks
refreshTasks: '=?'
unit... | angular.module('doubtfire.units.states.tasks.viewer.directives.unit-task-list', [])
.directive('unitTaskList', ->
restrict: 'E'
templateUrl: 'units/states/tasks/viewer/directives/unit-task-list/unit-task-list.tpl.html'
scope:
unit: '='
# Function to invoke to refresh tasks
refreshTasks: '=?'
unit... |
Fix for possible password exploit | Template.entrySignIn.helpers
emailInputType: ->
if AccountsEntry.settings.passwordSignupFields is 'EMAIL_ONLY'
'email'
else
'string'
emailPlaceholder: ->
fields = AccountsEntry.settings.passwordSignupFields
if _.contains([
'USERNAME_AND_EMAIL'
'USERNAME_AND_OPTIONAL_EMAIL'
... | Template.entrySignIn.helpers
emailInputType: ->
if AccountsEntry.settings.passwordSignupFields is 'EMAIL_ONLY'
'email'
else
'string'
emailPlaceholder: ->
fields = AccountsEntry.settings.passwordSignupFields
if _.contains([
'USERNAME_AND_EMAIL'
'USERNAME_AND_OPTIONAL_EMAIL'
... |
Use local resource path variable | path = require 'path'
os = require 'os'
LessCache = require 'less-cache'
{Subscriber} = require 'emissary'
tmpDir = if process.platform is 'win32' then os.tmpdir() else '/tmp'
module.exports =
class LessCompileCache
Subscriber.includeInto(this)
@cacheDir: path.join(tmpDir, 'atom-compile-cache', 'less')
constr... | path = require 'path'
os = require 'os'
LessCache = require 'less-cache'
{Subscriber} = require 'emissary'
tmpDir = if process.platform is 'win32' then os.tmpdir() else '/tmp'
module.exports =
class LessCompileCache
Subscriber.includeInto(this)
@cacheDir: path.join(tmpDir, 'atom-compile-cache', 'less')
constr... |
Cut out superfluous code, things are much smoother now | # Description:
# Card image fetcher for Magic: The Gathering cards
#
# Commands:
# [[<card name>]]
#
# Notes:
# Upon failure, returns Dismal Failure
#
# Author:
# JacobGinsparg
rCardNames = /\[\[(.*)\]\]/i
baseUrl = "http://gatherer.wizards.com/Handlers/Image.ashx"
loadCardDatabase = ->
req = new XMLHttpReq... | # Description:
# Card image fetcher for Magic: The Gathering cards
#
# Commands:
# [[<card name>]]
#
# Notes:
# Upon failure, returns Dismal Failure
#
# Author:
# JacobGinsparg
loadCardDatabase = ->
req = new XMLHttpRequest()
req.addEventListener 'readystatechange', ->
if req.readyState is 4 and req.st... |
Use relative links not full url | jQuery(document).ready ->
writeanswer = (ans) ->
jQuery("#answer").html(ans)
jQuery("#answer").attr("class", "answered")
jQuery(".unanswered").attr("class", "none")
question = jQuery("#question").val()
jQuery("#externallink").attr("href", "http://decisiverobot.com/?question=#... | jQuery(document).ready ->
writeanswer = (ans) ->
jQuery("#answer").html(ans)
jQuery("#answer").attr("class", "answered")
jQuery(".unanswered").attr("class", "none")
question = jQuery("#question").val()
jQuery("#externallink").attr("href", "/?question=#{question}")
... |
Tweak code for handling Ajax updates triggered by changing a Select | # 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... | # 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 agreed to in writing, software
# distributed under the... |
Use the same tooltipRemove method | Backbone.Factlink ||= {}
Backbone.Factlink.TooltipMixin =
default_options:
side: 'left'
align: 'center'
margin: 0
tooltipAdd: (selector, title, text, options) ->
options = _.extend @default_options, options
@_tooltips ?= {}
if @_tooltips[selector]?
throw "Cannot call tooltipAdd mul... | Backbone.Factlink ||= {}
Backbone.Factlink.TooltipMixin =
default_options:
side: 'left'
align: 'center'
margin: 0
tooltipAdd: (selector, title, text, options) ->
options = _.extend @default_options, options
@_tooltips ?= {}
if @_tooltips[selector]?
throw "Cannot call tooltipAdd mul... |
Fix interval in stress test | io = require('socket.io-client')
url = process.env.TEST_TARGET || 'https://snap-backend-dev.herokuapp.com' #'http://localhost:8080'
users = process.env.USERS || 50
randWord = (len) ->
Math.random().toString(36).substr(2, len)
startPlayer = (name) ->
name = name || process.env.TEST_NAME || 'John Smith'
sock... | io = require('socket.io-client')
url = process.env.TEST_TARGET || 'https://snap-backend-dev.herokuapp.com' #'http://localhost:8080'
users = process.env.USERS || 50
randWord = (len) ->
Math.random().toString(36).substr(2, len)
startPlayer = (name) ->
socket = io(url)
socket.on 'connect', ()->
setTimeout... |
Remove Preferences, Update Defaults, Add Tools Preferences | Dispatch = require './dispatch'
module.exports =
configDefaults:
environmentOverridesConfiguration: true
syntaxCheckOnSave: false
formatOnSave: true
gofmtArgs: "-w"
vetOnSave: true
vetArgs: ""
lintOnSave: false
goPath: ""
goExecutablePath: "/usr/local/go/bin/go"
gofmtPath: "/u... | Dispatch = require './dispatch'
module.exports =
configDefaults:
environmentOverridesConfiguration: true
syntaxCheckOnSave: true
formatOnSave: true
formatWithGoImports: true
getMissingTools: true
gofmtArgs: "-w"
vetOnSave: true
vetArgs: ""
lintOnSave: true
goPath: ""
golin... |
Enable harmony collections when running specs | module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
coffee:
glob_to_multiple:
expand: true
cwd: 'src'
src: ['*.coffee']
dest: 'lib'
ext: '.js'
coffeelint:
options:
no_empty_param_list:
level: 'error'
... | module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
coffee:
glob_to_multiple:
expand: true
cwd: 'src'
src: ['*.coffee']
dest: 'lib'
ext: '.js'
coffeelint:
options:
no_empty_param_list:
level: 'error'
... |
Add Elixir project dirs to Atom `ignoredNames` | "*":
"atom-ctags": {}
"autocomplete-plus":
enableAutoActivation: false
core:
audioBeep: false
disabledPackages: [
"exception-reporting"
"linter"
]
ignoredNames: [
".bundle"
".git"
"log"
"repositories"
"tmp"
]
themes: [
"atom-dark-ui"
... | "*":
"atom-ctags": {}
"autocomplete-plus":
enableAutoActivation: false
core:
audioBeep: false
disabledPackages: [
"exception-reporting"
"linter"
]
ignoredNames: [
".bundle"
".git"
"_build"
"deps"
"log"
"node_modules"
"repositories"
"t... |
Upgrade node to v0.10.9 since atom-shell branch has been merged. | 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/Frameworks/Atom.framework/Resources'
getNodeUrl: ->
process.env.ATOM_NODE_URL ? 'https://gh-... |
Fix counts with new tasks | currentProject = require 'zooniverse-readymade/current-project'
$ = window.jQuery
classifyPage = currentProject.classifyPages[0]
{subjectViewer, decisionTree} = classifyPage
# NOTE: This is super super hacky.
# Doing this for real will require a better DecisionTree class.
badges = {}
$(decisionTree.el).one decision... | currentProject = require 'zooniverse-readymade/current-project'
$ = window.jQuery
classifyPage = currentProject.classifyPages[0]
{subjectViewer, decisionTree} = classifyPage
# NOTE: This is super super hacky.
# Doing this for real will require a better DecisionTree class.
badges = {}
$(decisionTree.el).on decisionT... |
Add local cache to fetchImage() logic | "use strict"
site = require '../model/config'
cabin = require '../model/cabin'
exports.getList = (request, reply) ->
reply.view 'list',
site: site
user: request.auth.credentials
cabins: cabin.getCabins()
title: 'List'
exports.getCabin = (request, reply) ->
cabin.getCabin request.params.id, (err, ... | "use strict"
site = require '../model/config'
cabin = require '../model/cabin'
request = require 'request'
fs = require 'fs'
exports.getList = (request, reply) ->
reply.view 'list',
site: site
user: request.auth.credentials
cabins: cabin.getCabins()
title: 'List'
exports.getCabin = (request, reply)... |
Put driver instantiation in beforeAll block | Gozer = require('./helpers/gozer')
describe 'Gozer', ->
gozer = new Gozer(port: 3002)
page = null
beforeEach ->
page = gozer
.visit('/')
.resize(width: '1024')
describe 'HTML tests', ->
it 'can evaluate the document markup', ->
expect(page.run(-> document.title))
.to.eventua... | Gozer = require('./helpers/gozer')
describe 'Gozer', ->
gozer = page = null
before ->
gozer = new Gozer(port: 3002)
beforeEach ->
page = gozer
.visit('/')
.resize(width: '1024')
describe 'HTML tests', ->
it 'can evaluate the document markup', ->
expect(page.run(-> document.titl... |
Use ctrl-shift-l to select grammar | '.platform-darwin .editor':
'cmd-L': 'grammar-selector:show'
'.platform-win32 .editor':
'ctrl-L': 'grammar-selector:show'
| '.platform-darwin .editor':
'ctrl-L': 'grammar-selector:show'
'.platform-win32 .editor':
'ctrl-L': 'grammar-selector:show'
|
Load any config file before logic | exports.CoffeeTask = ->
dist:
options:
bare: false
sourceMap: true
files:
# all of the files used in testing and development - configuration, etc.
".tmp/scripts/else.js": [".tmp/scripts/*.coffee", "!.tmp/scripts/alchemy.src.... | exports.CoffeeTask = ->
dist:
options:
bare: false
sourceMap: true
files:
# all of the files used in testing and development - configuration, etc.
".tmp/scripts/else.js": [".tmp/scripts/*.coffee", "!.tmp/scripts/alchemy.src.... |
Check if local storege exist | class CartView extends Backbone.View
initialize: ->
@listenTo @collection, "reset update", @render
tagName: "button"
className: "epages-cart-button"
events:
"click": "openCart"
template: _.template """
<i class="fa fa-shopping-cart"></i><span><%= count %></span>
"""
render: ->
quanti... | class CartView extends Backbone.View
initialize: ->
@listenTo @collection, "reset update", @render
tagName: "button"
className: "epages-cart-button"
events:
"click": "openCart"
template: _.template """
<i class="fa fa-shopping-cart"></i><span><%= count %></span>
"""
render: ->
quanti... |
Fix a typo in coniferous | module.exports =
label: "Habitat"
key: "habitat"
values: [{
value: "deciduous"
label: "Deciduous woodland"
},{
value: "coniforous"
label: "Coniforous woodland"
},{
value: "grassland"
label: "Grassland"
},{
value: "heathland"
label: "Heathland and moors"
},{
value: "mars... | module.exports =
label: "Habitat"
key: "habitat"
values: [{
value: "deciduous"
label: "Deciduous woodland"
},{
value: "coniferous"
label: "Coniferous woodland"
},{
value: "grassland"
label: "Grassland"
},{
value: "heathland"
label: "Heathland and moors"
},{
value: "mars... |
Add ? for null check | {_} = require 'atom'
Reporter = require './reporter'
module.exports =
activate: (state) ->
if _.isFunction(window.onerror)
@originalOnError = window.onerror
window.onerror = (message, url, line) =>
Reporter.send(message, url, line)
@originalOnError?(arguments...)
deactivate: ->
if @... | {_} = require 'atom'
Reporter = require './reporter'
module.exports =
activate: (state) ->
if _.isFunction(window.onerror)
@originalOnError = window.onerror
window.onerror = (message, url, line) =>
Reporter.send(message, url, line)
@originalOnError?(arguments...)
deactivate: ->
if @... |
Fix incorrect reference to FieldControl events | define [
'../../core'
'../../controls'
'./base'
], (c, controls, base) ->
class NumberControl extends base.FieldControl
options:
regionViews:
value: controls.RangeInput
events: ->
events = c._.clone base.FieldControl.events
events["c... | define [
'../../core'
'../../controls'
'./base'
], (c, controls, base) ->
class NumberControl extends base.FieldControl
options:
regionViews:
value: controls.RangeInput
events: ->
events = c._.clone base.FieldControl::events
events["... |
Set paths before creating cache | path = require 'path'
os = require 'os'
LessCache = require 'less-cache'
{Subscriber} = require 'emissary'
tmpDir = if process.platform is 'win32' then os.tmpdir() else '/tmp'
module.exports =
class LessCompileCache
Subscriber.includeInto(this)
@cacheDir: path.join(tmpDir, 'atom-compile-cache', 'less')
constr... | path = require 'path'
os = require 'os'
LessCache = require 'less-cache'
{Subscriber} = require 'emissary'
tmpDir = if process.platform is 'win32' then os.tmpdir() else '/tmp'
module.exports =
class LessCompileCache
Subscriber.includeInto(this)
@cacheDir: path.join(tmpDir, 'atom-compile-cache', 'less')
constr... |
Improve app.react.Link: options and activeFor. | goog.provide 'app.react.Link'
class app.react.Link
###*
@param {app.Routes} routes
@param {app.react.Touch} touch
@constructor
###
constructor: (@routes, @touch) ->
###*
@param {este.Route} route
@param {string} text
@param {Object=} urlParams
@param {Object=} props
###
to: (r... | goog.provide 'app.react.Link'
goog.require 'goog.asserts'
class app.react.Link
###*
TODO: Move to este-library once api is stabilized.
@param {app.Routes} routes
@param {app.react.Touch} touch
@constructor
###
constructor: (@routes, @touch) ->
###*
@typedef {{
route: este.Route,
... |
Set max checkins per session to 23 | mongoose = require('mongoose')
checkinSchema = new mongoose.Schema
user: String
session: Number
checkinTime: Date
deleted: { type: Boolean, default: false }
deletedTime: Date
checkinSchema.methods.upsert = () ->
# https://jira.mongodb.org/browse/SERVER-14322
try
@checkinTime = new ... | mongoose = require('mongoose')
checkinSchema = new mongoose.Schema
user: String
session: Number
checkinTime: Date
deleted: { type: Boolean, default: false }
deletedTime: Date
checkinSchema.methods.upsert = () ->
# https://jira.mongodb.org/browse/SERVER-14322
try
@checkinTime = new ... |
Use color mode instead of primitive square | {View} = require 'atom'
module.exports =
class DevModeView extends View
@content: ->
@span class: 'inline-block icon icon-primitive-square text-error'
| {View} = require 'atom'
module.exports =
class DevModeView extends View
@content: ->
@span class: 'inline-block icon icon-color-mode text-error'
|
Use JSONP only with some IE versions | define 'app/settings', () ->
applyAjaxDefaults = (settings) ->
settings.dataType = sm_settings.ajax_format
settings.cache = sm_settings.ajax_cache
settings.jsonpCallback = sm_settings.ajax_jsonpCallback
settings.data = settings.data || {}
settings.data.format = sm_settings.a... | define 'app/settings', () ->
ie_version = get_ie_version()
applyAjaxDefaults = (settings) ->
settings.cache = sm_settings.ajax_cache
if not ie_version
return settings
if ie_version >= 10
return settings
settings.dataType = sm_settings.ajax_format
... |
Make sure state exists before reading | calculateAccess = (comp, props) ->
model = _.result(comp, 'modelForAccess') ||
comp.commands?.getModel()?.modelForAccess() ||
comp.model?.modelForAccess()
accessRight = if props.readonly or comp.context?.readonly
'r'
else if props.writable or comp.context?.writable or Lanes.current... | calculateAccess = (comp, props) ->
model = _.result(comp, 'modelForAccess') ||
comp.commands?.getModel()?.modelForAccess() ||
comp.model?.modelForAccess()
accessRight = if props.readonly or comp.context?.readonly
'r'
else if props.writable or comp.context?.writable or Lanes.current... |
Copy eventric js into scripts folder | mainBowerFiles = require 'main-bower-files'
concat = require 'gulp-concat'
filter = require 'gulp-filter'
commonjsWrap = require 'gulp-wrap-commonjs'
pickFilesByExtension = (extension) -> filter (file) -> file.path.match new RegExp("." + extension + "$")
module.exports = (gulp) ->
gulp.task '... | mainBowerFiles = require 'main-bower-files'
concat = require 'gulp-concat'
filter = require 'gulp-filter'
commonjsWrap = require 'gulp-wrap-commonjs'
pickFilesByExtension = (extension) -> filter (file) -> file.path.match new RegExp("." + extension + "$")
module.exports = (gulp) ->
gulp.task '... |
Use isReverse instead of reverse in RegexAddress | Address = require 'command-interpreter/address'
Range = require 'range'
module.exports =
class RegexAddress extends Address
regex: null
reverse: null
constructor: (pattern, reverse) ->
@reverse = reverse
@regex = new RegExp(pattern)
getRange: (editor, currentRange) ->
rangeBefore = new Range([0, ... | Address = require 'command-interpreter/address'
Range = require 'range'
module.exports =
class RegexAddress extends Address
regex: null
reverse: null
constructor: (pattern, isReversed) ->
@isReversed = isReversed
@regex = new RegExp(pattern)
getRange: (editor, currentRange) ->
rangeBefore = new R... |
Allow hash to match some more ids | class Turbolinks.Snapshot
@wrap: (value) ->
if value instanceof this
value
else
@fromHTML(value)
@fromHTML: (html) ->
element = document.createElement("html")
element.innerHTML = html
@fromElement(element)
@fromElement: (element) ->
new this
head: element.querySelector(... | class Turbolinks.Snapshot
@wrap: (value) ->
if value instanceof this
value
else
@fromHTML(value)
@fromHTML: (html) ->
element = document.createElement("html")
element.innerHTML = html
@fromElement(element)
@fromElement: (element) ->
new this
head: element.querySelector(... |
Add test for blank array | items = require("../build/liblol.js").items
describe "items", ->
describe "find", ->
it "should return all items when nothing is passed to it", ->
items.find().should.include item for item in items.list
it "should throw an error if the parameters are bad", ->
try
items.find "blah"
... | items = require("../build/liblol.js").items
describe "items", ->
describe "find", ->
it "should return all items when nothing is passed to it", ->
items.find().should.include item for item in items.list
it "should throw an error if the condition isn't a function", ->
try
items.find "bl... |
Add symbol to currency display | class Skr.Components.Currency extends Lanes.React.Component
getDefaultProps: ->
amount: _.bigDecimal('0.0')
propTypes:
amount: React.PropTypes.instanceOf(_.bigDecimal)
render: ->
<span className="currency">{@props.amount.toFixed(2)}</span>
| class Skr.Components.Currency extends Lanes.React.Component
getDefaultProps: ->
amount: _.bigDecimal('0.0')
symbol: '$'
propTypes:
amount: React.PropTypes.instanceOf(_.bigDecimal)
symbol: React.PropTypes.string
render: ->
className = _.classnames 'currency', @props... |
Add Meetup to example config file | # Facebook config
exports.facebook =
appId: null
secretKey: null | # Facebook config
exports.facebook =
appId: null
secretKey: null
# Meetup config
exports.meetup = null # API key as string |
Set defaults on the inquiry model directly | Backbone = require 'backbone'
{ API_URL } = require('sharify').data
module.exports = class ArtworkInquiry extends Backbone.Model
url: "#{API_URL}/api/v1/me/artwork_inquiry_request"
| Backbone = require 'backbone'
{ API_URL, SESSION_ID } = require('sharify').data
Cookies = require '../components/cookies/index.coffee'
module.exports = class ArtworkInquiry extends Backbone.Model
url: "#{API_URL}/api/v1/me/artwork_inquiry_request"
defaults:
session_id: SESSION_ID
referring_url: Cookies.ge... |
Update /roll and begin implementation of /ore | # Description:
# Rolls dice!
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot roll 2d6
#
# Author:
# dualmoon
module.exports = (robot) ->
# Helpers
randint = (sides) ->
return Math.round(Math.random()*(sides-1))+1
rolldice = (sides, num) ->
if num is 1
return 0+ra... | # Description:
# Rolls dice!
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot roll 2d6
#
# Author:
# dualmoon
module.exports = (robot) ->
# Helpers
randint = (sides) ->
return Math.round(Math.random()*(sides-1))+1
rolldice = (sides, num) ->
if num is 1
return 0+ra... |
Enable SyncTeX, and 'file:line' style errors in log files | child_process = require "child_process"
path = require "path"
module.exports =
executable: "latexmk"
run: (args) ->
# TODO: Add support for killing the process.
proc = child_process.exec("#{@executable} #{args.join(" ")}")
proc.on "close", (code, signal) =>
if code == 0
# TODO: Display a... | child_process = require "child_process"
path = require "path"
module.exports =
executable: "latexmk"
run: (args) ->
# TODO: Add support for killing the process.
proc = child_process.exec("#{@executable} #{args.join(" ")}")
proc.on "close", (code, signal) =>
if code == 0
# TODO: Display a... |
Define droppable as an amd module | Sortable = require("./sortable")
Draggable = require("./draggable")
Droppable = require("./droppable")
$.fn.droppable = (options = {}) ->
values = for element in this
(new Droppable(element, options))
values
$.fn.draggable = (options = {}) ->
values = for element in this
(new Draggable(element, options... | Sortable = require("./sortable")
Draggable = require("./draggable")
Droppable = require("./droppable")
factory = ($) ->
$.fn.droppable = (options = {}) ->
values = for element in this
(new Droppable(element, options))
values
$.fn.draggable = (options = {}) ->
values = for element in this
... |
Add a test for ::parse | describe 'linter helpers', ->
helpers = require '../lib/helpers'
fs = require 'fs'
testFile = __dirname + '/fixtures/test.txt'
testContents = fs.readFileSync(testFile).toString()
describe '::exec', ->
it 'cries when no argument is passed', ->
gotError = false
try
helpers.exec()
c... | describe 'linter helpers', ->
helpers = require '../lib/helpers'
fs = require 'fs'
testFile = __dirname + '/fixtures/test.txt'
testContents = fs.readFileSync(testFile).toString()
describe '::exec', ->
it 'cries when no argument is passed', ->
gotError = false
try
helpers.exec()
c... |
Use params also when logging out. | ReduxRouter = require 'redux-simple-router'
API = require 'api'
utils = require '../utils.coffee'
URL = require '../url.coffee'
appActions = require './app-actions.coffee'
module.exports =
sessionTimeout: ->
type: 'SESSION_TIMEOUT'
login: (data) ->
type: 'LOGIN'
payload:
promise: API.login(data).then (body... | ReduxRouter = require 'redux-simple-router'
API = require 'api'
utils = require '../utils.coffee'
URL = require '../url.coffee'
appActions = require './app-actions.coffee'
module.exports =
sessionTimeout: ->
type: 'SESSION_TIMEOUT'
login: (data) ->
type: 'LOGIN'
payload:
promise: API.login(data).then (body... |
Remove X-Requested-With HTTP header from defaults | TM = angular.module 'TM', []
# AUTH
CLIENT_ID = '522804721863.apps.googleusercontent.com'
SCOPES = [
'https://www.googleapis.com/auth/tasks'
'https://www.googleapis.com/auth/userinfo.profile'
]
window.onAuthLibLoad = ->
authorize handleAuthResult, true
authorize = (callback, immediate) ->
setTimeout ->
... | TM = angular.module 'TM', []
# AUTH
CLIENT_ID = '522804721863.apps.googleusercontent.com'
SCOPES = [
'https://www.googleapis.com/auth/tasks'
'https://www.googleapis.com/auth/userinfo.profile'
]
window.onAuthLibLoad = ->
authorize handleAuthResult, true
authorize = (callback, immediate) ->
setTimeout ->
... |
Fix exception "cannot read property payload from undefined" | debug = require("debug")("owfs:convert")
exports.extractValue = (callback) ->
(error, messages) ->
if !error
if messages.length > 1
debug "Received multiple messages in simple read",messages
messageToUse = messages.filter (message) ->
debug "Checking Header payload > 0",message.header.payload
me... | debug = require("debug")("owfs:convert")
exports.extractValue = (callback) ->
(error, messages) ->
if !error
if messages.length > 1
debug "Received multiple messages in simple read",messages
messageToUse = messages.filter (message) ->
debug "Checking Header payload > 0",message.header.payload
me... |
Add log_in to mobile routes | #
# /login, /sign_up and /forgot
# Render the homepage but force open the appropriate modals
#
express = require 'express'
routes = require './routes'
{ loginPagePath, signupPagePath,
twitterLastStepPath } = require('artsy-passport').options
app = module.exports = express()
app.set 'views', __dirname + '/templates'... | #
# /login, /sign_up and /forgot
# Render the homepage but force open the appropriate modals
#
express = require 'express'
routes = require './routes'
{ loginPagePath, signupPagePath,
twitterLastStepPath } = require('artsy-passport').options
app = module.exports = express()
app.set 'views', __dirname + '/templates'... |
Improve the default build task | fs = require 'fs'
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
sass: main:
files:
'dist/style.css': 'css/rohpod.scss'
copy:
js:
src: 'js/*.js'
dest: 'dist/'
flatten: true
expand: true
img:
src: 'img/*'
dest: 'dist/'
flatten: true
... | fs = require 'fs'
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
sass: main:
files:
'dist/style.css': 'css/rohpod.scss'
copy:
js:
src: 'js/*.js'
dest: 'dist/'
flatten: true
expand: true
img:
src: 'img/*'
dest: 'dist/'
flatten: true
... |
Update package to use `Workspace::getActiveEditor` | module.exports =
activate: ->
atom.workspaceView.command "ascii-art:convert", => @convert()
convert: ->
# This assumes the active pane item is an editor
selection = atom.workspace.activePane.Item.getSelection()
figlet = require 'figlet'
figlet selection.getText(), {font: "Larry 3D 2"}, (error,... | module.exports =
activate: ->
atom.workspaceView.command "ascii-art:convert", => @convert()
convert: ->
# This assumes the active pane item is an editor
selection = atom.workspace.getActiveEditor().getSelection()
figlet = require 'figlet'
figlet selection.getText(), {font: "Larry 3D 2"}, (erro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.