Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Add context menu to staging view with "Open File" | 'menu': [
{
'label': 'View'
'submenu': [
{
'label': 'Toggle Git Panel'
'command': 'github:toggle-git-panel'
}
]
}
{
'label': 'Packages'
'submenu': [
{
'label': 'GitHub',
'submenu': [
{
'label': 'Toggle'
'comman... | 'menu': [
{
'label': 'View'
'submenu': [
{
'label': 'Toggle Git Panel'
'command': 'github:toggle-git-panel'
}
]
}
{
'label': 'Packages'
'submenu': [
{
'label': 'GitHub',
'submenu': [
{
'label': 'Toggle'
'comman... |
Make sure we start from the actual @model passed in to the KeypathObserver. | class KeypathObserver
constructor: (@view, @model, @keypath, @callback) ->
@interfaces = (k for k, v of @view.adapters)
@objectPath = []
@tokens = Rivets.KeypathParser.parse @keypath, @interfaces, @view.config.rootInterface
@root = @tokens.shift()
@key = @tokens.pop()
@target = @realize()
u... | class KeypathObserver
constructor: (@view, @model, @keypath, @callback) ->
@interfaces = (k for k, v of @view.adapters)
@objectPath = []
@tokens = Rivets.KeypathParser.parse @keypath, @interfaces, @view.config.rootInterface
@root = @tokens.shift()
@key = @tokens.pop()
@target = @realize()
u... |
Remove unnecessary debug messages, and add TODO messages | path = require "path"
runas = require "runas"
module.exports =
activate: ->
atom.workspaceView.command "latex:build", => @build()
build: ->
editor = atom.workspace.activePaneItem
# console.debug editor
file = editor.buffer.file
# console.debug file
if file?
# file = editor.getUri()... | path = require "path"
runas = require "runas"
module.exports =
activate: ->
atom.workspaceView.command "latex:build", => @build()
build: ->
editor = atom.workspace.activePaneItem
file = editor.buffer.file
if file?
dir = path.dirname(file.path)
outdir = path.join(dir, "output") # TODO:... |
Change to dark atom theme | "*":
core:
disabledPackages: [
"background-tips"
"exception-reporting"
"metrics"
]
followSymlinks: false
hideGitIgnoredFiles: true
ignoredNames: [
".bundle"
".git"
"log"
"repositories"
"tmp"
"vendor"
]
themes: [
"unity-ui"
"... | "*":
core:
disabledPackages: [
"background-tips"
"exception-reporting"
"metrics"
]
followSymlinks: false
hideGitIgnoredFiles: true
ignoredNames: [
".bundle"
".git"
"log"
"repositories"
"tmp"
"vendor"
]
themes: [
"atom-dark-ui"
... |
Make sure main file is built first. | module.exports = (grunt) ->
files = [
'src/*.coffee'
]
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
watch:
coffee:
files: files
tasks: ['default']
coffee:
build:
options:
join: true
files:
'tweenmachine.js': files
... | module.exports = (grunt) ->
files = [
'src/tweenmachine.coffee'
'src/*.coffee'
]
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
watch:
coffee:
files: files
tasks: ['default']
coffee:
build:
options:
join: true
files:
... |
Put bower grunt task first | module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
coffee:
compile:
files:
'select.js': 'select.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:
'select.js': 'select.coffee'
'docs/welcome/js/welcome.js': 'docs/welcome/coffee/welcome.coffee'
watch:
coffee:
files: ['*.coffee', 'sass/*', 'docs/... |
Fix error handling in pick. | {APLArray} = require '../array'
@['β'] = (omega, alpha) ->
if alpha
# Pick (`β`)
#
# β¬β3 <=> 3
# 2β'PICK' <=> 'C'
# 1 0β2 2β΄'ABCD' <=> 'C'
# 1β'foo' 'bar' <=> 'bar'
if alpha.shape.length > 1
throw RankError
pick = alpha.toArray()
if pick.length isnt omega.... | {APLArray} = require '../array'
{RankError, IndexError} = require '../errors'
@['β'] = (omega, alpha) ->
if alpha
# Pick (`β`)
#
# β¬β3 <=> 3
# 2β'PICK' <=> 'C'
# 1 0β2 2β΄'ABCD' <=> 'C'
# 1β'foo' 'bar' <=> 'bar'
# (2 2β΄0)β1 2 !!! RANK ERROR
# (2 2)β1 2 !!! RA... |
Add Monday as first day of the week | $(document).on "turbolinks:load", ->
$('div.calendar').calendar()
$('.calendar_range_start').calendar
endCalendar: $('.calendar_range_end'),
type: 'date'
$('.calendar_range_end').calendar
startCalendar: $('.calendar_range_start'),
type: 'date'
$('.ui.accordion').accordion()
$('.ui.dropdown')... | $(document).on "turbolinks:load", ->
$('div.calendar').calendar
firstDayOfWeek: 1
$('.calendar_range_start').calendar
endCalendar: $('.calendar_range_end'),
type: 'date',
firstDayOfWeek: 1
$('.calendar_range_end').calendar
startCalendar: $('.calendar_range_start'),
type: 'date',
firs... |
Stop loading when modal opened | FactlinkJailRoot.createFactFromSelection = (current_user_opinion) ->
success = ->
window.document.getSelection().removeAllRanges()
FactlinkJailRoot.createButton.hide()
FactlinkJailRoot.off 'modalOpened', success
selInfo =
text: window.document.getSelection().toString()
title: window.document.ti... | FactlinkJailRoot.createFactFromSelection = (current_user_opinion) ->
success = ->
window.document.getSelection().removeAllRanges()
FactlinkJailRoot.createButton.stopLoading()
FactlinkJailRoot.createButton.hide()
FactlinkJailRoot.off 'modalOpened', success
selInfo =
text: window.document.getSele... |
Index of an enumerable starts at 0 for JS. | Sprangular.directive 'creditCardForm', ->
restrict: 'E'
templateUrl: 'credit_cards/form.html'
scope:
creditCard: '='
controller: ($scope, $locale) ->
$scope.months = _.map $locale.DATETIME_FORMATS.MONTH, (month, index) ->
{"index": index, "name": month}
currentYear = (new Date).getFullYear()
... | Sprangular.directive 'creditCardForm', ->
restrict: 'E'
templateUrl: 'credit_cards/form.html'
scope:
creditCard: '='
controller: ($scope, $locale) ->
$scope.months = _.map $locale.DATETIME_FORMATS.MONTH, (month, index) ->
{"index": index + 1, "name": month}
currentYear = (new Date).getFullYea... |
Include hidden files when running nak | _ = require 'underscore'
BufferedProcess = require 'buffered-process'
module.exports =
class LoadPathsTask
constructor: (@callback) ->
start: ->
rootPath = project.getPath()
ignoredNames = config.get('fuzzyFinder.ignoredNames') ? []
ignoredNames = ignoredNames.concat(config.get('core.ignoredNames') ? ... | _ = require 'underscore'
BufferedProcess = require 'buffered-process'
module.exports =
class LoadPathsTask
constructor: (@callback) ->
start: ->
rootPath = project.getPath()
ignoredNames = config.get('fuzzyFinder.ignoredNames') ? []
ignoredNames = ignoredNames.concat(config.get('core.ignoredNames') ? ... |
Use URL from the variable | noflo = require 'noflo'
uuid = require 'uuid'
iframeAddress = 'https://noflojs.org/noflo-browser/everything.html?fbp_noload=true&fbp_protocol=iframe'
ensureOneIframeRuntime = (runtimes) ->
for runtime in runtimes
# Check that we don't have the iframe runtime already
if runtime.protocol is 'iframe' and runti... | noflo = require 'noflo'
uuid = require 'uuid'
iframeAddress = 'https://noflojs.org/noflo-browser/everything.html?fbp_noload=true&fbp_protocol=iframe'
ensureOneIframeRuntime = (runtimes) ->
for runtime in runtimes
# Check that we don't have the iframe runtime already
if runtime.protocol is 'iframe' and runti... |
Add more tests to Canadian phones | expect = require('chai').expect
Phone = require('../../src/script/Phone')
canada = require('../../src/script/countries/CAN')
describe 'Canada', ->
describe 'Should get', ->
number = ''
afterEach ->
# Act
result = Phone.getPhoneInternational(number)
# Assert
expect(result.valid).to.be.true
expe... | expect = require('chai').expect
Phone = require('../../src/script/Phone')
canada = require('../../src/script/countries/CAN')
describe 'Canada', ->
describe 'Should get', ->
number = ''
it 'a number', ->
# Arrange
number = "+1 204 9898656"
# Act
result = Phone.getPhoneInternational(number)
# A... |
Remove JS-applied help block CSS | # Selects all options of a multi-select box belonging to a optgroup, when
# clicking on the optgroup label.
init_group_selectable = (select) ->
chosen = select.next()
chosen.on 'click', '.group-result', (e) ->
target = $(e.target)
group_name = target.text()
options = select.find('optgroup[label="' + gro... | # Selects all options of a multi-select box belonging to a optgroup, when
# clicking on the optgroup label.
init_group_selectable = (select) ->
chosen = select.next()
chosen.on 'click', '.group-result', (e) ->
target = $(e.target)
group_name = target.text()
options = select.find('optgroup[label="' + gro... |
Use collection get now that the backend supports it | React = require 'react'
talkClient = require '../api/talk'
apiClient = require '../api/client'
Paginator = require '../talk/lib/paginator'
SubjectViewer = require '../components/subject-viewer'
PromiseRenderer = require '../components/promise-renderer'
{Navigation} = require 'react-router'
module?.exports = React.crea... | React = require 'react'
talkClient = require '../api/talk'
apiClient = require '../api/client'
Paginator = require '../talk/lib/paginator'
SubjectViewer = require '../components/subject-viewer'
PromiseRenderer = require '../components/promise-renderer'
{Navigation} = require 'react-router'
module?.exports = React.crea... |
Call atom.show() in spec bootstrap | require 'atom'
{runSpecSuite} = require 'jasmine-helper'
document.title = "Spec Suite"
runSpecSuite "spec-suite"
| require 'atom'
atom.show()
{runSpecSuite} = require 'jasmine-helper'
document.title = "Spec Suite"
runSpecSuite "spec-suite"
|
Fix i18n and Google API credentials | class Recipes.ListenToYourHeart extends Recipes.Bitly
generateSteps: ->
position = 1
@generateStep(
key: "GoogleChooseAvatar"
,
$setOnInsert:
cls: "GoogleChooseAvatar"
api: "Google"
scopes: ["https://www.googleapis.com/auth/drive", "https://spreadsheets.google.com/feed... | class Recipes.ListenToYourHeart extends Recipes.Bitly
generateSteps: ->
position = 1
@generateStep(
key: "GoogleChooseAvatar"
,
$setOnInsert:
cls: "GoogleChooseAvatar"
api: "Google"
scopes: ["https://www.googleapis.com/auth/drive", "https://spreadsheets.google.com/feed... |
Convert model in templatehelper to json earlier for better performance | define (require) ->
$ = require('jquery')
BaseView = require('cs!helpers/backbone/views/base')
BookPopoverView = require('cs!./popovers/book/book')
template = require('hbs!./header-template')
require('less!./header')
return class MediaHeaderView extends BaseView
template: template
templateHelpers: ... | define (require) ->
$ = require('jquery')
BaseView = require('cs!helpers/backbone/views/base')
BookPopoverView = require('cs!./popovers/book/book')
template = require('hbs!./header-template')
require('less!./header')
return class MediaHeaderView extends BaseView
template: template
templateHelpers: ... |
Add examples for dummy project | all = require('../../src')
tasks = {
clean: () ->
all.task.clean()
build: () ->
all.task.library({
library: {
isPlugin: true
dependencies: [
{
param: 'ko'
name: 'knockout'
}
{
param: 'isAn'
name: 'is-an'
... | all = require('../../src')
tasks = {
clean: () ->
all.task.clean()
build: () ->
all.task.library({
library: {
isPlugin: true
dependencies: [
{
param: 'ko'
name: 'knockout'
}
{
param: 'isAn'
name: 'is-an'
... |
Set FR and EN to default languages | "title": "Your Blog title"
"api":
"baseUrl": "http://dev.julienrenaux.fr/wp-json"
"timeout": 10000
"maxAttempt": 3
"translation":
# "displayed" : ["en", "fr"]
# "prefered": "en"
"cordova":
"pushNotifications":
"enabled": false
"baseUrl": "http://yourDomain.com/pnfw"
"a... | "title": "Your Blog title"
"api":
"baseUrl": "http://dev.julienrenaux.fr/wp-json"
"timeout": 10000
"maxAttempt": 3
"translation":
"displayed" : ["en", "fr"]
"prefered": "en"
"cordova":
"pushNotifications":
"enabled": false
"baseUrl": "http://yourDomain.com/pnfw"
"andro... |
Enable middleware for catching validation errors | config = require './config'
module.exports = (app, passport) ->
isLoggedIn = app.middlewares.auth.isLoggedIn
isNotLoggedIn = app.middlewares.auth.isNotLoggedIn
setLocals = app.middlewares.auth.setLocals
errorHandlers = app.middlewares.error
app.get '/login', isNotLoggedIn, app.controllers.sessions.new
app... | config = require './config'
module.exports = (app, passport) ->
isLoggedIn = app.middlewares.auth.isLoggedIn
isNotLoggedIn = app.middlewares.auth.isNotLoggedIn
setLocals = app.middlewares.auth.setLocals
errorHandlers = app.middlewares.error
app.get '/login', isNotLoggedIn, app.controllers.sessions.new
app... |
Fix deleting old temp files. | {File} = require 'file-utils'
class LocaleTempFileRepository
items : null
constructor : (@items = []) ->
setInterval (=> @gc()), 60000
gc : ->
console.log 'LocaleTempFileRepository.gc'
now = new Date()
validUntil = now - 60
for id, item in @items when item.created < validUntil
consol... | {File} = require 'file-utils'
fs = require 'fs'
class LocaleTempFileRepository
items : null
constructor : (@items = {}) ->
setInterval (=> @gc()), 60000
gc : ->
console.log 'LocaleTempFileRepository.gc'
now = new Date()
validUntil = now - 60
for id, item of @items #when item.created < vali... |
Add manage projects controller tests | define [
'chai'
'underscore'
'controllers'
], (chai, _, controllers) ->
chai.should()
describe 'Index controller', =>
it 'should set not authentication status', =>
scope = {}
window.isAuthenticated = false
controllers.IndexCtrl scope
scope.isAu... | define [
'chai'
'underscore'
'controllers'
], (chai, _, controllers) ->
chai.should()
describe 'Index controller', =>
it 'should set not authentication status', =>
scope = {}
window.isAuthenticated = false
controllers.IndexCtrl scope
scope.isAu... |
Fix indexing of repo names | module.exports =
_id: '_design/repos'
languange: 'javascript'
views:
by_watchers:
map: (doc) -> emit doc.watchers, doc.description if doc.watchers
by_language:
map: (doc) -> emit doc.languange, doc.description if doc.languange
by_prefix:
map: (doc) ->
return unless doc.type ... | module.exports =
_id: '_design/repos'
languange: 'javascript'
views:
by_watchers:
map: (doc) -> emit doc.watchers, doc.description if doc.watchers
by_language:
map: (doc) -> emit doc.languange, doc.description if doc.languange
by_prefix:
map: (doc) ->
return unless doc.type ... |
Add task to refresh status of repository | fs = require 'fs'
_ = require 'underscore'
module.exports =
loadPaths: (rootPath, ignoredNames, excludeGitIgnoredPaths) ->
if excludeGitIgnoredPaths
Git = require 'git'
repo = Git.open(rootPath, refreshIndexOnFocus: 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('/'... |
Put marker on node nearest to click event | require('./styles/index.scss')
require('leaflet/dist/leaflet.css')
require('leaflet')
document.addEventListener('DOMContentLoaded', ->
map = L.map('map').setView([25.1701, 121.5948], 13)
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png',
attribution: '© <a href="http://osm.org/copyright">OpenStreetM... | require('./styles/index.scss')
require('leaflet/dist/leaflet.css')
require('leaflet')
findClosestTo = (origin, parsed) ->
minDistance = 1000
found = null
for element in parsed.elements
elemLatLng = new L.LatLng(element.lat, element.lon)
if origin.distanceTo(elemLatLng) < minDistance
found = elemLa... |
Fix hashbang that got macro-bliterated | !/usr/bin/env coffee
exports.command =
description: 'Build a tangle app'
if require.main is module
path = require 'path'
grunt = require 'grunt'
grunt.cli
gruntfile: path.join(__dirname, '..', 'subcommands', 'build', 'index.coffee')
base: process.cwd()
| #!/usr/bin/env coffee
exports.command =
description: 'Build a tangle app'
if require.main is module
path = require 'path'
grunt = require 'grunt'
grunt.cli
gruntfile: path.join(__dirname, '..', 'subcommands', 'build', 'index.coffee')
base: process.cwd()
|
Fix up press legacy routes | express = require 'express'
app = module.exports = express()
to = require './to'
app.get '/filter/artworks', to '/browse'
app.get '/filter/artworks/*', to '/browse'
app.get '/genes', to '/categories'
app.get '/partner-application', to '/apply'
app.get '/fair-application', to '/apply/fair'
app.get '/fairs', to 'art-fai... | express = require 'express'
app = module.exports = express()
to = require './to'
app.get '/filter/artworks', to '/browse'
app.get '/filter/artworks/*', to '/browse'
app.get '/genes', to '/categories'
app.get '/partner-application', to '/apply'
app.get '/fair-application', to '/apply/fair'
app.get '/fairs', to 'art-fai... |
Clear the chat box immediately upon submitting a new message | Chamber.Views.Rooms ||= {}
class Chamber.Views.Rooms.ShowView extends Backbone.View
template: JST["backbone/templates/rooms/show"]
events: {
"click input[type=submit]": "doSubmit",
}
initialize: ->
@messages_index_view = new Chamber.Views.Messages.IndexView(
{
el: $("#messages", @el... | Chamber.Views.Rooms ||= {}
class Chamber.Views.Rooms.ShowView extends Backbone.View
template: JST["backbone/templates/rooms/show"]
events: {
"click input[type=submit]": "doSubmit",
}
initialize: ->
@messages_index_view = new Chamber.Views.Messages.IndexView(
{
el: $("#messages", @el... |
Fix window unload event binding | window.InteractionWebTools ||= {}
window.InteractionWebTools.Chat ||= {}
jQuery ->
@chatClient = new InteractionWebTools.Chat.Client
InteractionWebTools.Chat.instance = @chatClient
$(document).on 'click', '.chat > .controls > a.open', =>
@chatClient.open()
false
$(document).on 'click', '.chat > .cont... | window.InteractionWebTools ||= {}
window.InteractionWebTools.Chat ||= {}
jQuery ->
@chatClient = new InteractionWebTools.Chat.Client
InteractionWebTools.Chat.instance = @chatClient
$(document).on 'click', '.chat > .controls > a.open', =>
@chatClient.open()
false
$(document).on 'click', '.chat > .cont... |
Change default port to 3034 | http = require('http')
http.globalAgent.maxSockets = 300
module.exports =
internal:
packageindexer:
port: 3022
host: "localhost"
mongo:
url: 'mongodb://127.0.0.1/sharelatex'
| http = require('http')
http.globalAgent.maxSockets = 300
module.exports =
internal:
packageindexer:
port: 3034
host: "localhost"
mongo:
url: 'mongodb://127.0.0.1/sharelatex'
|
Remove unused inclusion of $window in OffcanvasCtrl | Darkswarm.controller "OffcanvasCtrl", ($scope, $window) ->
$scope.menu = $(".left-off-canvas-menu")
$scope.setOffcanvasMenuHeight = ->
$scope.menu.height($(window).height())
$scope.bind = ->
$(window).on("resize", $scope.setOffcanvasMenuHeight)
$scope.setOffcanvasMenuHeight()
$scope.bind()
| Darkswarm.controller "OffcanvasCtrl", ($scope) ->
$scope.menu = $(".left-off-canvas-menu")
$scope.setOffcanvasMenuHeight = ->
$scope.menu.height($(window).height())
$scope.bind = ->
$(window).on("resize", $scope.setOffcanvasMenuHeight)
$scope.setOffcanvasMenuHeight()
$scope.bind()
|
Add some sweet spec helpers | require '../src/ext/svg-circle'
require '../src/ext/svg-draggable'
require '../src/ext/svg-export'
beforeEach ->
jasmine.addMatchers
toShow: ->
compare: (actual) ->
{passed: actual.css('display') != 'none'}
toHide: ->
compare: (actual) ->
{passed: actual.css('display') != 'none'}... | require '../src/ext/svg-circle'
require '../src/ext/svg-draggable'
require '../src/ext/svg-export'
util = require 'util'
beforeEach ->
jasmine.addMatchers
toShow: ->
compare: (actual) ->
pass = getComputedStyle(actual)['display'] isnt 'none'
{pass}
toHide: ->
compare: (actual) -... |
Add type:pr to restrict search results to only pull requests | _ = require "underscore"
moment = require "moment"
Octokat = require "octokat"
Config = require "../config"
PullRequest = require "./pullrequest"
Utils = require "../utils"
octo = new Octokat token: Config.github.token
class PullRequests
constructor: (prs) ->
@prs = (new PullRequest p for p in prs)
@fromKey... | _ = require "underscore"
moment = require "moment"
Octokat = require "octokat"
Config = require "../config"
PullRequest = require "./pullrequest"
Utils = require "../utils"
octo = new Octokat token: Config.github.token
class PullRequests
constructor: (prs) ->
@prs = (new PullRequest p for p in prs)
@fromKey... |
Use performance.now when available. Fall back to Date.now if needed. | hrtime = process.hrtime
module.exports = -> (getNanoSeconds() - loadTime) / 1e6
getNanoSeconds = ->
hr = hrtime()
hr[0] * 1e9 + hr[1]
loadTime = getNanoSeconds() | if performance? and performance.now
module.exports = -> performance.now()
else if process? and process.hrtime
module.exports = -> (getNanoSeconds() - loadTime) / 1e6
hrtime = process.hrtime
getNanoSeconds = ->
hr = hrtime()
hr[0] * 1e9 + hr[1]
loadTime = getNanoSeconds()
else
module.exports = -> Dat... |
Use the file path from jolie --check | helpers = require 'atom-linter'
{ BufferedProcess } = require 'atom'
executablePath = "jolie"
pattern = ".+:\\s*(?<file>[^:]+):\\s*(?<line>\\d+):\\s*(?<type>error|warning)\\s*:(?<message>.+)"
module.exports =
config: {}
activate: ->
require( "atom-package-deps" ).install( "linter-jolie" );
provideLinter: ... | helpers = require 'atom-linter'
{ BufferedProcess } = require 'atom'
executablePath = "jolie"
pattern = ".+:\\s*(?<file>[^:]+):\\s*(?<line>\\d+):\\s*(?<type>error|warning)\\s*:(?<message>.+)"
module.exports =
config: {}
activate: ->
require( "atom-package-deps" ).install( "linter-jolie" );
provideLinter: ... |
Switch to standard stream patterns | es = require 'event-stream'
glob = require 'glob'
module.exports =
create: (globb, opt={}) ->
throw new Error "Invalid or missing glob string" unless typeof globb is 'string'
opt.silent ?= true
opt.nonull ?= false
stream = es.pause()
globber = new glob.Glob globb, opt
globber.on 'erro... | es = require 'event-stream'
glob = require 'glob'
module.exports =
create: (globb, opt={}) ->
throw new Error "Invalid or missing glob string" unless typeof globb is 'string'
opt.silent ?= true
opt.nonull ?= false
stream = es.pause()
globber = new glob.Glob globb, opt
globber.on 'erro... |
Add event handling, prevent default behaviour of anchor tags | window.App.pendingUploads = 0;
window.App.successfulUploads = [];
$ ->
fetch_tree_for_path = (url) ->
alert("Fetching!")
success = (data) -> $("#tree-view").html(data)
$.get url, null, success, 'html'
$("#tree-view").on("click",
"#tree-view td.node a",
() -> fetch_tree_for_path($(this).dat... | window.App.pendingUploads = 0;
window.App.successfulUploads = [];
$ ->
# Fetches the tree for the given url and places it in the treeview
fetch_tree_for_path = (url) ->
internal_fetch = (url) ->
$("#tree-view").html("Loading...")
success = (data) -> $("#tree-view").html(data)
$.get url, ... |
Use paddingTop/Left, as this also works in firefox | FactlinkJailRoot.contentBox = (element) ->
$element = $(element)
offset = $element.offset()
top: offset.top + parseInt window.getComputedStyle(element)['padding-top']
left: offset.left + parseInt window.getComputedStyle(element)['padding-left']
width: $element.width()
height: $element.height()
| FactlinkJailRoot.contentBox = (element) ->
$element = $(element)
offset = $element.offset()
top: offset.top + parseInt window.getComputedStyle(element).paddingTop
left: offset.left + parseInt window.getComputedStyle(element).paddingLeft
width: $element.width()
height: $element.height()
|
Join github and atom dirs | fs = require 'fs'
path = require 'path'
delegate = require 'atom_delegate'
optimist = require 'optimist'
coffeeScript = require 'coffee-script'
atomApplication = null
delegate.browserMainParts.preMainMessageLoopRun = ->
commandLineArgs = parseCommandLine()
require('module').globalPaths.push(path.join(commandLineA... | fs = require 'fs'
path = require 'path'
delegate = require 'atom_delegate'
optimist = require 'optimist'
coffeeScript = require 'coffee-script'
atomApplication = null
delegate.browserMainParts.preMainMessageLoopRun = ->
commandLineArgs = parseCommandLine()
require('module').globalPaths.push(path.join(commandLineA... |
Add the proper return value for cancel | getQueryParam = (variable, defaultValue) ->
query = location.search.substring(1)
vars = query.split('&')
for v in vars
pair = v.split('=')
if pair[0] == variable
return decodeURIComponent(pair[1])
return defaultValue or false
getConfigData = () ->
options = {
forecastAPIKey: $('#forecast... | getQueryParam = (variable, defaultValue) ->
query = location.search.substring(1)
vars = query.split('&')
for v in vars
pair = v.split('=')
if pair[0] == variable
return decodeURIComponent(pair[1])
return defaultValue or false
getConfigData = () ->
options = {
forecastAPIKey: $('#forecast... |
Fix evaluating args with scheduler | V = Visualizer
N = V.ReactNodes
rootEvaluators = R.mapObjIndexed( ({useScheduler, getDefaultArgs}, key) ->
(input) ->
R.always(
"Rx.Observable.#{key}(" +
(if getDefaultArgs then input else '') +
(if useScheduler then (if getDefaultArgs then ', scheduler)' else 'scheduler)') else ')')
)
... | V = Visualizer
N = V.ReactNodes
getArgsWithScheduler = ({input, getDefaultArgs, useScheduler}) ->
if getDefaultArgs && useScheduler
"#{input}, scheduler"
else if useScheduler
"scheduler"
else if getDefaultArgs
input
else
""
rootEvaluators = R.mapObjIndexed( ({useScheduler, getDefaultArgs}, key... |
Move overlay to left of the marker | {Range} = require 'atom'
BubbleView = require './bubble-view'
class Bubble
constructor: (@linter) ->
@bubble = null
update: (point) ->
@remove()
return unless @linter.view.messages.length
textEditor = @linter.activeEditor
found = false
@linter.view.messages.forEach (message) =>
retur... | {Range} = require 'atom'
BubbleView = require './bubble-view'
class Bubble
constructor: (@linter) ->
@bubble = null
update: (point) ->
@remove()
return unless @linter.view.messages.length
textEditor = @linter.activeEditor
found = false
@linter.view.messages.forEach (message) =>
retur... |
Remove defaults; add an Array of valid hash fields as a hack around a broken API | _ = require 'underscore'
Q = require 'q'
Backbone = require 'backbone'
{ SESSION_ID, API_URL } = require('sharify').data
Relations = require './mixins/relations/collector_profile.coffee'
module.exports = class CollectorProfile extends Backbone.Model
_.extend @prototype, Relations
url: "#{API_URL}/api/v1/me/collec... | _ = require 'underscore'
Q = require 'q'
Backbone = require 'backbone'
{ SESSION_ID, API_URL } = require('sharify').data
Relations = require './mixins/relations/collector_profile.coffee'
module.exports = class CollectorProfile extends Backbone.Model
_.extend @prototype, Relations
url: "#{API_URL}/api/v1/me/collec... |
Update import after moving file | `import startApp from '../helpers/start-app';`
acceptance = (suiteName) ->
App = null
suite "Acceptance: #{suiteName}",
setup: -> App = startApp()
teardown: -> Ember.run(App, 'destroy')
`export default acceptance;`
| `import startApp from './start-app';`
acceptance = (suiteName) ->
App = null
suite "Acceptance: #{suiteName}",
setup: -> App = startApp()
teardown: -> Ember.run(App, 'destroy')
`export default acceptance;`
|
Disable source urls since they break handlebars atm | exports.config =
# See http://brunch.io/#documentation for docs.
files:
javascripts:
joinTo:
'javascripts/app.js': /^app/
'javascripts/vendor.js': /^vendor/
'test/javascripts/test.js': /^test[\\/](?!vendor)/
'test/javascripts/test-vendor.js': /^test[\\/](?=vendor)/
or... | exports.config =
# See http://brunch.io/#documentation for docs.
files:
javascripts:
joinTo:
'javascripts/app.js': /^app/
'javascripts/vendor.js': /^vendor/
'test/javascripts/test.js': /^test[\\/](?!vendor)/
'test/javascripts/test-vendor.js': /^test[\\/](?=vendor)/
or... |
Attach a Zoom modal for carousel images | { SHOW, ARTWORKS } = require('sharify').data
PartnerShow = require '../../../models/partner_show.coffee'
ShareView = require '../../../components/share/view.coffee'
initCarousel = require '../../../components/merry_go_round/index.coffee'
ArtworkColumnsView = require '../../../components/artwork_columns/view.coffee'
att... | _ = require 'underscore'
{ SHOW, ARTWORKS } = require('sharify').data
PartnerShow = require '../../../models/partner_show.coffee'
ShareView = require '../../../components/share/view.coffee'
initCarousel = require '../../../components/merry_go_round/index.coffee'
ArtworkColumnsView = require '../../../components/artwork... |
Add tests for trailingSlash - first problem, wrong scope for tests | j = @jasmine.getEnv()
j.describe "circle test suite", ->
j.it 'should increment a variable', ->
@expect(1).toEqual 1
| j = @jasmine.getEnv()
j.describe "trailingSlash", ->
j.it 'should remove trailing slashes', ->
@expect(stripTrailingSlash('/gh/a/b/')).toEqual '/gh/a/b'
j.it 'shouldnt remove non-trailing slashes', ->
@expect(stripTrailingSlash('/gh/a/b/edit')).toEqual '/gh/a/b/edit'
j.it 'shouldnt delete root variable... |
Add support for build config functions | path = require 'path'
require 'LiveScript'
module.exports = (grunt) ->
gruntConfig =
pkg: grunt.file.readJSON 'package.json'
grunt.file.expand(
{filter: 'isFile'},
['./grunt/config/**', './grunt/userconfig/**']
).forEach (filename) ->
key = path.basename filename, '.ls'
gruntConfig[key] = re... | path = require 'path'
require 'LiveScript'
module.exports = (grunt) ->
# Initialize the config with the only thing we know.
grunt.config.init
pkg: grunt.file.readJSON 'package.json'
# Assume all files under `grunt/config` and `grunt/userconfig`
# are config files.
grunt.file.expand(
{filter: 'isFile... |
Put bower grunt task first | module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
coffee:
compile:
files:
'select.js': 'select.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:
'select.js': 'select.coffee'
'docs/welcome/js/welcome.js': 'docs/welcome/coffee/welcome.coffee'
watch:
coffee:
files: ['*.coffee', 'sass/*', 'docs/... |
Update range selector on charts | class Workbench.Views.DatastreamChartView extends Backbone.View
initialize: ->
render: ->
@chart = @$el.GeocensChart
datastream: @model
this
| class Workbench.Views.DatastreamChartView extends Backbone.View
initialize: ->
render: ->
@chart = @$el.GeocensChart
datastream: @model
chart:
rangeSelector:
selected: 4
buttons: [{
type: 'minute'
count: 120
text: "2... |
Fix "unequal nodes with the same `data-reactid`:" errors in console. | {div, img} = React.DOM
module.exports = React.createClass
displayName: 'ProtoNode'
componentDidMount: ->
$(@refs.node.getDOMNode()).draggable
drag: @doMove
revert: true
helper: 'clone'
revertDuration: 0
opacity: 0.35
appendTo: 'body'
zIndex: 1000
doMove: -> undefi... | {div, img} = React.DOM
module.exports = React.createClass
displayName: 'ProtoNode'
componentDidMount: ->
reactSafeClone = (e) ->
clone = $(@).clone(false)
clone.attr('data-reactid', null)
clone.find("*").each (i,v) ->
$(v).attr('data-reactid', null)
clone
$(@refs.node.getD... |
Add confirm for server shutdown | Template.admin.servers = ->
servers.find()
Template.admin.events
"click .servt tr": ->
Router.go Router.routes["adminServer"].path {id: @_id}
Template.adminServer.events
"click .sdBtn": ->
id = @_id
console.log "Requesting host shutdown for "+id
Meteor.call "shutdownHost", id, (err, res)->
i... | Template.admin.servers = ->
servers.find()
Template.admin.events
"click .servt tr": ->
Router.go Router.routes["adminServer"].path {id: @_id}
Template.adminServer.events
"click .sdBtn": ->
id = @_id
if !confirm 'Are you sure you want to shut down '+@ip+"?"
return
console.log "Requesting host... |
Change interferring keybindings when toggeling | '.editor':
'ctrl-j': 'symbols-view:toggle-file-symbols'
'meta-.': 'symbols-view:go-to-declaration'
'body':
'ctrl-J': 'symbols-view:toggle-project-symbols'
| '.editor':
'meta-r': 'symbols-view:toggle-file-symbols'
'meta-.': 'symbols-view:go-to-declaration'
'body':
'meta-R': 'symbols-view:toggle-project-symbols'
|
Check for rendered HTML before rendering in client | editor = new Voltage.Editor
Deps.autorun ->
if Meteor.user()
Meteor.call 'isVoltageAuthorized', (err, authorized) ->
Session.set 'isVoltageAuthorized', authorized
else
Session.set 'isVoltageAuthorized', false
Template.voltagePage.helpers
isVoltageAuthorized: ->
editor.renderData()
Session... | editor = new Voltage.Editor
Deps.autorun ->
if Meteor.user()
Meteor.call 'isVoltageAuthorized', (err, authorized) ->
Session.set 'isVoltageAuthorized', authorized
else
Session.set 'isVoltageAuthorized', false
Template.voltagePage.helpers
isVoltageAuthorized: ->
editor.renderData()
Session... |
Set feed TTL to 12 hours. | #!/usr/bin/env coffee
RSS = require 'rss'
escape = require 'escape-html'
request = require 'request'
API_ENDPOINT = 'https://api.imgur.com/3/'
get = (clientId, path, query, cb) ->
request {
url: API_ENDPOINT + path
method: 'get'
qs: query
json: true
headers:
Authorization: "Client-ID #{ c... | #!/usr/bin/env coffee
RSS = require 'rss'
escape = require 'escape-html'
request = require 'request'
API_ENDPOINT = 'https://api.imgur.com/3/'
get = (clientId, path, query, cb) ->
request {
url: API_ENDPOINT + path
method: 'get'
qs: query
json: true
headers:
Authorization: "Client-ID #{ c... |
Remove unused group from funding disclosure | ETahi.FunderController = Ember.ObjectController.extend ETahi.SavesDelayed,
allAuthors: null
fundedAuthors: Em.computed.alias('model.authors')
addingAuthor: null
initAuthors: (->
@set('allAuthors', @get('task.paper.authors'))
).on('init').observes('task.paper.authors')
actions:
funderDidChange: ->
... | ETahi.FunderController = Ember.ObjectController.extend ETahi.SavesDelayed,
allAuthors: null
fundedAuthors: Em.computed.alias('model.authors')
addingAuthor: null
initAuthors: (->
@set('allAuthors', @get('task.paper.authors'))
).on('init').observes('task.paper.authors')
actions:
funderDidChange: ->
... |
Fix agentSpawner declaration in game state | class GameState
customers: []
agents: []
requestQueues: {}
tickables: []
tick: 0
money: 1000000
reputation: 0.5
agent_spawner = AgentSpawner()
addAgent: (agent) ->
@agents.append(agent)
fireAgent: (agent) ->
@agents.pop(agent)
calculateReputation: ->
totalWorth = 0
totalRep =... | class GameState
customers: []
agents: []
requestQueues: {}
tickables: []
tick: 0
money: 1000000
reputation: 0.5
agentSpawner: AgentSpawner()
addAgent: (agent) ->
@agents.append(agent)
fireAgent: (agent) ->
@agents.pop(agent)
calculateReputation: ->
totalWorth = 0
totalRep = 0... |
Fix event tracking not being injecting | define [
"base"
], (App) ->
App.controller "AutoCompileOnboardingController", ($scope) ->
recompileBtn = angular.element('#recompile')
popover = angular.element('.onboarding__autocompile')
{ top, left } = recompileBtn.offset()
# If pdf panel smaller than recompile button + popover, show to left.
# Otherwis... | define [
"base"
], (App) ->
App.controller "AutoCompileOnboardingController", ($scope, event_tracking) ->
recompileBtn = angular.element('#recompile')
popover = angular.element('.onboarding__autocompile')
{ top, left } = recompileBtn.offset()
# If pdf panel smaller than recompile button + popover, show to le... |
Clone user properly for profile page | angular.module('loomioApp').controller 'ProfilePageController', ($rootScope, Records, FormService, $location, AbilityService, ModalService, ChangePictureForm, ChangePasswordForm, DeactivateUserForm, $translate, Session, AppConfig, DeactivationModal) ->
$rootScope.$broadcast('currentComponent', { page: 'profilePage'})... | angular.module('loomioApp').controller 'ProfilePageController', ($rootScope, Records, FormService, $location, AbilityService, ModalService, ChangePictureForm, ChangePasswordForm, DeactivateUserForm, $translate, Session, AppConfig, DeactivationModal) ->
$rootScope.$broadcast('currentComponent', { page: 'profilePage'})... |
Remove exports for Backbonejs & Marionettejs since we use AMD versions | requirejs.config
baseUrl: '/scripts'
paths:
'underscore': '../bower_components/underscore/underscore'
'jquery': '../bower_components/jquery/jquery'
'backbone': '../bower_components/backbone/backbone'
'backbone.routefilter': '../bower_components/backbone-route-filter/backbone-route-filter'
'backb... | requirejs.config
baseUrl: '/scripts'
paths:
'underscore': '../bower_components/underscore/underscore'
'jquery': '../bower_components/jquery/jquery'
'backbone': '../bower_components/backbone/backbone'
'backbone.routefilter': '../bower_components/backbone-route-filter/backbone-route-filter'
'backb... |
Revert "show scrollbar on maps" | @['pages#home'] = (data) ->
handler = Gmaps.build('Google')
handler.buildMap
provider:
center:
lat: 39
lng: -101
zoom: 4
internal:
id: 'home-map-jumbotron'
->
handler.addMarkers markersJSON
@['pages#sponsor'] = (data) ->
handler = Gmaps.build('Google')
handl... | @['pages#home'] = (data) ->
handler = Gmaps.build('Google')
handler.buildMap
provider:
center:
lat: 39
lng: -101
zoom: 4
scrollwheel: false
internal:
id: 'home-map-jumbotron'
->
handler.addMarkers markersJSON
@['pages#sponsor'] = (data) ->
handler = Gmap... |
Remove terminal-plus package from Atom | packages: [
"editorconfig"
"file-icons"
"highlight-selected"
"linter"
"linter-coffeelint"
"linter-csslint"
"linter-flake8"
"linter-htmlhint"
"linter-js-yaml"
"linter-jshint"
"linter-jsonlint"
"linter-less"
"linter-php"
"linter-scss-lint"
"linter-shellcheck"
"linter-xmllint"
"minimap"
... | packages: [
"editorconfig"
"file-icons"
"highlight-selected"
"linter"
"linter-coffeelint"
"linter-csslint"
"linter-flake8"
"linter-htmlhint"
"linter-js-yaml"
"linter-jshint"
"linter-jsonlint"
"linter-less"
"linter-php"
"linter-scss-lint"
"linter-shellcheck"
"linter-xmllint"
"minimap"
... |
Switch from emmet to emmet-simplified | packages: [
"advanced-open-file"
"atom-react-native-autocomplete"
"auto-indent"
"autocomplete-modules"
"emmet"
"expand-region"
"file-icons"
"git-diff-popup"
"git-plus"
"git-time-machine"
"hyperclick"
"incremental-search"
"js-hyperclick"
"language-javascript-jsx"
"linter"
"linter-eslint"
... | packages: [
"advanced-open-file"
"atom-react-native-autocomplete"
"auto-indent"
"autocomplete-modules"
"emmet-simplified"
"expand-region"
"file-icons"
"git-diff-popup"
"git-plus"
"git-time-machine"
"hyperclick"
"incremental-search"
"js-hyperclick"
"language-javascript-jsx"
"linter"
"lint... |
Use jQuery symbol in template instead of name. | class exports.BrunchApplication
constructor: ->
jQuery =>
@initialize this
Backbone.history.start()
initialize: ->
null
| class exports.BrunchApplication
constructor: ->
$ =>
@initialize this
Backbone.history.start()
initialize: ->
null
|
Sort blocks in channels view by position | module.exports =
"""
query user($id: ID! $per: Int, $page: Int, $perBlocks: Int, $q: String, $sort: SearchSorts, $seed: Int) {
user(id: $id) {
contents(per: $per, type: "channel", page: $page, q: $q, sort_by: $sort, seed: $seed) {
title(truncate: 50)
updated_at(relative: true)
us... | module.exports =
"""
query user($id: ID! $per: Int, $page: Int, $perBlocks: Int, $q: String, $sort: SearchSorts, $seed: Int) {
user(id: $id) {
contents(per: $per, type: "channel", page: $page, q: $q, sort_by: $sort, seed: $seed) {
title(truncate: 50)
updated_at(relative: true)
us... |
Add LaTeX grammar to Atom | packages: [
"advanced-open-file"
"atom-alignment"
"atom-beautify"
"atom-transpose"
"change-case"
"color-picker"
"docblockr"
"editorconfig"
"emmet"
"expand-region"
"git-blame"
"language-apache"
"language-applescript"
"language-awk"
"language-babel"
"language-diff"
"language-env"
"lang... | packages: [
"advanced-open-file"
"atom-alignment"
"atom-beautify"
"atom-transpose"
"change-case"
"color-picker"
"docblockr"
"editorconfig"
"emmet"
"expand-region"
"git-blame"
"language-apache"
"language-applescript"
"language-awk"
"language-babel"
"language-diff"
"language-env"
"lang... |
Add Ruby snippet for test blocks | ".source.ruby":
"Hashrocket":
prefix: "="
body: " => "
".source.coffee":
"Describe block":
prefix: "de"
body: """
describe "${1:description}", ->
${2:body}
"""
"It block":
prefix: "i"
body: """
it "$1", ->
$2
"""
"Before each":
prefix: "be"
bo... | ".source.ruby":
"Hashrocket":
prefix: "="
body: " => "
"Test block":
prefix: "test"
body: """
test "$1" do
$2
end
"""
".source.coffee":
"Describe block":
prefix: "de"
body: """
describe "${1:description}", ->
${2:body}
"""
"It block":
prefi... |
Fix kassaStateToggle adding an extra history token on defaultValue | angular.module('kassa').directive('kassaStateToggle',[
'$location'
($location)->
linker = ($scope, $element, $attrs)->
stateKey = $attrs.kassaStateToggle
defaultValue = $attrs.kassaStateDefault || false
unless $location.search()[stateKey]?
$location.search stateKey, defaultValue
... | angular.module('kassa').directive('kassaStateToggle',[
'$location'
($location)->
linker = ($scope, $element, $attrs)->
stateKey = $attrs.kassaStateToggle
defaultValue = $attrs.kassaStateDefault || false
unless $location.search()[stateKey]?
$location.search(stateKey, defaultValue).repla... |
Detach from status bar when pane removed | {View} = require 'atom'
ImageEditor = require './image-editor'
module.exports =
class ImageEditorStatusView extends View
@content: ->
@div class: 'status-image inline-block', =>
@span class: 'image-size', outlet: 'imageSizeStatus'
initialize: (filePath, image) =>
@filePath = filePath
@image = im... | {View} = require 'atom'
ImageEditor = require './image-editor'
module.exports =
class ImageEditorStatusView extends View
@content: ->
@div class: 'status-image inline-block', =>
@span class: 'image-size', outlet: 'imageSizeStatus'
initialize: (filePath, image) =>
@filePath = filePath
@image = im... |
Fix CroppedImage require in ArticleListItem | React = require 'react'
createReactClass = require 'create-react-class'
CroppedImage = require '../../../components/cropped-image'
ArticleListItem = createReactClass
getDefaultProps: ->
icon: null
title: ''
onClick: ->
render: ->
<button type="button" className="field-guide-editor-article-button" ... | React = require 'react'
createReactClass = require 'create-react-class'
CroppedImage = require('../../../components/cropped-image').default
ArticleListItem = createReactClass
getDefaultProps: ->
icon: null
title: ''
onClick: ->
render: ->
<button type="button" className="field-guide-editor-article... |
Sort repos explicitly on dashboard | `import Ember from 'ember'`
`import TravisRoute from 'travis/routes/basic'`
`import config from 'travis/config/environment'`
Route = TravisRoute.extend
queryParams:
filter: { replace: true }
model: ->
apiEndpoint = config.apiEndpoint
$.ajax(apiEndpoint + '/v3/repos?repository.active=true', {
head... | `import Ember from 'ember'`
`import TravisRoute from 'travis/routes/basic'`
`import config from 'travis/config/environment'`
Route = TravisRoute.extend
queryParams:
filter: { replace: true }
model: ->
apiEndpoint = config.apiEndpoint
$.ajax(apiEndpoint + '/v3/repos?repository.active=true', {
head... |
Switch to ts course with one line | ###
Register all the editors.
One you add a new built in editor, it should go here.
###
# Require each module, which loads a file editor. These call register_file_editor.
# This should be a comprehensive list of all React editors
# require('./editor_terminal')
require('./chat/register')
require('./editor_archive')
... | ###
Register all the editors.
One you add a new built in editor, it should go here.
###
# Require each module, which loads a file editor. These call register_file_editor.
# This should be a comprehensive list of all React editors
# require('./editor_terminal')
require('./chat/register')
require('./editor_archive')
... |
Disable upload manuscript overlay when the paper is being edited. | ETahi.UploadManuscriptOverlayController = ETahi.TaskController.extend
manuscriptUploadUrl: (->
"/papers/#{@get('litePaper.id')}/upload"
).property('litePaper.id')
isUploading: false
isProcessing: false
uploadProgress: 0
showProgress: true
actions:
uploadStarted: ->
@set('isUploading', true... | ETahi.UploadManuscriptOverlayController = ETahi.TaskController.extend
manuscriptUploadUrl: (->
"/papers/#{@get('litePaper.id')}/upload"
).property('litePaper.id')
isUploading: false
isProcessing: false
uploadProgress: 0
showProgress: true
isEditable: (->
!@get('paper.lockedBy') && (@get('isUserE... |
Fix spec broken in previous commit (bdcf0c64). | define [
'controllers/node_tool'
'models/commands/commander'
], (NodeTool, Commander) ->
class MockContainer
addNode: ->
class MockDrawing extends MockContainer
select: (item) ->
@selection = [item]
clearSelection: ->
@selection = []
describe 'NodeTool', ->
befo... | define [
'controllers/node_tool'
'models/commands/commander'
], (NodeTool, Commander) ->
class MockContainer
addNode: ->
class MockDrawing extends MockContainer
select: (item) ->
@selection = [item]
clearSelection: ->
@selection = []
describe 'NodeTool', ->
befo... |
Test editing image attachment caption | editorModule "Attachments", template: "editor_with_image"
editorTest "moving an image by drag and drop", (expectDocument) ->
typeCharacters "!", ->
moveCursor direction: "right", times: 1, (coordinates) ->
img = document.activeElement.querySelector("img")
triggerEvent(img, "mousedown")
after 1,... | editorModule "Attachments", template: "editor_with_image"
editorTest "moving an image by drag and drop", (expectDocument) ->
typeCharacters "!", ->
moveCursor direction: "right", times: 1, (coordinates) ->
img = document.activeElement.querySelector("img")
triggerEvent(img, "mousedown")
after 1,... |
Make test helpers print out the correct spec name | Walrus = require '../../bin/walrus'
fs = require 'fs'
path = require 'path'
exec = require( 'child_process' ).exec
TestHelpers =
read : ( filename ) -> fs.readFileSync filename, 'utf8' if path.existsSync filename
pass : ( specs, suffix='' ) ->
for file in fs.readdirSync specs when path.extname( file ) is... | Walrus = require '../../bin/walrus'
fs = require 'fs'
path = require 'path'
exec = require( 'child_process' ).exec
TestHelpers =
read : ( filename ) -> fs.readFileSync filename, 'utf8' if path.existsSync filename
pass : ( specs, suffix='' ) ->
for file in fs.readdirSync specs when path.extname( file ) is... |
Fix bug in event handlers calling | class Game.State extends Game.TwoWay
constructor: () ->
@objects = {}
@eventCounters = {}
@eventHandlers = {}
super
onEvent: (e) ->
# Add timestamped instance to the event counters object
if e.type not of @eventCounters
@eventCounters[e.type] = []
@eventCounters[e.type].push new Da... | class Game.State extends Game.TwoWay
constructor: () ->
@objects = {}
@eventCounters = {}
@eventHandlers = {}
super
onEvent: (e) ->
# Add timestamped instance to the event counters object
if e.type not of @eventCounters
@eventCounters[e.type] = []
@eventCounters[e.type].push new Da... |
Add \ before question mark | module.exports = (robot) ->
names = ['Dana', 'Freia', 'Jhishan', 'Kyle', 'Brenton', 'Terri', 'Abhi', 'Drew']
robot.hear /Resume queen, who is next?/i, (res) ->
res.send res.random names
| module.exports = (robot) ->
names = ['Dana', 'Freia', 'Jhishan', 'Kyle', 'Brenton', 'Terri', 'Abhi', 'Drew']
robot.hear /Resume queen, who is next\?/i, (res) ->
res.send res.random names
|
Fix video indicator not showing anonymously on public leagues | module.exports = (app, server) ->
authMiddleware = require('./middleware/authentication')
models = require '../models'
app.io = require('socket.io')(server)
redisClient = require('./redis_client')()
respondSocketError = (next, err) ->
console.error "Socket failed to connect", err
next(new Error('not... | module.exports = (app, server) ->
authMiddleware = require('./middleware/authentication')
models = require '../models'
app.io = require('socket.io')(server)
redisClient = require('./redis_client')()
respondSocketError = (next, err) ->
console.error "Socket failed to connect", err
next(new Error('not... |
Fix type error upon completed commit | DiffChunk = require './diff-chunk'
List = require '../list'
_ = require 'underscore'
##
# A diff is a whole-file diff, and is broken into a list of chunks. End-game
# here is to be able to stage individual chunks, not just the whole diff.
#
module.exports =
class Diff extends List
model: DiffChunk
is_sublist: tru... | DiffChunk = require './diff-chunk'
List = require '../list'
_ = require 'underscore'
##
# A diff is a whole-file diff, and is broken into a list of chunks. End-game
# here is to be able to stage individual chunks, not just the whole diff.
#
module.exports =
class Diff extends List
model: DiffChunk
is_sublist: tru... |
Fix deprecated selectors in the keymap | # Keybindings require three things to be fully defined: A selector that is
# matched against the focused element, the keystroke and the command to
# execute.
#
# Below is a basic keybinding which registers on all platforms by applying to
# the root workspace element.
# For more detailed documentation see
# https://ato... | # Keybindings require three things to be fully defined: A selector that is
# matched against the focused element, the keystroke and the command to
# execute.
#
# Below is a basic keybinding which registers on all platforms by applying to
# the root workspace element.
# For more detailed documentation see
# https://ato... |
Change 'mock = require("TinyMockJS").mock' to 'mock = require("TinyMockJS")' | chai = require("chai")
should = chai.should()
mock = require("TinyMockJS").mock
Logger = require("../src/Logger").Logger
fs = require("fs")
describe "Logger", ->
describe "constructor(options)", ->
it "retrieves the log file name from 'options'", ->
mock (options) ->
options.expects("get_lo... | chai = require("chai")
should = chai.should()
mock = require("TinyMockJS")
Logger = require("../src/Logger").Logger
fs = require("fs")
describe "Logger", ->
describe "constructor(options)", ->
it "retrieves the log file name from 'options'", ->
mock (options) ->
options.expects("get_log_fil... |
Make sounds work both in chrome an firefox | window.Sounds2 = class
sounds:
walk: [0, 0.2]
chop: [1, 1.2]
throw: [2, 2.1]
snowball_hit: [3, 3.4]
drop: [4, 4.2]
pickup: [5, 5.2]
deliver: [6, 6.5]
constructor: ->
@players = []
for i in [0 .. 9] # create 10 players by default
@.createPlayer()
createPlayer: ->
pl... | window.Sounds2 = class
sounds:
walk: [0, 0.2]
chop: [1, 1.2]
throw: [2, 2.1]
snowball_hit: [3, 3.4]
drop: [4, 4.2]
pickup: [5, 5.2]
deliver: [6, 6.5]
constructor: ->
@players = []
for i in [0 .. 9] # create 10 players by default
@.createPlayer()
createPlayer: ->
pl... |
Attach the workspace to the DOM in specs. | module.exports =
openPath: (path, callback) ->
waitsForPromise -> atom.workspace.open(path)
runs ->
callback(atom.views.getView(atom.workspace.getActivePaneItem()))
rowRangeFrom: (marker) ->
[marker.getTailBufferPosition().row, marker.getHeadBufferPosition().row]
| module.exports =
openPath: (path, callback) ->
workspaceElement = atom.views.getView(atom.workspace)
jasmine.attachToDOM(workspaceElement)
waitsForPromise -> atom.workspace.open(path)
runs ->
callback(atom.views.getView(atom.workspace.getActivePaneItem()))
rowRangeFrom: (marker) ->
[mar... |
Add coffeelint in coffee task | gulp = require 'gulp'
jshint = require 'gulp-jshint'
coffeelint = require 'gulp-coffeelint'
mocha = require 'gulp-mocha'
runSequence = require 'run-sequence'
# compilers
coffee = require 'gulp-coffee'
gulp.task 'coffee', ->
gulp.src './src/*.coffee'
.pipe coffee()
.pipe gulp.dest './lib'
gulp.task 'coffeel... | gulp = require 'gulp'
jshint = require 'gulp-jshint'
coffeelint = require 'gulp-coffeelint'
mocha = require 'gulp-mocha'
runSequence = require 'run-sequence'
# compilers
coffee = require 'gulp-coffee'
gulp.task 'coffee', ->
gulp.src './src/*.coffee'
.pipe coffeelint()
.pipe coffeelint.reporter()
.pipe c... |
Fix scroll of login window | if Meteor.isCordova
document.addEventListener 'deviceready', ->
if device?.platform.toLowerCase() isnt 'android'
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
window.addEventListener 'native.keyboardshow', ->
if device?.platform.toLowerCase() isnt 'a... | if Meteor.isCordova
document.addEventListener 'deviceready', ->
if device?.platform.toLowerCase() isnt 'android'
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
window.addEventListener 'native.keyboardshow', ->
if device?.platform.toLowerCase() isnt 'a... |
Make breakout logic after draining N clients more clear | logger = require "logger-sharelatex"
module.exports =
startDrain: (io, rate) ->
# Clear out any old interval
clearInterval @interval
if rate == 0
return
@interval = setInterval () =>
@reconnectNClients(io, rate)
, 1000
RECONNECTED_CLIENTS: {}
reconnectNClients: (io, N) ->
drainedCount = 0
for c... | logger = require "logger-sharelatex"
module.exports =
startDrain: (io, rate) ->
# Clear out any old interval
clearInterval @interval
if rate == 0
return
@interval = setInterval () =>
@reconnectNClients(io, rate)
, 1000
RECONNECTED_CLIENTS: {}
reconnectNClients: (io, N) ->
drainedCount = 0
for c... |
Split options into options and dependencies | _ = require "underscore"
Promise = require "bluebird"
stream = require "readable-stream"
Match = require "mtr-match"
ActivityTask = require "../ActivityTask"
Read = require "./Read"
Save = require "./Save"
class Download extends ActivityTask
constructor: (options, dependencies) ->
Match.check dependencies, Match... | _ = require "underscore"
Promise = require "bluebird"
stream = require "readable-stream"
Match = require "mtr-match"
ActivityTask = require "../ActivityTask"
Read = require "./Read"
Save = require "./Save"
class Download extends ActivityTask
constructor: (options, dependencies) ->
Match.check dependencies, Match... |
Resolve "headers already sent" problems on errors. | # Given an array of actions, the actions will be called serially.
# The first action is called. If it calls the 'next' function that is passed to it
# the next action in the series is called. This continues until either one of the
# actions does not call 'next' or until the end of the list is reached.
_ = require('un... | # Given an array of actions, the actions will be called serially.
# The first action is called. If it calls the 'next' function that is passed to it
# the next action in the series is called. This continues until either one of the
# actions does not call 'next' or until the end of the list is reached.
_ = require('un... |
Set reaction stars as read only depending on data-readonly attribute. | $ ->
# Refresh if a page is loaded directly
pageLoad()
# Refresh if a page is loaded via turbolinks
$(document).on "page:load", pageLoad
pageLoad = ->
# Steps to do on a page load (with turbolinks)
# Refresh all ratings on the current page
refreshRatings()
# Refresh for the new event divs that... | $ ->
# Refresh if a page is loaded directly
pageLoad()
# Refresh if a page is loaded via turbolinks
$(document).on "page:load", pageLoad
pageLoad = ->
# Steps to do on a page load (with turbolinks)
# Refresh all ratings on the current page
refreshRatings()
# Refresh for the new event divs that... |
Select a plan based on a hash provided in URL. | stripeCallback = (status, response) ->
if response.error
anchortabSite.validationError("#card-number", response.error.message)
else
$("#stripe-token").val(response.id)
$(".stripe-form").submit()
$(document).ready ->
anchortabSite.event("stripe-form-ready")
$(".plan-selection").on 'change', (event)... | stripeCallback = (status, response) ->
if response.error
anchortabSite.validationError("#card-number", response.error.message)
else
$("#stripe-token").val(response.id)
$(".stripe-form").submit()
$(document).ready ->
anchortabSite.event("stripe-form-ready")
$(".plan-selection").on 'change', (event)... |
Change empty progress bar wording | React = require 'react'
BS = require 'react-bootstrap'
ChapterSectionType = require './chapter-section-type'
module.exports = React.createClass
displayName: 'LearningGuideProgressBar'
propTypes:
section: React.PropTypes.object.isRequired
onPractice: React.PropTypes.func
render: ->
{section, onPr... | React = require 'react'
BS = require 'react-bootstrap'
ChapterSectionType = require './chapter-section-type'
module.exports = React.createClass
displayName: 'LearningGuideProgressBar'
propTypes:
section: React.PropTypes.object.isRequired
onPractice: React.PropTypes.func
render: ->
{section, onPr... |
Add error logging to process forking | cp = require('child_process')
getBranchFromRef = (ref) ->
refParts = ref.split("/")
return refParts[refParts.length-1]
exports.index = (req, res) ->
parsedPayload = JSON.parse(req.body.payload)
console.log "Got deploy message from #{parsedPayload.ref}"
unless getBranchFromRef(parsedPayload.ref) is "deploy"... | cp = require('child_process')
getBranchFromRef = (ref) ->
refParts = ref.split("/")
return refParts[refParts.length-1]
exports.index = (req, res) ->
parsedPayload = JSON.parse(req.body.payload)
console.log "Got deploy message from #{parsedPayload.ref}"
unless getBranchFromRef(parsedPayload.ref) is "deploy"... |
Make sure VBox and HBox still work | _ = require "underscore"
LayoutDOM = require "./layout_dom"
p = require "../../core/properties"
class BaseBox extends LayoutDOM.Model
type: "BaseBox"
@define {
children: [ p.Array, [] ]
}
module.exports =
Model: BaseBox
| _ = require "underscore"
LayoutDOM = require "./layout_dom"
p = require "../../core/properties"
class BaseBox extends LayoutDOM.Model
type: "BaseBox"
@define {
children: [ p.Array, [] ]
}
get_layoutable_children: () ->
return @get('children')
get_edit_variables: () ->
edit_variables = supe... |
Make default gulp task compile and test | gulp = require 'gulp'
coffee = require 'gulp-coffee'
mocha = require 'gulp-mocha'
src = './src/*.coffee'
test = './test/*.coffee'
gulp.task('compile', ->
gulp.src(src)
.pipe(coffee())
.pipe(gulp.dest('./src'))
)
gulp.task('test', ->
gulp.src(test)
.pipe(mocha({ reporter: 'list' }))
)
gulp.task('watc... | gulp = require 'gulp'
coffee = require 'gulp-coffee'
mocha = require 'gulp-mocha'
src = './src/*.coffee'
test = './test/*.coffee'
gulp.task('compile', ->
gulp.src(src)
.pipe(coffee())
.pipe(gulp.dest('./src'))
)
gulp.task('test', ->
gulp.src(test)
.pipe(mocha({ reporter: 'list' }))
)
gulp.task('watc... |
Use opener methods from workspace instead of project | path = require 'path'
_ = require 'underscore-plus'
ImageEditor = require './image-editor'
module.exports =
activate: ->
atom.project.registerOpener(openUri)
deactivate: ->
atom.project.unregisterOpener(openUri)
# Files with these extensions will be opened as images
imageExtensions = ['.gif', '.ico', '.j... | path = require 'path'
_ = require 'underscore-plus'
ImageEditor = require './image-editor'
module.exports =
activate: ->
atom.workspace.registerOpener(openUri)
deactivate: ->
atom.workspace.unregisterOpener(openUri)
# Files with these extensions will be opened as images
imageExtensions = ['.gif', '.ico',... |
Correct the descriptions of the options | RubocopAutoCorrect = require './rubocop-auto-correct'
module.exports =
config:
rubocopCommandPath:
description: 'If command doesnot work, please input rubocop full path. example: /Users/<username>/.rbenv/shims/rubocop)'
type: 'string'
default: 'rubocop'
autoRun:
description: 'When you... | RubocopAutoCorrect = require './rubocop-auto-correct'
module.exports =
config:
rubocopCommandPath:
description: 'If the command does not work, please input rubocop full path here. Example: /Users/<username>/.rbenv/shims/rubocop)'
type: 'string'
default: 'rubocop'
autoRun:
description:... |
Change fallback for UX Markup from xml back to html | module.exports = {
name: "UX Markup"
namespace: "ux"
fallback: ['xml']
###
Supported Grammars
###
grammars: [
"UX"
]
###
Supported extensions
###
extensions: [
"ux"
]
defaultBeautifier: "Pretty Diff"
}
| module.exports = {
name: "UX Markup"
namespace: "ux"
fallback: ['html']
###
Supported Grammars
###
grammars: [
"UX"
]
###
Supported extensions
###
extensions: [
"ux"
]
defaultBeautifier: "Pretty Diff"
}
|
Add more tests to custom html view | should = require 'should'
KDCustomHTMLView = require '../../lib/core/customhtmlview'
describe 'KDCustomHTMLView', ->
it 'exists', ->
KDCustomHTMLView.should.exist
describe 'constructor', ->
it 'should instantiate without error', ->
router = new KDCustomHTMLView
router.should.exist
| should = require 'should'
KDCustomHTMLView = require '../../lib/core/customhtmlview'
describe 'KDCustomHTMLView', ->
it 'exists', ->
KDCustomHTMLView.should.exist
describe 'constructor', ->
it 'should instantiate without error', ->
view = new KDCustomHTMLView
view.should.exist
it 'should... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.