Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Reset scroll to 0 after changing pages | 'use strict'
app = angular.module('holmesApp', [
'ngCookies',
'ngSanitize',
'ngRoute',
'angularMoment',
'restangular'
])
.config ($routeProvider, RestangularProvider, ConfigConst) ->
$routeProvider
.when '/',
redirectTo: '/domains'
.when '/domains',
templateUrl: 'views/domai... | 'use strict'
app = angular.module('holmesApp', [
'ngCookies',
'ngSanitize',
'ngRoute',
'angularMoment',
'restangular'
])
.config ($routeProvider, RestangularProvider, ConfigConst) ->
$routeProvider
.when '/',
redirectTo: '/domains'
.when '/domains',
templateUrl: 'views/domai... |
Use console.error instead of /dev/stderr | fs = require 'fs'
print = (s) -> fs.write "/dev/stderr", s, 'w'
page = new WebPage()
page.onConsoleMessage = (msg) -> console.error msg
timeoutId = null
deferTimeout = ->
clearTimeout timeoutId if timeoutId
timeoutId = setTimeout ->
console.error "Timeout"
phantom.exit 1
, 3000
page.open phantom.args[0... | fs = require 'fs'
page = new WebPage()
page.onConsoleMessage = (msg) -> console.error msg
timeoutId = null
deferTimeout = ->
clearTimeout timeoutId if timeoutId
timeoutId = setTimeout ->
console.error "Timeout"
phantom.exit 1
, 3000
page.open phantom.args[0], ->
deferTimeout()
setInterval ->
t... |
Add simple test that constructs a chosen entirely in memory | describe "Basic setup", ->
it "should add chosen to jQuery object", ->
expect(jQuery.fn.chosen).toBeDefined()
| describe "Basic setup", ->
it "should add chosen to jQuery object", ->
expect(jQuery.fn.chosen).toBeDefined()
it "should create very basic chosen", ->
tmpl = "
<select data-placeholder='Choose a Country...'>
<option value=''></option>
<option value='United States'>United States</optio... |
Swap ctrl-9 and ctrl-shift-9 <_< >_> | '.workspace':
'ctrl-shift-9': 'github:toggle-git-panel'
'ctrl-9': 'github:toggle-git-panel-focus'
'.github-StagingView':
'left': 'github:focus-diff-view'
'.github-CommitView-editor atom-text-editor:not([mini])':
'cmd-enter': 'github:commit'
'ctrl-enter': 'github:commit'
'.github-FilePatchView':
'/': 'git... | '.workspace':
'ctrl-9': 'github:toggle-git-panel'
'ctrl-shift-9': 'github:toggle-git-panel-focus'
'.github-StagingView':
'left': 'github:focus-diff-view'
'.github-CommitView-editor atom-text-editor:not([mini])':
'cmd-enter': 'github:commit'
'ctrl-enter': 'github:commit'
'.github-FilePatchView':
'/': 'git... |
Fix name of helper in error message | isActive = (type, inverse = false) ->
name = 'is'
name = name + 'Not' if inverse
name = name + _.capitalize type
(view) ->
unless view instanceof Spacebars.kw
throw new Error "#{name} options must be key value pair such " +
"as {{#{name} regex='route/path'}}. You passed: " +
"#{JSON.s... | isActive = (type, inverse = false) ->
name = 'is'
name = name + 'Not' if inverse
name = name + 'Active' + _.capitalize type
(view) ->
unless view instanceof Spacebars.kw
throw new Error "#{name} options must be key value pair such " +
"as {{#{name} regex='route/path'}}. You passed: " +
... |
Use start, emit over ComputeController, start polling when requested, stop when not needed | class ComputeEventListener extends KDObject
constructor:(options = {})->
super
interval : options.interval ? 4000
@kloud = KD.singletons.kontrol.getKite
name : "kloud"
environment : "vagrant"
@listeners = []
@tickInProgress = no
@running = no
... | class ComputeEventListener extends KDObject
constructor:(options = {})->
super
interval : options.interval ? 4000
@kloud = KD.singletons.kontrol.getKite
name : "kloud"
environment : "vagrant"
@listeners = []
@tickInProgress = no
@running = no
... |
Fix buildURL wrt running the app on a prefix | DS.RESTAdapter.configure 'plurals',
corpus: 'corpora'
search: 'searches'
cwb_search: 'cwb_searches'
metadata_category: 'metadata_categories'
App.Adapter = DS.RESTAdapter.extend
buildURL: (record, suffix) ->
url = @_super(record, suffix)
url = "/search_engines#{url}" unless record.search(/_se... | DS.RESTAdapter.configure 'plurals',
corpus: 'corpora'
search: 'searches'
cwb_search: 'cwb_searches'
metadata_category: 'metadata_categories'
App.Adapter = DS.RESTAdapter.extend
buildURL: (record, suffix) ->
url = @_super(record, suffix)
unless record.search(/_search$/) is -1
parts = ur... |
Add non-code reesources to build | gulp = require "gulp"
gutil = require "gulp-util"
coffee = require "gulp-coffee"
del = require "del"
path = require "path"
{spawn} = require "child_process"
prefix = gutil.env.prefix || "./build"
resourceDir = path.join prefix, "Resources"
gulp.task "clean", (done) ->
del(prefix, done)
gulp.task ... | gulp = require "gulp"
gutil = require "gulp-util"
coffee = require "gulp-coffee"
del = require "del"
path = require "path"
{spawn} = require "child_process"
prefix = gutil.env.prefix || "./build"
resourceDir = path.join prefix, "Resources"
gulp.task "clean", (done) ->
del(prefix, done)
gulp.task ... |
Use twilight syntax theme for atom | "*":
"exception-reporting":
userId: "1e725750-c66d-33e4-9fce-f627ac32bde5"
"release-notes":
viewedVersion: "0.94.0"
welcome:
showOnStartup: false
metrics:
userId: "c2f08243ecb4a9bc44bd9e46d4f067086d9357e3"
editor:
fontSize: 11
showInvisibles: true
showIndentGuide: true
invisibl... | "*":
"exception-reporting":
userId: "1e725750-c66d-33e4-9fce-f627ac32bde5"
"release-notes":
viewedVersion: "0.94.0"
welcome:
showOnStartup: false
metrics:
userId: "c2f08243ecb4a9bc44bd9e46d4f067086d9357e3"
editor:
fontSize: 11
showInvisibles: true
showIndentGuide: true
invisibl... |
Add version to client exceptions | angular.module('loomioApp').factory '$exceptionHandler', ($log, AppConfig) ->
if !AppConfig.errbit.key?
return ->
client = new airbrakeJs.Client
projectId: AppConfig.errbit.key
projectKey: AppConfig.errbit.key
reporter: 'xhr'
host: AppConfig.errbit.url
client.addFilter (notice) ->
... | angular.module('loomioApp').factory '$exceptionHandler', ($log, AppConfig) ->
if !AppConfig.errbit.key?
return ->
client = new airbrakeJs.Client
projectId: AppConfig.errbit.key
projectKey: AppConfig.errbit.key
reporter: 'xhr'
host: AppConfig.errbit.url
client.addFilter (notice) ->
... |
Declare ui.router dependency in astrifex.maker module | 'use strict'
module.exports = angular.module('astrifex.maker', [])
.config(($stateProvider) ->
$stateProvider.state 'maker',
url: ''
templateUrl: 'app/maker/layout.html'
controller: 'makerController'
return
).controller('makerController', require('./makerController'))
| 'use strict'
module.exports = angular.module('astrifex.maker', ['ui.router'])
.config(($stateProvider) ->
$stateProvider.state 'maker',
url: ''
templateUrl: 'app/maker/layout.html'
controller: 'makerController'
return
).controller('makerController', require('./makerController'))
|
Send disconnect on gate close | noflo = require 'noflo'
class Gate extends noflo.Component
description: 'This component forwards received packets when the gate is open'
constructor: ->
@open = false
@inPorts =
in: new noflo.Port 'all'
open: new noflo.Port 'bang'
close: new noflo.Port 'bang'
@outPorts =
out: ... | noflo = require 'noflo'
class Gate extends noflo.Component
description: 'This component forwards received packets when the gate is open'
constructor: ->
@open = false
@inPorts =
in: new noflo.Port 'all'
open: new noflo.Port 'bang'
close: new noflo.Port 'bang'
@outPorts =
out: ... |
Switch Back to Default HAML Compiler | gulp = require 'gulp'
del = require 'del'
haml = require 'gulp-haml'
sourcemaps = require 'gulp-sourcemaps'
coffee = require 'gulp-coffee'
SRC = 'src'
DEST = 'out'
gulp.task 'default', ['haml', 'coffee']
gulp.task 'haml', ->
gulp.src "#{SRC}/haml/**/*.haml"
.pipe haml compiler: 'visionme... | gulp = require 'gulp'
del = require 'del'
haml = require 'gulp-haml'
sourcemaps = require 'gulp-sourcemaps'
coffee = require 'gulp-coffee'
SRC = 'src'
DEST = 'out'
gulp.task 'default', ['haml', 'coffee']
gulp.task 'haml', ->
gulp.src "#{SRC}/haml/**/*.haml"
.pipe haml()
.pipe gulp.de... |
Use skinny arrow for rootView.eachEditor callback | {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 compatibility check for html5 routing mode | app = angular.module 'draw', [ 'ngRoute' ]
app.config ($locationProvider) ->
# if window.history && window.history.pushState
$locationProvider.html5Mode true
module.exports = app | app = angular.module 'draw', [ 'ngRoute' ]
app.config ($locationProvider) ->
if window.history && window.history.pushState
$locationProvider.html5Mode true
module.exports = app |
Add reload and toggle dev tools key bindings to test window | # Start the crash reporter before anything else.
require('crash-reporter').start(productName: 'Atom', companyName: 'GitHub')
path = require 'path'
ipc = require 'ipc'
ipc.send('call-window-method', 'openDevTools')
try
require '../src/window'
Atom = require '../src/atom'
window.atom = new Atom
# Show windo... | # Start the crash reporter before anything else.
require('crash-reporter').start(productName: 'Atom', companyName: 'GitHub')
try
path = require 'path'
ipc = require 'ipc'
require '../src/window'
Atom = require '../src/atom'
window.atom = new Atom
# Show window synchronously so a focusout doesn't fire on ... |
Use KDSplitView in layout builder. | class WorkspaceLayoutBuilder extends KDSplitComboView
init: ->
@splitViews = {}
{direction, sizes, views, cssClass, splitName} = @getOption 'layoutOptions'
@baseSplitName = splitName
splitOptions = {
type : direction
viewsConfig : views
sizes
cssClass
}
@a... | class WorkspaceLayoutBuilder extends KDSplitComboView
init: ->
@splitViews = {}
{direction, sizes, views, cssClass, splitName} = @getOption 'layoutOptions'
@baseSplitName = splitName
splitOptions = {
type : direction
viewsConfig : views
sizes
cssClass
}
@a... |
Allow cancelling the filter chain and action. | Batman.LifecycleEvents =
initialize: ->
@::fireLifecycleEvent = fire
lifecycleEvent: (eventName, normalizeFunction) ->
beforeName = "before#{Batman.helpers.camelize(eventName)}"
afterName = "after#{Batman.helpers.camelize(eventName)}"
addCallback = (eventName) ->
(callbackName, options) ->
... | Batman.LifecycleEvents =
initialize: ->
@::fireLifecycleEvent = fire
lifecycleEvent: (eventName, normalizeFunction) ->
beforeName = "before#{Batman.helpers.camelize(eventName)}"
afterName = "after#{Batman.helpers.camelize(eventName)}"
addCallback = (eventName) ->
(callbackName, options) ->
... |
Allow activated callback to use dependency injection | angular.module 'angular.tourist'
.directive 'tourStep', ['$tourist', '$window', ($tourist, $window) ->
restrict: 'EAC'
controller: ['$scope', ($scope) ->
@element = null
# JQLite doesnt support offset, so we implement it here
_boundingOffset = (element) ->
return unless element?
... | angular.module 'angular.tourist'
.directive 'tourStep', ['$tourist', '$window', '$injector', ($tourist, $window, $injector) ->
restrict: 'EAC'
controller: ['$scope', ($scope) ->
@element = null
# JQLite doesnt support offset, so we implement it here
_boundingOffset = (element) ->
r... |
Fix JSX indent newline to allow for hard tabs when autoIndentJSX is off. | module.exports =
class InsertNlJsx
constructor: (@editor) ->
@adviseBefore(@editor, 'insertText', @insertText)
# patched TextEditor::insertText
# if a newLine is entered between a JSX tag open and close marked_ <div>_</div>
# then add another newLine and reposition cursor
insertText: (text, options) =>
... | module.exports =
class InsertNlJsx
constructor: (@editor) ->
@adviseBefore(@editor, 'insertText', @insertText)
# patched TextEditor::insertText
# if a newLine is entered between a JSX tag open and close marked_ <div>_</div>
# then add another newLine and reposition cursor
insertText: (text, options) =>
... |
Simplify ChangeListener, can now take a child function | React = require 'react'
# TODO: Maybe infer the on/off methods from a list if none is specified:
# ON_OFF_METHODS =
# addEventListener: 'removeEventListener' # DOM elements
# addListener: 'removeListener' # Node EventEmitter class
# listen: 'stopListening' # Panoptes Model and JSONAPIClient Resource classes (cha... | React = require 'react'
module.exports = React.createClass
displayName: 'ChangeListener'
getDefaultProps: ->
target: null
eventName: 'change'
on: 'listen'
off: 'stopListening'
handler: null
getInitialState: ->
payload: []
componentDidMount: ->
@startListeningTo @props.target
c... |
Make sure editor is set before trying to get code. | ScriptView = require './script-view'
configUri = "atom://script"
grammarMap =
CoffeeScript:
interpreter: "coffee"
makeargs: (code) -> ['-e', code]
Python:
interpreter: "python"
makeargs: (code) -> ['-c', code]
module.exports =
activate: ->
atom.project.registerOpener (uri) =>
interp... | ScriptView = require './script-view'
configUri = "atom://script"
grammarMap =
CoffeeScript:
interpreter: "coffee"
makeargs: (code) -> ['-e', code]
Python:
interpreter: "python"
makeargs: (code) -> ['-c', code]
module.exports =
activate: ->
atom.project.registerOpener (uri) =>
interp... |
Use promise for notify on completion |
class ModelSaver
constructor: ( @element, @options )->
@mask = new Lanes.Views.TimedMask( @element, @options.message )
@mask.prefixActions( "Save" )
_.bindAll(this,'_onError','_onSuccess')
save: ->
@options.model.save({
success: this._onSuccess, error: this._onErro... | class ModelSaver
constructor: ( @element, @options )->
@mask = new Lanes.Views.TimedMask( @element, @options.message )
@mask.prefixActions( "Save" )
_.bindAll(this,'_onError','_onSuccess')
this.notification = new _.DeferredPromise
save: ->
@options.model.save({
... |
Add stub config for grunt-release | module.exports = (grunt)->
require('grunt-recurse')(grunt, __dirname)
grunt.expandFileArg = (
prefix = '.',
base = '**',
postfix = '*test.coffee'
)->
part = (v)->"#{prefix}/#{v}#{postfix}"
files = grunt.option('files')
return part(base) unless files
f... | module.exports = (grunt)->
require('grunt-recurse')(grunt, __dirname)
grunt.expandFileArg = (
prefix = '.',
base = '**',
postfix = '*test.coffee'
)->
part = (v)->"#{prefix}/#{v}#{postfix}"
files = grunt.option('files')
return part(base) unless files
f... |
Add Ruby on Rails support | module.exports =
selector: ['.source.ruby']
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':
title: 'Left space for ... | 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... |
Remove outdated --harmony_collections parameter from build script | module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
coffee:
glob_to_multiple:
expand: true
cwd: 'src'
src: ['**/*.coffee']
dest: 'lib'
ext: '.js'
coffeelint:
options:
no_empty_param_list:
level: 'erro... | module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
coffee:
glob_to_multiple:
expand: true
cwd: 'src'
src: ['**/*.coffee']
dest: 'lib'
ext: '.js'
coffeelint:
options:
no_empty_param_list:
level: 'erro... |
Fix javascript error on tooltip hide (can't destroy elem that doesn't exist anymore) | #= require clipboard.min
$.fn.initSnippetCopyToClipboard = () ->
this.each () ->
$element = $(this)
$element.prepend('<button class="btn btn-default" data-clipboard-snippet><i class="fa fa-clipboard"></i></button>')
clipboardSnippets = new Clipboard('[data-clipboard-snippet]', target: (trigger) ->
... | #= require clipboard.min
$.fn.initSnippetCopyToClipboard = () ->
this.each () ->
$element = $(this)
$element.prepend('<button class="btn btn-default" data-clipboard-snippet><i class="fa fa-clipboard"></i></button>')
clipboardSnippets = new Clipboard('[data-clipboard-snippet]', target: (trigger) ->
... |
Create parent directories to symlink | path = require 'path'
fs = require './fs'
CSON = require 'season'
config = require './config'
module.exports =
class Linker
run: (options) ->
linkPath = path.resolve(process.cwd(), options.commandArgs.shift() ? '.')
try
packageName = CSON.readFileSync(CSON.resolve(path.join(linkPath, 'package'))).name
... | path = require 'path'
fs = require './fs'
CSON = require 'season'
config = require './config'
mkdir = require('mkdirp').sync
module.exports =
class Linker
run: (options) ->
linkPath = path.resolve(process.cwd(), options.commandArgs.shift() ? '.')
try
packageName = CSON.readFileSync(CSON.resolve(path.jo... |
Add command line flags to output available packages as json | request = require 'request'
npmconf = require 'npmconf'
config = require './config'
tree = require './tree'
semver = require 'semver'
_ = require 'underscore'
module.exports =
class Fetcher
getAvailablePackages: (atomVersion, callback) ->
if _.isFunction(atomVersion)
callback = atomVersion
atomVersio... | request = require 'request'
npmconf = require 'npmconf'
config = require './config'
tree = require './tree'
semver = require 'semver'
_ = require 'underscore'
module.exports =
class Fetcher
getAvailablePackages: (atomVersion, callback) ->
if _.isFunction(atomVersion)
callback = atomVersion
atomVersio... |
Make mongo-migrate config script self executable | fs = require 'fs'
module.exports.create = (KONFIG)->
connectionString = "mongodb://#{KONFIG.mongo}"
conn = { connectionString }
fileName = "./deployment/generated_files/mongomigration.json"
fs.writeFileSync fileName, JSON.stringify { conn }
| #!/usr/bin/env coffee
fs = require 'fs'
module.exports.create = create = (KONFIG) ->
connectionString = "mongodb://#{KONFIG.mongo}"
conn = { connectionString }
fileName = "./deployment/generated_files/mongomigration.json"
fs.writeFileSync fileName, JSON.stringify { conn }
if require.main is module
mongo =... |
Fix bug with undefined title_id in redirect following event creation | window.events_at_penn ?= {}
Template.new_event.helpers
'empty_object': {}
Template.new_event.events
'submit .create-event': (e) ->
e.preventDefault()
event = window.events_at_penn.parse_event_from_form $('.create-event')
Meteor.call('create_event', event, (error, id) ->
Meteor.Router.to "/event/... | window.events_at_penn ?= {}
Template.new_event.helpers
'empty_object': {}
Template.new_event.events
'submit .create-event': (e) ->
e.preventDefault()
event = window.events_at_penn.parse_event_from_form $('.create-event')
Meteor.call('create_event', event, (error, id) ->
Meteor.Router.to "/event/... |
Add a bunch of text builders. | {BaseTaskAction} = require "#{__dirname}/../../base_task_action"
{TempFileHolder} = require "#{__dirname}/../../helpers/temp_file_holder"
{GoogleTranslatorTtsStrategy} = require "#{__dirname}/../../plugins/say/tts_strategies/google_translator"
class BuildToSpeechAction extends BaseTaskAction
language: null
cons... | {BaseTaskAction} = require "#{__dirname}/../../base_task_action"
{TempFileHolder} = require "#{__dirname}/../../helpers/temp_file_holder"
{GoogleTranslatorTtsStrategy} = require "#{__dirname}/../../plugins/say/tts_strategies/google_translator"
class BuildToSpeechAction extends BaseTaskAction
language: null
text... |
Add trigger and accept string for url | noflo = require 'noflo'
coap = require 'coap'
# @runtime noflo-nodejs
exports.getComponent = ->
c = new noflo.Component
c.icon = 'cog'
c.description = 'Send request'
# Add input ports
c.inPorts.add 'url',
datatype: 'object'
require: yes
# Add output ports
c.outPorts.add 'request',
datatype... | noflo = require 'noflo'
coap = require 'coap'
# @runtime noflo-nodejs
exports.getComponent = ->
c = new noflo.Component
c.icon = 'cog'
c.description = 'Send request'
url = null
req = null
# Add input ports
c.inPorts.add 'url',
datatype: 'all'
require: yes
c.inPorts.add 'start',
datatype: ... |
Rename require from atom-api to atom | {RootView} = require 'atom-api'
shell = require 'shell'
describe "link package", ->
[editor] = []
beforeEach ->
atom.activatePackage('javascript-tmbundle', sync: true)
atom.activatePackage('hyperlink-helper-tmbundle', sync: true)
window.rootView = new RootView
rootView.open('sample.js')
atom.a... | {RootView} = require 'atom'
shell = require 'shell'
describe "link package", ->
[editor] = []
beforeEach ->
atom.activatePackage('javascript-tmbundle', sync: true)
atom.activatePackage('hyperlink-helper-tmbundle', sync: true)
window.rootView = new RootView
rootView.open('sample.js')
atom.activ... |
Use Finder app to create a filetree. | class FinderPane extends Pane
constructor: (options = {}, data) ->
super options, data
vmController = KD.getSingleton 'vmController'
vmController.fetchDefaultVmName (vmName) =>
@finder = new NFinderController
nodeIdPath : 'path'
nodeParentIdPath : 'parentPath'
contextMen... | class FinderPane extends Pane
constructor: (options = {}, data) ->
super options, data
appManager = KD.getSingleton 'appManager'
appManager.open 'Finder', (finderApp) =>
fc = @finderController = finderApp.create()
@addSubView fc.getView()
fc.reset()
fc.on 'FileNeedsToBeOpened'... |
Update for express 3.4.4, use the json and urlencoded middleware directly | express = require 'express'
mongoose = require 'mongoose'
ext_type = require 'connect-ext-type'
{ createServer } = require 'http'
{ join } = require 'path'
module.exports = express().configure ->
@set 'port', process.env.PORT or 8070
@set 'view engine', 'jade'
@set 'views', join __dirname, 'views'
@set 'url', ... | express = require 'express'
mongoose = require 'mongoose'
ext_type = require 'connect-ext-type'
{ createServer } = require 'http'
{ join } = require 'path'
module.exports = express().configure ->
@set 'port', process.env.PORT or 8070
@set 'view engine', 'jade'
@set 'views', join __dirname, 'views'
@set 'url', ... |
Update selected tab when set from props | React = require 'react'
classnames = require 'classnames'
# Renders ONLY the list of tabs (not tab body), with @props.chilren inline with the tabs
# Usefull for rendering controls beside the Tabs
TabsWithChildren = React.createClass
propTypes:
onClick: React.PropTypes.func.isRequired
tabs: React.PropType... | React = require 'react'
classnames = require 'classnames'
# Renders ONLY the list of tabs (not tab body), with @props.chilren inline with the tabs
# Usefull for rendering controls beside the Tabs
TabsWithChildren = React.createClass
propTypes:
onClick: React.PropTypes.func.isRequired
tabIndex: React.Prop... |
Make sure objectMode is enabled. | ###
irc-message
Copyright (c) 2013 Fionn Kelleher. All rights reserved.
Licensed under the BSD 2-Clause License (FreeBSD) - see LICENSE.md.
###
Transform = require("stream").Transform
Message = require "irc-message"
util = require "util"
class MessageStream
constructor: (options) ->
@buffer = ""
Trans... | ###
irc-message
Copyright (c) 2013 Fionn Kelleher. All rights reserved.
Licensed under the BSD 2-Clause License (FreeBSD) - see LICENSE.md.
###
Transform = require("stream").Transform
Message = require "irc-message"
util = require "util"
class MessageStream
constructor: (options = {}) ->
options.objectMod... |
Determine license name, version and url on load | define (require) ->
$ = require('jquery')
toc = require('cs!collections/toc')
Node = require('cs!models/content/node')
require('backbone-associations')
return class Page extends Node
defaults:
authors: []
constructor: () ->
super(arguments...)
toc.add(@)
parse: (response, opti... | define (require) ->
$ = require('jquery')
toc = require('cs!collections/toc')
Node = require('cs!models/content/node')
require('backbone-associations')
LICENSES = {
'by': 'Attribution License CC BY'
'by-sa': 'Attribution-ShareAlike CC BY-SA'
'by-nd': 'Attribution-NoDerivs CC BY-ND'
'by-nc': '... |
Stop loading when modal opened | FactlinkJailRoot.createFactFromSelection = (current_user_opinion) ->
success = ->
window.document.getSelection().removeAllRanges()
FactlinkJailRoot.createButton.hide()
FactlinkJailRoot.off 'modalOpened', success
selInfo =
text: window.document.getSelection().toString()
title: window.document.ti... | FactlinkJailRoot.createFactFromSelection = (current_user_opinion) ->
success = ->
window.document.getSelection().removeAllRanges()
FactlinkJailRoot.createButton.stopLoading()
FactlinkJailRoot.createButton.hide()
FactlinkJailRoot.off 'modalOpened', success
selInfo =
text: window.document.getSele... |
Change GitWrite success message to show 'all files' or filepath | {BufferedProcess} = require 'atom'
StatusView = require './status-view'
# if all param true, then 'git add .'
gitWrite = (all=false)->
dir = atom.project.getRepo().getWorkingDirectory()
currentFile = atom.workspace.getActiveEditor().getPath()
toStage = if all then '.' else currentFile
new BufferedProcess({
... | {BufferedProcess} = require 'atom'
StatusView = require './status-view'
# if all param true, then 'git add .'
gitWrite = (all=false)->
dir = atom.project.getRepo().getWorkingDirectory()
currentFile = atom.workspace.getActiveEditor().getPath()
toStage = if all then '.' else currentFile
new BufferedProcess({
... |
Fix mock url for content | define [
'jquery'
'mockjax'
], ($) ->
$.mockjax
url: '/api/me'
proxy: 'data/me.json'
$.mockjax
url: '/api/content'
proxy: 'data/content.json'
$.mockjax (settings) ->
# url: '/content/<id>'
id = settings.url.match(/\/content\/(.*)$/);
if id
return {proxy: 'data/content/' + ... | define [
'jquery'
'mockjax'
], ($) ->
$.mockjax
url: '/api/me'
proxy: 'data/me.json'
$.mockjax
url: '/api/content'
proxy: 'data/content.json'
$.mockjax (settings) ->
# url: '/api/content/<id>'
id = settings.url.match(/\/api\/content\/(.*)$/);
if id
return {proxy: 'data/con... |
Revert "temporary fix for dependecies" | `import DS from 'ember-data'`
Commit = DS.Model.extend
remoteId: DS.attr('string')
message: DS.attr('string')
state: DS.attr('string')
remoteUrl: DS.attr('string')
project: DS.belongsTo('project')
expiresAt: DS.attr('date')
createdAt: DS.attr('date')
authoredAt: DS.attr('date')
author: DS.belongsTo('... | `import DS from 'ember-data'`
Commit = DS.Model.extend
remoteId: DS.attr('string')
message: DS.attr('string')
state: DS.attr('string')
remoteUrl: DS.attr('string')
project: DS.belongsTo('project')
expiresAt: DS.attr('date')
createdAt: DS.attr('date')
authoredAt: DS.attr('date')
author: DS.belongsTo('... |
Add AdBreak module and URL handler | class VMAPParser
module.exports = VMAPParser | URLHandler = require './urlhandler.coffee'
ADBreak = require './adbreak.coffee'
ADData = require './addata.coffee'
class VMAPParser
@parse: (url, options, cb) ->
if not cb
cb = options if typeof options is 'function'
options = {}
@_parse url, null, options, (err, response) ->
cb(response)
... |
Add warning logging when unusual things happen | # Object which holds the methods that can be called from the factlink core iframe
modalOpen = false
FactlinkJailRoot.annotatedSiteReceiver =
modalFrameReady: (featureToggles) ->
FactlinkJailRoot.can_haz = featureToggles
window.FACTLINK_ON_CORE_LOAD?()
openModalOverlay: ->
return if modalOpen
Fact... | # Object which holds the methods that can be called from the factlink core iframe
modalOpen = false
FactlinkJailRoot.annotatedSiteReceiver =
modalFrameReady: (featureToggles) ->
FactlinkJailRoot.can_haz = featureToggles
window.FACTLINK_ON_CORE_LOAD?()
openModalOverlay: ->
if modalOpen
console.e... |
Disable rendering when element is added or removed from canvas | requirejs.config({
paths: {
fabric: [
'lib/fabric']
}
})
define ['game', 'synchronizedtime', 'position', 'lib/fabric'], (Game, SynchronizedTime, Position) -> # Fabric is deliberately not set as an argument
console.log "Fabric: ", fabric
console.log "Position: ", new Position([1,2], 0, 5)
canvas = n... | requirejs.config({
paths: {
fabric: [
'lib/fabric']
}
})
define ['game', 'synchronizedtime', 'position', 'lib/fabric'], (Game, SynchronizedTime, Position) -> # Fabric is deliberately not set as an argument
console.log "Fabric: ", fabric
console.log "Position: ", new Position([1,2], 0, 5)
canvas = n... |
Add CSS optimization to Grunt build (dist only) | module.exports = (grunt, options) ->
return {
client:
options:
paths: ['styles']
files:
'<%= build %>/css/servicemap.css': 'styles/servicemap.less'
'<%= build %>/css/bootstrap.css': 'styles/bootstrap/bootstrap.less'
'<%= build %>/css/servicemap_ie.css': 'styles/servicem... | module.exports = (grunt, options) ->
return {
options:
paths: ['styles']
dev:
files:
'<%= build %>/css/servicemap.css': 'styles/servicemap.less'
'<%= build %>/css/servicemap_ie.css': 'styles/servicemap_ie.less'
'<%= build %>/css/servicemap_ie9.css': 'styles/servicemap_ie9.l... |
Use name ivar instead of metadata.name | Q = require 'q'
AtomPackage = require './atom-package'
module.exports =
class ThemePackage extends AtomPackage
getType: -> 'theme'
getStylesheetType: -> 'theme'
enable: ->
atom.config.unshiftAtKeyPath('core.themes', @metadata.name)
disable: ->
atom.config.removeAtKeyPath('core.themes', @metadata.nam... | Q = require 'q'
AtomPackage = require './atom-package'
module.exports =
class ThemePackage extends AtomPackage
getType: -> 'theme'
getStylesheetType: -> 'theme'
enable: ->
atom.config.unshiftAtKeyPath('core.themes', @name)
disable: ->
atom.config.removeAtKeyPath('core.themes', @name)
load: ->
... |
Send text from each scraped element separately. | noflo = require "noflo"
jsdom = require "jsdom"
class ScrapeHtml extends noflo.Component
constructor: ->
@html = ""
@textSelector = ""
@crapSelectors = []
@inPorts =
in: new noflo.Port()
textSelector: new noflo.Port()
crapSelector: new noflo.Arra... | noflo = require "noflo"
jsdom = require "jsdom"
class ScrapeHtml extends noflo.Component
constructor: ->
@html = ""
@textSelector = ""
@crapSelectors = []
@inPorts =
in: new noflo.Port()
textSelector: new noflo.Port()
crapSelector: new noflo.Arra... |
Correct viewport attribute casing (runtime error) | DOM = require '../reactGUI/ReactDOMFactories-shim'
createReactClass = require '../reactGUI/createReactClass-shim'
createSetStateOnEventMixin = require '../reactGUI/createSetStateOnEventMixin'
{classSet} = require '../core/util'
module.exports = createReactClass
displayName: 'StrokeWidthPicker'
getState: (tool=@p... | DOM = require '../reactGUI/ReactDOMFactories-shim'
createReactClass = require '../reactGUI/createReactClass-shim'
createSetStateOnEventMixin = require '../reactGUI/createSetStateOnEventMixin'
{classSet} = require '../core/util'
module.exports = createReactClass
displayName: 'StrokeWidthPicker'
getState: (tool=@p... |
Change to more appropriate names | fs = require 'fs'
path = require 'path'
class Cli
constructor: ->
@error = null
buildOptions: (name) ->
options = {}
options.name = name
options
getValidators: ->
@validators = {}
for filename in fs.readdirSync(path.join(__dirname, 'validators'))
name = path.basename(filename, '.... | fs = require 'fs'
path = require 'path'
class Cli
constructor: ->
@exitCode = 0
getOptions: (name) ->
options = {}
options.name = name
options
getValidators: ->
@validators = {}
for filename in fs.readdirSync(path.join(__dirname, 'validators'))
name = path.basename(filename, '.co... |
Use __dirname for script directory | express = require 'express'
session = require 'express-session'
body_parser = require 'body-parser'
app = express()
app.use express.static 'app/public'
app.use session secret: 'secret-TODO-change-me'
app.use body_parser.json()
app.use body_parser.urlencoded extended: true
app.get '/', (req, res) ->
res.sen... | express = require 'express'
session = require 'express-session'
body_parser = require 'body-parser'
app = express()
app.use express.static __dirname + '/public'
app.use session secret: 'secret-TODO-change-me'
app.use body_parser.json()
app.use body_parser.urlencoded extended: true
app.get '/', (req, res) ->
... |
Add keybindings for "zoom to fit" | '.platform-darwin .image-view':
'cmd-+': 'image-view:zoom-in'
'cmd-=': 'image-view:zoom-in'
'cmd--': 'image-view:zoom-out'
'cmd-_': 'image-view:zoom-out'
'cmd-0': 'image-view:reset-zoom'
'.platform-win32 .image-view':
'ctrl-+': 'image-view:zoom-in'
'ctrl-=': 'image-view:zoom-in'
'ctrl--': 'image-view:z... | '.platform-darwin .image-view':
'cmd-+': 'image-view:zoom-in'
'cmd-=': 'image-view:zoom-in'
'cmd--': 'image-view:zoom-out'
'cmd-_': 'image-view:zoom-out'
'cmd-9': 'image-view:zoom-to-fit'
'cmd-0': 'image-view:reset-zoom'
'.platform-win32 .image-view':
'ctrl-+': 'image-view:zoom-in'
'ctrl-=': 'image-vie... |
Update status finder keybinding to meta-B | 'body':
'meta-t': 'fuzzy-finder:toggle-file-finder'
'meta-b': 'fuzzy-finder:toggle-buffer-finder'
'ctrl-.': 'fuzzy-finder:find-under-cursor'
'meta-T': 'fuzzy-finder:toggle-git-status-finder'
| 'body':
'meta-t': 'fuzzy-finder:toggle-file-finder'
'meta-b': 'fuzzy-finder:toggle-buffer-finder'
'ctrl-.': 'fuzzy-finder:find-under-cursor'
'meta-B': 'fuzzy-finder:toggle-git-status-finder'
|
Rename sub task : typescript-build -> ts-build | gulp = require 'gulp'
tsc = require 'gulp-typescript'
# Main task
gulp.task 'default', ['build']
gulp.task 'build', ['copy', 'typescript-build']
gulp.task 'copy', ()->
gulp.src 'src/html/**'
.pipe gulp.dest 'dest/html'
gulp.task 'watch', ['build'], ()->
gulp.watch 'src/**/*.html', ['copy']
gulp.wat... | gulp = require 'gulp'
tsc = require 'gulp-typescript'
# Main task
gulp.task 'default', ['build']
gulp.task 'build', ['copy', 'ts-build']
gulp.task 'copy', ()->
gulp.src 'src/html/**'
.pipe gulp.dest 'dest/html'
gulp.task 'watch', ['build'], ()->
gulp.watch 'src/**/*.html', ['copy']
gulp.watch 'src/... |
Fix mysterious teaspoon bug through try/catch. | window.Tahi ||= {}
Tahi.utils =
toCamel: (string) ->
string.replace /(\-[a-z])/g, ($1) ->
$1.toUpperCase().replace "-", ""
windowHistory: ->
window.history
bindColumnResize: ->
$(window).off('resize.columns').on 'resize.columns', =>
@resizeColumnHeaders()
resizeColumnHeaders: ->
$... | window.Tahi ||= {}
Tahi.utils =
toCamel: (string) ->
string.replace /(\-[a-z])/g, ($1) ->
$1.toUpperCase().replace "-", ""
windowHistory: ->
window.history
bindColumnResize: ->
$(window).off('resize.columns').on 'resize.columns', =>
@resizeColumnHeaders()
resizeColumnHeaders: ->
$... |
Set telementry consent to "no" for atom | "*":
core:
themes: [
"one-light-ui"
"solarized-dark-syntax"
]
editor:
fontFamily: "mononoki"
fontSize: 18
invisibles: {}
showIndentGuide: true
showInvisibles: true
"exception-reporting":
userId: "76d6bd0a-16fd-42b8-0163-bce5c8c7e379"
welcome:
showOnStartup: false
... | "*":
core:
telemetryConsent: "no"
themes: [
"one-light-ui"
"solarized-dark-syntax"
]
editor:
fontFamily: "mononoki"
fontSize: 18
invisibles: {}
showIndentGuide: true
showInvisibles: true
"exception-reporting":
userId: "76d6bd0a-16fd-42b8-0163-bce5c8c7e379"
welcome... |
Rework Requirements to Use Resolve | class Choice
constructor: (@id, @title, @text, @visibleReqs, @activeReqs, @next) ->
Object.freeze @
reqsAreMet = (reqs, qualities) ->
for qualityName, predicate of reqs
quality = qualities.lookup qualityName
return false unless predicate quality
return true
isVisibleWith: (qualities) ->
... | angular.module 'qbn.choice', ['qbn.resolve']
.factory 'frontalChoices', () ->
library = []
api =
register: (choice) ->
library.push choice # Choices are stored in immutable form
return this # Allow Chaining
getAll: () ->
library.filter (choice) -> choice.isVisible()
ret... |
Use ScopeSelector class from first-mate | module.exports =
activate: ->
rootView.command 'link:open', ->
editSession = rootView.getActivePaneItem()
return unless editSession?
token = editSession.tokenForBufferPosition(editSession.getCursorBufferPosition())
return unless token?
unless @selector?
TextMateScopeSelecto... | module.exports =
activate: ->
rootView.command 'link:open', ->
editSession = rootView.getActivePaneItem()
return unless editSession?
token = editSession.tokenForBufferPosition(editSession.getCursorBufferPosition())
return unless token?
unless @selector?
{ScopeSelector} = re... |
Make the iframe large enough to show everything without scrolling | ###* @jsx React.DOM ###
window.WFplayer = React.createClass
componentDidMount: ->
$node = $(@getDOMNode())
mediaObj = @props.mediaObj
$(document).tooltip
content: -> $node.prop('title')
corpus_id = mediaObj.corpus_id
line_key = mediaObj.mov.line_key
mov = mediaObj.mov.movie_loc
pa... | ###* @jsx React.DOM ###
window.WFplayer = React.createClass
componentDidMount: ->
$node = $(@getDOMNode())
mediaObj = @props.mediaObj
$(document).tooltip
content: -> $node.prop('title')
corpus_id = mediaObj.corpus_id
line_key = mediaObj.mov.line_key
mov = mediaObj.mov.movie_loc
pa... |
Remove trailing whitespace from tracks coffee file | App.Tracks =
tracking_enabled: ->
_paq?
set_custom_var: (id, name, value, scope) ->
_paq.push(['setCustomVariable', id, name, value, scope])
_paq.push(['trackPageView'])
track_event: ($this) ->
category = $this.data('track-event-category')
action = $this.data('track-event-action')
... | App.Tracks =
tracking_enabled: ->
_paq?
set_custom_var: (id, name, value, scope) ->
_paq.push(['setCustomVariable', id, name, value, scope])
_paq.push(['trackPageView'])
track_event: ($this) ->
category = $this.data('track-event-category')
action = $this.data('track-event-action')
_pa... |
Use "native-dot" marker type in Atom Pigments | "*":
core:
disabledPackages: [
"background-tips"
"exception-reporting"
"metrics"
"styleguide"
"timecop"
"welcome"
]
telemetryConsent: "no"
editor:
invisibles: {}
showIndentGuide: true
showInvisibles: true
"file-icons":
forceShow: true
onChanges: ... | "*":
core:
disabledPackages: [
"background-tips"
"exception-reporting"
"metrics"
"styleguide"
"timecop"
"welcome"
]
telemetryConsent: "no"
editor:
invisibles: {}
showIndentGuide: true
showInvisibles: true
"file-icons":
forceShow: true
onChanges: ... |
Remove application legacy imports from vendor | #= require ./prototype/prototype
#= require ./prototype/scriptaculous
#= require ./prototype/effects
#= require_tree ./prototype
#= require ./cropper
#= require_tree ./moe-legacy
| #= require ./prototype/prototype
#= require ./prototype/scriptaculous
#= require ./prototype/effects
#= require_tree ./prototype
#= require ./cropper
|
Add basic canvas render method | _ = require "underscore"
Annotation = require "./annotation"
Renderer = require "../renderers/renderer"
p = require "../../core/properties"
class LabelView extends Renderer.View
initialize: (options) ->
super(options)
class Label extends Annotation.Model
default_view: LabelView
type: 'LabelAnnotation'
... | _ = require "underscore"
Annotation = require "./annotation"
Renderer = require "../renderers/renderer"
p = require "../../core/properties"
class LabelView extends Renderer.View
initialize: (options) ->
super(options)
@$el.appendTo(@plot_view.$el.find('div.bk-canvas-overlays'))
@$el.addClass('label')
... |
Fix duration being incremented after a build/job is finished | Travis.DurationCalculations = Ember.Mixin.create
duration: (->
if duration = @get('_duration')
duration
else
Travis.Helpers.durationFrom(@get('startedAt'), @get('finishedAt'))
).property('_duration', 'finishedAt', 'startedAt')
updateTimes: ->
unless ['rootState.loaded.reloading', 'rootSta... | Travis.DurationCalculations = Ember.Mixin.create
duration: (->
if duration = @get('_duration')
duration
else
Travis.Helpers.durationFrom(@get('startedAt'), @get('finishedAt'))
).property('_duration', 'finishedAt', 'startedAt')
updateTimes: ->
unless ['rootState.loaded.reloading', 'rootSta... |
Use more relaxed closure defaults | _ = require 'underscore'
module.exports = class ClosureCompiler extends (require './engine')
defaults:
compilation_level: 'advanced_optimizations'
language: 'ecmascript5'
compress: (str, cb) ->
try
url = 'https://closure-compiler.appspot.com/compile'
form = _.extend {}, @options,
j... | _ = require 'underscore'
module.exports = class ClosureCompiler extends (require './engine')
defaults:
compilation_level: 'SIMPLE_OPTIMIZATIONS'
compress: (str, cb) ->
try
url = 'https://closure-compiler.appspot.com/compile'
form = _.extend {}, @options,
js_code: str
output_for... |
Fix bug with ajax contact form not showing error validation after first submit | $.fn.formBackup = ->
return false if !localStorage
forms = this
datas = {}
ls = false
datas.href = window.location.href
# Get localStorage informations
if localStorage['formBackup']
ls = JSON.parse localStorage['formBackup']
if ls.href == datas.href
for id of ls
if id != 'href'
... | $.fn.formBackup = ->
return false if !localStorage
forms = @
datas = {}
ls = false
datas.href = window.location.href
# Get localStorage informations
if localStorage['formBackup']
ls = JSON.parse localStorage['formBackup']
if ls.href == datas.href
for id of ls
if id != 'href'
... |
Clear test datbase before and after tests are run. | require('source-map-support').install handleUncaughtExceptions: false
| require('source-map-support').install handleUncaughtExceptions: false
mongoose = require 'mongoose'
config = require "../config/test.json"
dropTestDb = (done) ->
# ensure that we can only drop the test database
if config.mongo.url.indexOf('openhim-test') > -1
process.stdout.write 'Dropping test database...'
... |
Add all tools in toolbar for froala editor | #= require froala_editor.min.js
#= require plugins/lists.min.js
#= require plugins/char_counter.min.js
#= require langs/fr.js
$ ->
if $('.froala').length
froala_init()
$('.button.has_many_add').on 'click', (e) ->
setTimeout (->
froala_init()
return
), 150
froala_init = ->
$('.froala').e... | #= require froala_editor.min.js
#= require plugins/block_styles.min.js
#= require plugins/colors.min.js
#= require plugins/media_manager.min.js
#= require plugins/tables.min.js
#= require plugins/video.min.js
#= require plugins/font_family.min.js
#= require plugins/font_size.min.js
#= require plugins/file_upload.min.js... |
Refactor MoenyCounter. Shorten variable names and remove 'jQuery'. | # 残高編集時に金額を計算する
class MoneyCounter
money_counting_fields: ['man', 'gosen', 'nisen', 'sen', 'gohyaku', 'hyaku', 'gojyu', 'jyu', 'go', 'ichi']
money_counting_amounts: [10000, 5000, 2000, 1000, 500, 100, 50, 10, 5, 1]
count: ->
amount = 0
for i in [0..@money_counting_fields.length-1]
v = jQuery(... | # 残高編集時に金額を計算する
class MoneyCounter
fields: ['man', 'gosen', 'nisen', 'sen', 'gohyaku', 'hyaku', 'gojyu', 'jyu', 'go', 'ichi']
amounts: [10000, 5000, 2000, 1000, 500, 100, 50, 10, 5, 1]
count: ->
amount = 0
for i in [0..@fields.length-1]
v = $('#' + @fields[i]).val()
if v != ''
... |
Configure basic Grunt test task. | module.exports = (grunt) ->
path = require 'path'
require('time-grunt')(grunt)
require('jit-grunt')(grunt, {
express: 'grunt-express-server'
})
require('load-grunt-tasks')(grunt, {
pattern: ['main-bower-files']
})
require('load-grunt-config')(grunt, {
configPath: path.join __dirname, 'g... | module.exports = (grunt) ->
path = require 'path'
require('time-grunt')(grunt)
require('jit-grunt')(grunt, {
express: 'grunt-express-server'
})
require('load-grunt-tasks')(grunt, {
pattern: ['main-bower-files']
})
require('load-grunt-config')(grunt, {
configPath: path.join __dirname, 'g... |
Revert "Don't depend on modalOpened events but on factlinkAdded events for hiding the loading button" | getTextRange = ->
doc = window.document
if doc.getSelection
doc.getSelection()
else if doc.selection
doc.selection.createRange().text
else
''
FactlinkJailRoot.createFactFromSelection = ->
success = ->
FactlinkJailRoot.createButton.hide()
FactlinkJailRoot.off 'factlinkAdded', success
se... | getTextRange = ->
doc = window.document
if doc.getSelection
doc.getSelection()
else if doc.selection
doc.selection.createRange().text
else
''
FactlinkJailRoot.createFactFromSelection = ->
success = ->
FactlinkJailRoot.createButton.hide()
FactlinkJailRoot.off 'modalOpened', success
selI... |
Remove obsolete argument in stroke function | session = require '../session'
utils = require '../utils'
background = (color) ->
session.settings.bg = color
strokeColor = (color) ->
session.settings.stroke.color = color
session.ctx.strokeStyle = color
strokeWidth = (val) ->
session.settings.stroke.width = val
session.ctx.lineWidth = val * ses... | session = require '../session'
utils = require '../utils'
background = (color) ->
session.settings.bg = color
strokeColor = (color) ->
session.settings.stroke.color = color
session.ctx.strokeStyle = color
strokeWidth = (val) ->
session.settings.stroke.width = val
session.ctx.lineWidth = val * ses... |
Use skinny arrow for toggle | eslint = require('eslint').linter
{$, $$, SelectListView} = require 'atom'
module.exports =
class ESLintView extends SelectListView
initialize: (@editorView, @config) ->
super
@addClass('eslint-report overlay from-top')
@editor = @editorView.getEditor()
@buffer = @editor.getBuffer()
atom.worksp... | eslint = require('eslint').linter
{$, $$, SelectListView} = require 'atom'
module.exports =
class ESLintView extends SelectListView
initialize: (@editorView, @config) ->
super
@addClass('eslint-report overlay from-top')
@editor = @editorView.getEditor()
@buffer = @editor.getBuffer()
atom.worksp... |
Change URL hash when a tab is clicked | class Fustrate.Components.Tabs extends Fustrate.Components.Base
constructor: (@tabs) ->
@tabs.on 'click', 'li > a', (e) =>
@activateTab $(e.currentTarget)
false
if window.location.hash
@activateTab $("li > a[href='#{window.location.hash}']", @tabs).first()
else if $('li > a.active', @t... | class Fustrate.Components.Tabs extends Fustrate.Components.Base
constructor: (@tabs) ->
@tabs.on 'click', 'li > a', (e) =>
@activateTab $(e.currentTarget)
false
if window.location.hash
@activateTab $("li > a[href='#{window.location.hash}']", @tabs).first()
else if $('li > a.active', @t... |
Make confirmation key binding work with shadow DOM | '.editor':
'ctrl-space': 'autocomplete:toggle'
'.autocomplete .mini.editor input':
'enter': 'core:confirm'
'tab': 'core:confirm'
| '.editor':
'ctrl-space': 'autocomplete:toggle'
'.autocomplete .mini.editor':
'enter': 'core:confirm'
'tab': 'core:confirm'
|
Use turbolinks for dom loading | # 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/
$ ->
$("select#dashboard_filter_interval").on "change", (e) ->
this.form.submit()
| # 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/
$(document).on 'turbolinks:load', () ->
$("select#dashboard_filter_interval").on "change", (e) ->
this... |
Make configuration hash more magical | # Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
fileTypes = {
"GitHub Markdown": (editor) ->
editor.setSoftWrap(true)
editor.setTabLength(4)
"Java": (editor) ->
... | # Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# Settings to assign based on grammar name.
fileTypes =
"GitHub Markdown": (editor) ->
editor.setSoftWrap(true)
edit... |
Add askToTurnOn helper method to turn VM on globally | class VirtualizationController extends KDController
constructor:->
super
@kc = KD.singletons.kiteController
@lastState =
state : 'STOPPED'
run:(command, callback, emitStateChanged=yes)->
@kc.run
kiteName : 'os'
method : command
, @_cbWrapper callback, emitStateChanged
... | class VirtualizationController extends KDController
constructor:->
super
@kc = KD.singletons.kiteController
@lastState =
state : 'STOPPED'
run:(command, callback, emitStateChanged=yes)->
@kc.run
kiteName : 'os'
method : command
, @_cbWrapper callback, emitStateChanged
... |
Fix image width resizer bug | document.body.addEventListener "AutoPagerize_DOMNodeInserted", (e) ->
node = e.target
requestURL = e.newValue
parentNode = e.relatedNode
init node
, false
fitImageWidthToScreenWidth = ->
$('.body img').each ->
maxWidth = 900
deviceWidth = document.body.offsetWidth - 60
imageRatio = @nat... | document.body.addEventListener "AutoPagerize_DOMNodeInserted", (e) ->
node = e.target
requestURL = e.newValue
parentNode = e.relatedNode
init node
, false
fitImageWidthToScreenWidth = ->
$('.body img').each ->
maxWidth = 900
deviceWidth = document.body.offsetWidth
if window.orientation =... |
Change URL based on what tab you click on summary page | # Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
$(document).ready ->
ids = window.location.href.split('#')
if ids.length > 1
id = ids.pop(1)
$("#summaryTabs a[href=\"##{id}\"]").tab('show')
| # Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
$(document).ready ->
ids = window.location.href.split('#')
if ids.length > 1
id = ids.pop(1)
$("#summaryTabs a[href=\"##{id}\"]").tab('show')
$('#summaryTabs')... |
Concatenate pending request message to remove excess whitespace | define [
'jquery'
], ($) ->
# Relies on the jquery-ajax-queue plugin to supply this method.
# This ensures data is not silently lost
$(window).on 'beforeunload', ->
if $.hasPendingRequest()
return "Wow, you're quick! Your data is being saved.
It will only take a moment.... | define [
'jquery'
], ($) ->
# Relies on the jquery-ajax-queue plugin to supply this method.
# This ensures data is not silently lost
$(window).on 'beforeunload', ->
if $.hasPendingRequest()
return "Wow, you're quick! Your data is being saved. " +
"It will only take a m... |
Remove unneeded description from query | module.exports = """
fragment blockThumb on Connectable {
id
title
description
klass
created_at(relative: true)
updated_at(relative: true)
user {
name
}
href
kind {
__typename
... on Channel {
visibility
counts {
blocks
}
... | module.exports = """
fragment blockThumb on Connectable {
id
title
klass
created_at(relative: true)
updated_at(relative: true)
user {
name
}
href
kind {
__typename
... on Channel {
visibility
counts {
blocks
}
}
... on... |
Add debug to auth controller | redis = require 'redis'
Authenticator = require '../models/authenticator'
MeshbluAuthParser = require '../helpers/meshblu-auth-parser'
class AuthenticateController
constructor: (options={}, dependencies={}) ->
{@authenticator} = dependencies
@authenticator ?= new Authenticator
client: ... | redis = require 'redis'
Authenticator = require '../models/authenticator'
MeshbluAuthParser = require '../helpers/meshblu-auth-parser'
debug = require('debug')('meshblu-http-server:authenticate-controller')
class AuthenticateController
constructor: (options={}, dependencies={}) ->
{@authenticator... |
Update mininum Serrano version supporting notifications in response | define [
'../core'
'./base'
], (c, base) ->
class ExporterModel extends base.Model
class ExporterCollection extends base.Collection
model: ExporterModel
minSerranoVersionProgressEnabled: [2, 0, 16]
url: ->
c.getSessionUrl('exporter')
initialize: ->
... | define [
'../core'
'./base'
], (c, base) ->
class ExporterModel extends base.Model
class ExporterCollection extends base.Collection
model: ExporterModel
# Versions greater than or equal to this version are considered to
# support notification on completion.
minSe... |
Use `waitFor` when restoring a file in v2 history | define [
"base"
], (App) ->
App.controller "HistoryV2DiffController", ($scope, ide, event_tracking) ->
$scope.restoreState =
inflight: false
error: false
$scope.restoreDeletedFile = () ->
pathname = $scope.history.selection.pathname
return if !pathname?
version = $scope.history.selection.docs[path... | define [
"base"
], (App) ->
App.controller "HistoryV2DiffController", ($scope, ide, event_tracking) ->
$scope.restoreState =
inflight: false
error: false
$scope.restoreDeletedFile = () ->
pathname = $scope.history.selection.pathname
return if !pathname?
version = $scope.history.selection.docs[path... |
Use native JS iteration (instead of _.each) | {_} = require 'atom'
RangeFinder = require './range-finder'
module.exports =
activate: (state) ->
atom.workspaceView.command 'sort-lines:sort', '.editor', =>
editor = atom.workspaceView.getActivePaneItem()
@sortLines(editor)
sortLines: (editor) ->
lineRanges = RangeFinder.rangesFor(editor)
... | RangeFinder = require './range-finder'
module.exports =
activate: (state) ->
atom.workspaceView.command 'sort-lines:sort', '.editor', =>
editor = atom.workspaceView.getActivePaneItem()
@sortLines(editor)
sortLines: (editor) ->
lineRanges = RangeFinder.rangesFor(editor)
lineRanges.forEach (... |
Fix incorrect comment about Apollos.person | ###
Apollos.name
@example get a string with the name of this system
console.log Apollos.name
###
Apollos.name = "Apollos"
###
Apollos.user
@example get the currently logged in user
console.log Apollos.user()._id
###
Apollos.user = ->
user = Meteor.user()
return user or {}
###
Apollos.u... | ###
Apollos.name
@example get a string with the name of this system
console.log Apollos.name
###
Apollos.name = "Apollos"
###
Apollos.user
@example get the currently logged in user
console.log Apollos.user()._id
###
Apollos.user = ->
user = Meteor.user()
return user or {}
###
Apollos.p... |
Check if model is defined before cloning its attributes | define [
'../core'
'tpl!templates/context/actions.html'
], (c, templates...) ->
templates = c._.object ['actions'], templates
# Provides a set of actions for manipulating a ContextModel object
class ContextActions extends c.Marionette.ItemView
template: templates.actions
ui:
... | define [
'../core'
'tpl!templates/context/actions.html'
], (c, templates...) ->
templates = c._.object ['actions'], templates
# Provides a set of actions for manipulating a ContextModel object
class ContextActions extends c.Marionette.ItemView
template: templates.actions
ui:
... |
Split breakpoint assertions into two separate tests | express = require('express')
Gozer = require('../src/gozer')
startServer = (options = {}) ->
app = express()
app.use(express.static(__dirname + '/app'))
app.listen(options.port || 80)
describe 'Gozer', ->
gozer = page = null
before ->
startServer(port: 3002)
gozer = new Gozer(port: 3002)
beforeE... | express = require('express')
Gozer = require('../src/gozer')
startServer = (options = {}) ->
app = express()
app.use(express.static(__dirname + '/app'))
app.listen(options.port || 80)
describe 'Gozer', ->
gozer = page = null
before ->
startServer(port: 3002)
gozer = new Gozer(port: 3002)
beforeE... |
Update import for auth config. | {ProductImport} = require '../lib'
describe 'ProductImport', ->
beforeEach ->
@import = new ProductImport
it 'should initialize', ->
expect(@import).toBeDefined() | {ProductImport} = require '../lib'
Config = require('../config')
describe 'ProductImport', ->
beforeEach ->
@import = new ProductImport null, Config
it 'should initialize', ->
expect(@import).toBeDefined() |
Add decision and decision letter to ember paper model | a = DS.attr
ETahi.Paper = DS.Model.extend
shortTitle: a('string')
title: a('string')
assignees: DS.hasMany('assignee')
phases: DS.hasMany('phase')
declarations: DS.hasMany('declaration')
reviewers: DS.hasMany('user')
availableReviewers: Ember.computed.alias('journal.reviewers')
editors: DS.hasMany('user... | a = DS.attr
ETahi.Paper = DS.Model.extend
shortTitle: a('string')
title: a('string')
decision: a('string')
decisionLetter: a('string')
assignees: DS.hasMany('assignee')
phases: DS.hasMany('phase')
declarations: DS.hasMany('declaration')
reviewers: DS.hasMany('user')
availableReviewers: Ember.computed.... |
Use regex to clean code strings | Lanes.Models.Mixins.HasCodeField = {
INVALID: /[^A-Z0-9a-z]/
included: (klass)->
klass::INVALID_CODE_CHARS ||= Lanes.Models.mixins.Lanes.sCodeField.INVALID
initialize: ->
this.on('change:code', this.upcaseCode)
upcaseCode: ->
this.set('code', this.get('code').toUpperCase())
}... | DEFAULT_INVALID = /[^A-Z0-9a-z]/
Lanes.Models.Mixins.HasCodeField = {
included: (klass) ->
klass::INVALID_CODE_CHARS ||= DEFAULT_INVALID
initialize: ->
this.on('change:code', this._cleanCodeAttr)
_cleanCodeAttr: ->
this.set(
'code', this.get('code').toUpperCase().rep... |
Use camelCase version of accept-charset | React = require 'react'
{CurrentUserStore} = require '../../flux/current-user'
LOGOUT_URL = '/accounts/logout'
CSRF_Token = CurrentUserStore.getCSRFToken()
module.exports = React.createClass
render: ->
{className, children} = @props
classes = []
classes.push(className) if className
classes = classe... | React = require 'react'
{CurrentUserStore} = require '../../flux/current-user'
LOGOUT_URL = '/accounts/logout'
CSRF_Token = CurrentUserStore.getCSRFToken()
module.exports = React.createClass
render: ->
{className, children} = @props
classes = []
classes.push(className) if className
classes = classe... |
Fix formatR, do not pipe stdout to file, unnecessarily | ###
Requires [formatR](https://github.com/yihui/formatR)
###
path = require("path")
"use strict"
Beautifier = require('../beautifier')
module.exports = class R extends Beautifier
name: "formatR"
link: "https://github.com/yihui/formatR"
executables: [
{
name: "Rscript"
cmd: "rscript"
homepa... | ###
Requires [formatR](https://github.com/yihui/formatR)
###
path = require("path")
"use strict"
Beautifier = require('../beautifier')
module.exports = class R extends Beautifier
name: "formatR"
link: "https://github.com/yihui/formatR"
executables: [
{
name: "Rscript"
cmd: "rscript"
homepa... |
Improve DOM node children list | 'use strict'
List = require '../nodes/list'
module.exports = class ChildrenList extends List
constructor: (@element) ->
set: (elementList) ->
while (el = @element.lastChild)?
@element.removeChild(el)
for el in elementList
@element.appendChild(el)
return this
get: ->
@element... | 'use strict'
List = require '../nodes/list'
module.exports = class ChildrenList extends List
constructor: (@element) ->
set: (elementList) ->
while (el = @element.lastChild)?
@element.removeChild(el)
for el in elementList
@element.appendChild(el)
return this
setAt: (el, pos) ->
... |
Fix wrong call to debounce method. | # Copyright 2013 Andrey Antukh <niwi@niwi.be>
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | # Copyright 2013 Andrey Antukh <niwi@niwi.be>
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
Add school sites to the loaded data. | L.mapbox.accessToken = 'pk.eyJ1Ijoia25vY2siLCJhIjoiRVdjRFVjRSJ9.nIZeVnR6dJZ0hwNnKAiAlQ'
map = L.mapbox.map('map', 'knock.l5dpakki').
setView([47.61, -122.33], 13)
featureLayer = L.mapbox.featureLayer().addTo(map)
featureLayer.loadURL('http://zillowhack.hud.opendata.arcgis.com/datasets/2a462f6b548e4ab8bfd9b2523a3db4... | L.mapbox.accessToken = 'pk.eyJ1Ijoia25vY2siLCJhIjoiRVdjRFVjRSJ9.nIZeVnR6dJZ0hwNnKAiAlQ'
map = L.mapbox.map('map', 'knock.l5dpakki').
setView([47.61, -122.33], 13)
featureLayer = L.mapbox.featureLayer().addTo(map)
featureLayer.loadURL('/data/school_sites.json')
|
Support newer xregexp where XRegExp is imported as default | reader = require('readline').createInterface process.stdin, null
{XRegExp} = require 'xregexp'
counts = new Map()
reader.on 'line', (line) ->
wordPattern = XRegExp("[\\p{L}']+", 'g')
for word in (line.toLowerCase().match(wordPattern) or [])
counts.set word, (counts.get(word) or 0) + 1
reader.on 'close', ->
... | reader = require('readline').createInterface process.stdin, null
XRegExp = require 'xregexp'
counts = new Map()
reader.on 'line', (line) ->
wordPattern = XRegExp("[\\p{L}']+", 'g')
for word in (line.toLowerCase().match(wordPattern) or [])
counts.set word, (counts.get(word) or 0) + 1
reader.on 'close', ->
fo... |
Revert "utils: bugfix: eventSpy constructor returns self" | goog.provide 'athena.lib.util.test'
test = athena.lib.util.test
# construct, render, and display view
test.view_with_options = (options, ViewClass, appendTo) ->
ViewClass = ViewClass || lib.View
appendTo = appendTo || 'body'
view = new ViewClass options
view.render()
$(appendTo).append view.$el
view
# co... | goog.provide 'athena.lib.util.test'
test = athena.lib.util.test
# construct, render, and display view
test.view_with_options = (options, ViewClass, appendTo) ->
ViewClass = ViewClass || lib.View
appendTo = appendTo || 'body'
view = new ViewClass options
view.render()
$(appendTo).append view.$el
view
# co... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.