Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Use environmental variables to store database credentials | keychain = require './utils/keychain'
config =
use: (platform) ->
for key, value of config[platform]
config[key] = value
production:
url: 'http://sync.nitrotasks.com:443'
port: process.env.PORT || 8080
mysql:
host: keychain 'sql_host'
port: keychain 'sql_port'
user: keyc... | keychain = require './utils/keychain'
config =
use: (platform) ->
for key, value of config[platform]
config[key] = value
production:
url: 'http://sync.nitrotasks.com'
port: process.env.PORT || 8080
mysql:
host: process.env.NITRO_SQL_HOST
port: process.env.NITRO_SQL_PORT
... |
Load script synchronously (updated to match generator template) | fs = require 'fs'
path = require 'path'
module.exports = (robot, scripts) ->
scriptsPath = path.resolve(__dirname, 'src')
fs.exists scriptsPath, (exists) ->
if exists
for script in fs.readdirSync(scriptsPath)
if scripts? and '*' not in scripts
robot.loadF... | fs = require 'fs'
path = require 'path'
module.exports = (robot, scripts) ->
scriptsPath = path.resolve(__dirname, 'src')
if fs.existsSync scriptsPath
for script in fs.readdirSync(scriptsPath).sort()
if scripts? and '*' not in scripts
robot.loadFile(scriptsPath, script) if s... |
Add comment explaining why the odd double-json is necessary in trigger_Event | showPopup = (url) ->
width = 640
height = 480
left = (screen.width/2)-(width/2)
top = (screen.height/2)-(height/2)
popup_window = window.open url, "authPopup",
"menubar=no,toolbar=no,status=no,width=#{width},height=#{height},left=#{left},top=#{top}"
popup_window.focus()
$('html').on 'click', '.js... | showPopup = (url) ->
width = 640
height = 480
left = (screen.width/2)-(width/2)
top = (screen.height/2)-(height/2)
popup_window = window.open url, "authPopup",
"menubar=no,toolbar=no,status=no,width=#{width},height=#{height},left=#{left},top=#{top}"
popup_window.focus()
$('html').on 'click', '.js... |
Change 'OpenStax College' to 'OpenStax CNX' | define (require) ->
BaseView = require('cs!helpers/backbone/views/base')
HeaderView = require('cs!modules/header/header')
FooterView = require('cs!modules/footer/footer')
FindContentView = require('cs!modules/find-content/find-content')
DefaultView = require('cs!./default/default')
PeopleView = require('cs!... | define (require) ->
BaseView = require('cs!helpers/backbone/views/base')
HeaderView = require('cs!modules/header/header')
FooterView = require('cs!modules/footer/footer')
FindContentView = require('cs!modules/find-content/find-content')
DefaultView = require('cs!./default/default')
PeopleView = require('cs!... |
Add core:confirm and core:cancel keybindings | '.platform-darwin .editor':
'cmd-:': 'spell-check:correct-misspelling'
'.platform-win32 .editor':
'ctrl-:': 'spell-check:correct-misspelling'
| '.platform-darwin .editor':
'cmd-:': 'spell-check:correct-misspelling'
'.platform-darwin .corrections .editor':
'cmd-:': 'core:cancel'
'.platform-win32 .editor':
'ctrl-:': 'spell-check:correct-misspelling'
'.platform-win32 .corrections .editor':
'ctrl-:': 'core:cancel'
'.corrections .mini.editor input':
'... |
Use internal ip to setup redis | ### Examples
TUTUM_REDIS_HOST=127.0.0.1
TUTUM_REDIS_PORT=6379
TUTUM_CLIENT_NAME=mywebsite
TUTUM_CLIENT_HOST=www.dotcloud.com
TUTUM_CLIENT_ADDRESS=http://192.168.0.42:80
###
if process.env.TUTUM_REDIS_HOST?
redis = Npm.require 'redis'
process.env.TUTUM_REDIS_PORT ?= 6379
client = redis.createClient(process.env.TU... | ### Examples
TUTUM_REDIS_HOST=127.0.0.1
TUTUM_REDIS_PORT=6379
TUTUM_CLIENT_NAME=mywebsite
TUTUM_CLIENT_HOST=mywebsite.dotcloud.com
###
if process.env.TUTUM_REDIS_HOST? and process.env.TUTUM_CONTAINER_API_URL?
redis = Npm.require 'redis'
process.env.TUTUM_REDIS_PORT ?= 6379
client = redis.createClient(process.env... |
Fix the tag panel update, it was targetting the wrong div for replacement. | $ ->
$("div.tag-form").hide()
$("div.tag-form li.cancel a").live "click", ->
$("div.tags").show()
$("div.tag-form").hide()
false
$("a[rel='edit-tags']").live "click", ->
$("div.tags").hide()
$("div.tag-form").show()
false
$("form.edit-tags").live "ajax:success", (e, data, status, xhr)... | $ ->
$("div.tag-form").hide()
$("div.tag-form li.cancel a").live "click", ->
$("div.tags").show()
$("div.tag-form").hide()
false
$("a[rel='edit-tags']").live "click", ->
$("div.tags").hide()
$("div.tag-form").show()
false
$("form.edit-tags").live "ajax:success", (e, data, status, xhr)... |
Set up the form to place the order | $(document).on "page:change", ->
if $("body[data-controller=ships][data-action=index]").get 0
$(".ship-thumb").click ->
$("#ship-selection").val $(this).data "ship-id"
$('html, body').animate({
scrollTop: $("#purchase-form").offset().top
}, 2000)
| $(document).on "page:change", ->
if $("body[data-controller=ships][data-action=index]").get 0
$(".ship-thumb").click ->
$("#ship-selection").val $(this).data "ship-id"
$('html, body').animate({
scrollTop: $("#purchase-form").offset().top
}, 2000)
$("#submit-order").click ->
$.... |
Fix a critical typo in Panel | class PanelView extends HTMLElement
initialize(@linter)->
@id = 'linter-panel'
@decorations = []
removeDecorations: ->
return unless @decorations.length
@decorations.forEach (decoration) ->
try decoration.destroy()
@decorations = []
render: (messages)->
@removeDecorations()
@inne... | class PanelView extends HTMLElement
initialize:(@linter)->
@id = 'linter-panel'
@decorations = []
removeDecorations: ->
return unless @decorations.length
@decorations.forEach (decoration) ->
try decoration.destroy()
@decorations = []
render: (messages)->
@removeDecorations()
@inn... |
Fix issue with undefined dispather page | $ ->
new Dispatcher()
class Dispatcher
constructor: () ->
@initSearch()
@initPageScripts()
initPageScripts: ->
page = $('body').attr('data-page')
project_id = $('body').attr('data-project-id')
console.log(page)
path = page.split(':')
switch page
when 'issues:index'
... | $ ->
new Dispatcher()
class Dispatcher
constructor: () ->
@initSearch()
@initPageScripts()
initPageScripts: ->
page = $('body').attr('data-page')
project_id = $('body').attr('data-project-id')
console.log(page)
unless page
return false
path = page.split(':')
switch p... |
Fix multiple line translation test |
Tinytest.add 'Google Translate - should translate text' , (test)->
translation = GoogleTranslate.translate("my name is Brandon", "es")
expect(translation).to.be.a("string")
expect(translation).to.equal("mi nombre es Brandon")
Tinytest.add 'Google Translate - should translate text with multiple lines' , (test)-... |
Tinytest.add 'Google Translate - should translate text' , (test)->
translation = GoogleTranslate.translate("my name is Brandon", "es")
expect(translation).to.be.a("string")
expect(translation).to.equal("mi nombre es Brandon")
Tinytest.add 'Google Translate - should translate text with multiple lines' , (test)-... |
Put app into dev mode |
servers = {
official: 'sync.nitrotasks.com:443'
localhost: 'localhost:8080'
}
# Set active server
active = servers.official
module.exports =
sync: active
server: active + '/api'
email: active + '/email'
|
servers = {
official: 'sync.nitrotasks.com:443'
dev: 'localhost:8080'
}
# Set active server
active = servers.dev
module.exports =
sync: active
server: active
email: active + '/email'
|
Add teaching period state to doubtfire.admin | angular.module('doubtfire.admin.states', [
'doubtfire.admin.states.units'
'doubtfire.admin.states.users'
])
| angular.module('doubtfire.admin.states', [
'doubtfire.admin.states.teachingperiods'
'doubtfire.admin.states.units'
'doubtfire.admin.states.users'
])
|
Set active: true on registration | Meteor.methods
registerUser: (formData) ->
userData =
email: formData.email
password: formData.pass
userId = Accounts.createUser userData
Meteor.users.update userId,
$set:
name: formData.name
if userData.email
Accounts.sendVerificationEmail(userId, userData.email);
| Meteor.methods
registerUser: (formData) ->
userData =
email: formData.email
password: formData.pass
userId = Accounts.createUser userData
Meteor.users.update userId,
$set:
name: formData.name
active: true
if userData.email
Accounts.sendVerificationEmail(userId, userData.email);
|
Add a small useless fix | 'use strict'
{toggleGem} = require './actions'
store = require './store'
Gem = React.createClass
mixins: [Reflux.connect store, 'status']
onClick: (event) ->
toggleGem()
render: ->
statusStr = if @state?.status then 'activated' else 'deactivated'
(<p>
Gem is {statusStr}
<button ... | 'use strict'
{toggleGem} = require './actions'
store = require './store'
Gem = React.createClass
mixins: [Reflux.connect store, 'status']
onClick: (event) ->
toggleGem()
return
render: ->
statusStr = if @state?.status then 'activated' else 'deactivated'
(<p>
Gem is {statusStr}
... |
Add wrap guide and markdown preview to default config | requireExtension 'autocomplete'
requireExtension 'strip-trailing-whitespace'
requireExtension 'fuzzy-finder'
requireExtension 'tree-view'
requireExtension 'command-panel'
requireExtension 'keybindings-view'
requireExtension 'snippets'
requireExtension 'status-bar'
| requireExtension 'autocomplete'
requireExtension 'strip-trailing-whitespace'
requireExtension 'fuzzy-finder'
requireExtension 'tree-view'
requireExtension 'command-panel'
requireExtension 'keybindings-view'
requireExtension 'snippets'
requireExtension 'status-bar'
requireExtension 'wrap-guide'
requireExtension 'markdow... |
Increase discussion page size to 20 | module?.exports =
discussionPageSize: 10
inboxPageSize: 10
boardPageSize: 10
moderationsPageSize: 20
| module?.exports =
discussionPageSize: 20
inboxPageSize: 10
boardPageSize: 10
moderationsPageSize: 20
|
Maintain new window opening in Styleguide | define [
'jquery'
'backbone'
'hbs/styleguide/index'
], ($, Bb, t) ->
class StyleguideView extends Bb.View
el: $ 'body'
events:
'click a[href="#"]': 'cancel'
'click a[href*="//"]': 'openInNewWindow'
initialize: ->
@render()
render: ... | define [
'jquery'
'backbone'
'hbs/styleguide/index'
], ($, Bb, t) ->
class StyleguideView extends Bb.View
el: $ 'body'
events:
'click a[href="#"]': 'cancel'
'click a[href*="//"]': 'openInNewWindow'
initialize: ->
@render()
render: ... |
Add count as cssClass Option for ActivityLikeCount | class ActivityLikeView extends JView
constructor: (options = {}, data) ->
options.tagName or= 'span'
options.cssClass or= 'like-view'
options.tooltipPosition or= 'se'
options.useTitle ?= yes
super options, data
@link = new ActivityLikeLink {}, data
@... | class ActivityLikeView extends JView
constructor: (options = {}, data) ->
options.tagName or= 'span'
options.cssClass or= 'like-view'
options.tooltipPosition or= 'se'
options.useTitle ?= yes
super options, data
@link = new ActivityLikeLink {}, data
@... |
Use NavigationWorkspaceItem class for sidebar workspace list controller. | class SidebarMachineBox extends KDView
constructor: (options = {}, data) ->
super options, data
{machine, workspaces} = data
machine = new KD.remote.api.JMachine machine
@addSubView @machineItem = new NavigationMachineItem {}, machine
listController = new KDListViewController
itemClass... | class SidebarMachineBox extends KDView
constructor: (options = {}, data) ->
super options, data
{machine, workspaces} = data
machine = new KD.remote.api.JMachine machine
@addSubView @machineItem = new NavigationMachineItem {}, machine
listController = new KDListViewController
itemClass... |
Fix word selection in Atom | "*":
editor:
fontFamily: "Fira Mono OT"
showIndentGuide: true
tabLength: 2
softWrap: true
invisibles: {}
zoomFontWhenCtrlScrolling: false
core:
disabledPackages: [
"language-objective-c"
"archive-view"
"autosave"
"bookmarks"
"language-clojure"
"languag... | "*":
editor:
fontFamily: "Fira Mono OT"
showIndentGuide: true
tabLength: 2
softWrap: true
invisibles: {}
zoomFontWhenCtrlScrolling: false
nonWordCharacters: "^*\"`'/|\\?!;:,.%#@(){}[]<>=+~_"
core:
disabledPackages: [
"language-objective-c"
"archive-view"
"autosave"
... |
Add tip for symbols view | module.exports = [
'Everything Atom can do is in the Command Palette. See it by using {command-palette:toggle}'
'You can quickly open files with the Fuzzy Finder. Try it by using {fuzzy-finder:toggle-file-finder}'
'You can toggle the Tree View with {tree-view:toggle}'
'You can focus the Tree View with {tree-vie... | module.exports = [
'Everything Atom can do is in the Command Palette. See it by using {command-palette:toggle}'
'You can quickly open files with the Fuzzy Finder. Try it by using {fuzzy-finder:toggle-file-finder}'
'You can toggle the Tree View with {tree-view:toggle}'
'You can focus the Tree View with {tree-vie... |
Strengthen selectors for chosen boxes. | # Initialize chosen for multiselect tag list
crm.chosen_taglist = (asset, controller, id)->
new Chosen $(asset + '_tag_list'), {
allow_option_creation: true
on_option_add: (tag) ->
crm.load_field_group(controller, tag, id)
on_option_remove: (tag) ->
crm.remove_field_group(tag)
}
# Ensures ... | # Initialize chosen for multiselect tag list
crm.chosen_taglist = (asset, controller, id)->
new Chosen $(asset + '_tag_list'), {
allow_option_creation: true
on_option_add: (tag) ->
crm.load_field_group(controller, tag, id)
on_option_remove: (tag) ->
crm.remove_field_group(tag)
}
# Ensures ... |
Stop the controls at min/max temp | $ () ->
$(".increase-temp").on "click touchend", (e) ->
e.preventDefault()
$("#set_temp_temp").val(parseInt($("#set_temp_temp").val()) + 1)
$(".decrease-temp").on "click touchend", (e) ->
e.preventDefault()
$("#set_temp_temp").val(parseInt($("#set_temp_temp").val()) - 1)
| $ () ->
$(".increase-temp").on "click touchend", (e) ->
e.preventDefault()
field = $("#set_temp_temp")
if parseInt(field.val()) < parseInt(field.attr("max"))
field.val(parseInt(field.val()) + 1)
$(".decrease-temp").on "click touchend", (e) ->
e.preventDefault()
field = $("#set_temp_temp... |
Add (back in) showing of progress bar at 100% when connecting. | Template.connectionStatus.helpers
meteorStatus: ->
Meteor.status()
retryPc: ->
Session.get 'offlinePc'
retrySeconds: ->
Session.get 'connectRetrySeconds'
Template.connectionStatus.events
'click #connectionStatus-retry': ->
Meteor.reconnect()
Template.connectionStatus.rendered = ->
@autorun ... | Template.connectionStatus.helpers
meteorStatus: ->
Meteor.status()
retryPc: ->
Session.get 'offlinePc'
retrySeconds: ->
Session.get 'connectRetrySeconds'
Template.connectionStatus.events
'click #connectionStatus-retry': ->
Meteor.reconnect()
Template.connectionStatus.rendered = ->
@autorun ... |
Make broken symlink text red | path = require 'path'
require 'colors'
config = require './config'
fs = require './fs'
tree = require './tree'
module.exports =
class LinkLister
constructor: ->
@devPackagesPath = path.join(config.getAtomDirectory(), 'dev', 'packages')
@packagesPath = path.join(config.getAtomDirectory(), 'packages')
get... | path = require 'path'
require 'colors'
config = require './config'
fs = require './fs'
tree = require './tree'
module.exports =
class LinkLister
constructor: ->
@devPackagesPath = path.join(config.getAtomDirectory(), 'dev', 'packages')
@packagesPath = path.join(config.getAtomDirectory(), 'packages')
get... |
Use consistent escape codes in sample prompt test. | should = require 'should'
environment = require './shared/environment'
Impromptu = require '../lib/impromptu'
path = require 'path'
exec = require('child_process').exec
describe 'Config File', ->
impromptu = new Impromptu
after (done) ->
tempDir = path.dirname impromptu.path.compiled
exec "rm -rf #{tempD... | should = require 'should'
environment = require './shared/environment'
Impromptu = require '../lib/impromptu'
path = require 'path'
exec = require('child_process').exec
describe 'Config File', ->
impromptu = new Impromptu
after (done) ->
tempDir = path.dirname impromptu.path.compiled
exec "rm -rf #{tempD... |
Clean up the unit tests to be more natural languagey | Helper = require('hubot-test-helper')
helper = new Helper('../scripts/loud.coffee')
expect = require('chai').expect
describe 'being loud', ->
room = null
beforeEach ->
room = helper.createRoom()
context 'loud memory', ->
it 'should have 3 louds after some user chatter', ->
room.user.say 'alice',... | Helper = require('hubot-test-helper')
helper = new Helper('../scripts/loud.coffee')
expect = require('chai').expect
describe 'being loud', ->
room = null
beforeEach ->
room = helper.createRoom()
context 'loud database', ->
it 'should have 3 louds after some user chatter', ->
room.user.say 'alice... |
Convert to using the JS props system | _ = require "underscore"
Transform = require "./transform"
Interpolator = require "./interpolator"
class StepInterpolator extends Interpolator.Model
initialize: (attrs, options) ->
super(attrs, options)
defaults: ->
return _.extend({}, super())
compute: (x) ->
# Apply the transform to a single val... | _ = require "underscore"
Transform = require "./transform"
Interpolator = require "./interpolator"
p = require "../../core/properties"
class StepInterpolator extends Interpolator.Model
initialize: (attrs, options) ->
super(attrs, options)
props: ->
return _.extend {}, super(), {
mode: [ p.String, ... |
Revert timeout factor change for travis | require('source-map-support').install handleUncaughtExceptions: false
mongoose = require 'mongoose'
config = require "../config/test.json"
global.testTimeoutFactor = 1
if process.env.TRAVIS is 'true'
global.testTimeoutFactor = 20
dropTestDb = (done) ->
# ensure that we can only drop the test database
if config... | require('source-map-support').install handleUncaughtExceptions: false
mongoose = require 'mongoose'
config = require "../config/test.json"
global.testTimeoutFactor = 1
if process.env.TRAVIS is 'true'
global.testTimeoutFactor = 12
dropTestDb = (done) ->
# ensure that we can only drop the test database
if config... |
Add in setting to control whether the site has a homepage | logger = require('logger-sharelatex')
_ = require('underscore')
Path = require "path"
fs = require "fs"
ErrorController = require "../Errors/ErrorController"
AuthenticationController = require('../Authentication/AuthenticationController')
homepageExists = fs.existsSync Path.resolve(__dirname + "/../../../views/exter... | logger = require('logger-sharelatex')
Settings = require('settings-sharelatex')
_ = require('underscore')
Path = require "path"
fs = require "fs"
ErrorController = require "../Errors/ErrorController"
AuthenticationController = require('../Authentication/AuthenticationController')
homepageExists = fs.existsSync Path.... |
Add basic C, C++, Objective-C, and Objective-C++ specs | CodeContext = require '../lib/code-context'
grammarMap = require '../lib/grammars'
describe 'grammarMap', ->
beforeEach ->
@codeContext = new CodeContext('test.txt', '/tmp/test.txt', null)
# TODO: Test using an actual editor or a selection?
@dummyTextSource = {}
@dummyTextSource.getText = -> ""
it... | CodeContext = require '../lib/code-context'
grammarMap = require '../lib/grammars'
describe 'grammarMap', ->
beforeEach ->
@codeContext = new CodeContext('test.txt', '/tmp/test.txt', null)
# TODO: Test using an actual editor or a selection?
@dummyTextSource = {}
@dummyTextSource.getText = -> ""
it... |
Add deprecated shim for TextEditor export | 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: ... | TextBuffer = require 'text-buffer'
{Point, Range} = TextBuffer
{File, Directory} = require 'pathwatcher'
{Emitter, Disposable, CompositeDisposable} = require 'event-kit'
Grim = require 'grim'
module.exports =
BufferedNodeProcess: require '../src/buffered-node-process'
BufferedProcess: require '../src/buffered-proc... |
Remove token header from angular `$http` | define [
"libs"
"modules/recursionHelper"
"modules/errorCatcher"
"modules/localStorage"
"utils/underscore"
], () ->
App = angular.module("SharelatexApp", [
"ui.bootstrap"
"autocomplete"
"RecursionHelper"
"ng-context-menu"
"underscore"
"ngSanitize"
"ipCookie"
"mvdSixpack"
"ErrorCatcher"
"localS... | define [
"libs"
"modules/recursionHelper"
"modules/errorCatcher"
"modules/localStorage"
"utils/underscore"
], () ->
App = angular.module("SharelatexApp", [
"ui.bootstrap"
"autocomplete"
"RecursionHelper"
"ng-context-menu"
"underscore"
"ngSanitize"
"ipCookie"
"mvdSixpack"
"ErrorCatcher"
"localS... |
Trim zero-width spaces from input. | # Import all known parsers in a convenient map.
asDriver = (parser) ->
(raw) -> "\n" + parser(raw.split(/\n/)).join("\n") + "\n"
exports.identity = asDriver require './identity'
exports.slackapp = asDriver require './slackapp'
| # Import all known parsers in a convenient map.
asDriver = (parser) ->
(raw) ->
trimmed = raw.replace(/\u200B/g, "")
"\n" + parser(trimmed.split(/\n/)).join("\n") + "\n"
exports.identity = asDriver require './identity'
exports.slackapp = asDriver require './slackapp'
|
Check if opElement exists before setting in manage users search | #= require "../users/new"
$ ->
if isOnPage 'manage', 'users'
mconf.Resources.addToBind ->
mconf.Users.New.bind()
window.onpopstate = (event) ->
window.location.href = mconf.Base.urlFromParts(event.state)
event.state
$('input.resource-filter-field').each ->
input = $(this)
... | #= require "../users/new"
$ ->
if isOnPage 'manage', 'users'
mconf.Resources.addToBind ->
mconf.Users.New.bind()
window.onpopstate = (event) ->
window.location.href = mconf.Base.urlFromParts(event.state)
event.state
$('input.resource-filter-field').each ->
input = $(this)
... |
Reset window title after each spec | beforeEach ->
@previousHref = location.href
@previousTitle = document.title
afterEach ->
if up.browser.canPushState()
history.replaceState?({}, @previousTitle, @previousHref)
| beforeEach ->
@previousHref = location.href
@previousTitle = document.title
afterEach ->
if up.browser.canPushState()
history.replaceState?({}, @previousTitle, @previousHref)
document.title = @previousTitle
|
Fix error where one too many dummy items were created | "use strict"
ObjectID = require('mongodb').ObjectID
Moniker = require('moniker')
rand = (min, max) -> Math.floor (Math.random() * (max - min + 1) + min)
lisence = [
"CC BY-NC-ND 3.0 NO"
"CC BY-NC 3.0 NO"
"CC BY-ND 3.0 NO"
"CC BY 3.0 NO"
]
provider = [
"DNT"
"NRK"
"TURAPP"
]
module.exports = (num) ->
... | "use strict"
ObjectID = require('mongodb').ObjectID
Moniker = require('moniker')
rand = (min, max) -> Math.floor (Math.random() * (max - min + 1) + min)
lisence = [
"CC BY-NC-ND 3.0 NO"
"CC BY-NC 3.0 NO"
"CC BY-ND 3.0 NO"
"CC BY 3.0 NO"
]
provider = [
"DNT"
"NRK"
"TURAPP"
]
module.exports = (num) ->
... |
Concatenate and minifiy js files | module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
cssmin:
compileMain:
src: 'public/stylesheets/style.css'
dest: 'public/stylesheets/style.min.css'
less:
dev:
options:
paths: ['public/stylesheets/']
files:
... | module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
cssmin:
compileMain:
src: 'public/stylesheets/style.css'
dest: 'public/stylesheets/style.min.css'
less:
dev:
options:
paths: ['public/stylesheets/']
files:
... |
Add missing "not found" string | counterpart = require 'counterpart'
React = require 'react'
TitleMixin = require '../lib/title-mixin'
apiClient = require '../api/client'
OwnedCardList = require '../components/owned-card-list'
counterpart.registerTranslations 'en',
projectsPage:
title: 'All Projects'
countMessage: 'Showing %(count)s found'
... | counterpart = require 'counterpart'
React = require 'react'
TitleMixin = require '../lib/title-mixin'
apiClient = require '../api/client'
OwnedCardList = require '../components/owned-card-list'
counterpart.registerTranslations 'en',
projectsPage:
title: 'All Projects'
countMessage: 'Showing %(count)s found'
... |
Read and store city district in cookie | jQuery ($) ->
$("aside.feedback .trigger").click ->
$(@).hide()
$("aside.feedback form").slideDown(100)
$('html, body').animate
scrollTop: $("aside.feedback").offset().top - 45
, 100
$("aside.contact-us .write-to-us").click (event) ->
event.preventDefault()
$form = $(@).hide().closest... | jQuery ($) ->
$("aside.feedback .trigger").click ->
$(@).hide()
$("aside.feedback form").slideDown(100)
$('html, body').animate
scrollTop: $("aside.feedback").offset().top - 45
, 100
$("aside.contact-us .write-to-us").click (event) ->
event.preventDefault()
$form = $(@).hide().closest... |
Move menu item to 'Haskell IDE' menu | # See https://atom.io/docs/latest/hacking-atom-package-word-count#menus for more details
'context-menu':
'atom-text-editor': [
{
'label': 'Toggle ide-haskell-repl'
'command': 'ide-haskell-repl:toggle'
}
]
'menu': [
{
'label': 'Packages'
'submenu': [
'label': 'ide-haskell-repl'
... | 'menu': [
'label': 'Haskell IDE'
'submenu': [
'label': 'Toggle REPL'
'command': 'ide-haskell-repl:toggle'
]
]
|
Add support for == and === | module.exports =
selector: ['.text.html.php']
id: 'aligner-php' # package name
config:
'=>-alignment':
title: 'Padding for =>'
description: 'Pad left or right of the character'
type: 'string'
enum: ['left', 'right']
default: 'left'
'=>-leftSpace':
title: 'Left space for... | module.exports =
selector: ['.text.html.php']
id: 'aligner-php' # package name
config:
'=>-alignment':
title: 'Padding for =>'
description: 'Pad left or right of the character'
type: 'string'
enum: ['left', 'right']
default: 'left'
'=>-leftSpace':
title: 'Left space for... |
Remove producers without lat + long from map | Darkswarm.factory "OfnMap", (Enterprises, EnterpriseModal, visibleFilter) ->
new class OfnMap
constructor: ->
@enterprises = @enterprise_markers(Enterprises.enterprises)
enterprise_markers: (enterprises) ->
@extend(enterprise) for enterprise in visibleFilter(enterprises)
# Adding methods to ... | Darkswarm.factory "OfnMap", (Enterprises, EnterpriseModal, visibleFilter) ->
new class OfnMap
constructor: ->
@enterprises = @enterprise_markers(Enterprises.enterprises)
@enterprises = @enterprises.filter (enterprise) ->
enterprise.latitude || enterprise.longitude # Remove enterprises w/o lat ... |
Add value and width props to Range class | class App.Range
constructor: (@min, @max) ->
@values = [@min, @max] | class App.Range
constructor: (@min, @max) ->
@values = [@min, @max]
@width = @max - @min |
Clean up database master require. | # class KeyValue
# get: (key, callback) ->
# get_all: (keys, callback) ->
# keys: (pattern, callback) ->
# set: (key, value, callback) ->
# atomic_set: (key, value, callback) ->
# del: (key, callback) ->
# flush: (callback) ->
# # map: (object, emit) -> ... emit(key, value) ...
# # reduce: (key, value... | # class KeyValue
# get: (key, callback) ->
# get_all: (keys, callback) ->
# keys: (pattern, callback) ->
# set: (key, value, callback) ->
# atomic_set: (key, value, callback) ->
# del: (key, callback) ->
# flush: (callback) ->
# # map: (object, emit) -> ... emit(key, value) ...
# # reduce: (key, value... |
Remove view when package is deactivated | _ = require 'underscore'
module.exports =
projectPaths: null
fuzzyFinderView: null
loadPathsTask: null
activate: (state) ->
rootView.command 'fuzzy-finder:toggle-file-finder', =>
@createView().toggleFileFinder()
rootView.command 'fuzzy-finder:toggle-buffer-finder', =>
@createView().toggleB... | _ = require 'underscore'
module.exports =
projectPaths: null
fuzzyFinderView: null
loadPathsTask: null
activate: (state) ->
rootView.command 'fuzzy-finder:toggle-file-finder', =>
@createView().toggleFileFinder()
rootView.command 'fuzzy-finder:toggle-buffer-finder', =>
@createView().toggleB... |
Refactor for new sidebar list controller. | class AddWorkspaceView extends KDCustomHTMLView
constructor: (options = {}, data) ->
options.cssClass = 'add-workspace-view'
super options, data
@addSubView new KDCustomHTMLView tagName: 'figure'
@addSubView @input = new KDInputView
type : 'text'
keydown : @bound 'handleKeyDown'... | class AddWorkspaceView extends KDCustomHTMLView
constructor: (options = {}, data) ->
options.cssClass = 'add-workspace-view kdlistitemview-main-nav workspace'
super options, data
@addSubView new KDCustomHTMLView tagName: 'figure'
@addSubView @input = new KDInputView
type : 'text'
... |
Remove old comments and add new donation name type ahead | # Once we can edit donations, this should behave like addOrderRow from orders.coffee
addDonationRow = ->
row = $ tmpl("donation-row-template", {})
$("#donation-table tbody").append row
row.find("select").select2(theme: "bootstrap")
expose "addInitialDonationRow", ->
$ ->
# Once we can edit donations, this ... | addDonationRow = ->
row = $ tmpl("donation-row-template", {})
$("#donation-table tbody").append row
row.find("select").select2(theme: "bootstrap")
expose "addInitialDonationRow", ->
$ ->
addDonationRow()
$(document).on "click", "#add-donation-row", (event) ->
event.preventDefault()
addDonationRow()
b... |
Load scenefrom from command line. |
Reflector = require './lib/reflector'
WebsocketServer = require './lib/websocket_server'
Scene = require './scene'
class Server
constructor: (@filename, @port) ->
Scene.load(@filename, @onLoaded)
onLoaded: (scene) =>
@scene = scene
# The reflector handles sending updates to the scene to observers
... | _ = require 'underscore'
Reflector = require './lib/reflector'
WebsocketServer = require './lib/websocket_server'
Scene = require './scene'
class Server
constructor: (@filename, @port) ->
console.log "Loading '#{@filename}'..."
Scene.load(@filename, @onLoaded)
onLoaded: (scene) =>
@scene = scene
... |
Remove Go to Declaration from mini editor context menu | 'menu': [
{
'label': 'Packages'
'submenu': [
'label': 'Symbols'
'submenu': [
{ 'label': 'File Symbols', 'command': 'symbols-view:toggle-file-symbols' }
{ 'label': 'Project Symbols', 'command': 'symbols-view:toggle-project-symbols' }
]
]
}
]
'context-menu':
'atom-text... | 'menu': [
{
'label': 'Packages'
'submenu': [
'label': 'Symbols'
'submenu': [
{ 'label': 'File Symbols', 'command': 'symbols-view:toggle-file-symbols' }
{ 'label': 'Project Symbols', 'command': 'symbols-view:toggle-project-symbols' }
]
]
}
]
'context-menu':
'atom-text... |
Switch task completion csv download | angular.module("doubtfire.api.models.task-completion-csv", [])
.service("TaskCompletionCsv", (DoubtfireConstants, $window, currentUser) ->
this.downloadFile = (unit) ->
$window.open "#{DoubtfireConstants.API_URL}/csv/units/#{unit.id}/task_completion.json?auth_token=#{currentUser.authenticationToken}", "_blank"
... | angular.module("doubtfire.api.models.task-completion-csv", [])
.service("TaskCompletionCsv", (DoubtfireConstants, $window, currentUser, fileDownloaderService) ->
this.downloadFile = (unit) ->
fileDownloaderService.downloadFile "#{DoubtfireConstants.API_URL}/csv/units/#{unit.id}/task_completion.json?auth_token=#{... |
Update PaymentConstants for failed attempts | globals = require 'globals'
module.exports =
getOperation : (current, selected) ->
arr = [
@planTitle.FREE
@planTitle.HOBBYIST
@planTitle.DEVELOPER
@planTitle.PROFESSIONAL
]
current = arr.indexOf current
selected = arr.indexOf selected
return switch
when selecte... | globals = require 'globals'
module.exports =
getOperation : (current, selected) ->
arr = [
@planTitle.FREE
@planTitle.HOBBYIST
@planTitle.DEVELOPER
@planTitle.PROFESSIONAL
]
current = arr.indexOf current
selected = arr.indexOf selected
return switch
when selecte... |
Add ctrl-space binding for autocomplete | window.keymap.bindKeys '.editor',
'escape': 'autocomplete:attach'
window.keymap.bindKeys '.autocomplete .editor',
'enter': 'autocomplete:confirm'
'escape': 'autocomplete:cancel'
| window.keymap.bindKeys '.editor',
'escape': 'autocomplete:attach'
'ctrl-space': 'autocomplete:attach'
window.keymap.bindKeys '.autocomplete .editor',
'enter': 'autocomplete:confirm'
'escape': 'autocomplete:cancel'
'ctrl-space': 'autocomplete:cancel'
|
Add test project creation setup | request = require 'request'
async = require 'async'
should = require 'should'
_ = require 'underscore'
uuid = require 'uuid'
startApp = require './../start_app'
base = require './../base'
options = require './../options'
describe 'Projects', ->
before (done) ->
startApp -> done()
it 'should get all projects'... | request = require 'request'
async = require 'async'
should = require 'should'
_ = require 'underscore'
uuid = require 'uuid'
startApp = require './../start_app'
base = require './../base'
options = require './../options'
validProject = (p)->
p.should.have.property 'name'
p.should.have.property 'userid'
p.should... |
Fix URL parsing for bitbucket | module.exports = [{
# Bitbucket
exps: [
/^git@(bitbucket\.org):(.+)\/(.+)\.git$/
/^https:\/\/(bitbucket\.org)\/(.+)\/(.+)\.git$/
/^https:\/\/.+@(bitbucket\.org)\/(.+)\/(.+)\.git$/
]
template: "https://{host}/{user}/{repo}/commits/{hash}"
},{
# Generic (Github, GitLab and others)
exps: [
/^gi... | module.exports = [{
# Bitbucket
exps: [
/^git@(bitbucket\.org):(.+)\/(.+)\.git$/
/^https:\/\/(bitbucket\.org)\/(.+)\/(.+)(\.git)?$/
/^https:\/\/.+@(bitbucket\.org)\/(.+)\/(.+)(\.git)?$/
]
template: "https://{host}/{user}/{repo}/commits/{hash}"
},{
# Generic (Github, GitLab and others)
exps: [
... |
Set the right linter args from cur editor grammar | linterPath = atom.packages.getLoadedPackage("linter").path
Linter = require "#{linterPath}/lib/linter"
path = require 'path'
class LinterClang extends Linter
# The syntax that the linter handles. May be a string or
# list/tuple of strings. Names should be all lowercase.
@syntax: ['source.c++']
# A string, lis... | linterPath = atom.packages.getLoadedPackage("linter").path
Linter = require "#{linterPath}/lib/linter"
path = require 'path'
class LinterClang extends Linter
# The syntax that the linter handles. May be a string or
# list/tuple of strings. Names should be all lowercase.
@syntax: ['source.c++', 'source.c']
# A... |
Refactor TerminalPane to work with multiple VMs. | class TerminalPane extends Pane
constructor: (options = {}, data) ->
options.cssClass = 'terminal-pane terminal'
super options, data
createWebTermView: ->
@fetchVm (err, vm) =>
@addSubView @webterm = new WebTermView
cssClass : 'webterm'
advancedSettings : no
... | class TerminalPane extends Pane
constructor: (options = {}, data) ->
options.cssClass = 'terminal-pane terminal'
options.vm or= null
super options, data
createTerminal: (vm) ->
@addSubView @webterm = new WebTermView
cssClass : 'webterm'
advancedSettings : no
del... |
Add some actual tests for toolbar | require './spec-helper'
ToolbarView = require '../app/coffee/toolbar.coffee'
describe 'ToolbarView', ->
it 'can be create', ->
expect(new ToolbarView('test', [])).not.toBeNull()
| require './spec-helper'
$ = require 'jquery'
{View, $$} = require 'space-pen'
ToolbarView = require '../app/coffee/toolbar.coffee'
targetDiv = '<div id="target"></div>'
FIXTURE_FUN = (e, $this, context) ->
console.log e, $this, context
FIXTURE_DEF = [
{
id: 'bold',
tip: 'Bold',
label: '<i class="fa ... |
Set state to OK once we have projects | noflo = require 'noflo'
exports.getComponent = ->
c = new noflo.Component
c.inPorts.add 'token',
datatype: 'string'
c.outPorts.add 'projects',
datatype: 'object'
c.outPorts.add 'error',
datatype: 'object'
noflo.helpers.WirePattern c,
in: 'token'
out: 'projects'
async: true
, (token... | noflo = require 'noflo'
exports.getComponent = ->
c = new noflo.Component
c.inPorts.add 'token',
datatype: 'string'
c.outPorts.add 'projects',
datatype: 'object'
c.outPorts.add 'error',
datatype: 'object'
noflo.helpers.WirePattern c,
in: 'token'
out: 'projects'
async: true
, (token... |
Fix sporadic test failure in IE | 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,... |
Revert "Better import for multiple Elm components." | $ = require('jquery')
bootstrap = require('bootstrap')
Elm = require('./Main.elm')
Elm.embed(Elm.JdClock, document.getElementById('jd-clock'))
Elm.embed(Elm.JdConverter, document.getElementById('elm-jd-converter'),
{timezoneOffset: new Date().getTimezoneOffset() * 60000})
$ ->
$('.julian-day').tooltip
co... | $ = require('jquery')
bootstrap = require('bootstrap')
ElmJdClock = require('./JdClock.elm')
ElmJdConverter = require('./JdConverter.elm')
ElmJdClock.embed(ElmJdClock.JdClock, document.getElementById('jd-clock'))
ElmJdConverter.embed(ElmJdConverter.JdConverter, document.getElementById('elm-jd-converter'),
{timezoneOf... |
Add wage theft report info endpoint | # External Dependencies
debug = require('debug')('minimum-wage-service')
express = require 'express'
# Express Components
router = express.Router()
#Internal Dependencies
employer_size_router = require './employer_size'
survey_router = require './survey'
router.all '*', (req,res,next) ->
res.header("Access-Contro... | # External Dependencies
debug = require('debug')('minimum-wage-service')
express = require 'express'
# Express Components
router = express.Router()
#Internal Dependencies
employer_size_router = require './employer_size'
survey_router = require './survey'
router.all '*', (req,res,next) ->
res.header("Access-Contro... |
Add naked requires for circle and draggable | {SVG} = require '../test/vendor/svg'
require './_module'
require './import'
PointerTool = require './pointer-tool'
SelectionModel = require './selection-model'
SelectionView = require './selection-view'
module.exports =
class SvgDocument
constructor: (svgContent, rootNode) ->
@svg = SVG(rootNode)
window.svg... | {SVG} = require '../test/vendor/svg'
require '../test/vendor/svg.circle.js'
require '../test/vendor/svg.draggable.js'
require './_module'
require './import'
PointerTool = require './pointer-tool'
SelectionModel = require './selection-model'
SelectionView = require './selection-view'
module.exports =
class SvgDocument... |
Insert new file input on focus instead of after change. | # Image upload control
class @ImageUpload
uploadMethod: null
constructor: (@container)->
@setupNestedAttributes()
@setupSwtiching()
setupNestedAttributes: ->
@container.nestedAttributes
bindAddTo: $(".actions .add")
collectionName: 'images'
collectIdAttributes: false
$clone:... | # Image upload control
class @ImageUpload
uploadMethod: null
constructor: (@container)->
@setupNestedAttributes()
@setupSwtiching()
setupNestedAttributes: ->
@container.nestedAttributes
bindAddTo: $(".actions .add")
collectionName: 'images'
collectIdAttributes: false
$clone:... |
Add specs for none selected and some selected callbacks. | describe 'thumb_selector', ->
beforeEach ->
loadFixtures 'thumb_selector.html'
window.thumb_selector_init()
describe 'inidividual selection', ->
it 'gives its parents the selected class when checked', ->
$('#check1').prop('checked', true).trigger('change')
expect($('#div1')).toHaveClass('s... | describe 'thumb_selector', ->
beforeEach ->
loadFixtures 'thumb_selector.html'
window.thumb_selector_init()
describe 'individual selection', ->
it 'gives its parents the selected class when checked', ->
$('#check1').prop('checked', true).trigger('change')
expect($('#div1')).toHaveClass('se... |
Use skinny arrow for WrapGuide.initialize() | {View} = require 'space-pen'
$ = require 'jquery'
_ = require 'underscore'
module.exports =
class WrapGuideView extends View
@activate: ->
rootView.eachEditor (editor) =>
editor.underlayer.append(new WrapGuideView(editor)) if editor.attached
@content: ->
@div class: 'wrap-guide'
defaultColumn: 80... | {View} = require 'space-pen'
$ = require 'jquery'
_ = require 'underscore'
module.exports =
class WrapGuideView extends View
@activate: ->
rootView.eachEditor (editor) =>
editor.underlayer.append(new WrapGuideView(editor)) if editor.attached
@content: ->
@div class: 'wrap-guide'
defaultColumn: 80... |
Add test to ensure an event is emitted. | {BattleServer} = require('../').server
describe 'BattleServer', ->
it 'can create a new battle', ->
server = new BattleServer
battleId = server.createBattle()
server.battles.should.have.ownProperty battleId
| sinon = require 'sinon'
{BattleServer, Player} = require('../').server
describe 'BattleServer', ->
it 'can create a new battle', ->
server = new BattleServer
battleId = server.createBattle()
server.battles.should.have.ownProperty battleId
it "emits the 'start battle' event for each matched player", ->... |
Use only one reactiveVar to manage tableExporting state | Template.downloadCSVModal.onCreated ->
@prepared = new ReactiveVar(null)
@preparing = new ReactiveVar(false)
@autorun =>
if @prepared.get()
@preparing.set(false)
Template.downloadCSVModal.onRendered ->
@data.rendered()
Template.downloadCSVModal.helpers
getField: (row, field)->
row[field]
p... | Template.downloadCSVModal.onCreated ->
@tableExport = new ReactiveVar(true)
Template.downloadCSVModal.onRendered ->
@data.rendered()
Template.downloadCSVModal.helpers
getField: (row, field)->
row[field]
preparing: ->
not Template.instance().tableExport.get()
Template.downloadCSVModal.events
'click... |
Remove outdated options from datetimepicker call | #= require jquery
#= require jquery_ujs
#= require jquery-fileupload/basic
#= require jquery-fileupload/vendor/tmpl
#= require attachments
#= require dropzone_effects
#= require bootstrap-sprockets
#= require moment
#= require moment/de
#= require bootstrap-datetimepicker
#= require marked.min
# http://github.com/t... | #= require jquery
#= require jquery_ujs
#= require jquery-fileupload/basic
#= require jquery-fileupload/vendor/tmpl
#= require attachments
#= require dropzone_effects
#= require bootstrap-sprockets
#= require moment
#= require moment/de
#= require bootstrap-datetimepicker
#= require marked.min
# http://github.com/t... |
Add keybinding for row and columns insertion commands | # 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... |
Rename sitemap in content tree | xml = require 'xml'
module.exports = (env, callback) ->
class Sitemap extends env.plugins.Page
getFilename: ->
'sitemap.xml'
getPages: (contents) ->
pages = []
for filename in Object.keys contents
content = contents[filename]
if content instanceof env.plugins.MarkdownPage... | xml = require 'xml'
module.exports = (env, callback) ->
class Sitemap extends env.plugins.Page
getFilename: ->
'sitemap.xml'
getPages: (contents) ->
pages = []
for filename in Object.keys contents
content = contents[filename]
if content instanceof env.plugins.MarkdownPage... |
Fix undefined error on destroy | HighlightedAreaView = require './highlighted-area-view'
module.exports =
config:
onlyHighlightWholeWords:
type: 'boolean'
default: false
hideHighlightOnSelectedWord:
type: 'boolean'
default: false
ignoreCase:
type: 'boolean'
default: false
lightTheme:
type: '... | HighlightedAreaView = require './highlighted-area-view'
module.exports =
config:
onlyHighlightWholeWords:
type: 'boolean'
default: false
hideHighlightOnSelectedWord:
type: 'boolean'
default: false
ignoreCase:
type: 'boolean'
default: false
lightTheme:
type: '... |
Add initial cache lookup method | Module = require 'module'
fs = require 'fs-plus'
originalResolveFilename = Module._resolveFilename
# Precompute versions of all modules in node_modules
# Precompute the version each file is compatible
Module._resolveFilename = (relative, parent) ->
resolved = originalResolveFilename.apply(global, arguments)
if r... | Module = require 'module'
fs = require 'fs-plus'
originalResolveFilename = Module._resolveFilename
# Precompute versions of all modules in node_modules
# Precompute the version each file is compatible
getCachedModulePath = (relative, parent) ->
return unless relative
return unless parent?.id
return if relativ... |
Hide "advancedMode" option and assume it as always true | FormView = require './form-view'
Configuration = require './configuration.coffee'
class ConfigurationFormView extends FormView
initialize: ->
super
@addRow @createTitleRow("Editing Tools Configuration")
# @addRow @createFieldRow("repoUrl", "text", Configuration.labels.repoUrl)
@addRow @createFieldR... | FormView = require './form-view'
Configuration = require './configuration.coffee'
class ConfigurationFormView extends FormView
initialize: ->
super
@addRow @createTitleRow("Editing Tools Configuration")
# @addRow @createFieldRow("repoUrl", "text", Configuration.labels.repoUrl)
@addRow @createFieldR... |
Add double click fix to last commit | initMobileMenu = ->
$body = $('body')
$inputQuery = $("#search_form_query")
$homeTemplate = $("body.template--pages-home").length
$inputLocationContainer = $(".search_form_search_location")
$submit = $(".main-search__submit")
$distributor = $(".Distributor--navigation")
smartphone = ($(window).width() < ... | initMobileMenu = ->
$body = $('body')
$inputQuery = $("#search_form_query")
$homeTemplate = $("body.template--pages-home").length
$inputLocationContainer = $(".search_form_search_location")
$submit = $(".main-search__submit")
$distributor = $(".Distributor--navigation")
smartphone = ($(window).width() < ... |
Load / run scripts synchronously | fs = require "fs"
path = require "path"
module.exports = (robot, scripts) ->
scriptsPath = path.resolve(__dirname, "src")
fs.exists scriptsPath, (exists) ->
if exists
for script in fs.readdirSync(scriptsPath)
if scripts? and "*" not in scripts
robot.loadF... | fs = require 'fs'
path = require 'path'
module.exports = (robot, scripts) ->
scriptsPath = path.resolve(__dirname, 'src')
if fs.existsSync scriptsPath
for script in fs.readdirSync(scriptsPath).sort()
if scripts? and '*' not in scripts
robot.loadFile(scriptsPath, script) if s... |
Stop doing hard stuff on every request | _ = require('underscore')
httpVerbWhitelist = ['GET']
module.exports = (req, res, next) ->
if process.env.NODE_ENV is 'production'
httpVerbWhitelist = []
return next() if /^\/login/.test(req.path)
return next() if process.env.NODE_ENV == 'test'
return next() if req.isAuthenticated() or _.contains(httpVer... | _ = require('underscore')
httpVerbWhitelist = ['GET']
if process.env.NODE_ENV is 'production'
httpVerbWhitelist = []
module.exports = (req, res, next) ->
return next() if /^\/login/.test(req.path)
return next() if process.env.NODE_ENV == 'test'
return next() if req.isAuthenticated() or _.contains(httpVerbWhit... |
Update deprecated selectors in keymap | '.platform-darwin, .platform-win32, .platform-linux':
'ctrl-g': 'go-to-line:toggle'
'.go-to-line .mini.editor input':
'enter': 'core:confirm',
'escape': 'core:cancel'
'.platform-darwin .go-to-line .mini.editor input':
'cmd-w': 'core:cancel'
'.platform-win32 .go-to-line .mini.editor input':
'ctrl-w': 'core:... | '.platform-darwin, .platform-win32, .platform-linux':
'ctrl-g': 'go-to-line:toggle'
'.go-to-line atom-text-editor[mini]':
'enter': 'core:confirm',
'escape': 'core:cancel'
'.platform-darwin .go-to-line atom-text-editor[mini]':
'cmd-w': 'core:cancel'
'.platform-win32 .go-to-line atom-text-editor[mini]':
'ctr... |
Fix routing of recent activity links | React = require 'react'
ReactRouter = require 'react-router'
Router = ReactRouter.Router
Link = ReactRouter.Link
DidYouKnowHandler = require './did_you_know_handler'
PlagiarismHandler = require './plagiarism_handler'
RecentEditsHandler = require './recent_edits_handler'
RecentActivityHandler = R... | React = require 'react'
ReactRouter = require 'react-router'
Router = ReactRouter.Router
Link = ReactRouter.Link
DidYouKnowHandler = require './did_you_know_handler'
PlagiarismHandler = require './plagiarism_handler'
RecentEditsHandler = require './recent_edits_handler'
RecentActivityHandler = R... |
Hide the panel when it looses focues | class MainChatPanel extends JView
constructor:->
super
cssClass : 'main-chat-panel visible'
@registerSingleton "chatPanel", @, yes
@header = new MainChatHeader
@conversationList = new ChatConversationListView
@conversationListController = new ChatConversationListController
view : @c... | class MainChatPanel extends JView
constructor:->
super
cssClass : 'main-chat-panel'
@registerSingleton "chatPanel", @, yes
@header = new MainChatHeader
@conversationList = new ChatConversationListView
@conversationListController = new ChatConversationListController
view : @conversat... |
Fix error message upon page load failure. | async = require "async"
{assign} = require "lodash"
class PhantomTask
constructor: (options) ->
@jobs = []
@scripts = []
@options = assign {}, options
@page = require('./webpage').create()
add: (request, description = "Job ##{@jobs.length}", options = {}) ->
task = require(request) options
@jobs.push... | async = require "async"
{assign} = require "lodash"
class PhantomTask
constructor: (options) ->
@jobs = []
@scripts = []
@options = assign {}, options
@page = require('./webpage').create()
add: (request, description = "Job ##{@jobs.length}", options = {}) ->
task = require(request) options
@jobs.push... |
Optimize performance by reducing amount of DB requests | if Meteor.isServer
@Sessions = new Meteor.Collection("session_timeouts")
Meteor.methods( {
session_heartbeat: ->
user_id = Meteor.userId()
return unless user_id
old_session = Sessions.findOne({user_id: user_id})
if old_session?
Sessions.update({user_i... | if Meteor.isServer
@Sessions = new Meteor.Collection("session_timeouts")
Meteor.methods( {
session_heartbeat: ->
user_id = Meteor.userId()
return unless user_id
old_session = Sessions.findOne({user_id: user_id})
if old_session?
Sessions.update({user_i... |
Fix initialization of empty selects. | `import Em from "vendor/ember"`
Component = Em.Component.extend
initializeValue: Em.on "init", ->
prompt = @get "content.prompt"
if prompt
options = @get "content.options"
if prompt isnt options[0].label
options.unshift
label: prompt
... | `import Em from "vendor/ember"`
Component = Em.Component.extend
initializeValue: Em.on "init", ->
prompt = @get "content.prompt"
if prompt
options = @get "content.options"
if prompt isnt options[0].label
options.unshift
label: prompt
... |
Use {prod, dev}tunnel for tunnelled kites | globals = require 'globals'
module.exports = (url) ->
return url if globals.config.environment is 'dev'
return url if /p.koding.com/.test url
# let's use DOM for parsing the url
parser = global.document.createElement('a')
parser.href = url
# build our new url, example:
# old: http://54.164.174.218:3... | globals = require 'globals'
module.exports = (url) ->
return url if globals.config.environment is 'dev'
return url if /p\.koding\.com/.test url
# let's use DOM for parsing the url
parser = global.document.createElement('a')
parser.href = url
# build our new url, example:
# old: http://54.164.174.218... |
Allow user to specify port | #!/usr/bin/env coffee
express = require 'express'
path = require 'path'
favicon = require 'serve-favicon'
logger = require 'morgan'
methodOverride = require 'method-override'
session = require 'express-session'
bodyParser = require 'body-parser'
multer = require 'mult... | #!/usr/bin/env coffee
express = require 'express'
path = require 'path'
favicon = require 'serve-favicon'
logger = require 'morgan'
methodOverride = require 'method-override'
session = require 'express-session'
bodyParser = require 'body-parser'
multer = require 'mult... |
Rename the homepage param to simple for clarity | counterpart = require 'counterpart'
React = require 'react'
TitleMixin = require '../lib/title-mixin'
apiClient = require '../api/client'
OwnedCardList = require '../components/owned-card-list'
counterpart.registerTranslations 'en',
projectsPage:
title: 'All Projects'
countMessage: 'Showing %(pageStart)s-%(p... | counterpart = require 'counterpart'
React = require 'react'
TitleMixin = require '../lib/title-mixin'
apiClient = require '../api/client'
OwnedCardList = require '../components/owned-card-list'
counterpart.registerTranslations 'en',
projectsPage:
title: 'All Projects'
countMessage: 'Showing %(pageStart)s-%(p... |
Call getPath on Editor instead of EditorView | {_, $, 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'
... |
Use underlayer property on editor | {View} = require 'space-pen'
$ = require 'jquery'
_ = require 'underscore'
module.exports =
class WrapGuideView extends View
@activate: ->
rootView.eachEditor (editor) =>
@appendToEditorPane(rootView, editor) if editor.attached
@appendToEditorPane: (rootView, editor) ->
if underlayer = editor.find('... | {View} = require 'space-pen'
$ = require 'jquery'
_ = require 'underscore'
module.exports =
class WrapGuideView extends View
@activate: ->
rootView.eachEditor (editor) =>
editor.underlayer.append(new WrapGuideView(editor)) if editor.attached
@content: ->
@div class: 'wrap-guide'
defaultColumn: 80... |
Add bowercopy task for pages | module.exports = (grunt) ->
require('time-grunt')(grunt)
require('load-grunt-config')(grunt)
grunt.registerTask 'default', ['clean', 'amd_tamer', 'uglify']
grunt.registerTask 'test', ['jshint']
grunt.registerTask 'doc', ['groc']
grunt.registerTask 'pages', ['metalsmith', 'doc']
| module.exports = (grunt) ->
require('time-grunt')(grunt)
require('load-grunt-config')(grunt)
grunt.registerTask 'default', ['clean', 'amd_tamer', 'uglify']
grunt.registerTask 'test', ['jshint']
grunt.registerTask 'doc', ['groc']
grunt.registerTask 'pages', ['metalsmith', 'doc', 'bowercopy']
|
Add method on ActionCreator to generate a request id | dispatcher = require './dispatcher'
invariant = require './invariant'
Action = require './action'
_id = 0
class ActionInstance
constructor: (@type, @payload) ->
@actionID = _id++
Object.freeze @
valueOf: () ->
@payload
getActionID: () ->
@actionID
module.exports = class ActionCreator
###
# Method fo... | dispatcher = require './dispatcher'
invariant = require './invariant'
Action = require './action'
_actionID = 0
_requestID = 0
class ActionInstance
constructor: (@type, @payload) ->
@actionID = _actionID++
Object.freeze @
valueOf: () ->
@payload
getActionID: () ->
@actionID
module.exports = class Actio... |
Enable only in dev mode | {$} = require 'atom'
UIWatcher = require './ui-watcher'
module.exports =
activate: (state) ->
uiWatcher = null
# HACK: I need an actvation event when the ui or packages are all loaded.
# It cant watch all the packages until they are all loaded.
createUIWatcher = ->
uiWatcher = new UIWatcher
... | {$} = require 'atom'
UIWatcher = require './ui-watcher'
module.exports =
activate: (state) ->
return unless atom.getLoadSettings().devMode
console.log 'Enabling live reloader...'
uiWatcher = null
# HACK: I need an actvation event when the ui or packages are all loaded.
# It cant watch all the ... |
Add snippet for Magento getChildHtml method | # Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#... | # Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#... |
Implement a queuing system to avoid quadratic pipe reading time in node IPC. | idCounter = 0
module.exports =
class SpellCheckTask
@handler: null
@callbacksById: {}
constructor: (@task) ->
@id = idCounter++
terminate: ->
delete @constructor.callbacksById[@id]
start: (buffer) ->
# Figure out the paths since we need that for checkers that are project-specific.
projectP... | idCounter = 0
log = console.log
module.exports =
class SpellCheckTask
@handler: null
@callbacksById: {}
@isBusy: false
@queue: []
constructor: (@task) ->
@id = idCounter++
terminate: ->
delete @constructor.callbacksById[@id]
start: (buffer) ->
# Figure out the paths since we need that for ... |
Fix 'undefined is not a function' error | passport = require 'passport'
exports.logInFirst = (req, res, next) ->
if req.isAuthenticated()
next()
else
res.redirect "/auth/login?next=#{req.path}"
exports.storeNext = (req, res, next) ->
if req.query.next
req.session.next = req.query.next
next()
exports.login =
passport.authenticate 'goog... | passport = require 'passport'
exports.logInFirst = (req, res, next) ->
if req.isAuthenticated()
next()
else
res.redirect "/auth/login?next=#{req.path}"
exports.storeNext = (req, res, next) ->
if req.query.next
req.session.next = req.query.next
next()
exports.login =
passport.authenticate 'goog... |
Change websocket trigger to turbolinks:load; debugging | is_page_visible = true
num_unseen_posts = 0
$(document).on 'page:change', ->
if location.pathname == '/posts'
App.posts = App.cable.subscriptions.create "PostsChannel",
received: (data) ->
$('table tbody').prepend(data['row'])
unless is_page_visible
num_unseen_posts++
d... | is_page_visible = true
num_unseen_posts = 0
$(document).on 'turbolinks:load', ->
console.log "hi"
if location.pathname == '/posts'
App.posts = App.cable.subscriptions.create "PostsChannel",
received: (data) ->
$('table tbody').prepend(data['row'])
unless is_page_visible
num_uns... |
Set ArticleList as default route. | React = require 'react'
Router = require 'react-router'
ArticleList = require './views/article-list.cjsx'
DefaultRoute = Router.DefaultRoute
Route = Router.Route
RouteHandler = Router.RouteHandler
Link = Router.Link
App = React.createClass
render: ->
<div>
<ul>
<li><Link to="blog">Blog</Link></li>
</ul>... | React = require 'react'
Router = require 'react-router'
ArticleList = require './views/article-list.cjsx'
DefaultRoute = Router.DefaultRoute
Route = Router.Route
RouteHandler = Router.RouteHandler
Link = Router.Link
App = React.createClass
render: ->
<div>
<ul>
<li><Link to="app">Home</Link></li>
</ul>
... |
Add error handling for stat server request | # Config and Start SyncedCron
logger = new Logger 'SyncedCron'
SyncedCron.config
logger: (opts) ->
logger[opts.level].call(logger, opts.message)
collectionName: 'rocketchat_cron_history'
generateStatistics = ->
statistics = RocketChat.statistics.save()
statistics.host = Meteor.absoluteUrl()
if RocketChat.setti... | # Config and Start SyncedCron
logger = new Logger 'SyncedCron'
SyncedCron.config
logger: (opts) ->
logger[opts.level].call(logger, opts.message)
collectionName: 'rocketchat_cron_history'
generateStatistics = ->
statistics = RocketChat.statistics.save()
statistics.host = Meteor.absoluteUrl()
if RocketChat.setti... |
Use fat arrow for callbacks | url = require 'url'
{$$} = require 'space-pen'
ScrollView = require 'scroll-view'
BuddyView = require './buddy-view'
module.exports =
class BuddyList extends ScrollView
@content: ->
@div class: 'buddy-list', tabindex: -1
initialize: (@presence) ->
super
@presence.on 'person-added', -> @updateBuddies(... | url = require 'url'
{$$} = require 'space-pen'
ScrollView = require 'scroll-view'
BuddyView = require './buddy-view'
module.exports =
class BuddyList extends ScrollView
@content: ->
@div class: 'buddy-list', tabindex: -1
initialize: (@presence) ->
super
@presence.on 'person-added', => @updateBuddies(... |
Convert segments and their text to words in the PPT slides | window.StrutBuilder ||= {}
# [
# { #slide 1
# start: 0,
# end: 2.5,
# texts: [
# {text: 'Hum', position: 1.2},
# {text: 'bewafaa', position: 1.7}
# ]
# },
# { #slide 2
# start: 2.5,
# end: 4.3,
# texts: [
# {text: 'Hargiz', position: 3.3},... | window.StrutBuilder ||= {}
# [
# { #slide 1
# start: 0,
# end: 2.5,
# texts: [
# {text: 'Hum', position: 1.2},
# {text: 'bewafaa', position: 1.7}
# ]
# },
# { #slide 2
# start: 2.5,
# end: 4.3,
# texts: [
# {text: 'Hargiz', position: 3.3},... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.