Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Fix for the master checkbox. | 'use strict'
angular.module('xoWebApp')
.controller 'MainCtrl', ($scope, $location, stats, objects) ->
$scope.stats = stats.stats
$scope.byUUIDs = objects.byUUIDs
$scope.hosts = objects.byTypes.host ? []
$scope.pools = objects.byTypes.pool ? []
$scope.SRs = objects.byTypes.SR ? []
$scope.VMs... | 'use strict'
angular.module('xoWebApp')
.controller 'MainCtrl', ($scope, $location, stats, objects) ->
$scope.stats = stats.stats
$scope.byUUIDs = objects.byUUIDs
$scope.hosts = objects.byTypes.host ? []
$scope.pools = objects.byTypes.pool ? []
$scope.SRs = objects.byTypes.SR ? []
$scope.VMs... |
Add user credentials delete on controller | BaseController = require "#{__dirname}/base"
sql = require 'sql'
UserCredential = require "#{__dirname}/../models/user_credential"
class UsersController extends BaseController
user_credential: sql.define
name: 'usercredentials'
columns: (new UserCredential).columns()
create: (userId, callback)->
user... | BaseController = require "#{__dirname}/base"
sql = require 'sql'
UserCredential = require "#{__dirname}/../models/user_credential"
class UsersController extends BaseController
user_credential: sql.define
name: 'usercredentials'
columns: (new UserCredential).columns()
create: (userId, callback)->
user... |
Update coffeelint test to fix bug where the test was getting the output from the 1.5.0+ version of coffeescript | path = require 'path'
vows = require 'vows'
assert = require 'assert'
coffeelint = require path.join('..', 'lib', 'coffeelint')
vows.describe('coffeelint').addBatch({
"CoffeeLint's version number" :
topic : coffeelint.VERSION
'exists' : (version) ->
assert.isString(version)
"Co... | path = require 'path'
vows = require 'vows'
assert = require 'assert'
coffeelint = require path.join('..', 'lib', 'coffeelint')
vows.describe('coffeelint').addBatch({
"CoffeeLint's version number" :
topic : coffeelint.VERSION
'exists' : (version) ->
assert.isString(version)
"Co... |
Watch for hash change for tabs | define [
"base"
], (App) ->
App.directive "bookmarkableTabset", ($location, _) ->
restrict: "A"
require: "tabset"
link: (scope, el, attrs, tabset) ->
scope.$applyAsync () ->
hash = $location.hash()
if hash? and hash != ""
matchingTab = _.find tabset.tabs, (tab) ->
tab.bookmarkableTabId == ... | define [
"base"
], (App) ->
App.directive "bookmarkableTabset", ($location, _) ->
restrict: "A"
require: "tabset"
link: (scope, el, attrs, tabset) ->
linksToTabs = document.querySelectorAll(".link-to-tab");
_clickLinkToTab = (event) ->
_makeActive(event.currentTarget.getAttribute("href").replace('#', ... |
Add correct password to postgres connect | exports.conString = 'postgres://postgres:@localhost:5432/test'
exports.from = [
{table: 'calendar', type: 'C', colId: 'id'}
{table: 'calendar_entry', type: 'E', colId: 'id'}
]
exports.oid = {table: 'objectid', colType: 'type', colId: 'id', colOid: 'oid'}
| exports.conString = 'postgres://postgres:1234@localhost:5432/test'
exports.from = [
{table: 'calendar', type: 'C', colId: 'id'}
{table: 'calendar_entry', type: 'E', colId: 'id'}
]
exports.oid = {table: 'objectid', colType: 'type', colId: 'id', colOid: 'oid'}
|
Change the ratio of partner cover images to 3:2, as suggested in CMS. | module.exports =
'''
fragment partner on Partner {
id
name
initials
locations(size:15) {
city
}
profile {
id
href
image {
cropped(width:400, height:300, version: ["wide", "large", "featured", "larger"]) {
url
}
}
}
}
'''
| module.exports =
'''
fragment partner on Partner {
id
name
initials
locations(size:15) {
city
}
profile {
id
href
image {
cropped(width:400, height:266, version: ["wide", "large", "featured", "larger"]) {
url
}
}
}
}
'''
|
Include XML error response message in exception. | # Require Node.js core modules.
http = require("http")
# Require Node EC2 specific modules.
ResponseParser = require("./response").ResponseParser
invoke = require("./request").invoke
# Used whan a callback is not provided.
amazon = (options, splat) ->
extended = options
switch splat.length
... | # Require Node.js core modules.
http = require("http")
# Require Node EC2 specific modules.
ResponseParser = require("./response").ResponseParser
invoke = require("./request").invoke
# Used whan a callback is not provided.
amazon = (options, splat) ->
extended = options
switch splat.length
... |
Set up a new GA tracking code for 2015 | Template.setup.rendered = ->
setupGa()
setupGa = ->
if !window.ga?
(
(i, s, o, g, r, a, m) ->
i['GoogleAnalyticsObject'] = r
i[r] = i[r] || -> (i[r].q = i[r].q || []).push(arguments)
i[r].l = 1 * new Date()
a = s.createElement(o)
m = s.getElementsByTagName(o)[0]
... | Template.setup.rendered = ->
setupGa()
setupGa = ->
if !window.ga?
(
(i, s, o, g, r, a, m) ->
i['GoogleAnalyticsObject'] = r
i[r] = i[r] || -> (i[r].q = i[r].q || []).push(arguments)
i[r].l = 1 * new Date()
a = s.createElement(o)
m = s.getElementsByTagName(o)[0]
... |
Use lazy loading for requires to ensure we only include the minimum necessary code. | module.exports =
Server: require("patchboard-server")
Client: require("patchboard-client")
Tools: require("./tools")
| lazyRequire = (path) -> get: (-> require( path )), enumerable: true
Object.defineProperties module.exports,
Server: lazyRequire "patchboard-server"
Client: lazyRequire "patchboard-client"
Tools: lazyRequire "./tools"
|
Fix typo in test name | chai = require 'chai'
sinon = require 'sinon'
chai.use require 'sinon-chai'
expect = chai.expect
describe 'pathview', ->
beforeEach ->
@robot =
respond: sinon.spy()
hear: sinon.spy()
require('../src/pathview')(@robot)
it 'registers a pathview listener', ->
expect(@robot.respond).to.have.... | chai = require 'chai'
sinon = require 'sinon'
chai.use require 'sinon-chai'
expect = chai.expect
describe 'pathview', ->
beforeEach ->
@robot =
respond: sinon.spy()
hear: sinon.spy()
require('../src/pathview')(@robot)
it 'registers a pathview listener', ->
expect(@robot.respond).to.have.... |
Change $ to jQuery, to prevent naming conflicts | window.App ||= {}
class App.Base
constructor: ->
if (window.jQuery) then @setClearEventHandlers() # clearing application event handlers only possible with jQuery
return this
###
Run the new action for the create action. Generally the create action will 'render :new' if there was a problem.
This prev... | window.App ||= {}
class App.Base
constructor: ->
if (window.jQuery) then @setClearEventHandlers() # clearing application event handlers only possible with jQuery
return this
###
Run the new action for the create action. Generally the create action will 'render :new' if there was a problem.
This prev... |
Change version to 0.9.3.1 (with "pre") in preparation for release. | ###
This version class exists so we can work a version number into the catalog.
###
class window._Version extends Control
@catalog: "0.9.3.1-pre"
| ###
This version class exists so we can work a version number into the catalog.
###
class window._Version extends Control
@catalog: "0.9.3.1"
|
Add more JS snippets for Polymer declarations | ".source.js":
"Polymer: Element declaration":
"prefix": "Polymer"
"body": """
Polymer({
is: "${1:my-element}",
$2
});
"""
"Polymer: properties":
"prefix": "properties"
"body": """
properties: {
${1:name}: {
type: ${2:Boolean}
}
}
"""
"Polymer... | ".source.js":
"Polymer: Element declaration":
"prefix": "Polymer"
"body": """
Polymer({
is: "${1:my-element}",
$2
});
"""
"Polymer: Declare properties":
"prefix": "properties"
"body": """
properties: {
${1:name}: {
type: ${2:Boolean}
}$3
}
"""
... |
Add `uniExternalCollaboration` proxy to AnalyticRouter | AuthenticationController = require './../Authentication/AuthenticationController'
AnalyticsController = require('./AnalyticsController')
AnalyticsProxy = require('./AnalyticsProxy')
module.exports =
apply: (webRouter, privateApiRouter, publicApiRouter) ->
webRouter.post '/event/:event', AnalyticsController.recordEv... | AuthenticationController = require './../Authentication/AuthenticationController'
AnalyticsController = require('./AnalyticsController')
AnalyticsProxy = require('./AnalyticsProxy')
module.exports =
apply: (webRouter, privateApiRouter, publicApiRouter) ->
webRouter.post '/event/:event', AnalyticsController.recordEv... |
Add parentheses to Jison Lex injection scopes | "name": "Jison Lex Injection"
scopeName: "source.jisonlex-injection"
# Jison Lex replaces certain strings that start with “yy”:
#
# This string | is replaced with
# ------------|-----------------
# yyleng | yy_.yyleng
# yylineno | yy_.yylineno
# yylloc | yy_.yylloc
# yytext | yy_.yytext
#
# This repl... | "name": "Jison Lex Injection"
scopeName: "source.jisonlex-injection"
# Jison Lex replaces certain strings that start with “yy”:
#
# This string | is replaced with
# ------------|-----------------
# yyleng | yy_.yyleng
# yylineno | yy_.yylineno
# yylloc | yy_.yylloc
# yytext | yy_.yytext
#
# This repl... |
Swap order of map updates | $(document).ready( ->
require(['factsheet_handler'], (FactsheetHandler) ->
new FactsheetHandler($('.factsheet'))
)
require(['tabs'], (Tabs) ->
new Tabs($('.js-tabs-map'), ($tab, $tabContainer = null) ->
#update the geometry when the tab is changed
if($tab != null)
window.ProtectedPla... | $(document).ready( ->
require(['factsheet_handler'], (FactsheetHandler) ->
new FactsheetHandler($('.factsheet'))
)
require(['tabs'], (Tabs) ->
new Tabs($('.js-tabs-map'), ($tab, $tabContainer = null) ->
#update the geometry when the tab is changed
if($tab != null)
window.ProtectedPla... |
Fix heroku /public file serving | express = require 'express'
app = express()
# Serve static files
app.use express.static(__dirname + '/public')
# Set cache manifext content-type
app.use (req, res, next)->
if req.originalUrl == '/cache.manifest'
res.setHeader('Content-Type', 'text/cache-manifest')
next()
app.get '/', (req, res, next)->
res... | express = require 'express'
app = express()
process.env.PWD = process.cwd()
# Serve static files
app.use express.static(process.env.PWD + '/public')
# Set cache manifext content-type
app.use (req, res, next)->
if req.originalUrl == '/cache.manifest'
res.setHeader('Content-Type', 'text/cache-manifest')
next()... |
Fix undefined variable access and modifiers not being passed through to guest avatar | ###
# Copyright 2015-2017 ppy Pty. Ltd.
#
# This file is part of osu!web. osu!web is distributed with the hope of
# attracting more community contributions to the core ecosystem of osu!.
#
# osu!web is free software: you can redistribute it and/or modify
# it under the terms of the Affero GNU General Pub... | ###
# Copyright 2015-2017 ppy Pty. Ltd.
#
# This file is part of osu!web. osu!web is distributed with the hope of
# attracting more community contributions to the core ecosystem of osu!.
#
# osu!web is free software: you can redistribute it and/or modify
# it under the terms of the Affero GNU General Pub... |
Use different hashing function for the mouth machine | # node libs
fs = require('fs')
path = require('path')
# our libs
SlotMachine = require('./slotMachine.coffee')
basePath = path.join(__dirname, '..')
generatedPath = path.join(basePath, '.generated')
class Potato
colors: [
'#81bef1'
'#ad8bf2'
'#bff288'
'#de7878'
'#a5aa... | # node libs
fs = require('fs')
path = require('path')
# our libs
SlotMachine = require('./slotMachine.coffee')
basePath = path.join(__dirname, '..')
generatedPath = path.join(basePath, '.generated')
class Potato
colors: [
'#81bef1'
'#ad8bf2'
'#bff288'
'#de7878'
'#a5aa... |
Fix the interaction between batch actions | $(document).on 'ready page:load turbolinks:load', ->
#
# Use ActiveAdmin.modal_dialog to prompt user if confirmation is required for current Batch Action
#
$('.batch_actions_selector li a').click (e)->
e.stopPropagation() # prevent Rails UJS click event
e.preventDefault()
if message = $(@).data 'co... | $(document).on 'ready page:load turbolinks:load', ->
#
# Use ActiveAdmin.modal_dialog to prompt user if confirmation is required for current Batch Action
#
$('.batch_actions_selector li a').click (e)->
e.stopPropagation() # prevent Rails UJS click event
e.preventDefault()
if message = $(@).data 'co... |
Use song id as key. | goog.provide 'app.react.pages.Home'
class app.react.pages.Home
###*
@param {app.Routes} routes
@param {app.songs.Store} songsStore
@param {app.react.Touch} touch
@constructor
###
constructor: (routes, songsStore, touch) ->
{div,h1,ul,li,br} = React.DOM
{a} = touch.scroll 'a', 'button'
... | goog.provide 'app.react.pages.Home'
class app.react.pages.Home
###*
@param {app.Routes} routes
@param {app.songs.Store} songsStore
@param {app.react.Touch} touch
@constructor
###
constructor: (routes, songsStore, touch) ->
{div,h1,ul,li,br} = React.DOM
{a} = touch.scroll 'a'
@create... |
Remove unused syncing logic to conform to new sync architecture | # A button used to set integers
ctrl = [
'$scope',
'Devices',
'Data'
'Calendar'
($scope, Devices, Data, Calendar) ->
$scope.text = ->
switch Devices.current.busy
when 0 then 'Sync'
when 1 then 'Sync (busy)'
else 'Waiting'
$scope.sync = ->
nope = (data) -> alert 'SYN... | # A button used to set integers
ctrl = [
'$scope',
'Devices',
'Data'
'Calendar'
($scope, Devices, Data, Calendar) ->
$scope.text = ->
switch Devices.current.busy
when 0 then 'Sync'
when 1 then 'Working'
else 'Waiting'
$scope.sync = -> Devices.send "sync_sequence"
]
direct... |
Modify change tracker to detect nested attributes | # If you add the follow event to your View this will automatically update
# all attributes on your model when the input field changes.
#
# 'change :input': 'changed'
#
# Note: The name attribute of the field must match the attrbiute name:
Backbone.View = Backbone.View.extend(
changed: (evt) ->
field = $(evt.c... | # If you add the follow event to your View this will automatically update
# all attributes on your model when the input field changes.
#
# 'change :input': 'changed'
#
# Note: The name attribute of the field must match the attrbiute name:
Backbone.View = Backbone.View.extend(
changed: (evt) ->
field = $(evt.c... |
Move menu item to Edit menu. | # See https://atom.io/docs/latest/creating-a-package#menus for more details
'context-menu':
'.overlayer':
'Execute as Ruby': 'execute-as-ruby:execute'
'menu': [
{
'label': 'Packages'
'submenu': [
'label': 'Execute as Ruby'
'submenu': [
{ 'label': 'Execute', 'command': 'execute-as-... | # See https://atom.io/docs/latest/creating-a-package#menus for more details
'context-menu':
'.overlayer':
'Execute as Ruby': 'execute-as-ruby:execute'
'menu': [
{
'label': 'Edit'
'submenu': [
'label': 'Text'
'submenu': [
{ 'label': 'Execute as Ruby', 'command': 'execute-as-ruby:ex... |
Use get_value instead of call | exports.draw_grid = (SVG, world) ->
grid_size = world.get('size')
cell_size = world.get('scale')
draw_leg = (x, y) ->
size = cell_size * 0.5
SVG.rect {
x: x
y: y
height: size
width: size / 2
fill: "#00aa00"
}
grid_path = world.call('grid_path')
[
SVG.r... | exports.draw_grid = (SVG, world) ->
grid_size = world.get('size')
cell_size = world.get('scale')
draw_leg = (x, y) ->
size = cell_size * 0.5
SVG.rect {
x: x
y: y
height: size
width: size / 2
fill: "#00aa00"
}
grid_path = world.get_value('grid_path')
[
... |
Convert integer dropbox id to string when searching mongo | logger = require("logger-sharelatex")
async = require "async"
User = require("../../models/User").User
TpdsUpdateSender = require "../ThirdPartyDataStore/TpdsUpdateSender"
module.exports = DropboxWebhookHandler =
pollDropboxUids: (dropbox_uids, callback = (error) ->) ->
jobs = []
for uid in dropbox_uids
do (ui... | logger = require("logger-sharelatex")
async = require "async"
User = require("../../models/User").User
TpdsUpdateSender = require "../ThirdPartyDataStore/TpdsUpdateSender"
module.exports = DropboxWebhookHandler =
pollDropboxUids: (dropbox_uids, callback = (error) ->) ->
jobs = []
for uid in dropbox_uids
do (ui... |
Fix bug where tests from new ES code being included in requirejs wrapped code | # Set up requirejs to load the tests
# Uses heuristic that test filenames end with Tests.js
tests = []
for file of window.__karma__.files
if window.__karma__.files.hasOwnProperty(file)
if /Tests\.js$/.test(file)
tests.push(file)
requirejs.config
baseUrl: '/base/public/js'
paths:
"moment": "libs/mom... | # Set up requirejs to load the tests
# Uses heuristic that test filenames end with Tests.js
tests = []
for file of window.__karma__.files
if window.__karma__.files.hasOwnProperty(file)
if /test\/unit_frontend\/js.+Tests.js$/.test(file)
tests.push(file)
requirejs.config
baseUrl: '/base/public/js'
paths:... |
Fix error raised on tab close | module.exports = ->
highlightSelectedPackage = atom.packages.getLoadedPackage('highlight-selected')
highlightSelected = require (highlightSelectedPackage.path)
HighlightedAreaView = require (highlightSelectedPackage.path + '/lib/highlighted-area-view')
class FakeEditor
constructor: (@minimap) ->
getA... | module.exports = ->
highlightSelectedPackage = atom.packages.getLoadedPackage('highlight-selected')
highlightSelected = require (highlightSelectedPackage.path)
HighlightedAreaView = require (highlightSelectedPackage.path + '/lib/highlighted-area-view')
class FakeEditor
constructor: (@minimap) ->
getA... |
Call os kite from VM buttons. | class VirtualizationControls extends KDButtonGroupView
constructor:->
options =
cssClass : "virt-controls"
buttons :
"Start" :
callback : -> log "Start machine"
"Stop" :
callback : -> log "Stop machine"
"Turn Off" :
callback... | class VirtualizationControls extends KDButtonGroupView
constructor:->
options =
cssClass : "virt-controls"
buttons :
"Start" :
callback : ->
KD.singletons.kiteController.run
kiteName: 'os',
method: 'vm.start'
"Stop" ... |
Use x3dom feature to load dynamically added x3d nodes | Controller = require 'controllers/base/controller'
X3dPageView = require 'views/x3d_page_view'
module.exports = class X3dsController extends Controller
historyURL: 'x3d'
show: ->
@view = new X3dPageView()
x3dom.load()
| Controller = require 'controllers/base/controller'
X3dPageView = require 'views/x3d_page_view'
module.exports = class X3dsController extends Controller
historyURL: 'x3d'
show: ->
x3dom.unload()
@view = new X3dPageView()
x3dom.load()
dispose: ->
super
x3dom.unload()
|
Format consistently with other (more complex) modules | # 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... |
Fix media url problem in tinymce | WysiwygSelectView = OrchestraView.extend(
events:
'click #sendToTiny': 'sendToTiny'
'change #media_crop_format' : 'changeCropFormat'
initialize: (options) ->
@options = @reduceOption(options, [
'domContainer'
'html'
'thumbnails'
'original'
])
@loadTemplates [
'Op... | WysiwygSelectView = OrchestraView.extend(
events:
'click #sendToTiny': 'sendToTiny'
'change #media_crop_format' : 'changeCropFormat'
initialize: (options) ->
@options = @reduceOption(options, [
'domContainer'
'html'
'thumbnails'
'original'
])
@loadTemplates [
'Op... |
Set props on self rather than prototype | class CheckBox extends Lanes.React.BaseComponent
d: -> @props.query.results.xtraData(@props.row)
onChange: (ev) -> #, me, results, index) ->
@d().selected = ev.target.checked
@props.selections.onChange?(@props)
@forceUpdate()
render: ->
selected = @d().selected
sele... | class CheckBox extends Lanes.React.BaseComponent
d: -> @props.query.results.xtraData(@props.row)
onChange: (ev) -> #, me, results, index) ->
@d().selected = ev.target.checked
@props.selections.onChange?(@props)
@forceUpdate()
render: ->
selected = @d().selected
sele... |
Fix indent and bump timeout a bit |
{ jsJobRun } = require './cli'
path = require 'path'
chai = require 'chai'
testserver = 'http://localhost:8001'
example = (name) ->
return path.join testserver, 'dist/examples', name
describe 'Examples: Sudoku', ->
stdout = null
stderr = null
describe 'with a valid input board', ->
it 'executes without e... |
{ jsJobRun } = require './cli'
path = require 'path'
chai = require 'chai'
testserver = 'http://localhost:8001'
example = (name) ->
return path.join testserver, 'dist/examples', name
describe 'Examples: Sudoku', ->
stdout = null
stderr = null
describe 'with a valid input board', ->
it 'executes without e... |
Remove spaces and hyphens from "fromNumber" | example =
twilio:
AccountSID: 'AC_YOUR_TWILIO_ACCOUNT_SID'
AuthToken: 'YOUR_TWILIO_AUTH_TOKEN'
fromNumber: '+1_YOUR_TWILIO_NUMBER_TO_SEND_CONFIRMATION_CODES_FROM'
testing:
AccountSID: 'AC_YOUR_TWILIO_TEST_CREDENTIALS_ACCOUNT_SID'
AuthToken: 'YOUR_TWILIO_TEST_CREDENTIALS_AUTH_TOKEN'
f... | example =
twilio:
AccountSID: 'AC_YOUR_TWILIO_ACCOUNT_SID'
AuthToken: 'YOUR_TWILIO_AUTH_TOKEN'
fromNumber: '+1_YOUR_TWILIO_NUMBER_TO_SEND_CONFIRMATION_CODES_FROM'
testing:
AccountSID: 'AC_YOUR_TWILIO_TEST_CREDENTIALS_ACCOUNT_SID'
AuthToken: 'YOUR_TWILIO_TEST_CREDENTIALS_AUTH_TOKEN'
f... |
Add command to insert now as timestamp | # Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to make opened Markdown files always be soft wrapped:
#
# path = require 'path'
#
# atom.workspaceView.eachEd... | # Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to make opened Markdown files always be soft wrapped:
#
# path = require 'path'
#
# atom.workspaceView.eachEd... |
Allow CoffeeScript files to be directly required. | # Expose `Impromptu`.
exports = module.exports = {}
# Expose APIs.
exports.db = require './db'
exports.color = require './color'
exports.Prompt = require './prompt'
exports.Section = require './section' | # Allow `.coffee` files in `require()`.
require 'coffee-script'
# Expose `Impromptu`.
exports = module.exports = {}
# Expose APIs.
exports.db = require './db'
exports.color = require './color'
exports.Prompt = require './prompt'
exports.Section = require './section' |
Use built-ins instead of _ | {_, $, View} = require 'atom'
module.exports =
class WrapGuideView extends View
@activate: ->
atom.workspaceView.eachEditorView (editorView) ->
if editorView.attached and editorView.getPane()
editorView.underlayer.append(new WrapGuideView(editorView))
@content: ->
@div class: 'wrap-guide'
... | {$, View} = require 'atom'
module.exports =
class WrapGuideView extends View
@activate: ->
atom.workspaceView.eachEditorView (editorView) ->
if editorView.attached and editorView.getPane()
editorView.underlayer.append(new WrapGuideView(editorView))
@content: ->
@div class: 'wrap-guide'
in... |
Fix tabs, and fix some syntax errors | http = require( 'http' )
clientID = ""
module.exports = {
setApiKey: ( ApiKey ) ->
clientID = ApiKey
getJSON: ( trackID ) ->
https.get(url, (res) ->
body = ''
res.on('data', ( chunk ) ->
body += chunk;
)
res.on('end', ->
return JSON.parse(body)
)
).... | https = require( 'https' )
clientID = ""
module.exports = {
setApiKey: ( ApiKey ) ->
clientID = ApiKey
getJSON: ( trackID ) ->
https.get(url, (res) ->
body = ''
res.on('data', ( chunk ) ->
body += chunk;
)
res.on('end', ->
return JSON.parse(body)
)
).on('error', (e) ->
console.l... |
Return a valid current user id when testing | Dashboard.CustomAuthenticator = SimpleAuth.Authenticators.Devise.extend
restore: (properties) ->
new Ember.RSVP.Promise((resolve, reject) ->
if not Ember.isEmpty(properties.access_token)
resolve properties
else
reject()
return
)
authenticate: (credentials) ->
_this = t... | Dashboard.CustomAuthenticator = SimpleAuth.Authenticators.Devise.extend
restore: (properties) ->
new Ember.RSVP.Promise((resolve, reject) ->
if not Ember.isEmpty(properties.access_token)
resolve properties
else
reject()
return
)
authenticate: (credentials) ->
_this = t... |
Fix for when the array is empty | do ($$ = Quo) ->
VENDORS = [ "-webkit-", "-moz-", "-ms-", "-o-", "" ]
$$.fn.addClass = (name) ->
@each ->
unless _existsClass(name, @className)
@className += " " + name
@className = @className.trim()
$$.fn.removeClass = (name) ->
@each ->
... | do ($$ = Quo) ->
VENDORS = [ "-webkit-", "-moz-", "-ms-", "-o-", "" ]
$$.fn.addClass = (name) ->
@each ->
unless _existsClass(name, @className)
@className += " " + name
@className = @className.trim()
$$.fn.removeClass = (name) ->
@each ->
... |
Change default homeRoute to / | AccountsEntry =
settings:
wrapLinks: true
homeRoute: '/home'
dashboardRoute: '/dashboard'
passwordSignupFields: 'EMAIL_ONLY'
emailToLower: true
usernameToLower: false
entrySignUp: '/sign-up'
extraSignUpFields: []
showOtherLoginServices: true
isStringEmail: (email) ->
emailPa... | AccountsEntry =
settings:
wrapLinks: true
homeRoute: '/'
dashboardRoute: '/dashboard'
passwordSignupFields: 'EMAIL_ONLY'
emailToLower: true
usernameToLower: false
entrySignUp: '/sign-up'
extraSignUpFields: []
showOtherLoginServices: true
isStringEmail: (email) ->
emailPatter... |
Remove unnecessary caching of StyleGuideView class | StyleguideView = null
styleguideUri = 'atom://styleguide'
createStyleguideView = (state) ->
StyleguideView ?= require './styleguide-view'
new StyleguideView(state)
atom.deserializers.add
name: 'StyleguideView'
deserialize: (state) -> createStyleguideView(state)
module.exports =
activate: ->
atom.worksp... | styleguideUri = 'atom://styleguide'
createStyleguideView = (state) ->
StyleguideView = require './styleguide-view'
new StyleguideView(state)
atom.deserializers.add
name: 'StyleguideView'
deserialize: (state) -> createStyleguideView(state)
module.exports =
activate: ->
atom.workspace.addOpener (filePath... |
Fix music entry previews not being visible | ###*
* Copyright 2015 ppy Pty. Ltd.
*
* This file is part of osu!web. osu!web is distributed with the hope of
* attracting more community contributions to the core ecosystem of osu!.
*
* osu!web is free software: you can redistribute it and/or modify
* it under the terms of the Affero GNU General Public ... | ###*
* Copyright 2015 ppy Pty. Ltd.
*
* This file is part of osu!web. osu!web is distributed with the hope of
* attracting more community contributions to the core ecosystem of osu!.
*
* osu!web is free software: you can redistribute it and/or modify
* it under the terms of the Affero GNU General Public ... |
Allow changing environment from browser | DEFAULT_ENV = '_cam'
API_HOSTS =
production: '' # Same domain!
staging: 'https://panoptes-staging.zooniverse.org'
development: 'http://localhost:3000'
test: 'http://localhost:7357'
_cam: 'http://172.17.2.87:3000'
API_APPLICATION_IDS =
_cam: '05fd85e729327b2f71cda394d8e87e042e0b77b05e05280e8246e8bdb05d54ed... | DEFAULT_ENV = 'staging'
API_HOSTS =
production: '' # Same domain!
staging: 'https://panoptes-staging.zooniverse.org'
development: 'http://localhost:3000'
test: 'http://localhost:7357'
cam: 'http://172.17.2.87:3000'
API_APPLICATION_IDS =
cam: '05fd85e729327b2f71cda394d8e87e042e0b77b05e05280e8246e8bdb05d54e... |
Fix necessary key for looped items | MaterialLink = React.createClass
render: ->
link = @props.link
return `(
<div style={{float: 'right'}}><a href={link.url} className={'button'} target={link.target}>{link.text}</a></div>
)`
MaterialLinks = React.createClass
render: ->
links = @props.links.map (link)->
return if link? th... | MaterialLink = React.createClass
render: ->
link = @props.link
return `(
<div key={link.url} style={{float: 'right'}}><a href={link.url} className={'button'} target={link.target}>{link.text}</a></div>
)`
MaterialLinks = React.createClass
render: ->
links = @props.links.map (link)->
ret... |
Use correct email address for deb package. | fs = require 'fs'
path = require 'path'
_ = require 'underscore-plus'
fillTemplate = (filePath, data) ->
template = _.template(String(fs.readFileSync(filePath + '.in')))
filled = template(data)
fs.writeFileSync(filePath, filled)
module.exports = (grunt) ->
{spawn} = require('./task-helpers')(grunt)
grunt.r... | fs = require 'fs'
path = require 'path'
_ = require 'underscore-plus'
fillTemplate = (filePath, data) ->
template = _.template(String(fs.readFileSync(filePath + '.in')))
filled = template(data)
fs.writeFileSync(filePath, filled)
module.exports = (grunt) ->
{spawn} = require('./task-helpers')(grunt)
grunt.r... |
Set DataCollector's primary key as set by Pancakes' services. | adapter = if window.location.search.lastIndexOf('fixture') != -1
DS.FixtureAdapter.extend
latency: 250
else
DS.RESTAdapter.configure 'plurals',
event_search: 'event_searches'
DS.RESTAdapter.extend
namespace: 'api/v1'
Pancakes.Adap... | #= require models/data_collector
adapter = if window.location.search.lastIndexOf('fixture') != -1
DS.FixtureAdapter.extend
latency: 250
else
DS.RESTAdapter.configure 'plurals',
event_search: 'event_searches'
DS.RESTAdapter.extend
... |
Update to coffeescript for select all and individual select interactivity | $(document).ready ->
$('#index-table').on 'change', '#select-all', ->
if $(this).is(':checked')
$('#index-table').find('.print-survey').prop 'checked', true
$('#submit').prop 'disabled', false
else
$('#index-table').find('.print-survey').prop 'checked', false
$('#submit').prop 'disable... | $(document).ready ->
$('#index-table').on 'change', '#select-all', ->
if $(this).is(':checked')
$('#index-table').find('.print-survey').prop 'checked', true
$('#submit').prop 'disabled', false
else
$('#index-table').find('.print-survey').prop 'checked', false
$('#submit').prop 'disable... |
Add spec for copying version | About = require '../lib/about'
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", ->
it "shows the About Atom vie... | 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"... |
Remove extraneous - from variant. | React = require 'react'
{ Classes } = require 'shiny'
module.exports = React.createClass
displayName: '_Title'
propTypes:
title : React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.array])
level : React.PropTypes.oneOf([1,2,3,4,5,6])
link : React.PropTypes.strin... | React = require 'react'
{ Classes } = require 'shiny'
module.exports = React.createClass
displayName: '_Title'
propTypes:
title : React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.array])
level : React.PropTypes.oneOf([1,2,3,4,5,6])
link : React.PropTypes.strin... |
Check for user id on feed redirect | _ = require 'underscore'
sd = require('sharify').data
ExploreBlocks = require '../../collections/explore_blocks'
@index = (req, res, next) ->
return next() unless req.user
res.locals.sd.CURRENT_PATH = "/"
res.locals.sd.FEED_TYPE = 'primary'
res.render 'feed', path: 'Feed'
@notifications = (req, res, next) -... | _ = require 'underscore'
sd = require('sharify').data
ExploreBlocks = require '../../collections/explore_blocks'
@index = (req, res, next) ->
return next() unless req.user?.id
res.locals.sd.CURRENT_PATH = "/"
res.locals.sd.FEED_TYPE = 'primary'
res.render 'feed', path: 'Feed'
@notifications = (req, res, nex... |
Fix sortie free slot check | window.addEventListener 'game.response',
({detail: {path, body}}) ->
if path == '/kcsapi/api_get_member/mapinfo'
basic = getStore 'info.basic'
if config.get 'poi.mapStartCheck.ship.enable', false
minShipSlots = config.get 'poi.mapStartCheck.ship.minFreeSlots', 4
shipSlots = basic.api_... | __ = i18n.main.__.bind(i18n.main)
window.addEventListener 'game.response',
({detail: {path, body}}) ->
if path == '/kcsapi/api_get_member/mapinfo'
basic = getStore 'info.basic'
if config.get 'poi.mapStartCheck.ship.enable', false
minShipSlots = config.get 'poi.mapStartCheck.ship.minFreeSlots... |
Rename isMemberOfCourse to just getCourse | _ = require 'underscore'
React = require 'react'
EventEmitter2 = require 'eventemitter2'
Course = require '../course/model'
api = require '../api'
BLANK_USER =
is_admin: false
is_content_analyst: false
is_customer_service: false
name: null
profile_url: null
User =
channel: new EventEmitter2 wildcard: tru... | _ = require 'underscore'
React = require 'react'
EventEmitter2 = require 'eventemitter2'
Course = require '../course/model'
api = require '../api'
BLANK_USER =
is_admin: false
is_content_analyst: false
is_customer_service: false
name: null
profile_url: null
User =
channel: new EventEmitter2 wildcard: tru... |
Simplify guarding in address-selection watch | Sprangular.directive 'addressSelection', ->
restrict: 'E'
templateUrl: 'addresses/selection.html'
scope:
address: '='
addresses: '='
countries: '='
disabled: '='
controller: ($scope) ->
$scope.existingAddress = false
$scope.$watch 'addresses', (addresses) ->
return unless addresse... | Sprangular.directive 'addressSelection', ->
restrict: 'E'
templateUrl: 'addresses/selection.html'
scope:
address: '='
addresses: '='
countries: '='
disabled: '='
controller: ($scope) ->
$scope.existingAddress = false
$scope.$watch 'addresses', (addresses) ->
return unless addresse... |
Add a snippet that references an external script | ".text.html":
"polymer element":
"prefix": "pe"
"body": """
<link rel="import" href="${1:../bower_components}/polymer/polymer.html">
<dom-module id="$2">
<style>
:host {
$5
}
</style>
<template>
$4
</template>
<script>
Polymer({
... | ".text.html":
"polymer element":
"prefix": "pe"
"body": """
<link rel="import" href="${1:../bower_components}/polymer/polymer.html">
<dom-module id="$2">
<style>
:host {
$5
}
</style>
<template>
$4
</template>
<script>
Polymer({
... |
Remove deprecations from Atom exports | TextBuffer = require 'text-buffer'
{Point, Range} = TextBuffer
{File, Directory} = require 'pathwatcher'
{Emitter, Disposable, CompositeDisposable} = require 'event-kit'
{includeDeprecatedAPIs, deprecate} = require 'grim'
module.exports =
BufferedNodeProcess: require '../src/buffered-node-process'
BufferedProcess:... | TextBuffer = require 'text-buffer'
{Point, Range} = TextBuffer
{File, Directory} = require 'pathwatcher'
{Emitter, Disposable, CompositeDisposable} = require 'event-kit'
module.exports =
BufferedNodeProcess: require '../src/buffered-node-process'
BufferedProcess: require '../src/buffered-process'
GitRepository: ... |
Add error handling in BufferToCanvas | noflo = require 'noflo'
Canvas = require('noflo-canvas').canvas
# @runtime noflo-nodejs
# @name BufferToCanvas
exports.getComponent = ->
c = new noflo.Component
c.icon = 'expand'
c.description = 'Convert a buffer to a canvas'
c.inPorts.add 'buffer',
datatype: 'object'
description: 'An image buffer'
... | noflo = require 'noflo'
Canvas = require('noflo-canvas').canvas
# @runtime noflo-nodejs
# @name BufferToCanvas
exports.getComponent = ->
c = new noflo.Component
c.icon = 'expand'
c.description = 'Convert a buffer to a canvas'
c.inPorts.add 'buffer',
datatype: 'object'
description: 'An image buffer'
... |
Use object to dedupe languages | {Emitter} = require 'event-kit'
{KeyboardLayoutObserver} = require '../build/Release/keyboard-layout-observer.node'
emitter = new Emitter
observer = new KeyboardLayoutObserver -> emitter.emit 'did-change-current-keyboard-layout', getCurrentKeyboardLayout()
getCurrentKeyboardLayout = ->
observer.getCurrentKeyboardLa... | {Emitter} = require 'event-kit'
{KeyboardLayoutObserver} = require '../build/Release/keyboard-layout-observer.node'
emitter = new Emitter
observer = new KeyboardLayoutObserver -> emitter.emit 'did-change-current-keyboard-layout', getCurrentKeyboardLayout()
getCurrentKeyboardLayout = ->
observer.getCurrentKeyboardLa... |
Add iconfont to list of tools | _ = require 'underscore'
Backbone = require 'backbone'
Backbone.$ = require 'jquery'
plugin = require 'plugin'
module.exports = Backbone.View.extend
template: require './template'
initialize: ->
underscoreTest = _.last([0,1,2, 'hi mom!'])
@render()
render: ->
@$el.html @template
... | _ = require 'underscore'
Backbone = require 'backbone'
Backbone.$ = require 'jquery'
plugin = require 'plugin'
module.exports = Backbone.View.extend
template: require './template'
initialize: ->
underscoreTest = _.last([0,1,2, 'hi mom!'])
@render()
render: ->
@$el.html @template
... |
Save point before Boss Fight | _ = require 'underscore-plus'
{EventEmitter} = require 'events'
module.exports =
class AutoUpdater
_.extend @prototype, EventEmitter.prototype
setFeedUrl: ->
console.log 'setFeedUrl'
quitAndInstall: ->
console.log 'quitAndInstall'
checkForUpdates: ->
console.log 'checkForUpdates'
| _ = require 'underscore-plus'
path = require 'path'
fs = require 'fs'
{EventEmitter} = require 'events'
{BufferedProcess} = require 'atom'
module.exports =
class AutoUpdater
_.extend @prototype, EventEmitter.prototype
setFeedUrl: (url) ->
@updateUrl = url
quitAndInstall: ->
console.log 'quitAndInstall... |
Fix up the sandbox testing functions. | Aether = require '../aether'
describe "Global Scope Exploit Suite", ->
it 'should intercept "this"', ->
code = "G=100;var globals=(function(){return this;})();return globals.G;"
aether = new Aether()
aether.transpile(code)
expect(aether.run()).toEqual 100
it 'should disallow using Function', ->
... | Aether = require '../aether'
describe "Global Scope Exploit Suite", ->
it 'should intercept "this"', ->
code = "G=100;var globals=(function(){return this;})();return globals.G;"
aether = new Aether()
aether.transpile(code)
expect(aether.run()).toEqual 100
it 'should disallow using Function', ->
... |
Set ‘bin’ to main executable in every test file | chai = require 'chai'
global.should = chai.should()
| path = require 'path'
chai = require 'chai'
global.should = chai.should()
global.bin = path.join __dirname, '..', '..', 'bin', 'brave-mouse'
|
Create helper to auto-undef requirejs modules | allTestFiles = []
TEST_REGEXP = /(spec|test)\.js$/i
Object.keys(window.__karma__.files).forEach (file) ->
allTestFiles.push(file) if TEST_REGEXP.test(file)
require.config
#Karma serves files under /base, which is the basePath from your config file
baseUrl: '/base/src'
paths: {
'easyxdm': '../compiled/vend... | allTestFiles = []
TEST_REGEXP = /(spec|test)\.js$/i
Object.keys(window.__karma__.files).forEach (file) ->
allTestFiles.push(file) if TEST_REGEXP.test(file)
window.__requirejs__ =
loaded_amds: {}
clearRequireState: ->
for key, value of window.__requirejs__.loaded_amds
requirejs.undef key
delete w... |
Add watcher and watch manifest.json | lineman = require(process.env["LINEMAN_MAIN"])
# completely ignore Lineman's built-in application config
config =
pkg: lineman.grunt.file.readJSON("package.json")
appTasks:
common: [ "copy" ]
dev: []
dist: []
loadNpmTasks: [
"grunt-contrib-copy"
]
clean:
dev:
src: "generated"
... | lineman = require(process.env["LINEMAN_MAIN"])
# completely ignore Lineman's built-in application config
config =
pkg: lineman.grunt.file.readJSON("package.json")
appTasks:
common: [ "copy" ]
dev: [ "watch" ]
dist: []
loadNpmTasks: [
"grunt-contrib-copy"
]
clean:
dev:
src: "gener... |
Handle error on browserify to keep watching | {full: version} = require './lib/version'
TARGET = "eyetribe-#{version}"
isDevelopment = version.indexOf 'SNAPSHOT' > 0
gulp = require 'gulp'
browserify = require 'browserify'
uglify = require 'gulp-uglify'
source = require 'vinyl-source-stream'
concat = require 'gulp-concat'
gulp.task 'default', ['compress']
gulp.t... | {full: version} = require './lib/version'
TARGET = "eyetribe-#{version}"
isDevelopment = version.indexOf 'SNAPSHOT' > 0
gulp = require 'gulp'
browserify = require 'browserify'
uglify = require 'gulp-uglify'
source = require 'vinyl-source-stream'
concat = require 'gulp-concat'
gulp.task 'default', ['compress']
gulp.t... |
Save session explicitly before returning from user refresh | CurrentUser = require '../../models/current_user'
module.exports.refresh = (req, res) ->
return res.redirect("/") unless req.user
req.user.fetch
error: res.backboneError
success: ->
req.login req.user, (error) ->
if (error)
next error
else
# Avoid race condition wh... | CurrentUser = require '../../models/current_user'
module.exports.refresh = (req, res, next) ->
return res.redirect("/") unless req.user
req.user.fetch
error: res.backboneError
success: ->
req.login req.user, (error) ->
if (error)
next error
else
# Avoid race condit... |
Make the global radio channel available to the views | $ = require 'jquery'
_ = require 'underscore'
Marionette = require 'backbone.marionette'
require './helpers/mixinTemplateHelpers'
require './helpers/handlebarsHelpers'
require '../../jquery/toggleWrapper'
# backup the original method
_remove = Marionette.View::remove
module.exports =
###
Adds... | $ = require 'jquery'
_ = require 'underscore'
Marionette = require 'backbone.marionette'
channel = require '../../utilities/appChannel'
require './helpers/mixinTemplateHelpers'
require './helpers/handlebarsHelpers'
require '../../jquery/toggleWrapper'
# backup the original method
_remove = Marion... |
Destroy editors without files after checkout | {$$, SelectListView} = require 'atom'
git = require '../git'
StatusView = require './status-view'
module.exports =
class ListView extends SelectListView
initialize: (@data) ->
super
@addClass 'overlay from-top'
@parseData()
parseData: ->
items = @data.split("\n")
branches = []
for item in... | fs = require 'fs-plus'
{$$, SelectListView} = require 'atom'
git = require '../git'
StatusView = require './status-view'
module.exports =
class ListView extends SelectListView
initialize: (@data) ->
super
@addClass 'overlay from-top'
@parseData()
parseData: ->
items = @data.split("\n")
branch... |
Clean up backbone plugin code | el = @elvis
class Binding
constructor: (@model, @attr, @transform) ->
bindTo: (obj, attr) ->
@model.on "change:#{@attr}", =>
el.setAttr(obj, attr, @getValue())
getValue: ->
value = @model.get(@attr)
if @transform then @transform(value) else value
el.bind = (model, attr, transform) ->
new ... | el = @elvis
class Binding
constructor: (@model, @attr, @transform) ->
bindTo: (obj, attr) ->
@toObj = obj
@toAttr = attr
@model.on("change:#{@attr}", @update, this)
this
getValue: ->
value = @model.get(@attr)
if @transform then @transform(value) else value
update: ->
el.setAttr(@... |
Save action for new user | App.UsersNewController = Em.Controller.extend
needs: ["application"]
validRoles: ["admin", "member"]
| App.UsersNewController = Em.Controller.extend
needs: ["application"]
validRoles: ["member", "admin"]
actions:
save: ->
userAttributes = @getProperties(["firstName", "lastName", "role", "password", "email"])
user = @store.createRecord("user", userAttributes)
console.log userAttributes
... |
Switch servers to use the heroku beta |
servers = {
official: 'sync.nitrotasks.com:443'
local: 'localhost:8080'
heroku: 'nitro-server.herokuapp.com'
custom: '192.168.0.100:8080'
}
# Set active server
active = servers.local
module.exports =
server: active
sync: active + '/socket'
email: active + '/email'
|
servers = {
official: 'sync.nitrotasks.com:443'
local: 'localhost:8080'
heroku: 'nitro-server.herokuapp.com'
custom: '192.168.0.100:8080'
}
# Set active server
active = servers.heroku
module.exports =
server: active
sync: active + '/socket'
email: active + '/email'
|
Fix parsing markdown at first | # 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/
ready = ->
checkTextChange = (e) ->
old = v = $(e).find('#item-text').val()
return ->
v = $(e).find(... | # 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/
ready = ->
parseText = (text) ->
# parsing markdown to html
$('#item-preview-content').html(marked(text... |
Add ability to make Liobot emote | # Description:
# Liona is just so awesome
#
# Commands:
# hubot <3
whitelist = require '../support/whitelist'
module.exports = (robot) ->
robot.respond /say to ([a-zA-Z-_\#]+) (.*)/, (msg) ->
if whitelist.canSay(robot, msg.message.user)
[room, message] = msg.match[1..2]
robot.messageRoom room, m... | # Description:
# Liona is just so awesome
#
# Commands:
# hubot <3
whitelist = require '../support/whitelist'
module.exports = (robot) ->
robot.respond /say to ([a-zA-Z-_\#]+) (.*)/, (msg) ->
if whitelist.canSay(robot, msg.message.user)
[room, message] = msg.match[1..2]
robot.messageRoom room, m... |
Use the `ember-data` initializer as a target instead of the soon to be deprecated `store` initializer | `import Ember from 'ember'`
`import DS from 'ember-data'`
`import { findAll, findById, findByQuery } from '../extensions/finders'`
`import strategyFor from '../extensions/strategy-for'`
`import push from '../extensions/push'`
initialize = (ctn, app) ->
unless DS.Store::_emberDataComplexPatched is true
DS.Store.r... | `import Ember from 'ember'`
`import DS from 'ember-data'`
`import { findAll, findById, findByQuery } from '../extensions/finders'`
`import strategyFor from '../extensions/strategy-for'`
`import push from '../extensions/push'`
initialize = (ctn, app) ->
unless DS.Store::_emberDataComplexPatched is true
DS.Store.r... |
Adjust fixture to match current generated content | class AppyApp.Screens.ReadySetGo extends AppyApp.Screens.Base
render: ->
<div className="fancy-header">
<h1>Hello bright shiny world</h1>
<h2>Served by the AppyApp extension’s ReadySetGo screen</h2>
</div>
| class AppyApp.Screens.ReadySetGo extends AppyApp.Screens.Base
render: ->
<LC.ScreenWrapper identifier="appy-app">
<div className="fancy-header">
<h1>Hello bright shiny world</h1>
<h2>Served by the AppyApp extension’s ReadySetGo screen</h2>
</div... |
Add workflow ID to tutorial subject | Subject = require 'zooniverse/models/subject'
module.exports = ->
new Subject
location: standard: './subjects/standard/514092d13ae74064ba00000e.jpg'
coords: [0, 0]
metadata: tutorial: true
| Subject = require 'zooniverse/models/subject'
module.exports = ->
new Subject
location: standard: './subjects/standard/514092d13ae74064ba00000e.jpg'
coords: [0, 0]
metadata:
tutorial: true
file_name: 'TUTORIAL_SUBJECT'
workflow_ids: ['514092d13ae74064ba000002']
|
Throw on type error during CLI run | fs = require 'fs'
path = require 'path'
helpers = require './helpers'
compiler = require './compiler'
exports.compileModule = compile = (source, options) ->
result = compiler.compileModule source
if result.request
console.error options
console.error result
else
result.js
# Compile and execute a str... | fs = require 'fs'
path = require 'path'
helpers = require './helpers'
compiler = require './compiler'
exports.compileModule = compile = (source, options) ->
result = compiler.compileModule source
if result.request
console.error options
console.error result
else if result.errors
throw new Error result... |
Remove unneeded tools from the toolbar |
window.Tahi = {}
Tahi.papers =
init: ->
$('#add_author').on 'click', (e) ->
e.preventDefault()
$('<li class="author">').appendTo $('ul.authors')
$(document).ready ->
if $('[contenteditable!=false]').length > 0
for elementId in ['body_editable', 'abstract_editable']
CKEDITOR.inline elemen... |
window.Tahi = {}
Tahi.papers =
init: ->
$('#add_author').on 'click', (e) ->
e.preventDefault()
$('<li class="author">').appendTo $('ul.authors')
$(document).ready ->
if $('[contenteditable!=false]').length > 0
for elementId in ['body_editable', 'abstract_editable']
CKEDITOR.inline elemen... |
Use class instead of instanceof to check if the active view is an editor | _ = require 'underscore-plus'
{EditorView, View} = require 'atom'
MarkerView = require './marker-view'
module.exports =
class FindResultsView extends View
@content: ->
@div class: 'search-results'
initialize: (@findModel) ->
@markerViews = {}
@subscribe @findModel, 'updated', (args...) => @markersUpd... | _ = require 'underscore-plus'
{EditorView, View} = require 'atom'
MarkerView = require './marker-view'
module.exports =
class FindResultsView extends View
@content: ->
@div class: 'search-results'
initialize: (@findModel) ->
@markerViews = {}
@subscribe @findModel, 'updated', (args...) => @markersUpd... |
Use just `process.env.USERPROFILE` to determine a user's home folder on Windows | ###
Nesh Configuration. Implements a basic configuration system
which can load and save state via JSON. By default this data
is stored in ~/.nesh_config.json, but a custom path can be
passed to the load and save functions.
###
fs = require 'fs'
log = require './log'
path = require 'path'
_config = {}
config = exports... | ###
Nesh Configuration. Implements a basic configuration system
which can load and save state via JSON. By default this data
is stored in ~/.nesh_config.json, but a custom path can be
passed to the load and save functions.
###
fs = require 'fs'
log = require './log'
path = require 'path'
_config = {}
config = exports... |
Remove TDS 7.1 from supported versions |
exports.versions =
'7_1': 0x71000001
'7_2': 0x72090002
'7_3_A': 0x730A0003
'7_3_B': 0x730B0003
'7_4': 0x74000004
exports.versionsByValue = {}
for name, value of exports.versions
exports.versionsByValue[value] = name
|
exports.versions =
'7_2': 0x72090002
'7_3_A': 0x730A0003
'7_3_B': 0x730B0003
'7_4': 0x74000004
exports.versionsByValue = {}
for name, value of exports.versions
exports.versionsByValue[value] = name
|
Fix typo in csv config class name | _ = require 'underscore-plus'
module.exports =
class CSVEditor
constructor: (@config={}) ->
get: (path, config) ->
if config? then @config[path]?[config] else @config[path]
set: (path, config, value) ->
@config[path] ?= {}
@config[path][config] = value
move: (oldPath, newPath) ->
@config[new... | _ = require 'underscore-plus'
module.exports =
class CSVConfig
constructor: (@config={}) ->
get: (path, config) ->
if config? then @config[path]?[config] else @config[path]
set: (path, config, value) ->
@config[path] ?= {}
@config[path][config] = value
move: (oldPath, newPath) ->
@config[new... |
Call done() in leveled async test | assert = require 'assert'
leveldb = require '../lib'
describe 'db', ->
db = new leveldb.DB
path = "#{__dirname}/../tmp/db-test-file"
key = "Hello"
value = "World"
it 'should open database', (done) ->
db.open path, { create_if_missing: true, paranoid_checks: true }, done
it 'should put key/value ... | assert = require 'assert'
leveldb = require '../lib'
describe 'db', ->
db = new leveldb.DB
path = "#{__dirname}/../tmp/db-test-file"
key = "Hello"
value = "World"
it 'should open database', (done) ->
db.open path, { create_if_missing: true, paranoid_checks: true }, done
it 'should put key/value ... |
Use a link with target=_blank for account profile | React = require 'react'
BS = require 'react-bootstrap'
Router = require 'react-router'
{CurrentUserStore} = require '../../flux/current-user'
{TransitionAssistant} = require '../unsaved-state'
module.exports = React.createClass
displayName: 'Navigation'
contextTypes:
router: React.PropTypes.func
redirectTo... | React = require 'react'
BS = require 'react-bootstrap'
{CurrentUserStore} = require '../../flux/current-user'
module.exports = React.createClass
displayName: 'Navigation'
render: ->
return null unless CurrentUserStore.getProfileUrl()
<li>
<a href={CurrentUserStore.getProfileUrl()} target='_blank'>M... |
Remove automatic Daniel Webster achievement | # Description:
# None
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot achievement get <achievement> [achiever's gravatar email] - life goals are in reach
#
# Author:
# Chris
module.exports = (robot) ->
robot.hear /achievement (get|unlock(ed)?) (.+?)(\s*[^@\s]+@[^@\s]+)?\s*$/i, (msg... | # Description:
# None
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot achievement get <achievement> [achiever's gravatar email] - life goals are in reach
#
# Author:
# Chris
module.exports = (robot) ->
robot.hear /achievement (get|unlock(ed)?) (.+?)(\s*[^@\s]+@[^@\s]+)?\s*$/i, (msg... |
Fix deleted post triggering new post notification | class TentStatus.FetchPool extends TentStatus.Paginator
constructor: (@collection, @options = {}) ->
super
@sinceId = @options.sinceId
paramsForOffsetAndLimit: (sinceId, limit) =>
params = { limit: limit }
params.since_id = sinceId if sinceId
params
fetch: (options = {}) =>
_options = {
... | class TentStatus.FetchPool extends TentStatus.Paginator
constructor: (@collection, @options = {}) ->
super
@sinceId = @options.sinceId
paramsForOffsetAndLimit: (sinceId, limit) =>
params = { limit: limit }
params.since_id = sinceId if sinceId
params
fetch: (options = {}) =>
_options = {
... |
Fix adapter code to handle unresolved services, errors | should = require 'should'
restler = require 'restler'
setup = require './setup'
describe 'with no services or routes wired up', () ->
beforeEach (done) ->
{@app, @server, @url} = setup()
done()
afterEach (done) ->
@server.close()
done()
it 'should return with a 501 status', (done) ->
req ... | should = require 'should'
restler = require 'restler'
setup = require './setup'
describe 'with no services or routes wired up', () ->
beforeEach (done) ->
{@app, @server, @url} = setup()
done()
afterEach (done) ->
@server.close()
done()
it 'should return with a 501 status', (done) ->
req ... |
Add support for ctrl key | angular.module('loomioApp').directive 'lmoHref', ($window, $router, LmoUrlService) ->
restrict: 'A'
scope:
path: '@lmoHref'
model: '=lmoHrefModel'
link: (scope, elem, attrs) ->
route = LmoUrlService.route(path: scope.path, model: scope.model, params: scope.params)
elem.attr 'href', ''
elem.bin... | angular.module('loomioApp').directive 'lmoHref', ($window, $router, LmoUrlService) ->
restrict: 'A'
scope:
path: '@lmoHref'
model: '=lmoHrefModel'
link: (scope, elem, attrs) ->
route = LmoUrlService.route(path: scope.path, model: scope.model, params: scope.params)
elem.attr 'href', ''
elem.bin... |
Adjust font size of editor | "*":
autosave:
enabled: true
core:
audioBeep: false
closeDeletedFileTabs: true
excludeVcsIgnoredPaths: false
packagesWithKeymapsDisabled: []
telemetryConsent: "limited"
themes: [
"one-light-ui"
"one-light-syntax"
]
"custom-title":
template: "<%= fileName %><% if (pr... | "*":
autosave:
enabled: true
core:
audioBeep: false
closeDeletedFileTabs: true
excludeVcsIgnoredPaths: false
packagesWithKeymapsDisabled: []
telemetryConsent: "limited"
themes: [
"one-light-ui"
"one-light-syntax"
]
"custom-title":
template: "<%= fileName %><% if (pr... |
Update preview pane url and emit location changed event. | class IDE.PreviewPane extends IDE.Pane
constructor: (options = {}, data) ->
options.cssClass = KD.utils.curry 'preview-pane', options.cssClass
options.paneType = 'preview'
super options, data
viewerOptions =
delegate : this
params :
path : @getOptions().url
de... | class IDE.PreviewPane extends IDE.Pane
constructor: (options = {}, data) ->
options.cssClass = KD.utils.curry 'preview-pane', options.cssClass
options.paneType = 'preview'
super options, data
viewerOptions =
delegate : this
params :
path : @getOptions().url
de... |
Add event parameter to popover close button click | $(document).on 'ready page:load', ->
$("a.popover").click (event) ->
event.preventDefault()
popover_src = $(this).children("img").attr("data-src")
popover_caption = $(this).children("img").attr("alt")
popover_width = $(this).children("img").attr("data-width")
popover_height = $(this).children("... | $(document).on 'ready page:load', ->
$("a.popover").click (event) ->
event.preventDefault()
popover_src = $(this).children("img").attr("data-src")
popover_caption = $(this).children("img").attr("alt")
popover_width = $(this).children("img").attr("data-width")
popover_height = $(this).children("... |
Remove console log and wrap in document start | $(".js-bucket-list").sortable({
connectWith: ".js-bucket-list"
update: (event, ui) ->
if this == ui.item.parent()[0]
window.target = $(event.target)
bucket_id = target.data("bucket-id")
position = ui.item.index()
console.log bucket_id, position
$.ajax
type: "POST"
... | $ ->
$(".js-bucket-list").sortable({
connectWith: ".js-bucket-list"
update: (event, ui) ->
if this == ui.item.parent()[0]
window.target = $(event.target)
bucket_id = target.data("bucket-id")
position = ui.item.index()
$.ajax
type: "POST"
url: ui.i... |
Fix follow on show page | CurrentUser = require '../../../../models/current_user.coffee'
{ Following, FollowButton } = require '../../../../components/follow_button/index.coffee'
module.exports = (artists) ->
user = CurrentUser.orNull()
following = new Following if user
ids = artists.map (artist) ->
$el = $(".artist-follow[data-id='... | Backbone = require 'backbone'
CurrentUser = require '../../../../models/current_user.coffee'
{ Following, FollowButton } = require '../../../../components/follow_button/index.coffee'
module.exports = (artists) ->
user = CurrentUser.orNull()
following = new Following if user
ids = artists.map (artist) ->
$el... |
Order matters on arrays, unfortunately | describe 'acceptance', ->
Given -> @subject = require '../lib/kindly'
context 'sync', ->
When -> @files = @subject.get('test/fixtures')
Then -> expect(@files).to.deep.equal
files: [ 'test/fixtures/baz.quux' , 'test/fixtures/foo.bar']
directories: []
other: []
context 'async', ->
Wh... | describe 'acceptance', ->
Given -> @subject = require '../lib/kindly'
context 'sync', ->
When -> @descriptors = @subject.get('test/fixtures')
Then -> expect(@descriptors.files).to.contain 'test/fixtures/baz.quux'
And -> expect(@descriptors.files).to.contain 'test/fixtures/foo.bar'
context 'async', -... |
Make /try hit the new endpoint. | runEvaluation = ->
$('#result').text("Loading...")
$.ajax {
"url": "/jsontest",
"type": "POST",
"data": JSON.stringify({
"language": $('#eval-language').val(),
"code": $('textarea').val()
}),
"dataType": "json",
"contentType": "application/json; charset=utf-8",
"success": (da... | runEvaluation = ->
$('#result').text("Loading...")
$.ajax {
"url": "/api/evaluate",
"type": "POST",
"data": JSON.stringify({
"language": $('#eval-language').val(),
"code": $('textarea').val()
}),
"dataType": "json",
"contentType": "application/json; charset=utf-8",
"success":... |
Implement decorator pattern for student dashboard. | #= require almond
window.ttm ||= {}
ttm.ClassMixer = (klass)->
klass.build = ->
it = new klass
it.initialize && it.initialize.apply(it, arguments)
it
klass.prototype.klass = klass
klass
define "lib/class_mixer", ->
return ttm.ClassMixer
| #= require almond
window.ttm ||= {}
window.decorators ||= {}
ttm.ClassMixer = (klass)->
klass.build = ->
it = new klass
it.initialize && it.initialize.apply(it, arguments)
it
klass.prototype.klass = klass
klass
define "lib/class_mixer", ->
return ttm.ClassMixer
|
Add points command to command list. | # A collection of common, simple text response
# commands that don’t require data from elsewhere
#
# Command(s):
# hubot schedule — Return the current stream schedule
# hubot social — Links to Twitter and Facebook
# hubot commands - Shows a current list of commands
# hubot bot - A quick bot a... | # A collection of common, simple text response
# commands that don’t require data from elsewhere
#
# Command(s):
# hubot schedule — Return the current stream schedule
# hubot social — Links to Twitter and Facebook
# hubot commands - Shows a current list of commands
# hubot bot - A quick bot a... |
Add helper method to goto a course by name | selenium = require 'selenium-webdriver'
{TestHelper} = require './test-element'
COMMON_ELEMENTS =
courseLink: (appearance, isCoach = false) ->
dataAttr = 'data-appearance'
if appearance?
dataAttr += "='#{appearance}'"
if isCoach
teacherLink = "[#{dataAttr}] > [href*='cc-dashboard']"
... | selenium = require 'selenium-webdriver'
{TestHelper} = require './test-element'
COMMON_ELEMENTS =
courseLink: (appearance, isCoach = false) ->
dataAttr = 'data-appearance'
if appearance?
dataAttr += "='#{appearance}'"
if isCoach
teacherLink = "[#{dataAttr}] > [href*='cc-dashboard']"
... |
Use request helper in ThemeConverter class | 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'
fs = require './fs'
request = require './request'
TextMateTheme = require './text-mate-theme'
# Convert a TextMate theme to an Atom theme
module.exports =
class ThemeConverter
constructor: (@sourcePath, destinationPath) ->
@destinationPath = path.resolve(destinationPath)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.