Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Fix for empty resonses from API |
Base = require './Base'
class TrafficSituation extends Base
constructor: (config) ->
@key = config.keys.trafficSituation
@service = 'trafficSituation (SL Trafikläget 2)'
super
parseResponse: (body) ->
body = JSON.parse body
err = if body.StatusCode isnt 0
"#{body.StatusCode} - #{body.Me... |
Base = require './Base'
class TrafficSituation extends Base
constructor: (config) ->
@key = config.keys.trafficSituation
@service = 'trafficSituation (SL Trafikläget 2)'
super
parseResponse: (body) ->
body = JSON.parse body
err = if body.StatusCode isnt 0
"#{body.StatusCode} - #{body.Me... |
Add `:` support for 1.9 syntax | module.exports =
selector: ['.source.ruby', '.source.ruby.rails']
id: 'aligner-ruby' # package name
config:
'=>-alignment':
title: 'Padding for =>'
description: 'Pad left or right of the character'
type: 'string'
enum: ['left', 'right']
default: 'left'
'=>-leftSpace':
t... | module.exports =
selector: ['.source.ruby', '.source.ruby.rails']
id: 'aligner-ruby' # package name
config:
'=>-alignment':
title: 'Padding for =>'
description: 'Pad left or right of the character'
type: 'string'
enum: ['left', 'right']
default: 'left'
'=>-leftSpace':
t... |
Correct error in inbox when null task | angular.module('doubtfire.projects.states.dashboard.directives.task-dashboard.directives.task-assessment-card', [])
#
# Shows quality stars and graded task information
#
.directive('taskAssessmentCard', ->
restrict: 'E'
templateUrl: 'projects/states/dashboard/directives/task-dashboard/directives/task-assessment-car... | angular.module('doubtfire.projects.states.dashboard.directives.task-dashboard.directives.task-assessment-card', [])
#
# Shows quality stars and graded task information
#
.directive('taskAssessmentCard', ->
restrict: 'E'
templateUrl: 'projects/states/dashboard/directives/task-dashboard/directives/task-assessment-car... |
Fix non-exiting on clean win32 error, improve efficiency | { attemptShell, isBinaryExecutable } = require './utils'
logger = require './logger'
styler = require './styler'
_ = require 'lodash'
@clean = ({ recursive = no, deep = no } = {}) ->
hasFileTool = attemptShell('which', 'file')?
unless hasFileTool
if process.platform is "win32"
logger.e "To... | { attemptShell, isBinaryExecutable } = require './utils'
logger = require './logger'
styler = require './styler'
_ = require 'lodash'
@clean = ({ recursive = no, deep = no } = {}) ->
hasFileTool = attemptShell('which', 'file')?
unless hasFileTool
if process.platform is "win32"
logger.e "To... |
Store routing table hash in model | surveyor = require './lib/surveyor.coffee'
websocket = require './lib/websocket.coffee'
webserver = require './lib/webserver.coffee'
webserver.listen 4001
util = require './lib/util.coffee'
lock = false
check = ->
return if lock
lock = true
surveyor.getManifest (err) ->
console.error err if err?
throw ne... | surveyor = require './lib/surveyor.coffee'
websocket = require './lib/websocket.coffee'
webserver = require './lib/webserver.coffee'
webserver.listen 4001
util = require './lib/util.coffee'
lock = false
check = ->
return if lock
lock = true
surveyor.getManifest (err) ->
console.error err if err?
throw ne... |
Call function returned from _.template | fs = require 'fs'
path = require 'path'
temp = require 'temp'
_ = require 'underscore'
temp.track()
module.exports = (grunt) ->
grunt.registerTask 'create-windows-installer', 'Create the Windows installer', ->
@requiresConfig("#{@name}.appDirectory")
done = @async()
{appDirectory, outputDirectory} = g... | fs = require 'fs'
path = require 'path'
temp = require 'temp'
_ = require 'underscore'
temp.track()
module.exports = (grunt) ->
grunt.registerTask 'create-windows-installer', 'Create the Windows installer', ->
@requiresConfig("#{@name}.appDirectory")
done = @async()
{appDirectory, outputDirectory} = g... |
Add language-sca to atom package list | packages: [
"advanced-open-file"
"atom-alignment"
"auto-update-packages"
"docblockr"
"editorconfig"
"emmet"
"expand-region"
"language-apache"
"language-applescript"
"language-awk"
"language-env"
"language-gitattributes"
"language-gitignore"
"language-hosts"
"language-ini"
"language-latex... | packages: [
"advanced-open-file"
"atom-alignment"
"auto-update-packages"
"docblockr"
"editorconfig"
"emmet"
"expand-region"
"language-apache"
"language-applescript"
"language-awk"
"language-env"
"language-gitattributes"
"language-gitignore"
"language-hosts"
"language-ini"
"language-latex... |
Add callback to get all | DB = require './db'
Project = require './project'
module.exports =
class Projects
properties:
_id: null
title: null
icon: null
paths: []
settings: {}
group: null
devMode: false
template: null
db: null
initialize: () ->
@db = new DB()
getAll: ->
projectSettings = @db.f... | DB = require './db'
Project = require './project'
module.exports =
class Projects
db: null
constructor: ->
@db = new DB()
getAll: (callback) ->
@db.findAll (projectSettings) ->
projects = []
for setting in projectSettings
if setting.paths?
project = new Project(setting)
... |
Fix key handling so it registers its handler | _ = require 'lodash'
direction = require 'rl-directions'
bindings = require '../key-bindings.json'
eventBus = require './event-bus'
module.exports = exports = ->
eventBus.on 'key.*', (ch, key) ->
action = bindings[key.full] ? bindings[key.name]
if action?
parts = action.split('.')
if parts[0] is 'direct... | _ = require 'lodash'
direction = require 'rl-directions'
bindings = require '../key-bindings.json'
eventBus = require './event-bus'
eventBus.on 'key.*', (ch, key) ->
action = bindings[key.full] ? bindings[key.name]
if action?
parts = action.split('.')
if parts[0] is 'direction'
parts[1] = direction.normal... |
Add tests for the user factory | describe 'User factory', ->
scope = undefined
__User__ = undefined
httpBackend = undefined
beforeEach ->
module 'trackaKeepa'
inject ($httpBackend, User, $rootScope) ->
scope = $rootScope
__User__ = User
httpBackend = $httpBackend
it 'createUser should create and log in a user', ->... | describe 'User factory', ->
scope = undefined
__User__ = undefined
__Socket__ = undefined
httpBackend = undefined
window = undefined
state = undefined
username = undefined
password = undefined
beforeEach ->
module 'trackaKeepa'
inject ($httpBackend, User, Socket, $rootScope, $window, $state) ... |
Clean up hideMarker on removal | Crafty.c 'Enemy',
init: ->
@requires '2D, Canvas, Collision, Choreography, ViewportFixed'
enemy: ->
Crafty.trigger('EnemySpawned', this)
@onHit 'Bullet', (e) ->
return if @hidden
bullet = e[0].obj
bullet.trigger 'HitTarget', target: this
@trigger('Hit', this)
@health -= bu... | Crafty.c 'Enemy',
init: ->
@requires '2D, Canvas, Collision, Choreography, ViewportFixed'
enemy: ->
Crafty.trigger('EnemySpawned', this)
@onHit 'Bullet', (e) ->
return if @hidden
bullet = e[0].obj
bullet.trigger 'HitTarget', target: this
@trigger('Hit', this)
@health -= bu... |
Normalize all the line endings | # I realize polluting body with .code-links-{ctrl,alt} is not ideal, but I don't
# see a better solution. I couldn't extract which key is being pressed in the
# event handler to match against the config.
'body.code-links-ctrl atom-text-editor': {
'ctrl': 'code-links:tmp-show-links'
}
'body.code-links-alt atom-te... | # I realize polluting body with .code-links-{ctrl,alt} is not ideal, but I don't
# see a better solution. I couldn't extract which key is being pressed in the
# event handler to match against the config.
'body.code-links-ctrl atom-text-editor': {
'ctrl': 'code-links:tmp-show-links'
}
'body.code-links-alt atom-text-... |
Update minimal minimap version to 4.x | MinimapSelectionView = require './minimap-selection-view'
module.exports =
active: false
views: {}
activate: (state) ->
try
atom.packages.activatePackage('minimap').then (minimapPackage) =>
@minimap = minimapPackage.mainModule
return @deactivate() unless @minimap.versionMatch('>= 3.5.... | MinimapSelectionView = require './minimap-selection-view'
module.exports =
active: false
views: {}
activate: (state) ->
try
atom.packages.activatePackage('minimap').then (minimapPackage) =>
@minimap = minimapPackage.mainModule
return @deactivate() unless @minimap.versionMatch('4.x')
... |
Add generic highlighting for RUNOFF control-lines | name: "RUNOFF"
scopeName: "text.runoff"
fileTypes: [
"rnb"
"rnc"
"rnd"
"rne"
"rnh"
"rnl"
"rnm"
"rno"
"rnp"
"rns"
"rnt"
"rnx"
"run"
]
patterns: [include: "#main"]
repository:
# Common patterns
main:
patterns: [
{include: "#comment"}
{include: "#underline"}
{include: "#commands"}
]
# ... | name: "RUNOFF"
scopeName: "text.runoff"
fileTypes: [
"rnb"
"rnc"
"rnd"
"rne"
"rnh"
"rnl"
"rnm"
"rno"
"rnp"
"rns"
"rnt"
"rnx"
"run"
]
patterns: [include: "#main"]
repository:
# Common patterns
main:
patterns: [
{include: "#comment"}
{include: "#underline"}
{include: "#commands"}
]
# ... |
Add show prop (needed for updated RB) | React = require 'react'
BS = require 'react-bootstrap'
_ = require 'underscore'
{ExerciseStore} = require 'stores/exercise'
PublishedModal = React.createClass
getInitialState: -> {}
componentWillMount: ->
ExerciseStore.on('published', @onPublished)
componentWillUnmount: ->
ExerciseStore.off('publishe... | React = require 'react'
BS = require 'react-bootstrap'
_ = require 'underscore'
{ExerciseStore} = require 'stores/exercise'
PublishedModal = React.createClass
getInitialState: -> {}
componentWillMount: ->
ExerciseStore.on('published', @onPublished)
componentWillUnmount: ->
ExerciseStore.off('publishe... |
Use cozydb plugin for americano | americano = require 'americano'
fs = require 'fs'
path = require 'path'
clientPath = path.resolve(__dirname, '..', 'client', 'public')
useBuildView = fs.existsSync path.resolve(__dirname, 'views', 'index.js')
config =
common:
set:
'view engine': if useBuildView then 'js' else 'j... | americano = require 'americano'
fs = require 'fs'
path = require 'path'
clientPath = path.resolve(__dirname, '..', 'client', 'public')
useBuildView = fs.existsSync path.resolve(__dirname, 'views', 'index.js')
config =
common:
set:
'view engine': if useBuildView then 'js' else 'j... |
Use coffee feature to pass the context | class Calculator
presetNames: ['full', 'half', 'noSalad']
weekdays: ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']
weekTotalFor: (preset, target) ->
total = 0
week = target[preset]
for weekday, countServings of week
continue if @weekdays.indexOf(weekday) == -1
total += countServings... | class Calculator
presetNames: ['full', 'half', 'noSalad']
weekdays: ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']
weekTotalFor: (preset, target) ->
total = 0
week = target[preset]
for weekday, countServings of week
continue if @weekdays.indexOf(weekday) == -1
total += countServings... |
Set type to log for console.log forwarding | eval("window = {};")
eval("attachEvent = function(){};")
eval("console = {};")
console.warn = ->
self.postMessage
type: 'warn'
details: arguments
console.log = ->
self.postMessage
type: 'warn'
details: arguments
self.addEventListener 'message', (event) ->
switch event.data.type
when 'start'
... | eval("window = {};")
eval("attachEvent = function(){};")
eval("console = {};")
console.warn = ->
self.postMessage
type: 'warn'
details: arguments
console.log = ->
self.postMessage
type: 'log'
details: arguments
self.addEventListener 'message', (event) ->
switch event.data.type
when 'start'
... |
Move module require to top | _ = require 'underscore-plus'
optimist = require 'optimist'
request = require 'request'
View = require './view'
config = require './config'
tree = require './tree'
module.exports =
class Docs extends View
@commandNames: ['docs', 'home', 'open']
open: require 'open'
parseOptions: (argv) ->
options = optimis... | _ = require 'underscore-plus'
optimist = require 'optimist'
request = require 'request'
open = require 'open'
View = require './view'
config = require './config'
tree = require './tree'
module.exports =
class Docs extends View
@commandNames: ['docs', 'home', 'open']
open: open
parseOptions: (argv) ->
optio... |
Add the 'Reveal in Tree View' context menu to the file tab. | 'menu': [
{
'label': 'View'
'submenu': [
{ 'label': 'Toggle Tree View', 'command': 'tree-view:toggle' }
{ 'label': 'Toggle Tree Side', 'command': 'tree-view:toggle-side' }
]
}
{
'label': 'Packages'
'submenu': [
'label': 'Tree View'
'submenu': [
{ 'label': 'Focus... | 'menu': [
{
'label': 'View'
'submenu': [
{ 'label': 'Toggle Tree View', 'command': 'tree-view:toggle' }
{ 'label': 'Toggle Tree Side', 'command': 'tree-view:toggle-side' }
]
}
{
'label': 'Packages'
'submenu': [
'label': 'Tree View'
'submenu': [
{ 'label': 'Focus... |
Set user as away when app goes to background and online when back to foreground | if Meteor.isCordova
document.addEventListener 'pause', ->
Meteor.disconnect()
document.addEventListener 'resume', ->
Meteor.reconnect() | if Meteor.isCordova
document.addEventListener 'pause', ->
UserPresence.setAway()
document.addEventListener 'resume', ->
UserPresence.setOnline() |
Support OSX for Chrome extension build | module.exports = ->
@loadNpmTasks 'grunt-shell'
# Find Chrome binary here...
@config 'shell',
'chrome-extension':
command: 'google-chrome ' + [
'--pack-extension=chrome-extension/dist/tipsy'
'--pack-extension-key=chrome-extension/key.pem'
'--no-message-box'
].join(' ')
| module.exports = ->
@loadNpmTasks 'grunt-shell'
# https://code.google.com/p/selenium/wiki/ChromeDriver#Requirements
if process.platform is 'linux'
chrome = '/usr/bin/google-chrome '
else if process.platform is 'darwin'
chrome = '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome '
@config ... |
Simplify by using coffeescript syntax. | Backbone.Factlink ||= {}
class Backbone.Factlink.CrossFadeRegion extends Backbone.Marionette.Region
defaultFadeTime = 560
initialize: -> @on 'close', -> @$el?.stop()
crossFade: (newView) ->
if @currentView
@$el.stop().fadeOut(@_fadeTime(), => @show newView)
else
@show(newView)
open: (vi... | Backbone.Factlink ||= {}
class Backbone.Factlink.CrossFadeRegion extends Backbone.Marionette.Region
defaultFadeTime = 560
initialize: -> @on 'close', -> @$el?.stop()
crossFade: (newView) ->
if @currentView
@$el.stop().fadeOut(@_fadeTime(), => @show newView)
else
@show(newView)
open: (vi... |
Fix language loading from cordova | # Adding CORS headers so we can use CDNs for static content
WebApp.rawConnectHandlers.use (req, res, next) ->
res.setHeader("Access-Control-Allow-Origin", "*")
res.setHeader("X-Rocket-Chat-Version", VERSION)
res.setHeader("Access-Control-Expose-Headers", "X-Rocket-Chat-Version")
return next()
_staticFilesMiddlew... | # Adding CORS headers so we can use CDNs for static content
WebApp.rawConnectHandlers.use (req, res, next) ->
res.setHeader("Access-Control-Allow-Origin", "*")
res.setHeader("X-Rocket-Chat-Version", VERSION)
res.setHeader("Access-Control-Expose-Headers", "X-Rocket-Chat-Version")
# Block next handlers to override... |
Make sure tests are always run without any preexisting tokens from the environment | _ = require('lodash')
IS_BROWSER = window?
{ fetchMock, mockedFetch } = require('resin-fetch-mock')
dataDirectoryPath = null
if not IS_BROWSER
temp = require('temp').track()
dataDirectoryPath = temp.mkdirSync()
ResinAuth = require('resin-auth')['default']
auth = new ResinAuth({
dataDirectory: dataDirectoryPath,... | _ = require('lodash')
IS_BROWSER = window?
{ fetchMock, mockedFetch } = require('resin-fetch-mock')
dataDirectoryPath = null
if not IS_BROWSER
temp = require('temp').track()
dataDirectoryPath = temp.mkdirSync()
ResinAuth = require('resin-auth')['default']
auth = new ResinAuth({
dataDirectory: dataDirectoryPath,... |
Add optional prefix to globals | ###
Inject some [pseudo-]local variables
###
fs = require 'fs'
path = require 'path'
ini = require '../package'
for f of ini.devDependencies when /^[$\w]+$/.test f
exports[f] = f
for lib in fs.readdirSync src = path.join __dirname, '../src'
continue unless fs.statSync lib = path.join src, lib
.isDirectory()
... | ###
Inject some [pseudo-]local variables
###
fs = require 'fs'
path = require 'path'
ini = require '../package'
for f of ini.devDependencies when /^[$\w]+$/.test f
exports[f] = f
for libname in fs.readdirSync src = path.join __dirname, '../src'
continue unless fs.statSync lib = path.join src, libname
.isDirec... |
Update deprecated selectors in keymap | '.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'
'.platform-linux .editor':
'ctrl-:... | '.platform-darwin atom-text-editor':
'cmd-:': 'spell-check:correct-misspelling'
'.platform-darwin .corrections atom-text-editor':
'cmd-:': 'core:cancel'
'.platform-win32 atom-text-editor':
'ctrl-:': 'spell-check:correct-misspelling'
'.platform-win32 .corrections atom-text-editor':
'ctrl-:': 'core:cancel'
'.... |
Create helper to buffer process lines | Point = require 'point'
ChildProcess = nodeRequire 'child_process'
$ = require 'jquery'
module.exports =
class TagGenerator
constructor: (@path) ->
parseTagLine: (line) ->
sections = line.split('\t')
if sections.length > 3
position: new Point(parseInt(sections[2]) - 1)
name: sections[0]
el... | Point = require 'point'
ChildProcess = nodeRequire 'child_process'
$ = require 'jquery'
BufferedProcess = require 'buffered-process'
module.exports =
class TagGenerator
constructor: (@path) ->
parseTagLine: (line) ->
sections = line.split('\t')
if sections.length > 3
position: new Point(parseInt(sec... |
Implement <p> tags in activity summaries | ACTIVITIES =
TW:
action: 'lähetti Tweetin'
icon: 'twitter'
FB:
action: 'teki Facebook-päivityksen'
icon: 'facebook'
ST:
action: 'käytti täysistuntopuheenvuoron'
icon: 'comment-alt'
SI:
action: 'allekirjoitti aloitteen'
icon: 'pencil'
IN... | ACTIVITIES =
TW:
action: 'lähetti Tweetin'
icon: 'twitter'
FB:
action: 'teki Facebook-päivityksen'
icon: 'facebook'
ST:
action: 'käytti täysistuntopuheenvuoron'
icon: 'comment-alt'
SI:
action: 'allekirjoitti aloitteen'
icon: 'pencil'
IN... |
Use spacepen's outlet to append to the output div | {ScrollView, BufferedProcess} = require 'atom'
# Runs a portion of a script through an interpreter and displays it line by line
module.exports =
class ScriptView extends ScrollView
@content: ->
@div class: 'script', tabindex: -1, =>
@div class: 'output'
constructor: (interpreter, make_args) ->
sup... | {ScrollView, BufferedProcess} = require 'atom'
# Runs a portion of a script through an interpreter and displays it line by line
module.exports =
class ScriptView extends ScrollView
@content: ->
@div class: 'script', tabindex: -1, =>
@div class: 'output', outlet: 'output'
constructor: (interpreter, mak... |
Use steroids.nativeBridge.nativeCall instead of supers nativecall | class Screen extends NativeObject
freeze: (options={}, callbacks={})->
@nativeCall
method: "freeze"
parameters: options
successCallbacks: [callbacks.onSuccess]
failureCallbacks: [callbacks.onFailure]
unfreeze: (options={}, callbacks={})->
@nativeCall
method: "unfreeze"
p... | class Screen
freeze: (options={}, callbacks={})->
steroids.nativeBridge.nativeCall
method: "freeze"
parameters: options
successCallbacks: [callbacks.onSuccess]
failureCallbacks: [callbacks.onFailure]
unfreeze: (options={}, callbacks={})->
steroids.nativeBridge.nativeCall
metho... |
Rename internal Base58 class to Base58Builder | class Base58
constructor: ->
@alphabet = "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
@base = @alphabet.length
encode: (num) ->
throw new Error('Value passed is not a number.') if typeof num != 'number'
str = ''
while num >= @base
mod = num % @base
str = @alphabet[mo... | class Base58Builder
constructor: ->
@alphabet = "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
@base = @alphabet.length
encode: (num) ->
throw new Error('Value passed is not a number.') if typeof num != 'number'
str = ''
while num >= @base
mod = num % @base
str = @alph... |
Use atom.getActivePackages() API for package names | _ = require 'underscore'
module.exports =
class Collector
constructor: ->
@sessionId = new Date().getTime()
# Private
getPath: ->
global.project.getPath()
# Private
getUser: ->
process.env.USER
# Private
getSessionId: ->
@sessionId
# Private
getUserAgen... | _ = require 'underscore'
module.exports =
class Collector
constructor: ->
@sessionId = new Date().getTime()
# Private
getPath: ->
global.project.getPath()
# Private
getUser: ->
process.env.USER
# Private
getSessionId: ->
@sessionId
# Private
getUserAgen... |
Verify that vtexjs.checkout.orderForm object is created | expect = chai.expect
mocha.setup 'bdd'
describe 'VTEX JS Checkout Module', ->
before ->
$.mockjax
url: mock.API_URL
responseText: mock.orderform.empty
it 'should have basic properties', ->
expect(vtexjs.checkout).to.be.ok
expect(vtexjs.checkout.getOrderForm).to.be.a('function')
expect... | expect = chai.expect
mocha.setup 'bdd'
describe 'VTEX JS Checkout Module', ->
before ->
$.mockjax
url: mock.API_URL
responseText: mock.orderform.empty
it 'should have basic properties', ->
expect(vtexjs.checkout).to.be.ok
expect(vtexjs.checkout.getOrderForm).to.be.a('function')
expect... |
Initialize moment to english or swedish | # Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
$ ->
$('time').each (index, elem) ->
$elem = $(elem)
datetime = $elem.attr 'datetime'
$elem.te... | # Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
$ ->
$('time').each (index, elem) ->
$elem = $(elem)
datetime = $elem.attr 'datetime'
moment.l... |
Implement exit codes != 0 | coffee = require 'gulp-coffee'
gulp = require 'gulp'
gutil = require 'gulp-util'
mocha = require 'gulp-mocha'
rimraf = require 'rimraf'
handleError = (err) ->
gutil.log err
@emit 'end'
gulp.task 'clean', (done) ->
rimraf './lib', done
gulp.task 'build', ['clean'], ->
gulp.src './lib-src/**/*.coffee'
.pip... | coffee = require 'gulp-coffee'
gulp = require 'gulp'
gutil = require 'gulp-util'
mocha = require 'gulp-mocha'
rimraf = require 'rimraf'
errorOccurred = no
process.once 'exit', (code) ->
if errorOccurred and code == 0
process.exit 1
handleError = (err) ->
errorOccurred = yes
gutil.log err
@emit 'end'
gulp... |
Use absolute root path for opts.config.root | # Load all requirements.
gulp = require 'gulp'
GulpTaskLoader = require 'gulp-task-loader'
require 'require-yaml'
# Load configuration.
config = require './config.yml'
# Configure gulp-task-loader
opts =
root: config.root,
dir: config.tasks,
exts: config.ext,
config: config
gulpTaskLoader = GulpTaskLoader opt... | # Load all requirements.
gulp = require 'gulp'
GulpTaskLoader = require 'gulp-task-loader'
require 'require-yaml'
relpath = require 'relative-path'
# Load configuration.
config = require './config.yml'
# Convert config.root to absolute path
absroot = relpath config.root
console.log absroot
# Configure gulp-task-load... |
Send pending find mistakes metric to graphite | import {mongoCallbacksCount} from '../mongo/MongooseCallbackManager'
import {GROUPS} from '../../client/lib/informaticsGroups'
import {START_SUBMITS_DATE} from '../api/dashboard'
import send from '../metrics/graphite'
import notify from '../metrics/notify'
import Result from "../models/result"
sendGraphite = () ->
... | import {GROUPS} from '../../client/lib/informaticsGroups'
import {START_SUBMITS_DATE} from '../api/dashboard'
import send from '../metrics/graphite'
import notify from '../metrics/notify'
import FindMistake from '../models/FindMistake'
import Result from "../models/result"
import {mongoCallbacksCount} from '../mong... |
Rename the `caller` command `to-caller`. | EnterDialog = require './enter-dialog'
{Stacktrace} = require './stacktrace'
{StacktraceView} = require './stacktrace-view'
{NavigationView} = require './navigation-view'
editorDecorator = require './editor-decorator'
module.exports =
activate: (state) ->
atom.workspaceView.command 'stacktrace:paste', ->
... | EnterDialog = require './enter-dialog'
{Stacktrace} = require './stacktrace'
{StacktraceView} = require './stacktrace-view'
{NavigationView} = require './navigation-view'
editorDecorator = require './editor-decorator'
module.exports =
activate: (state) ->
atom.workspaceView.command 'stacktrace:paste', ->
... |
Add failing test to verify Travis works. | # spec/javascripts/foobar_spec.js.coffee
describe "foobar", ->
it 'works', -> expect(1 + 1).toEqual(2);
| # spec/javascripts/foobar_spec.js.coffee
describe "foobar", ->
it 'works', -> expect(1 + 1).toEqual(2);
describe "wanted failure", ->
it 'fails', -> expect(1 + 1).toEqual(42);
|
Remove items from the CKEDITOR toolbar | window.Tahi ||= {}
class Tahi.RichEditableElement
constructor: (@element) ->
@instance = CKEDITOR.inline @element,
extraPlugins: 'sharedspace'
removePlugins: 'floatingspace,resize'
sharedSpaces:
top: 'toolbar'
toolbar: [
[ 'Styles', 'Format', 'FontSize' ]
[ 'Bold',... | window.Tahi ||= {}
class Tahi.RichEditableElement
constructor: (@element) ->
@instance = CKEDITOR.inline @element,
extraPlugins: 'sharedspace'
removePlugins: 'floatingspace,resize'
sharedSpaces:
top: 'toolbar'
toolbar: [
[ 'Format' ]
[ 'Bold', 'Italic', 'Underline'... |
Call updateColorPreview in Labels constructor | class Labels
constructor: ->
form = $('.label-form')
@setupLabelForm(form)
@cleanBinding()
@addBinding()
@updateColorPreview
addBinding: ->
$(document).on 'click', '.suggest-colors a', @setSuggestedColor
$(document).on 'input', 'input#label_color', @updateColorPreview
cleanBinding: -... | class Labels
constructor: ->
form = $('.label-form')
@setupLabelForm(form)
@cleanBinding()
@addBinding()
@updateColorPreview()
addBinding: ->
$(document).on 'click', '.suggest-colors a', @setSuggestedColor
$(document).on 'input', 'input#label_color', @updateColorPreview
cleanBinding:... |
Support preview toggle when focus is on editor | '.workspace':
'ctrl-M': 'markdown-preview:toggle'
'.platform-darwin .markdown-preview':
'cmd-+': 'markdown-preview:zoom-in'
'cmd-=': 'markdown-preview:zoom-in'
'cmd--': 'markdown-preview:zoom-out'
'cmd-_': 'markdown-preview:zoom-out'
'cmd-0': 'markdown-preview:reset-zoom'
'.platform-win32 .markdown-previe... | '.workspace .editor':
'ctrl-M': 'markdown-preview:toggle'
'.platform-darwin .markdown-preview':
'cmd-+': 'markdown-preview:zoom-in'
'cmd-=': 'markdown-preview:zoom-in'
'cmd--': 'markdown-preview:zoom-out'
'cmd-_': 'markdown-preview:zoom-out'
'cmd-0': 'markdown-preview:reset-zoom'
'.platform-win32 .markdow... |
Change time for atom dark theme | "*":
core:
disabledPackages: [
"wrap-guide"
"activate-power-mode"
]
editor: {}
"exception-reporting":
userId: "79967b20-c933-87c9-85b8-ea6b20c3a648"
"linter-puppet-lint":
oldVersion: false
skip140Chars: true
skip80Chars: true
minimap:
plugins:
cursorline: true
... | "*":
core:
disabledPackages: [
"wrap-guide"
"activate-power-mode"
]
themes: [
"one-light-ui"
"one-light-syntax"
]
editor: {}
"exception-reporting":
userId: "79967b20-c933-87c9-85b8-ea6b20c3a648"
"linter-puppet-lint":
oldVersion: false
skip140Chars: true
sk... |
Fix can't insert text to TextWell | class ResultViewModel
constructor: (@htmlArray) ->
@html = ko.computed () =>
@htmlArray().join("")
afterListviewRender: (element, data) ->
# サムネイル表示時のレンダリングがうまくいかないので
# 自前でクラスを設定する。
$(element).addClass("ui-li-has-thumb")
$(element).find("img").addClass("ui-li-thumb")
# refresh しないと説明文... | class ResultViewModel
constructor: (@htmlArray) ->
@html = ko.computed () =>
@htmlArray().join("")
afterListviewRender: (element, data) ->
# サムネイル表示時のレンダリングがうまくいかないので
# 自前でクラスを設定する。
$(element).addClass("ui-li-has-thumb")
$(element).find("img").addClass("ui-li-thumb")
# refresh しないと説明文... |
Support bumping version from apm publish | path = require 'path'
colors = require 'colors'
CSON = require 'season'
config = require './config'
Command = require './command'
module.exports =
class Publisher extends Command
userConfigPath: null
atomNpmPath: null
constructor: ->
@userConfigPath = config.getUserConfigPath()
@atomNpmPath = require.re... | path = require 'path'
colors = require 'colors'
CSON = require 'season'
config = require './config'
Command = require './command'
module.exports =
class Publisher extends Command
userConfigPath: null
atomNpmPath: null
constructor: ->
@userConfigPath = config.getUserConfigPath()
@atomNpmPath = require.re... |
Add Jasmine tests to cover AJAX error notifications | describe "CMS", ->
beforeEach ->
CMS.unbind()
it "should initialize Models", ->
expect(CMS.Models).toBeDefined()
it "should initialize Views", ->
expect(CMS.Views).toBeDefined()
describe "main helper", ->
beforeEach ->
@previousAjaxSettings = $.extend(true, {}, $.ajaxSettings)
window.stub... | describe "CMS", ->
beforeEach ->
CMS.unbind()
it "should initialize Models", ->
expect(CMS.Models).toBeDefined()
it "should initialize Views", ->
expect(CMS.Views).toBeDefined()
describe "main helper", ->
beforeEach ->
@previousAjaxSettings = $.extend(true, {}, $.ajaxSettings)
window.stub... |
Fix list of routes on startup | routes = require './routes.js'
bodyParser = require 'body-parser'
path = require 'path'
express = require 'express'
app = express()
models = require('mongoose').models
outline = require '../outline.js'
utils = require './utils.js'
# Default parsers
app.use express.static(path.resolve(outline.dist))
app.use bodyParser... | routes = require './routes.js'
bodyParser = require 'body-parser'
path = require 'path'
express = require 'express'
app = express()
models = require('mongoose').models
outline = require '../outline.js'
utils = require './utils.js'
# Default parsers
app.use express.static(path.resolve(outline.dist))
app.use bodyParser... |
Make the details link for info working dynamically | window.UsersComponent = class UsersComponent
@initialize: ->
@addEventListeners()
@addEventListeners: ->
@userDetailsTooltip()
@userDetailsTooltip: ->
tooltipClass = '.information-tooltip'
$("#{tooltipClass}-trigger").toggle( (ev) ->
ev.preventDefault()
$("#{tooltipClass}-trigger").n... | window.UsersComponent = class UsersComponent
@initialize: ->
@addEventListeners()
@addEventListeners: ->
@userDetailsTooltip()
@userDetailsTooltip: ->
tooltipClass = '.information-tooltip'
$(document).on('click', "#{tooltipClass}-trigger", (ev) ->
ev.preventDefault()
if ($(@).find('.... |
Add specs for Results Validation. | Helpers = require '../lib/helpers'
describe "The Results Validation Helper", ->
it "should throw an exception when nothing is passed.", ->
expect( -> Helpers.validateResults()).toThrow()
it "should throw an exception when a String is passed.", ->
expect( -> Helpers.validateResults('String')).toThrow()
des... | Helpers = require '../lib/helpers'
describe "The Results Validation Helper", ->
it "should throw an exception when nothing is passed.", ->
expect( -> Helpers.validateResults()).toThrow()
it "should throw an exception when a String is passed.", ->
expect( -> Helpers.validateResults('String')).toThrow()
it... |
Support JSON datatype a bit better. | Bookshelf = require('bookshelf')
config = require('../knex_config').database
Bookshelf.PG = PG = Bookshelf.initialize(config)
Team = PG.Model.extend
tableName: 'teams'
hasTimestamps: ['created_at', 'updated_at']
toJSON: -> {
id: @id
name: @get('name')
generation: @get('generation')
poke... | Bookshelf = require('bookshelf')
{_} = require('underscore')
config = require('../knex_config').database
Bookshelf.PG = PG = Bookshelf.initialize(config)
Team = PG.Model.extend
tableName: 'teams'
hasTimestamps: ['created_at', 'updated_at']
toJSON: ->
contents = @get('contents')
{
id: @id
na... |
Use defaultClickHandler to navigate to subChannel | class window.SubchannelItemView extends Backbone.Marionette.ItemView
tagName: "li"
events:
click: "clickHandler"
"click .close": "destroySubchannel"
template: "subchannels/_subchannel_item"
initialize: ->
@model.bind "destroy", @close, this
destroySubchannel: (e) ->
@model.destroy() if conf... | class window.SubchannelItemView extends Backbone.Marionette.ItemView
tagName: "li"
events:
click: "clickHandler"
"click .close": "destroySubchannel"
template: "subchannels/_subchannel_item"
initialize: ->
@model.bind "destroy", @close, this
destroySubchannel: (e) ->
@model.destroy() if conf... |
Remove 90 degree limit from fan tool | Mark = require './mark'
class FanMark extends Mark
type: 'fan'
source: null
distance: 0
angle: 0
spread: 0
constructor: ->
super
@set
source: @source || {x: 0, y: 0}
distance: @distance
angle: @angle
spread: @spread
'set distance': (value) -> Math.max value, 10
'set ... | Mark = require './mark'
class FanMark extends Mark
type: 'fan'
source: null
distance: 0
angle: 0
spread: 0
constructor: ->
super
@set
source: @source || {x: 0, y: 0}
distance: @distance
angle: @angle
spread: @spread
'set distance': (value) -> Math.max value, 10
'set ... |
Handle 404's better for queues | # For some odd reason, this isn't working. There's no reason why it shouldn't. I
# think either Heroku is messing up my config, or I need to flip a setting in
# Heroku somewhere.
#
# Instead, I'm requiring HTTPS through CloudFlare page rules, a hacky but
# effective solution
#config = require '../config'
#
#exports.for... | # For some odd reason, this isn't working. There's no reason why it shouldn't. I
# think either Heroku is messing up my config, or I need to flip a setting in
# Heroku somewhere.
#
# Instead, I'm requiring HTTPS through CloudFlare page rules, a hacky but
# effective solution
#config = require '../config'
#
#exports.for... |
Fix broken tests for resources show | App.Votes =
hoverize: (selector, delegateTo) ->
$(selector).on "mouseenter", delegateTo, ->
$(this).find("div.anonymous-votes").show()
$(this).find("div.organizations-votes").show()
$(this).find("div.not-logged").show()
$(selector).on "mouseleave", delegateTo, ->
$(this).find("div.ano... | App.Votes =
hoverize: (selector, delegateTo) ->
$(selector).on "mouseenter", delegateTo, ->
$(this).find("div.anonymous-votes").show()
$(this).find("div.organizations-votes").show()
$(this).find("div.not-logged").show()
$(selector).on "mouseleave", delegateTo, ->
$(this).find("div.ano... |
Remove angular service not used | #= require ../../node_modules/share/node_modules/browserchannel/dist/bcsocket-uncompressed
#= require ../../node_modules/share/webclient/share.uncompressed
#= require ../../node_modules/share/webclient/json.uncompressed
module = angular.module "plunker.share", []
module.service "share", [ () ->
] | #= require ./../../node_modules/share/node_modules/browserchannel/dist/bcsocket-uncompressed
#= require ./../../node_modules/share/webclient/share.uncompressed
#= require ./../../node_modules/share/webclient/json.uncompressed
|
Use || instead of or |
module.exports =
config:
jshintExecutablePath:
default: ''
type: 'string'
description: 'Leave empty to use bundled'
provideLinter: ->
jshintPath = require('path').join(__dirname, '..', 'node_modules', '.bin', 'jshint')
helpers = require('atom-linter')
reporter = require('jshint-js... |
module.exports =
config:
jshintExecutablePath:
default: ''
type: 'string'
description: 'Leave empty to use bundled'
provideLinter: ->
jshintPath = require('path').join(__dirname, '..', 'node_modules', '.bin', 'jshint')
helpers = require('atom-linter')
reporter = require('jshint-js... |
Improve handling of TextEditor subscriptions and only save on ActiveTextEditors. | {CompositeDisposable} = require 'atom'
module.exports =
config: require './config'
activate: (state) ->
@transpiler ?= new (require './transpiler')
# track any file save ( buffer save) events and transpile if babel
@disposable = new CompositeDisposable
@disposable.add atom.project.onDidChangePaths... | {CompositeDisposable} = require 'atom'
module.exports =
config: require './config'
activate: (state) ->
@transpiler ?= new (require './transpiler')
# track any file save events and transpile if babel
@disposable = new CompositeDisposable
@textEditors = {}
@disposable.add atom.project.onDidCha... |
Test for allowed extensions by converting list to regexp and testing. | connect = require('connect')
utils = connect.utils
forbiddenURLChars= /\/([._][^/]*)|_$/
###
todo: // detect if URL is of a directory and, if so, bring up the _index
if (stat.isDirectory())
if (!redirect) return @next();
@res.statusCode = 301;
@res.setHeader('Location', url.pathname + '/');
@res.end('Redirecti... | connect = require('connect')
utils = connect.utils
forbiddenURLChars= /\/([._][^/]*)|_$/
###
todo: // detect if URL is of a directory and, if so, bring up the _index
if (stat.isDirectory())
if (!redirect) return @next();
@res.statusCode = 301;
@res.setHeader('Location', url.pathname + '/');
@res.end('Redirecti... |
Add multi-language object ({en: "hoge"}) support | I18n = (id, args...) ->
m = chrome.i18n.getMessage(id, [args...])
return escapeHtml(m) if m != ""
m = id.replace(/(.)([A-Z][a-z])/g, (m, p1, p2) -> "#{p1} #{p2.toLowerCase()}")
m = m.replace(/_/g, ' ')
escapeHtml(m)
$(->
pat = /__MSG_([A-Za-z0-9]+)__/
$("a,button").each((i, v) ->
e = $(v)
title =... | I18n = (id_or_object, args...) ->
switch typeof id_or_object
when "string"
m = chrome.i18n.getMessage(id_or_object, [args...])
return escapeHtml(m) if m != ""
m = id_or_object.replace(
/(.)([A-Z][a-z])/g,
(m, p1, p2) -> "#{p1} #{p2.toLowerCase()}"
)
m = m.replace(/_/g... |
Remove hardcoded home directory path | httpProxy = require 'http-proxy'
http = require 'http'
service = require './service'
DEFAULT_CONFIG =
dir: "/Users/adam/.wow"
timeout: 20000
class ServiceManager
constructor: (config) ->
@config = config or DEFAULT_CONFIG
@services = {}
getService: (name) =>
if @services[name]?... | httpProxy = require 'http-proxy'
http = require 'http'
path = require 'path'
service = require './service'
HOME = process.env.HOME or process.env.HOMEPATH or process.env.USERPROFILE
DEFAULT_CONFIG =
dir: path.join HOME, ".wow"
timeout: 20000
class ServiceManager
constructor: (config) ->
@config =... |
Set bootstrapScript and resourcePath params in URL. | app = require 'app'
delegate = require 'atom_delegate'
path = require 'path'
Window = require 'window'
# All opened windows.
windows = []
# Quit when all windows are closed.
app.on 'window-all-closed', ->
app.quit()
delegate.browserMainParts.preMainMessageLoopRun = ->
win = new Window width: 800, height: 600, sh... | app = require 'app'
delegate = require 'atom_delegate'
path = require 'path'
Window = require 'window'
resourcePath = path.dirname(__dirname)
# All opened windows.
windows = []
# Quit when all windows are closed.
app.on 'window-all-closed', ->
app.quit()
openWindowWithParams = (pairs) ->
win = new Window width:... |
Remove unused type -> source map | Q = require 'q'
moment = require('moment')
HeadlineService = require('../services/headline')
TYPE_SOURCE_MAP =
esri:
name: 'Environment Agency - Abu Dhabi'
url: 'http://www.ead.ae'
worldBank:
name: 'World Bank Database'
url: 'http://data.worldbank.org'
DATE_FORMAT = 'D MMM YYYY'
module.exports =... | Q = require 'q'
moment = require('moment')
HeadlineService = require('../services/headline')
DATE_FORMAT = 'D MMM YYYY'
module.exports = class IndicatorPresenter
constructor: (@indicator) ->
populateHeadlineRangesFromHeadlines: (headlines) ->
@indicator.headlineRanges = {}
xAxis = @indicator.indicatorD... |
Hide rnv delay if undefined | Batman.mixin Batman.Filters,
timeText: (str_time)->
str_time = str_time.split('+')
moment.locale('de')
now = moment.utc()
start = moment(str_time[0], "HH-mm").add(str_time[1], 'minutes')
"#{start.from(now)} (+#{str_time[1]})"
class Dashing.List extends Dashing.Widget
ready: ->
if @get('uno... | Batman.mixin Batman.Filters,
timeText: (str_time)->
str_time = str_time.split('+')
moment.locale('de')
now = moment.utc()
start = moment(str_time[0], "HH-mm").add(str_time[1], 'minutes')
if str_time[1]
"#{start.from(now)} (+#{str_time[1]})"
else
"#{start.from(now)} (+?)"
class Da... |
Fix variable names since changing parameter names. | mkdirp = Meteor.npmRequire 'mkdirp'
Busboy = Meteor.npmRequire "busboy"
fs = Npm.require 'fs'
os = Npm.require 'os'
path = Npm.require 'path'
Router.route '/image/:roomId',
name: 'image'
where: 'server'
onBeforeAction: (req, res, next) ->
{roomId} = @params
filenames = []
if req.method is 'POST'
... | mkdirp = Meteor.npmRequire 'mkdirp'
Busboy = Meteor.npmRequire "busboy"
fs = Npm.require 'fs'
os = Npm.require 'os'
path = Npm.require 'path'
Router.route '/image/:roomId',
name: 'image'
where: 'server'
onBeforeAction: (req, res, next) ->
{roomId} = @params
filenames = []
if req.method is 'POST'
... |
Use slug for favorites naming | # Get the name of the favorites collection for a project
module?.exports = (project) ->
#--> Naming Convention: "Favorites for #{project_id}"
# Prevents global uniqueness validation conflict under project scope
name = "Favorites"
name += " (#{project.id})" if project?
name
| # Get the name of the favorites collection for a project
module?.exports = (project) ->
#--> Naming Convention: "Favorites for #{project_id}"
# Prevents global uniqueness validation conflict under project scope
name = "Favorites"
name += " (#{project.slug})" if project?
name
|
Rename saveToFile operator as create:file | op = require '../../../tasks/package/operators'
module.exports = (config) ->
config.tasks.package.merge
operatorsMap:
'annotate:class': op.annotateClass
'annotate:file': op.annotateFile
'join': op.join
'compile': op.compile
'uglify': op.uglify
'create:directory': op.createDire... | op = require '../../../tasks/package/operators'
module.exports = (config) ->
config.tasks.package.merge
operatorsMap:
'annotate:class': op.annotateClass
'annotate:file': op.annotateFile
'compile': op.compile
'create:directory': op.createDirectory
'create:file': op.saveToFile
'... |
Use random number as id in CallbacksRegistry. | module.exports =
class CallbacksRegistry
constructor: ->
@nextId = 0
@callbacks = {}
add: (callback) ->
@callbacks[++@nextId] = callback
@nextId
get: (id) ->
@callbacks[id]
call: (id, args...) ->
@get(id).call global, args...
apply: (id, args...) ->
@get(id).apply global, args.... | module.exports =
class CallbacksRegistry
constructor: ->
@emptyFunc = -> throw new Error "Browser trying to call a non-exist callback
in renderer, this usually happens when renderer code forgot to release
a callback installed on objects in browser when renderer was going to be
unloaded or releas... |
Fix the header and success path | Twitter = require 'twitter'
client = new Twitter
consumer_key: process.env.HUBOT_TWITTER_CONSUMER_KEY,
consumer_secret: process.env.HUBOT_TWITTER_CONSUMER_SECRET,
access_token_key: process.env.HUBOT_TWITTER_ACCESS_TOKEN_KEY,
access_token_secret: process.env.HUBOT_TWITTER_ACCESS_TOKEN_SECRET,
# I give you, a p... | Twitter = require 'twitter'
client = new Twitter
consumer_key: process.env.HUBOT_TWITTER_CONSUMER_KEY,
consumer_secret: process.env.HUBOT_TWITTER_CONSUMER_SECRET,
access_token_key: process.env.HUBOT_TWITTER_ACCESS_TOKEN_KEY,
access_token_secret: process.env.HUBOT_TWITTER_ACCESS_TOKEN_SECRET,
# I give you, a p... |
Fix copy-to-clipboard links in highlighted code blocks | class app.views.BasePage extends app.View
constructor: (@el, @entry) -> super
deactivate: ->
if super
@highlightNodes = []
render: (content, fromCache = false) ->
@highlightNodes = []
@previousTiming = null
@addClass "_#{@entry.doc.type}" unless @constructor.className
@html content
... | class app.views.BasePage extends app.View
constructor: (@el, @entry) -> super
deactivate: ->
if super
@highlightNodes = []
render: (content, fromCache = false) ->
@highlightNodes = []
@previousTiming = null
@addClass "_#{@entry.doc.type}" unless @constructor.className
@html content
... |
Use calculated outerHeight for equalHeight plugin | $.fn.equalHeights = () ->
max = -1
$(this).each ->
h = $(this).height()
max = (if h > max then h else max)
$(this).css "min-height": max | $.fn.equalHeights = () ->
max = -1
$(this).each ->
h = $(this).outerHeight()
max = (if h > max then h else max)
$(this).css "min-height": max |
Bump line length limit to 100 | module.exports = ->
# Project configuration
@initConfig
pkg: @file.readJSON 'package.json'
# BDD tests on Node.js
mochaTest:
nodejs:
src: ['spec/*.coffee']
options:
reporter: 'spec'
# Coding standards
coffeelint:
components:
files:
src: [... | module.exports = ->
# Project configuration
@initConfig
pkg: @file.readJSON 'package.json'
# BDD tests on Node.js
mochaTest:
nodejs:
src: ['spec/*.coffee']
options:
reporter: 'spec'
# Coding standards
coffeelint:
components:
files:
src: [... |
Add a crude debugging method for Atom package development | # I love this program.
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
#... | # I love this program.
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
#... |
Make the final count the original number | # Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
roundUpBy = (value, round_to) ->
return round_to * Math.ceil(value / round_to)
formatNumber = (number) ->... | # Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
roundUpBy = (value, round_to) ->
return round_to * Math.ceil(value / round_to)
formatNumber = (number) ->... |
Add smooth down arrow navigation to /schools | app = require 'core/application'
AuthModal = require 'views/core/AuthModal'
RootView = require 'views/core/RootView'
template = require 'templates/sales-view'
module.exports = class SalesView extends RootView
id: 'sales-view'
template: template
events:
'click .btn-contact-us': 'onClickContactUs'
'click ... | app = require 'core/application'
AuthModal = require 'views/core/AuthModal'
RootView = require 'views/core/RootView'
template = require 'templates/sales-view'
module.exports = class SalesView extends RootView
id: 'sales-view'
template: template
events:
'click .btn-contact-us': 'onClickContactUs'
'click ... |
Make upcoming lectures into a scrolly fadey inny outy carousel | class Dashing.Lecturelist extends Dashing.Widget
ready: ->
onData: (data) ->
i = 0
node = $(@get('node'))
if data.items.length == 0
@set 'empty', true
while i < data.items.length
capacity = data.items[i].capacity
tickets = data.items[i].tickets
people = ""
x = capac... | class Dashing.Lecturelist extends Dashing.Widget
ready: ->
@currentIndex = 0
@items = $(@node).find('li')
@nextItem()
@startCarousel()
onData: (data) ->
@currentIndex = 0
i = 0
if data.items.length == 0
@set 'empty', true
while i < data.items.length
capacity = data.it... |
Allow user package specs to override bundled package specs | fs = require 'fs'
require 'window'
measure 'spec suite require time', ->
fsUtils = require 'fs-utils'
path = require 'path'
require 'spec-helper'
requireSpecs = (directoryPath, specType) ->
for specPath in fsUtils.listTreeSync(path.join(directoryPath, 'spec')) when /-spec\.coffee$/.test specPath
re... | require 'window'
measure 'spec suite require time', ->
fs = require 'fs'
fsUtils = require 'fs-utils'
path = require 'path'
_ = require 'underscore'
require 'spec-helper'
requireSpecs = (directoryPath, specType) ->
for specPath in fsUtils.listTreeSync(path.join(directoryPath, 'spec')) when /-spec\.cof... |
Add VendorGoogle to vendor list | class VendorView extends KDView
constructor:->
super cssClass: 'vendor'
@vendorController = new KDListViewController
selection : yes
viewOptions :
cssClass : 'vendor-list'
wrapper : yes
itemClass : VendorItemView
, items : [
{ name : "Koding", ... | class VendorView extends KDView
constructor:->
super cssClass: 'vendor'
@vendorController = new KDListViewController
selection : yes
viewOptions :
cssClass : 'vendor-list'
wrapper : yes
itemClass : VendorItemView
, items : [
{ name : "Koding", ... |
Fix nav selected when path prefix | Marbles.Views.NavigationActive = class NavigationActiveView extends Marbles.View
@view_name: 'navigation_active'
@buildMappingRegexp: (mapping) ->
new RegExp("^#{mapping.replace("*", ".*?")}$")
initialize: ->
@active_class = Marbles.DOM.attr(@el, 'data-active-class')
@active_selector = Marbles.DOM.a... | Marbles.Views.NavigationActive = class NavigationActiveView extends Marbles.View
@view_name: 'navigation_active'
@buildMappingRegexp: (mapping) ->
new RegExp("^#{mapping.replace("*", ".*?")}$")
initialize: ->
@active_class = Marbles.DOM.attr(@el, 'data-active-class')
@active_selector = Marbles.DOM.a... |
Fix PDFs with embedded images via BrowserPolicy | ## Browser policy to allow many external sources, but *not* frames.
#BrowserPolicy.content.allowOriginForAll 'http://meteor.local'
BrowserPolicy.content.allowImageOrigin '*'
BrowserPolicy.content.allowMediaOrigin '*'
BrowserPolicy.content.allowFontOrigin '*'
BrowserPolicy.content.allowStyleOrigin '*'
BrowserPolicy.cont... | ## Browser policy to allow many external sources, but *not* frames.
#BrowserPolicy.content.allowOriginForAll 'http://meteor.local'
BrowserPolicy.content.allowImageOrigin '*'
BrowserPolicy.content.allowMediaOrigin '*'
BrowserPolicy.content.allowFontOrigin '*'
BrowserPolicy.content.allowStyleOrigin '*'
BrowserPolicy.cont... |
Add a generic idType to each built instance. Perhaps removed later. | {Wrappers} = require "#{__dirname}/wrappers"
class BeanBuilder
basePath: null
suffix: null
createObjectCallback: null
useSingletons: false
instances: null
constructor: ({@basePath, @suffix, @createObjectCallback, @useSingletons}) ->
if @suffix[0] is '_'
@suffix = @suffix[1..]
@instances =... | {Wrappers} = require "#{__dirname}/wrappers"
class BeanBuilder
basePath: null
suffix: null
createObjectCallback: null
useSingletons: false
instances: null
constructor: ({@basePath, @suffix, @createObjectCallback, @useSingletons}) ->
if @suffix[0] is '_'
@suffix = @suffix[1..]
@instances =... |
Add more inteligent image preloading | Yossarian.EventArtistView = Ember.View.extend
tagName: 'img'
attributeBindings: ['src', 'title']
preload: ->
@set('src', @get('content.image.image.large.url'))
@set('title', @get('content.name'))
Yossarian.EventArtistsView = Ember.CollectionView.extend
tagName: 'div'
content: []
currentItem: null
... | Yossarian.EventArtistView = Ember.View.extend
tagName: 'img'
attributeBindings: ['src', 'title']
preload: ->
@set('src', @get('content.image.image.large.url'))
@set('title', @get('content.name'))
Yossarian.EventArtistsView = Ember.CollectionView.extend
tagName: 'div'
content: []
nextSlideView: nul... |
Disable continue button when saving | React = require 'react'
BS = require 'react-bootstrap'
_ = require 'underscore'
{StepPanel} = require '../../helpers/policies'
{CardBody} = require '../pinned-header-footer-card/sections'
AsyncButton = require '../buttons/async-button'
{TaskStore} = require '../../flux/task'
{TaskStepStore} = require '../../flux/task... | React = require 'react'
BS = require 'react-bootstrap'
_ = require 'underscore'
{StepPanel} = require '../../helpers/policies'
{CardBody} = require '../pinned-header-footer-card/sections'
AsyncButton = require '../buttons/async-button'
{TaskStore} = require '../../flux/task'
{TaskStepStore} = require '../../flux/task... |
Determine when to scroll content back to top dynamically | define (require) ->
router = require('cs!router')
analytics = require('cs!helpers/handlers/analytics')
BaseView = require('cs!helpers/backbone/views/base')
template = require('hbs!./nav-template')
require('less!./nav')
return class MediaNavView extends BaseView
template: template
templateHelpers:
... | define (require) ->
$ = require('jquery')
router = require('cs!router')
analytics = require('cs!helpers/handlers/analytics')
BaseView = require('cs!helpers/backbone/views/base')
template = require('hbs!./nav-template')
require('less!./nav')
return class MediaNavView extends BaseView
template: templat... |
Fix getting word under cursor for various Ruby scopes | {Task} = require 'atom'
ctags = require 'ctags'
async = require 'async'
getTagsFile = require "./get-tags-file"
handlerPath = require.resolve './load-tags-handler'
module.exports =
find: (editor, callback) ->
if editor.getLastCursor().getScopeDescriptor().getScopesArray().indexOf('source.ruby') isnt -1
# ... | {Task} = require 'atom'
ctags = require 'ctags'
async = require 'async'
getTagsFile = require "./get-tags-file"
handlerPath = require.resolve './load-tags-handler'
module.exports =
find: (editor, callback) ->
cursor = editor.getLastCursor()
scopes = cursor.getScopeDescriptor().getScopesArray()
rubyScope... |
Store latest to address into local storage. | define ['jquery', 'underscore', 'backbone', 'views/search_input_view'], ($, _, Backbone, SearchInputView) ->
class SearchView extends Backbone.View
el: $('#search')
events:
'submit form': 'searchRoute'
initialize: ->
@to = new SearchInputView(el: @$el.find('#to'))
@from = new SearchIn... | define ['jquery', 'underscore', 'backbone', 'views/search_input_view'], ($, _, Backbone, SearchInputView) ->
class SearchView extends Backbone.View
el: $('#search')
events:
'submit form': 'searchRoute'
initialize: ->
@to = new SearchInputView(el: @$el.find('#to'))
@to.val localStorage... |
Append a cache buster to atom.css url in stylesheet link tag. | $ = require 'jquery'
Template = require 'template'
module.exports =
class Layout extends Template
@attach: ->
view = @build()
$('body').append view
view
content: ->
@link rel: 'stylesheet', href: 'static/atom.css'
@div id: 'app-horizontal', =>
@div id: 'app-vertical', outlet: 'vertical',... | $ = require 'jquery'
Template = require 'template'
module.exports =
class Layout extends Template
@attach: ->
view = @build()
$('body').append view
view
content: ->
@link rel: 'stylesheet', href: "#{require.resolve('atom.css')}?#{(new Date).getTime()}"
@div id: 'app-horizontal', =>
@div ... |
Add specs for new async behavior | {Emitter} = require('../src/emitter')
describe "Emitter", ->
it "invokes the observer when the named event is emitted until disposed", ->
emitter = new Emitter
fooEvents = []
barEvents = []
sub1 = emitter.on 'foo', (value) -> fooEvents.push(['a', value])
sub2 = emitter.on 'bar', (value) -> barE... | {Emitter} = require('../src/emitter')
describe "Emitter", ->
it "invokes the observer when the named event is emitted until disposed", ->
emitter = new Emitter
fooEvents = []
barEvents = []
sub1 = emitter.on 'foo', (value) -> fooEvents.push(['a', value])
sub2 = emitter.on 'bar', (value) -> barE... |
Use naturalOrder for legend label ordering | class PG.Legend
defaults:
className: "legend"
constructor: (container, @graphs, options) ->
@container = $(container)
@options = $.extend @defaults, options
@element = $("<div></div>").addClass(@options.className)
@container.append @element
@legend = new Rickshaw.Graph.Legend
graph:... | class PG.Legend
defaults:
className: "legend"
constructor: (container, @graphs, options) ->
@container = $(container)
@options = $.extend @defaults, options
@element = $("<div></div>").addClass(@options.className)
@container.append @element
@legend = new Rickshaw.Graph.Legend
graph:... |
Switch back to 100ms delay til process.exit on error | Q = require 'q'
argv = (require 'yargs').argv
log = require './log'
Q.longStackSupport = yes
process.on 'uncaughtException', (err) ->
log.error 'Uncaught exception:', err.stack
process.nextTick ->
process.exit 1
logLevel = argv.log ? 'info'
log.initialize logLevel, require './io/tty-log'
log "Using log level ... | Q = require 'q'
argv = (require 'yargs').argv
log = require './log'
Q.longStackSupport = yes
process.on 'uncaughtException', (err) ->
log.error 'Uncaught exception:', err.stack
Q.delay(100).then ->
process.exit 1
logLevel = argv.log ? 'info'
log.initialize logLevel, require './io/tty-log'
log "Using log level... |
Replace Angular router with ui-router. | app = angular.module 'qiprofile', [
'ngRoute', 'ui.bootstrap', 'nvd3ChartDirectives',
'qiprofile.services', 'qiprofile.controllers', 'qiprofile.filters',
'qiprofile.directives', 'qiprofile.routes'
]
| app = angular.module 'qiprofile', [
'ui.router', 'ui.bootstrap', 'nvd3ChartDirectives',
'qiprofile.services', 'qiprofile.routes', 'qiprofile.controllers',
'qiprofile.filters', 'qiprofile.directives'
]
|
Add image location to subject data | define (require) ->
Backbone = require('backbone')
settings = require('cs!settings')
SERVER = "#{location.protocol}//#{settings.cnxarchive.host}:#{settings.cnxarchive.port}"
return new class Subjects extends Backbone.Collection
url: () -> "#{SERVER}/extras"
initialize: () ->
@fetch({reset: true... | define (require) ->
_ = require('underscore')
Backbone = require('backbone')
settings = require('cs!settings')
SERVER = "#{location.protocol}//#{settings.cnxarchive.host}:#{settings.cnxarchive.port}"
return new class Subjects extends Backbone.Collection
url: () -> "#{SERVER}/extras"
initialize: () ... |
Check heading in visit / test. | define ['app', 'tests/testUtils'], (App, TestUtils) ->
run = ->
module 'Integration: showActivity',
teardown: -> App.reset()
test 'hello', -> ok true, 'true is tautological'
test 'visit /, list all activity', ->
expect 1
TestUtils.stubAjax '/api/v1/activity/days', 'GET', '[{"day":1399096800000,"activ... | define ['app', 'tests/testUtils'], (App, TestUtils) ->
run = ->
module 'Integration: showActivity',
teardown: -> App.reset()
test 'visit /, list all activity', ->
expect 2
activity = [{
day: new Date().getTime()
activities: ['Tested DayTracker']
}]
TestUtils.stubAjax '/api/v1/activity/day... |
Add a new menu item | 'menu': [
{
'label': 'Packages'
'submenu': [
'label': 'Bracket Matcher'
'submenu': [
{ 'label': 'Go To Matching Bracket', 'command': 'bracket-matcher:go-to-matching-bracket' }
{ 'label': 'Select Inside Brackets', 'command': 'bracket-matcher:select-inside-brackets' }
{ 'labe... | 'menu': [
{
'label': 'Packages'
'submenu': [
'label': 'Bracket Matcher'
'submenu': [
{ 'label': 'Go To Matching Bracket', 'command': 'bracket-matcher:go-to-matching-bracket' }
{ 'label': 'Select Inside Brackets', 'command': 'bracket-matcher:select-inside-brackets' }
{ 'labe... |
Install apm in deb package. | path = require 'path'
runas = null
module.exports = (grunt) ->
{cp, mkdir, rm} = require('./task-helpers')(grunt)
grunt.registerTask 'install', 'Install the built application', ->
installDir = grunt.config.get('atom.installDir')
shellAppDir = grunt.config.get('atom.shellAppDir')
if process.platform is... | fs = require 'fs'
path = require 'path'
runas = null
module.exports = (grunt) ->
{cp, mkdir, rm} = require('./task-helpers')(grunt)
grunt.registerTask 'install', 'Install the built application', ->
installDir = grunt.config.get('atom.installDir')
shellAppDir = grunt.config.get('atom.shellAppDir')
if p... |
Remove log statement for dropdowns | $ ->
$("div.tabs").tab()
$ ->
$("a[rel=twipsy]").tooltip live: true
$ ->
$("a[rel=popover]").popover offset: 10
$ ->
# TODO: find a better way to set this event handler
# it is here, so this 'click' is handled before the 'dropdown' one
$('ul.quickjump-dropdown').parents("li.dropdown").find("a.dropdown-toggl... | $ ->
$("div.tabs").tab()
$ ->
$("a[rel=twipsy]").tooltip live: true
$ ->
$("a[rel=popover]").popover offset: 10
$ ->
# TODO: find a better way to set this event handler
# it is here, so this 'click' is handled before the 'dropdown' one
$('ul.quickjump-dropdown').parents("li.dropdown").find("a.dropdown-toggl... |
Make sure there actually is a user when we list files | Template.login.events
'submit form': (e) ->
e.preventDefault()
user = e.target.username.value
pass = e.target.password.value
Meteor.loginWithPg user, pass, (err) ->
unless err
Tracker.autorun ->
Meteor.call 'listFiles', Meteor.user().user
else
FlashMessages.sendEr... | Template.login.events
'submit form': (e) ->
e.preventDefault()
user = e.target.username.value
pass = e.target.password.value
Meteor.loginWithPg user, pass, (err) ->
unless err
Tracker.autorun ->
if user = Meteor.user()
Meteor.call 'listFiles', user.user
else
... |
Clean up versionCheck disconnect hack | versionCheck = (scope)->
scope.alert ||= false
scope.requiredProtocolVerion ||= 6
scope.disconnect ||= true
if (typeof Leap != 'undefined') && Leap.Controller
if Leap.version.minor < 5 && Leap.version.dot < 4
console.warn("LeapJS Version Check plugin incompatible with LeapJS pre 0.4.4")
@on 'read... | versionCheck = (scope)->
scope.alert ||= false
scope.requiredProtocolVersion ||= 6
scope.disconnect ||= true
if (typeof Leap != 'undefined') && Leap.Controller
if Leap.version.minor < 5 && Leap.version.dot < 4
console.warn("LeapJS Version Check plugin incompatible with LeapJS pre 0.4.4")
@on 'rea... |
Remove ember-auth sign out route | Dashboard.SessionsNewRoute = Ember.Route.extend
authRedirectable: false
renderTemplate: ->
Dashboard.SessionsDestroyRoute = Ember.Route.extend
activate: ->
@auth.signOut().then -> window.location.reload true
this.render('sessions/new', outlet: 'login')
| Dashboard.SessionsNewRoute = Ember.Route.extend
renderTemplate: ->
this.render('sessions/new', outlet: 'login')
|
Mark Pasteboard class as public | clipboard = require 'clipboard'
crypto = require 'crypto'
# Internal: Represents the clipboard used for copying and pasting in Atom.
module.exports =
class Pasteboard
signatureForMetadata: null
# Creates an `md5` hash of some text.
#
# text - A {String} to encrypt.
#
# Returns an encrypted {String}.
md5... | clipboard = require 'clipboard'
crypto = require 'crypto'
# Public: Represents the clipboard used for copying and pasting in Atom.
#
# A pasteboard instance is always available under the `atom.pasteboard` global.
module.exports =
class Pasteboard
signatureForMetadata: null
# Creates an `md5` hash of some text.
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.