Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Update fact whenever from_fact changes -- this prevents a timing issue in Backbone, as such specific event handlers are executed before "change" itself. | class window.FactRelation extends Evidence
defaults:
evidence_type: 'FactRelation'
setOpinion: (type) ->
$.ajax
url: @url() + "/opinion/" + type
success: (data) =>
mp_track "Evidence: Opinionate",
opinion: type
evidence_id: @id
@set data
type: "post"... | class window.FactRelation extends Evidence
defaults:
evidence_type: 'FactRelation'
setOpinion: (type) ->
$.ajax
url: @url() + "/opinion/" + type
success: (data) =>
mp_track "Evidence: Opinionate",
opinion: type
evidence_id: @id
@set data
type: "post"... |
Change syntax to follow ES6 conventions | # https://atom.io/docs/latest/using-atom-snippets
'.source.js':
'Mocha Describe':
'prefix': 'describe'
'body': """
describe('$1', function() {
$2
})
"""
'Mocha Context':
'prefix': 'context'
'body': """
context('$1', function() {
$2
})
"""
'Mocha Bef... | # https://atom.io/docs/latest/using-atom-snippets
'.source.js':
'Mocha Describe':
'prefix': 'describe'
'body': """
describe('$1', () => {
$2
})
"""
'Mocha Context':
'prefix': 'context'
'body': """
context('$1', () => {
$2
})
"""
'Mocha BeforeEach':
... |
Use @presenter from NavGroup instead of @options.viewClass | styles = require('styles').ui
Controller = require 'views/controller'
View = require 'views/base'
module.exports = class NavGroup extends View
viewName: 'iPhone::NavigationGroup'
attributes: styles.window.view
initialize: ->
@initializeController()
initializeController: ->
@controller = new Cont... | styles = require('styles').ui
Controller = require 'views/controller'
View = require 'views/base'
module.exports = class NavGroup extends View
viewName: 'iPhone::NavigationGroup'
attributes: styles.window.view
initialize: ->
@initializeController()
initializeController: ->
@controller = new Cont... |
Apply effect in tag version as well. | 'use strict'
$ ->
if Uno.is 'device', 'desktop'
$('a').not('[href*="mailto:"]').click ->
if this.href.indexOf(location.hostname) is -1
window.open $(this).attr 'href'
false
else
FastClick.attach Uno.app
if Uno.is('page', 'home') or Uno.is('page', 'paged')
Uno.timeAgo '#posts-l... | 'use strict'
$ ->
if Uno.is 'device', 'desktop'
$('a').not('[href*="mailto:"]').click ->
if this.href.indexOf(location.hostname) is -1
window.open $(this).attr 'href'
false
else
FastClick.attach Uno.app
if Uno.is('page', 'home') or Uno.is('page', 'paged') or Uno.is('page', 'tag')
... |
Clean up run loop call | View = Em.View.extend
classNames: ['application-wrapper']
didInsertElement: ->
Em.run.scheduleOnce 'afterRender', =>
@doResize()
$(window).on 'resize', =>
Em.run.debounce @, @doResize, 200
`export default View` | View = Em.View.extend
classNames: ['application-wrapper']
didInsertElement: ->
$(window).on 'resize', =>
Em.run @, ->
Em.run.debounce @, @doResize, 200
Em.run.scheduleOnce 'afterRender', @, ->
@doResize()
`export default View`
|
Add [] as word boundaries | module.exports =
findMisspellings: (text) ->
wordRegex = /(?:^|\s)([a-zA-Z']+)(?=\s|\.|$)/g
row = 0
misspellings = []
for line in text.split('\n')
while matches = wordRegex.exec(line)
word = matches[1]
continue unless $native.isMisspelled(word)
startColumn = matches.index... | module.exports =
findMisspellings: (text) ->
wordRegex = /(?:^|[\s\[\]])([a-zA-Z']+)(?=[\s\.\[\]]|$)/g
row = 0
misspellings = []
for line in text.split('\n')
while matches = wordRegex.exec(line)
word = matches[1]
continue unless $native.isMisspelled(word)
startColumn = ma... |
Remove blocking on synchronous volume creationg | fs = require "fs-extra"
path = require "path"
sanitize = require "sanitize-filename"
uuid = require "node-uuid"
module.exports = (files, cb) ->
basePath = path.dirname(require.main.filename)
volume = path.join basePath, 'uploads', uuid.v4()
fs.ensureDirSync(volume)
for file in files
file... | fs = require "fs-extra"
path = require "path"
sanitize = require "sanitize-filename"
uuid = require "node-uuid"
module.exports = (files, cb) ->
basePath = path.dirname(require.main.filename)
volume = path.join basePath, 'uploads', uuid.v4()
fs.ensureDir volume, (err) ->
unwrittenFileCount ... |
Switch from autocomplete-elixir to atom-elixir | packages: [
"advanced-open-file"
"atom-beautify"
"atom-react-native-autocomplete"
"auto-indent"
"auto-update-packages"
"autocomplete-elixir"
"autocomplete-modules"
"busy-signal"
"color-picker"
"emmet-simplified"
"expand-region"
"file-icons"
"git-diff-popup"
"git-plus"
"git-time-machine"
... | packages: [
"advanced-open-file"
"atom-beautify"
"atom-elixir"
"atom-react-native-autocomplete"
"auto-indent"
"auto-update-packages"
"autocomplete-modules"
"busy-signal"
"color-picker"
"emmet-simplified"
"expand-region"
"file-icons"
"git-diff-popup"
"git-plus"
"git-time-machine"
"hypercl... |
Fix for zindex values being changed by gulp-cssnano by default | gulp = require('gulp-help') require 'gulp'
$ = do require 'gulp-load-plugins'
config = require '../config'
paths = require '../paths'
util = require '../util'
gulp.task 'style', false, ->
gulp.src config.style
.pipe $.plumber errorHandler: util.onError
.pipe do $.less
.pipe $.cssnano
discardComments: remo... | gulp = require('gulp-help') require 'gulp'
$ = do require 'gulp-load-plugins'
config = require '../config'
paths = require '../paths'
util = require '../util'
gulp.task 'style', false, ->
gulp.src config.style
.pipe $.plumber errorHandler: util.onError
.pipe do $.less
.pipe $.cssnano
discardComments: remo... |
Add a `url` setting, in addition to the local | 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'
@locals
... | 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', ... |
Fix select form not binding when injected via ajax | $ ->
if $('[data-action=favourite]').length > 0
$('body').on 'ajax:success', '[data-action=favourite] [data-remote]', (event, data, status, xhr) ->
$(this).closest('[data-action=favourite]').replaceWith data
$('form[data-action=change-collection] select').change ->
$(this).closest('form').submit(... | $ ->
if $('[data-action=favourite]').length > 0
$('body').on 'ajax:success', '[data-action=favourite] [data-remote]', (event, data, status, xhr) ->
$(this).closest('[data-action=favourite]').replaceWith data
$('body').on 'change', 'form[data-action=change-collection] select', ->
$(this).closest('... |
Remove awfully pale color form random slide colors. | AllAboard.PerspectiveAssignmentComponent = Em.Component.extend
tagName: "li"
classNames: [ "perspective-assignment" ]
attributeBindings: [
"assignment.row:data-row",
"assignment.column:data-col",
"assignment.template.width:data-sizex",
"assignment.template.height:data-sizey",
"inlineStyle:styl... | AllAboard.PerspectiveAssignmentComponent = Em.Component.extend
tagName: "li"
classNames: [ "perspective-assignment" ]
attributeBindings: [
"assignment.row:data-row",
"assignment.column:data-col",
"assignment.template.width:data-sizex",
"assignment.template.height:data-sizey",
"inlineStyle:styl... |
Remove unnecessary second git path definition. | RepoView = require './views/repo-view'
Repo = require './models/repo'
module.exports =
configDefaults:
pre_commit_hook: "",
atomatigitView: null
activate: (state) ->
atom_git = atom.project.getRepo()
path = atom_git.getWorkingDirectory()
@repo = new Repo({path: path})
@repo_view = new RepoV... | RepoView = require './views/repo-view'
Repo = require './models/repo'
module.exports =
configDefaults:
pre_commit_hook: "",
atomatigitView: null
activate: (state) ->
@repo = new Repo
@repo_view = new RepoView(@repo)
@insert_commands()
insert_commands: ->
atom.workspaceView.command "atom... |
Include settings in AJAX error message | email = 'support@roqua.nl'
message = "Onbekende fout. Mail naar <a href='mailto:#{email}'>#{email}</a> voor hulp"
applicationInitialized = ->
Screensmart? && typeof Screensmart.store?.dispatch == 'function'
showUnknownError = ->
# Show error in a primitive way if something went wrong during initialization
if ap... | email = 'support@roqua.nl'
message = "Onbekende fout. Mail naar <a href='mailto:#{email}'>#{email}</a> voor hulp"
applicationInitialized = ->
Screensmart? && typeof Screensmart.store?.dispatch == 'function'
showUnknownError = ->
# Show error in a primitive way if something went wrong during initialization
if ap... |
Remove unused method leftover from earlier image transfer attempts. | Connection = Meteor.npmRequire 'ssh2'
sshExec = (id, command, action, callback) ->
room = Rooms.findOne id
if room
conn = new Connection()
conn.on 'ready', ->
conn.exec command, (err, stream) ->
callback "Could not complete action '#{action}' on #{id}." if err
stream.on 'exit', (code,... | Connection = Meteor.npmRequire 'ssh2'
sshExec = (id, command, action, callback) ->
room = Rooms.findOne id
if room
conn = new Connection()
conn.on 'ready', ->
conn.exec command, (err, stream) ->
callback "Could not complete action '#{action}' on #{id}." if err
stream.on 'exit', (code,... |
Change the way changes to underlying model are watched and updated for select2 elements | angular.module("admin.indexUtils").directive "select2MinSearch", ($timeout) ->
require: 'ngModel'
link: (scope, element, attrs, ngModel) ->
element.select2
minimumResultsForSearch: attrs.select2MinSearch
scope.$watch attrs.ngModel, (newVal, oldVal) ->
$timeout -> element.trigger('change')
| angular.module("admin.indexUtils").directive "select2MinSearch", ($timeout) ->
require: 'ngModel'
link: (scope, element, attrs, ngModel) ->
element.select2
minimumResultsForSearch: attrs.select2MinSearch
ngModel.$formatters.push (value) ->
element.select2('val', value)
value
|
Fix allCampaigns and create userCampaigns | Meteor.methods
allCampaigns: ->
if not @userId?
return 401
data = Campaigns.find({}, {sort: {createdAt: 1}}).fetch()
for item in data
item.canonicalUrl = encodeURI("#{process.env.SITE_URL}/campanha/#{item.name}/#{item._id}")
return data
myDonatedCampaigns: ->
if not @userId?
return 401
query =... | Meteor.methods
userCampaigns: (userId) ->
data = Campaigns.find({'user._id': userId}, {sort: {createdAt: 1}}).fetch()
for item in data
item.canonicalUrl = encodeURI("#{process.env.SITE_URL}/campanha/#{item.name}/#{item._id}")
return data
allCampaigns: ->
data = Campaigns.find({}, {sort: {createdAt: 1}}).f... |
Fix send message each emoji on emoji action | # Description:
# github ใฎ API ใใใใ
#
# Commands:
# hubot github emoji yum #-> https://assets-cdn.github.com/images/icons/emoji/yum.png?v5
fs = require "fs"
cachefile = "cache/github-emojis.json"
module.exports = (robot) ->
robot.respond /(?:github )?emoji(?: me)? (.*)/i, (msg) ->
emojiMe msg, (url) ->
... | # Description:
# github ใฎ API ใใใใ
#
# Commands:
# hubot github emoji yum #-> https://assets-cdn.github.com/images/icons/emoji/yum.png?v5
fs = require "fs"
cachefile = "cache/github-emojis.json"
module.exports = (robot) ->
robot.respond /(?:github )?emoji(?: me)? (.*)/i, (msg) ->
emojiMe msg, (url) ->
... |
Clarify PulsarApi construction. Remove the default config extending redundancy. | _ = require('underscore')
config = require('./config')
async = require('async')
PulsarApiClient = require('./pulsar-api-client')
class PulsarApi
_clientMap = {}
constructor: ()->
pulsarApiConfig = config.pulsarApi
clientDefaultConfig = _.pick(pulsarApiConfig, 'url', 'token')
@_clientDefault = new Pu... | _ = require('underscore')
config = require('./config')
async = require('async')
PulsarApiClient = require('./pulsar-api-client')
class PulsarApi
_clientMap = {}
constructor: ()->
pulsarApiConfig = config.pulsarApi
@_clientDefault = new PulsarApiClient(pulsarApiConfig.url, pulsarApiConfig.authToken)
_... |
Add command queue functionality using `&&` | angular.module("grumbles")
.controller "FormCtrl", ($http, Output) ->
@submit = ->
return unless @command
words = @command.split ' '
words.length = 3
path = words.join '/'
$http.post("/cli/#{path}")
.success (data, status, headers, config) =>
Output.add data
... | angular.module("grumbles")
.controller "FormCtrl", ($http, Output) ->
@commandQueue = []
@submit = ->
return unless @command
@commandQueue = @command.split("&&").map (command, index) ->
query: command.trim()
nextIndex: index + 1
queryCommand @commandQueue[0]
queryCom... |
Use proper CoffeeScript in scaffold | <%= view_namespace %> ||= {}
class <%= view_namespace %>.IndexView extends Backbone.View
template: JST["<%= jst 'index' %>"]
initialize: () ->
_.bindAll(this, 'addOne', 'addAll', 'render');
@options.<%= plural_model_name %>.bind('reset', this.addAll);
addAll: () ->
@options.<%= plural_m... | <%= view_namespace %> ||= {}
class <%= view_namespace %>.IndexView extends Backbone.View
template: JST["<%= jst 'index' %>"]
initialize: () ->
_.bindAll(this, 'addOne', 'addAll', 'render')
@options.<%= plural_model_name %>.bind('reset', @addAll)
addAll: () ->
@options.<%= plural_model_n... |
Refresh changes page every 2 minutes. | $ ->
if $('h1').html() == 'Changes'
setTimeout(->
location.reload()
, 10 * 1000)
| $ ->
if $('h1').html() == 'Changes'
setTimeout(->
location.reload()
, 120 * 1000)
|
Remove Point and Range classes now provided by telepath | _ = require 'underscore'
Range = require 'range'
module.exports =
class Snippet
name: null
prefix: null
body: null
lineCount: null
tabStops: null
constructor: ({@name, @prefix, bodyTree}) ->
@body = @extractTabStops(bodyTree)
extractTabStops: (bodyTree) ->
tabStopsByIndex = {}
bodyText = []... | _ = require 'underscore'
{Range} = require 'telepath'
module.exports =
class Snippet
name: null
prefix: null
body: null
lineCount: null
tabStops: null
constructor: ({@name, @prefix, bodyTree}) ->
@body = @extractTabStops(bodyTree)
extractTabStops: (bodyTree) ->
tabStopsByIndex = {}
bodyText... |
Change image copy method to work accross different partitions |
fs = require 'fs'
crypto = require 'crypto'
path = require 'path'
createHashID = ->
crypto.createHash('sha1').update("#{Math.random()}").digest('hex');
module.exports = (file, callback) ->
return callback("No `image` file. Make sure the `image` field is being set.") unless file
p = path.normalize("#{global.im... |
fs = require 'fs'
crypto = require 'crypto'
path = require 'path'
createHashID = ->
crypto.createHash('sha1').update("#{Math.random()}").digest('hex');
module.exports = (file, callback) ->
return callback("No `image` file. Make sure the `image` field is being set.") unless file
_path = path.normalize("#{globa... |
Fix to remove BaseTool from Toolbox | class Toolbox extends Backbone.View
_.extend @prototype, Backbone.Events
tagName: 'div'
className: 'toolbox'
template: require './templates/toolbox'
events:
'click .tool-icon button' : 'createTool'
'click button[name="remove-tools"]' : 'removeTools'
render: =>
tools = _.keys Ubret
tools... | class Toolbox extends Backbone.View
_.extend @prototype, Backbone.Events
tagName: 'div'
className: 'toolbox'
template: require './templates/toolbox'
events:
'click .tool-icon button' : 'createTool'
'click button[name="remove-tools"]' : 'removeTools'
render: =>
tools = _.keys Ubret
toolN... |
Add keybinding for toggle command | # Keybindings require three things to be fully defined: A selector that is
# matched against the focused element, the keystroke and the command to
# execute.
#
# Below is a basic keybinding which registers on all platforms by applying to
# the root workspace element.
# For more detailed documentation see
# https://ato... | # Keybindings require three things to be fully defined: A selector that is
# matched against the focused element, the keystroke and the command to
# execute.
#
# Below is a basic keybinding which registers on all platforms by applying to
# the root workspace element.
# For more detailed documentation see
# https://ato... |
Use new syntax for finding records | Review.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('author')
tickets: DS.h... | Review.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('author')
tickets: DS.h... |
Add CORS support for in place edit | EditableForm = $.fn.editableform.Constructor
EditableForm.prototype.saveWithUrlHook = (value) ->
url = @options.url
@options.url = (params) =>
params[@options.model] ||= {}
params[@options.model][params.name] = value
ajax_opts =
url: url
data: params
type: 'PATCH'
dataType: 'json... | EditableForm = $.fn.editableform.Constructor
EditableForm.prototype.saveWithUrlHook = (value) ->
url = @options.url
@options.url = (params) =>
params[@options.model] ||= {}
params[@options.model][params.name] = value
params._method = 'PATCH'
ajax_opts =
url: url
data: params
type: ... |
Bring back schema meta validation | tv4 = require 'tv4'
chai = require 'chai' if not chai
path = require 'path'
fs = require 'fs'
schemaPath = '../schema'
getSchema = (name) ->
filepath = path.join __dirname, schemaPath, name
loadSchema filepath
loadSchema = (filepath) ->
content = fs.readFileSync filepath, { encoding: 'utf-8' }
return JSON.par... | tv4 = require 'tv4'
chai = require 'chai' if not chai
path = require 'path'
fs = require 'fs'
schemaPath = '../schema'
getSchema = (name) ->
filepath = path.join __dirname, schemaPath, name
loadSchema filepath
loadSchema = (filepath) ->
content = fs.readFileSync filepath, { encoding: 'utf-8' }
return JSON.par... |
Enable the spell checker for Atom | "*":
core:
disabledPackages: [
"spell-check"
]
telemetryConsent: "limited"
themes: [
"one-light-ui"
"atom-light-syntax"
]
editor:
fontFamily: "Menlo"
invisibles: {}
softWrap: true
"exception-reporting":
userId: "0f9c4bca-c1e4-c885-1374-c2dd26290ade"
"spell-c... | "*":
core:
telemetryConsent: "limited"
themes: [
"one-light-ui"
"atom-light-syntax"
]
editor:
fontFamily: "Menlo"
invisibles: {}
softWrap: true
"exception-reporting":
userId: "0f9c4bca-c1e4-c885-1374-c2dd26290ade"
"spell-check": {}
tabs:
addNewTabsAtEnd: true
welc... |
Add AAF signout redirect URL to config | angular.module("doubtfire.sessions.states.sign-out", [])
#
# State for sign out
#
.config(($stateProvider) ->
signOutStateData =
url: "/sign_out"
views:
main:
controller: "SignOutCtrl"
templateUrl: "sessions/states/sign-out/sign-out.tpl.html"
data:
pageTitle: "_Sign Out_"
$s... | angular.module("doubtfire.sessions.states.sign-out", [])
#
# State for sign out
#
.config(($stateProvider) ->
signOutStateData =
url: "/sign_out"
views:
main:
controller: "SignOutCtrl"
templateUrl: "sessions/states/sign-out/sign-out.tpl.html"
data:
pageTitle: "_Sign Out_"
$s... |
Move Newrelic to the top | #
# Main API Server
#
restify = require 'restify'
chalk = require 'chalk'
newrelic = require './helpers/newrelic'
exceptionHandler = require './helpers/exceptionhandler'
logger = require './helpers/logger'
app = module.exports = restify.createServer()
listenHost = process.env.HOST or process.env.VCAP_APP_HOST or "0.... | #
# Main API Server
#
# Newrelic should be on the top
newrelic = require './helpers/newrelic'
restify = require 'restify'
chalk = require 'chalk'
exceptionHandler = require './helpers/exceptionhandler'
logger = require './helpers/logger'
app = module.exports = restify.createServer()
listenHost = process.env.HOST or ... |
Use unshift instead of push for creating connections | Reflux = require 'reflux'
Actions = require '../actions/database'
Common = require '../common/application'
Got = require 'got'
cache =
loading: false
connections: []
Store = Reflux.createStore(
init: ->
@listenToMany(Actions)
onCreateConnection: (data) ->
cache.loading = true
@trigger()
Got ... | Reflux = require 'reflux'
Actions = require '../actions/database'
Common = require '../common/application'
Got = require 'got'
cache =
loading: false
connections: []
Store = Reflux.createStore(
init: ->
@listenToMany(Actions)
onCreateConnection: (data) ->
cache.loading = true
@trigger()
Got ... |
Fix a lint warning reported by `./script/grunt lint`. | module.exports =
class InputComponent
constructor: (@presenter) ->
@domNode = document.createElement('input')
@domNode.classList.add('hidden-input')
@domNode.setAttribute('data-react-skip-selection-restoration', true)
@domNode.style['-webkit-transform'] = 'translateZ(0)'
@domNode.addEventListener ... | module.exports =
class InputComponent
constructor: (@presenter) ->
@domNode = document.createElement('input')
@domNode.classList.add('hidden-input')
@domNode.setAttribute('data-react-skip-selection-restoration', true)
@domNode.style['-webkit-transform'] = 'translateZ(0)'
@domNode.addEventListener ... |
Use more descriptive variable name | setTimeout ->
ok =
loaded: true
interactive: !(document.documentMode < 11)
complete: true
if ok[document.readyState]
FactlinkJailRoot.host_ready_promise.resolve()
else
document.addEventListener('DOMContentLoaded', -> FactlinkJailRoot.host_ready_promise.resolve())
if 'complete' == document... | setTimeout ->
isDOMContentLoaded =
loaded: true
interactive: !(document.documentMode < 11)
complete: true
if isDOMContentLoaded[document.readyState]
FactlinkJailRoot.host_ready_promise.resolve()
else
document.addEventListener('DOMContentLoaded', -> FactlinkJailRoot.host_ready_promise.resolve... |
Change index to display latest recipes | RouteHandler = require '../../core/RouteHandler'
###
Index/frontpage/home
@author Torstein Thune
@copyright 2015 Microbrew.it
###
class Handler extends RouteHandler
getRoute: () ->
super { path: '/', method: 'GET' }
render: (err, res, body, user) ->
return @renderer.page
title: "Home of homebrewers"
nav... | RouteHandler = require '../../core/RouteHandler'
###
Index/frontpage/home
@author Torstein Thune
@copyright 2015 Microbrew.it
###
class Handler extends RouteHandler
getRoute: () ->
super { path: '/', method: 'GET' }
render: (err, res, body, user) ->
return @renderer.page
title: "Home of homebrewers"
nav... |
Add author info to profile feeds | TentStatus.Routers.profile = new class ProfileRouter extends Marbles.Router
routes: {
"profile" : "currentProfile"
":entity/profile" : "profile"
}
actions_titles: {
"currentProfile" : "Profile"
"profile" : "Profile"
}
currentProfile: (params) =>
if TentStatus.Helpers.isAppSubdomain()
... | TentStatus.Routers.profile = new class ProfileRouter extends Marbles.Router
routes: {
"profile" : "currentProfile"
":entity/profile" : "profile"
}
actions_titles: {
"currentProfile" : "Profile"
"profile" : "Profile"
}
_initAuthorInfoView: (options = {}) =>
new Marbles.Views.AuthorInfo _.... |
Switch to blockchain.info over SSL | { Util: { parseValue, bytesToNum }, convert: { bytesToHex, hexToBytes } } = require 'bitcoinjs-lib'
# Send transaction to Bitcoin network using blockchain.info's pushtx
tx_broadcast = (tx, cb) ->
tx = bytesToHex tx.serialize()
($.post 'https://blockchain.info/pushtx?cors=true', { tx })
.fail((xhr, status, err)... | { Util: { parseValue, bytesToNum }, convert: { bytesToHex, hexToBytes } } = require 'bitcoinjs-lib'
# Send transaction to Bitcoin network using blockchain.info's pushtx
tx_broadcast = (tx, cb) ->
tx = bytesToHex tx.serialize()
($.post 'https://blockchain.info/pushtx?cors=true', { tx })
.fail((xhr, status, err)... |
Throw warning on missing task | import isFunction from 'es-is/function'
import isGeneratorFunction from 'es-is/generator-function'
import log from '../log'
import tasks from '../tasks'
import invokeAsync from './async'
import invokeGenerator from './generator'
import invokeSync from './sync'
import serial from './serial... | import isFunction from 'es-is/function'
import isGeneratorFunction from 'es-is/generator-function'
import log from '../log'
import tasks from '../tasks'
import invokeAsync from './async'
import invokeGenerator from './generator'
import invokeSync from './sync'
import serial from './serial... |
Rename variable to pattern to shadow config key path | {View} = require 'space-pen'
$ = require 'jquery'
_ = require 'underscore'
module.exports =
class WrapGuide extends View
@activate: (rootView, state) ->
rootView.eachEditor (editor) =>
@appendToEditorPane(rootView, editor) if editor.attached
@appendToEditorPane: (rootView, editor) ->
if underlayer =... | {View} = require 'space-pen'
$ = require 'jquery'
_ = require 'underscore'
module.exports =
class WrapGuide extends View
@activate: (rootView, state) ->
rootView.eachEditor (editor) =>
@appendToEditorPane(rootView, editor) if editor.attached
@appendToEditorPane: (rootView, editor) ->
if underlayer =... |
Fix typo in the query string. | Repository = require('../models/repository').Repository
Build = require('../models/build').Build
Resque = require('../config/resque').Connection
exports.findOrCreateRepository = (desired_repository, callback) ->
query =
name: desired_repository.name
ownerName: desired_repository.ownername
... | Repository = require('../models/repository').Repository
Build = require('../models/build').Build
Resque = require('../config/resque').Connection
exports.findOrCreateRepository = (desired_repository, callback) ->
query =
name: desired_repository.name
ownerName: desired_repository.ownerName
... |
Switch back to regular cylon | gpio = require('gpio')
Events = require('events').EventEmitter
Cylon = require('cylon-raspi')
module.exports = class Buzzer extends Events
interval: 200
buzzes: 0
lastOpened: new Date()
isOpen: false
defaultTime: 5
maxTime: 15000
constructor: ( pin )->
@pinNum = pin
@servo = null
Cylon.robot
... | gpio = require('gpio')
Events = require('events').EventEmitter
Cylon = require('cylon')
module.exports = class Buzzer extends Events
interval: 200
buzzes: 0
lastOpened: new Date()
isOpen: false
defaultTime: 5
maxTime: 15000
constructor: ( pin )->
@pinNum = pin
@servo = null
Cylon.robot
... |
Set env var before loading script | assert = require 'assert'
Helper = require('hubot-test-helper')
helper = new Helper('../scripts/poo-tracker.coffee')
describe 'poo-tracker', ->
room = null
beforeEach ->
room = helper.createRoom()
room.user.say 'shithead', '@hubot hello, this is dog'
it 'compiled if it got this fucking far', ->
as... | assert = require 'assert'
Helper = require('hubot-test-helper')
process.env.POO_REDIS_URL = "redis://h:pass@localhost:6379/0"
helper = new Helper('../scripts/poo-tracker.coffee')
describe 'poo-tracker', ->
room = null
beforeEach ->
room = helper.createRoom()
room.user.say 'shithead', '@hubot hello, this ... |
Stop reversing levels in CampaignEditor | ModalView = require 'views/core/ModalView'
template = require 'templates/editor/campaign/save-campaign-modal'
DeltaView = require 'views/editor/DeltaView'
module.exports = class SaveCampaignModal extends ModalView
id: 'save-campaign-modal'
template: template
plain: true
events:
'click #save-button': 'onCl... | ModalView = require 'views/core/ModalView'
template = require 'templates/editor/campaign/save-campaign-modal'
DeltaView = require 'views/editor/DeltaView'
module.exports = class SaveCampaignModal extends ModalView
id: 'save-campaign-modal'
template: template
plain: true
events:
'click #save-button': 'onCl... |
Remove a log no longer relevant to modern browsers | ThangType = require 'models/ThangType'
CocoCollection = require 'collections/CocoCollection'
module.exports = class ThangNamesCollection extends CocoCollection
url: '/db/thang.type/names'
model: ThangType
isCachable: false
constructor: (@ids) ->
super()
@ids.sort()
if @ids.length > 55
consol... | ThangType = require 'models/ThangType'
CocoCollection = require 'collections/CocoCollection'
module.exports = class ThangNamesCollection extends CocoCollection
url: '/db/thang.type/names'
model: ThangType
isCachable: false
constructor: (@ids) ->
super()
@ids.sort()
fetch: (options) ->
options ?... |
Fix incorrect version in CoffeeScript portion. | leveldb = exports = module.exports = require './leveldb/handle'
binding = require '../build/Release/leveldb.node'
leveldb.version = '0.7.0'
leveldb.bindingVersion = "#{binding.majorVersion}.#{binding.minorVersion}"
leveldb.Batch = require('./leveldb/batch').Batch
###
Create a partitioned bitwise comparator for... | leveldb = exports = module.exports = require './leveldb/handle'
binding = require '../build/Release/leveldb.node'
leveldb.version = '0.7.1'
leveldb.bindingVersion = "#{binding.majorVersion}.#{binding.minorVersion}"
leveldb.Batch = require('./leveldb/batch').Batch
###
Create a partitioned bitwise comparator for... |
Update expample to use my | # TODO: Normalize to 100 or 1.00
SCALE = 30
me = {
name: 'me'
shape: 'turtle'
position: [0,0]
color: 'blue'
programs: {first: [], repeat: ['forward']}
editable: true
}
exit = {
name: 'exit'
shape: 'diamond'
position: [0,4]
color: 'red'
programs: {turtle: ['victory']}
}
me2 = me#$.extend me, {... | {my} = require '../my'
{vector} = require '../god/vector'
# TODO: Normalize to 100 or 1.00
SCALE = 30
me = {
name: 'me'
shape: 'turtle'
position: [0,0]
color: 'blue'
programs: {first: [], repeat: ['forward']}
editable: true
}
exit = {
name: 'exit'
shape: 'diamond'
position: [0,4]
color: 'red'
p... |
Add spec for missing search query | path = require 'path'
express = require 'express'
http = require 'http'
apm = require '../lib/apm-cli'
describe 'apm search', ->
server = null
beforeEach ->
silenceOutput()
spyOnToken()
app = express()
app.get '/search', (request, response) ->
response.sendfile path.join(__dirname, 'fixture... | path = require 'path'
express = require 'express'
http = require 'http'
apm = require '../lib/apm-cli'
describe 'apm search', ->
server = null
beforeEach ->
silenceOutput()
spyOnToken()
app = express()
app.get '/search', (request, response) ->
response.sendfile path.join(__dirname, 'fixture... |
Add operator scope to `:` | module.exports =
selector: ['.source.css.scss', '.source.sass']
id: 'aligner-scss' # package name
config:
':-alignment':
title: 'Padding for :'
description: 'Pad left or right of the character'
type: 'string'
default: 'right'
':-leftSpace':
title: 'Left space for :'
des... | module.exports =
selector: ['.source.css.scss', '.source.sass']
id: 'aligner-scss' # package name
config:
':-alignment':
title: 'Padding for :'
description: 'Pad left or right of the character'
type: 'string'
default: 'right'
':-leftSpace':
title: 'Left space for :'
des... |
Modify wage theft report info endpoint | # External Dependencies
debug = require('debug')('minimum-wage-service')
express = require 'express'
# Express Components
router = express.Router()
#Internal Dependencies
employer_size_router = require './employer_size'
survey_router = require './survey'
router.all '*', (req,res,next) ->
res.header("Access-Contro... | # External Dependencies
debug = require('debug')('minimum-wage-service')
express = require 'express'
# Express Components
router = express.Router()
#Internal Dependencies
employer_size_router = require './employer_size'
survey_router = require './survey'
router.all '*', (req,res,next) ->
res.header("Access-Contro... |
Add CoffeeScript describe and reorganize | # Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#... | # Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#... |
Allow future dates in timeago | window.languageAutocomplete = ->
return false if !$("[data-provide=typeahead]").length
projectLanguages = $("[data-provide=typeahead]").data "source"
$("[data-provide=typeahead]").typeahead
name: $(this).attr "name"
local: projectLanguages
jQuery ->
$("a[rel=popover]").popover()
$(".tooltip").toolt... | window.languageAutocomplete = ->
return false if !$("[data-provide=typeahead]").length
projectLanguages = $("[data-provide=typeahead]").data "source"
$("[data-provide=typeahead]").typeahead
name: $(this).attr "name"
local: projectLanguages
jQuery.timeago.settings.allowFuture = true;
jQuery ->
$("a[r... |
Use the deis specified port if it exists. | 'use strict'
Hapi = require 'hapi'
Boom = require 'boom'
BadRequest = Boom.badRequest
join = require('path').join
class Server
constructor: ->
@server = new Hapi.Server()
@server.connection(port: 4555)
@_names()
_names: ->
@server.route
method: 'GET'
path: '/names'
handler: (req... | 'use strict'
Hapi = require 'hapi'
Boom = require 'boom'
BadRequest = Boom.badRequest
join = require('path').join
class Server
constructor: ->
@server = new Hapi.Server()
@server.connection(process.env.PORT or 4545)
@_names()
_names: ->
@server.route
method: 'GET'
path: '/names'
... |
Rename variables for readability and to avoid confusion | #= require ./validators
class Batman.ExclusionValidator extends Batman.Validator
@triggers 'exlusionIn'
constructor: (options) ->
@acceptableValues = options.exlusionIn
super
validateEach: (errors, record, key, callback) ->
value = record.get(key)
for acceptableValue in @acceptableValues
... | #= require ./validators
class Batman.ExclusionValidator extends Batman.Validator
@triggers 'exlusionIn'
constructor: (options) ->
@unacceptableValues = options.exlusionIn
super
validateEach: (errors, record, key, callback) ->
value = record.get(key)
for unacceptableValue in @unacceptableValues... |
Work around Atom not displaying keybindings | '.platform-linux atom-text-editor.ide-haskell-repl, .platform-win32 atom-text-editor.ide-haskell-repl':
'shift-enter': 'ide-haskell-repl:exec-command'
'shift-up': 'ide-haskell-repl:history-back'
'shift-down': 'ide-haskell-repl:history-forward'
'ctrl-shift-r': 'ide-haskell-repl:ghci-reload'
'.platform-darwin at... | '.platform-linux atom-text-editor.ide-haskell-repl':
'shift-enter': 'ide-haskell-repl:exec-command'
'shift-up': 'ide-haskell-repl:history-back'
'shift-down': 'ide-haskell-repl:history-forward'
'ctrl-shift-r': 'ide-haskell-repl:ghci-reload'
'.platform-win32 atom-text-editor.ide-haskell-repl':
'shift-enter': '... |
Remove GitHubFactory (replaced with GitHubFetcher) | do ->
global.Libs or= {}
global.Libs.JsZip = require("jszip")
global.Libs.CoffeeScript = require("coffee-script")
# global.Libs.Canarium = require("canarium")
global.Libs.GitHubFactory = {
GitHub: require("github-api")
apiBase: "http://#{window.location.host}/api"
create: (args...) ->
in... | do ->
global.Libs or= {}
global.Libs.JsZip = require("jszip")
global.Libs.CoffeeScript = require("coffee-script")
# global.Libs.Canarium = require("canarium")
|
Remove atom-shell during partial-clean task instead of clean task | path = require 'path'
module.exports = (grunt) ->
{rm} = require('./task-helpers')(grunt)
grunt.registerTask 'partial-clean', 'Delete some of the build files', ->
rm grunt.config.get('atom.buildDir')
rm '/tmp/atom-coffee-cache'
rm '/tmp/atom-cached-atom-shells'
rm 'node'
grunt.registerTask 'cle... | path = require 'path'
module.exports = (grunt) ->
{rm} = require('./task-helpers')(grunt)
grunt.registerTask 'partial-clean', 'Delete some of the build files', ->
rm grunt.config.get('atom.buildDir')
rm '/tmp/atom-coffee-cache'
rm '/tmp/atom-cached-atom-shells'
rm 'node'
rm 'atom-shell'
gru... |
Fix prevent ui router from encoding path names in the URL | mod = angular.module 'mothership', [
'ui.router'
'ui.bootstrap'
]
mod.config ($stateProvider, $urlRouterProvider) ->
$urlRouterProvider.otherwise('/playing')
$stateProvider.state
name: 'layout'
abstract: true
views:
'layout':
template: '<m-header></m-header><main ui-view></main>'
... | mod = angular.module 'mothership', [
'ui.router'
'ui.bootstrap'
]
mod.config (
$stateProvider, $urlRouterProvider, $urlMatcherFactoryProvider
) ->
$urlRouterProvider.otherwise('/playing')
valToString = (val) -> if val? then val.toString() else val
$urlMatcherFactoryProvider.type 'nonURIEncoded',
enco... |
Add `height` to prevent scaling issue in IE | React = require 'react'
objectAssign = require 'object-assign'
module.exports = (icons) ->
React.createClass
propTypes:
icon: React.PropTypes.string.isRequired
size: React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.number
])
style: React.PropTypes.object... | React = require 'react'
objectAssign = require 'object-assign'
module.exports = (icons) ->
React.createClass
propTypes:
icon: React.PropTypes.string.isRequired
size: React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.number
])
style: React.PropTypes.object... |
Disable Clear button when there's no crop | React = require 'react'
CropInitializer = require './initializer'
GenericTask = require '../generic'
module.exports = React.createClass
displayName: 'CropTask'
statics:
getSVGProps: ({workflow, classification, annotation}) ->
tasks = require '../index'
[previousCropAnnotation] = classification.ann... | React = require 'react'
CropInitializer = require './initializer'
GenericTask = require '../generic'
module.exports = React.createClass
displayName: 'CropTask'
statics:
getSVGProps: ({workflow, classification, annotation}) ->
tasks = require '../index'
[previousCropAnnotation] = classification.ann... |
Change indentation to follow coffeelint | dependencies = [
'ngRoute',
'ui.bootstrap',
'myApp.filters',
'myApp.services',
'myApp.controllers',
'myApp.directives',
'myApp.common',
'myApp.routeConfig'
]
app = angular.module('myApp', dependencies)
angular.module('myApp.routeConfig', ['ngRoute']).config ($locationProvider) ->
$... | dependencies = [
'ngRoute',
'ui.bootstrap',
'myApp.filters',
'myApp.services',
'myApp.controllers',
'myApp.directives',
'myApp.common',
'myApp.routeConfig'
]
app = angular.module('myApp', dependencies)
angular.module('myApp.routeConfig', ['ngRoute']).config ($locationProvider) ->
$locationProvider.h... |
Fix memory leak in NamespaceStoreSpec | _ = require 'underscore'
NamespaceStore = require '../../src/flux/stores/namespace-store'
describe "NamespaceStore", ->
beforeEach ->
@constructor = NamespaceStore.constructor
it "should initialize current() using data saved in config", ->
state =
"id": "123",
"email_address":"bengotow@gmail.c... | _ = require 'underscore'
NamespaceStore = require '../../src/flux/stores/namespace-store'
describe "NamespaceStore", ->
beforeEach ->
@instance = null
@constructor = NamespaceStore.constructor
afterEach ->
@instance.stopListeningToAll()
it "should initialize current() using data saved in config", -... |
Fix radio input to work with new BS forms | class Lanes.Components.RadioField extends Lanes.React.Component
mixins: [
Lanes.Components.Form.FieldMixin
]
renderEdit: ->
<BS.Col {...@props}>
<BS.Input
type="radio"
checked={@props.checked? || @props.value == @model[@props.name]}
... | class FakeInputEvent
constructor: (value) ->
@target = {value}
isDefaultPrevented: -> false
class Lanes.Components.RadioField extends Lanes.React.Component
mixins: [
Lanes.Components.Form.FieldMixin
]
handleRadioChange: (ev) ->
if ev.target.checked
@fieldMixin... |
Replace callbacks with an API | showFrame = document.getElementById("frame")
last_created_text = null
window.remote = Factlink.createFrameProxyObject window.parent,
['hide', 'show', 'highlightNewFactlink', 'stopHighlightingFactlink',
'createdNewFactlink', 'trigger', 'setFeatureToggles'
]
local =
showFactlink: (id, successFn) ->
ur... | showFrame = document.getElementById("frame")
last_created_text = null
window.remote = Factlink.createFrameProxyObject window.parent,
['hide', 'onModalReady', 'highlightNewFactlink', 'stopHighlightingFactlink',
'createdNewFactlink', 'trigger', 'setFeatureToggles'
]
local =
showFactlink: (id) ->
url =... |
Add Poller class to poll rooms | App.IndexRoute = App.AuthenticatedRoute.extend
setupController: (controller, model)->
states = []
stateIds = []
activeState = null
model.forEach (item)->
stateId = item.get("id")
if !activeState? && item.get("joined") == true
activeState = item
states.push(stateId)
s... | App.IndexRoute = App.AuthenticatedRoute.extend
setupController: (controller, model)->
stateData = []
stateIds = []
activeState = null
# Loop thru all room states
# find the first joined room to load
# start pollers for all joined rooms
model.forEach (item)=>
stateId = item.get... |
Refactor finder pane to work with multiple vms. | class FinderPane extends Pane
constructor: (options = {}, data) ->
super options, data
vmController = KD.getSingleton 'vmController'
vmController.fetchDefaultVmName (vmName) =>
@finder = new NFinderController
nodeIdPath : 'path'
nodeParentIdPath : 'parentPath'
contex... | class FinderPane extends Pane
constructor: (options = {}, data) ->
super options, data
KD.getSingleton('appManager').open 'Finder', (finderApp) =>
@createFinderController finderApp
@bindListeners()
createFinderController: (finderApp) ->
@finderController = finderApp.create()
@addSubV... |
Fix kdblockingmodal, take care hidden objects | class KDBlockingModalView extends KDModalView
constructor:->
super
$(window).off "keydown.modal"
putOverlay:()->
@$overlay = $ "<div/>",
class : "kdoverlay"
@$overlay.hide()
@$overlay.appendTo "body"
@$overlay.fadeIn 200
setDomElement:(cssClass)->
@domElement = $ "
<div... | class KDBlockingModalView extends KDModalView
constructor:->
super
$(window).off "keydown.modal"
putOverlay:()->
@$overlay = $ "<div/>",
class : "kdoverlay"
@$overlay.hide()
@$overlay.appendTo "body"
@$overlay.fadeIn 200
setDomElement:(cssClass)->
@domElement = $ """
<d... |
Use modal-form dialog for collections manager icon | React = require 'react'
CollectionsManager = require './manager'
alert = require '../lib/alert'
# Shows an icon to logged-in users that pops up a collections manager
module?.exports = React.createClass
displayName: 'CollectionsManagerIcon'
propTypes:
subject: React.PropTypes.object
user: React.PropTypes.o... | React = require 'react'
CollectionsManager = require './manager'
Dialog = require 'modal-form/dialog'
# Shows an icon to logged-in users that pops up a collections manager
module?.exports = React.createClass
displayName: 'CollectionsManagerIcon'
propTypes:
subject: React.PropTypes.object
user: React.PropT... |
Clean files in project sub directories as well | { Disposable } = require 'atom'
path = require 'path'
fs = require 'fs'
glob = require 'glob'
module.exports =
class Cleaner extends Disposable
constructor: (latex) ->
@latex = latex
clean: ->
if !@latex.manager.findMain()
return false
rootDir = path.dirname(@latex.mainFile)
removeGlobs = at... | { Disposable } = require 'atom'
path = require 'path'
fs = require 'fs'
glob = require 'glob'
module.exports =
class Cleaner extends Disposable
constructor: (latex) ->
@latex = latex
clean: ->
if !@latex.manager.findMain()
return false
rootDir = path.dirname(@latex.mainFile)
FileExts = atom.... |
Add `quiet` parameter to `removePane` method | class AceApplicationTabView extends ApplicationTabView
removePane_: KDTabView::removePane
removePane: (pane, shouldDetach) ->
{aceView} = pane.getOptions()
return @removePane_ pane, shouldDetach unless aceView
{ace} = aceView
file = ace.getData()
return @removePane_ pane, shouldDetach u... | class AceApplicationTabView extends ApplicationTabView
removePane_: KDTabView::removePane
removePane: (pane, shouldDetach, quiet = no) ->
{aceView} = pane.getOptions()
return @removePane_ pane, shouldDetach if quiet or not aceView
{ace} = aceView
file = ace.getData()
return @removePane_ ... |
Implement retrieving existing markers and destroying decorations along binding | {CompositeDisposable} = require 'atom'
module.exports =
class MinimapBookmarksBinding
constructor: (@minimap) ->
@subscriptions = new CompositeDisposable
@editor = @minimap.getTextEditor()
@subscriptions.add @editor.displayBuffer.onDidCreateMarker (marker) =>
if marker.matchesProperties(class: 'bo... | {CompositeDisposable} = require 'atom'
module.exports =
class MinimapBookmarksBinding
constructor: (@minimap) ->
@subscriptions = new CompositeDisposable
@editor = @minimap.getTextEditor()
@decorationsByMarkerId = {}
@decorationSubscriptionsByMarkerId = {}
@subscriptions.add @editor.displayBuffe... |
Test should account for possible charset | request = require 'request'
should = require 'should'
startApp = require './start_app'
base = require './base'
options = require './options'
describe 'Basic Things', ->
before (done) ->
startApp done
it 'should return version information', (done)->
request (base '/'), options, (e,r,b)->
r.statusCod... | request = require 'request'
should = require 'should'
startApp = require './start_app'
base = require './base'
options = require './options'
describe 'Basic Things', ->
before (done) ->
startApp done
it 'should return version information', (done)->
request (base '/'), options, (e,r,b)->
r.statusCod... |
Make CartoDB formatter available for Indicator formatting | fs = require('fs')
Q = require('q')
_ = require('underscore')
StandardIndicatorator = require('../indicatorators/standard_indicatorator')
GETTERS =
gdoc: require('../getters/gdoc')
cartodb: require('../getters/cartodb')
FORMATTERS =
gdoc = require('../formatters/gdoc')
module.exports = class Indicator
const... | fs = require('fs')
Q = require('q')
_ = require('underscore')
StandardIndicatorator = require('../indicatorators/standard_indicatorator')
GETTERS =
gdoc: require('../getters/gdoc')
cartodb: require('../getters/cartodb')
FORMATTERS =
gdoc: require('../formatters/gdoc')
cartodb: require('../formatters/cartodb'... |
Make sure that we properly unsubscribe from any outdated portions of a keypath. | class KeypathObserver
constructor: (@view, @model, @keypath, @callback) ->
@interfaces = (k for k, v of @view.adapters)
@objectPath = []
@tokens = Rivets.KeypathParser.parse @keypath, @interfaces, @view.config.rootInterface
@root = @tokens.shift()
@key = @tokens.pop()
@target = @realize()
u... | class KeypathObserver
constructor: (@view, @model, @keypath, @callback) ->
@interfaces = (k for k, v of @view.adapters)
@objectPath = []
@tokens = Rivets.KeypathParser.parse @keypath, @interfaces, @view.config.rootInterface
@root = @tokens.shift()
@key = @tokens.pop()
@target = @realize()
u... |
Add mising relation in Track | Yossarian.Track = DS.Model.extend
name: DS.attr 'string'
| Yossarian.Track = DS.Model.extend
name: DS.attr 'string'
recordings: DS.hasMany 'recording'
|
Fix jQuery promise failure handler API reference | $ = require 'jquery'
globals = require 'globals'
module.exports = shortenUrl = (longUrl, callback) ->
{ apiKey } = globals.config.google
apiUrl = "https://www.googleapis.com/urlshortener/v1/url?key=#{apiKey}"
request = $.ajax
url : apiUrl
type : 'POST'
contentType : 'applicati... | $ = require 'jquery'
globals = require 'globals'
module.exports = shortenUrl = (longUrl, callback) ->
{ apiKey } = globals.config.google
apiUrl = "https://www.googleapis.com/urlshortener/v1/url?key=#{apiKey}"
request = $.ajax
url : apiUrl
type : 'POST'
contentType : 'applicati... |
Fix propType to be correct "oneOfType" | React = require 'react'
BS = require 'react-bootstrap'
classnames = require 'classnames'
_ = require 'underscore'
module.exports = React.createClass
displayName: 'Icon'
propTypes:
type: React.PropTypes.string.isRequired
spin: React.PropTypes.bool
className: React.PropTypes.string
tooltip: ... | React = require 'react'
BS = require 'react-bootstrap'
classnames = require 'classnames'
_ = require 'underscore'
module.exports = React.createClass
displayName: 'Icon'
propTypes:
type: React.PropTypes.string.isRequired
spin: React.PropTypes.bool
className: React.PropTypes.string
tooltip: ... |
Set status to 1 when queuing | @lobbyQueue = new Meteor.Collection "lobbyQueue"
Meteor.startup ->
lobbyQueue.remove({})
@cancelFindServer = (lobbyId)->
console.log "canceling server search: "+lobbyId
lobbyQueue.remove
lobby: lobbyId
@startFindServer = (lobbyId)->
console.log "finding server for "+lobbyId
lobbyQueue.insert
lobby:... | @lobbyQueue = new Meteor.Collection "lobbyQueue"
Meteor.startup ->
lobbyQueue.remove({})
@cancelFindServer = (lobbyId)->
console.log "canceling server search: "+lobbyId
lobbyQueue.remove
lobby: lobbyId
@startFindServer = (lobbyId)->
console.log "finding server for "+lobbyId
lobbyQueue.insert
lobby:... |
Add test for getCurrentPath bug | ProjectManager = require '../lib/project-manager'
{WorkspaceView} = require 'atom'
fs = require 'fs'
describe "ProjectManager", ->
activationPromise: null
describe "Toggle Project Manager", ->
beforeEach ->
atom.workspaceView = new WorkspaceView
activationPromise = atom.packages.activatePackage('p... | ProjectManager = require '../lib/project-manager'
{WorkspaceView} = require 'atom'
fs = require 'fs'
describe "ProjectManager", ->
activationPromise: null
describe "Toggle Project Manager", ->
beforeEach ->
atom.workspaceView = new WorkspaceView
activationPromise = atom.packages.activatePackage('p... |
Fix bug in new script | msgpack = require 'msgpack'
r = require('redis').createClient detect_buffers: true
r.keys '*', (err, all_keys) ->
throw err if err
keys = []
for key in all_keys
parts = key.split ':'
continue if (parts.length == 1) || (parts[0] == 'lock')
keys.push key
count = keys.length
for key in keys
do (... | msgpack = require 'msgpack'
r = require('redis').createClient 6379, 'localhost', detect_buffers: true
r.keys '*', (err, all_keys) ->
throw err if err
keys = []
for key in all_keys
parts = key.split ':'
continue if (parts.length == 1) || (parts[0] == 'lock')
keys.push key
count = keys.length
for k... |
Add integration test for new customer. | Config = require '../config'
CustomerXmlImport = require '../lib/customerxmlimport'
# Increase timeout
jasmine.getEnv().defaultTimeoutInterval = 10000
describe 'process', ->
beforeEach ->
@import = new CustomerXmlImport Config
it 'one customer', (done) ->
rawXml = '
<Customer>
<CustomerNr>1234</Custome... | _ = require('underscore')._
Config = require '../config'
CustomerXmlImport = require '../lib/customerxmlimport'
# Increase timeout
jasmine.getEnv().defaultTimeoutInterval = 10000
describe 'process', ->
beforeEach ->
@import = new CustomerXmlImport Config
it 'one existing customer', (done) ->
rawXml = '
<... |
Revert to non TOC markdown | counterpart = require 'counterpart'
React = require 'react'
{Markdown} = (require 'markdownz').default
counterpart.registerTranslations 'en',
glossary:
content: '''
## Glossary
A collection of definitions for terms used across the Zooniverse. The terms are split into three different groups; [General ... | counterpart = require 'counterpart'
React = require 'react'
{Markdown} = (require 'markdownz').default
counterpart.registerTranslations 'en',
policiesPage:
content: '''
## Glossary
A collection of definitions for terms used across the Zooniverse. The terms are split into three different groups:
... |
Update title to be "Class Dashboard" | React = require 'react'
BS = require 'react-bootstrap'
Router = require 'react-router'
{CCDashboardStore, CCDashboardActions} = require '../../flux/cc-dashboard'
LoadableItem = require '../loadable-item'
CCDashboard = require './dashboard'
BookLinks = require './book-links'
classnames = require 'classnames'
Dashbo... | React = require 'react'
BS = require 'react-bootstrap'
Router = require 'react-router'
{CCDashboardStore, CCDashboardActions} = require '../../flux/cc-dashboard'
LoadableItem = require '../loadable-item'
CCDashboard = require './dashboard'
BookLinks = require './book-links'
classnames = require 'classnames'
Dashbo... |
Move turbolinks up to make client_side_validations working after ajax request | #= require vendor/modernizr
#= require jquery
#= require jquery_ujs
#= require foundation/foundation
#= require foundation
#= require rails.validations
#= require rails.validations.simple_form
#= require rails.validations.simple_form.fix
#= require turbolinks
#= require nprogress
#= require nprogress-turbolinks
#= requ... | #= require vendor/modernizr
#= require jquery
#= require jquery_ujs
#= require foundation/foundation
#= require foundation
#= require turbolinks
#= require nprogress
#= require nprogress-turbolinks
#= require rails.validations
#= require rails.validations.simple_form
#= require rails.validations.simple_form.fix
#= requ... |
Add `Change Top Folder` context menu action | class IDE.FinderContextMenuController extends NFinderContextMenuController
getFolderMenu: (fileView) ->
fileData = fileView.getData()
items =
Expand :
action : "expand"
separator : yes
Collapse :
... | class IDE.FinderContextMenuController extends NFinderContextMenuController
getFolderMenu: (fileView) ->
fileData = fileView.getData()
items =
Expand :
action : "expand"
separator : yes
Collapse :
... |
Send OAuth token as web socket query param | _ = require 'underscore'
guid = require 'guid'
module.exports =
class WsChannel
_.extend @prototype, require('event-emitter')
constructor: (@name) ->
@clientId = guid.create().toString()
@socket = new WebSocket('ws://localhost:8080')
@socket.onopen = =>
@rawSend 'subscribe', @name, @clientId
... | _ = require 'underscore'
guid = require 'guid'
keytar = require 'keytar'
module.exports =
class WsChannel
_.extend @prototype, require('event-emitter')
constructor: (@name) ->
@clientId = guid.create().toString()
token = keytar.getPassword('github.com', 'github')
@socket = new WebSocket("ws://localhos... |
Add a submitted/unsubmitted thing to editing links. | 'use strict'
app.directive 'volumeEditLinksForm', [
'pageService',
(page) ->
restrict: 'E',
templateUrl: 'volume/editLinks.html',
link: ($scope) ->
volume = $scope.volume
form = $scope.volumeEditLinksForm
form.data = _.map volume.links, (ref) ->
head: ref.head
url: re... | 'use strict'
app.directive 'volumeEditLinksForm', [
'pageService',
(page) ->
restrict: 'E',
templateUrl: 'volume/editLinks.html',
link: ($scope) ->
volume = $scope.volume
form = $scope.volumeEditLinksForm
form.data = _.map volume.links, (ref) ->
head: ref.head
url: re... |
Hide practice button if practice handler isn't provided | React = require 'react'
BS = require 'react-bootstrap'
Router = require 'react-router'
_ = require 'underscore'
LearningGuide = require '../../flux/learning-guide'
PracticeButton = require './practice-button'
WeakerSections = require './weaker-sections'
WeakerPanel = React.createClass
propTypes:
courseId: ... | React = require 'react'
BS = require 'react-bootstrap'
Router = require 'react-router'
_ = require 'underscore'
LearningGuide = require '../../flux/learning-guide'
PracticeButton = require './practice-button'
WeakerSections = require './weaker-sections'
WeakerPanel = React.createClass
propTypes:
courseId: ... |
Check the keychain for the token before falling back to ATOM_ACCESS_TOKEN. | try
keytar = require 'keytar'
catch error
# Gracefully handle keytar failing to load due to missing library on Linux
if process.platform is 'linux'
keytar =
findPassword: ->
replacePassword: ->
else
throw error
tokenName = 'Atom.io API Token'
module.exports =
# Get the Atom.io API token ... | try
keytar = require 'keytar'
catch error
# Gracefully handle keytar failing to load due to missing library on Linux
if process.platform is 'linux'
keytar =
findPassword: ->
replacePassword: ->
else
throw error
tokenName = 'Atom.io API Token'
module.exports =
# Get the Atom.io API token ... |
Change site tile to Sherpa | "use strict"
module.exports =
title: 'Hytteadmin'
version: '2.0.0-alpha'
desc: 'Administrasjon av hytter i Nasjonal Turbase'
author: 'Hans Kristian Flaatten, Den Norske Turistforening'
copyright: '© Den Norske Turistforening'
| "use strict"
module.exports =
title: 'Sherpa'
version: '2.0.0-alpha'
desc: 'Administrasjon av hytter i Nasjonal Turbase'
author: 'Hans Kristian Flaatten, Den Norske Turistforening'
copyright: '© Den Norske Turistforening'
|
Add default content when created to avoid extra DOM manipulation when attached | {cloneFragment} = Trix
Trix.registerElement "trix-toolbar",
defaultCSS: """
%t {
white-space: collapse;
}
%t .dialog {
display: none;
}
%t .dialog.active {
display: block;
}
%t .dialog input.validate:invalid {
background-color: #ffdddd;
}
%t[native] {
... | {cloneFragment} = Trix
Trix.registerElement "trix-toolbar",
defaultCSS: """
%t {
white-space: collapse;
}
%t .dialog {
display: none;
}
%t .dialog.active {
display: block;
}
%t .dialog input.validate:invalid {
background-color: #ffdddd;
}
%t[native] {
... |
Add context menu items for staging and unstaging in changed files list | 'menu': [
{
'label': 'View'
'submenu': [
{
'label': 'Toggle Git Panel'
'command': 'github:toggle-git-panel'
}
]
}
{
'label': 'Packages'
'submenu': [
{
'label': 'GitHub',
'submenu': [
{
'label': 'Toggle'
'comman... | 'menu': [
{
'label': 'View'
'submenu': [
{
'label': 'Toggle Git Panel'
'command': 'github:toggle-git-panel'
}
]
}
{
'label': 'Packages'
'submenu': [
{
'label': 'GitHub',
'submenu': [
{
'label': 'Toggle'
'comman... |
Enable linting on the fly | {CompositeDisposable} = require 'atom'
module.exports =
config:
executablePath:
type: 'string'
title: 'PHP Executable Path'
default: 'php' # Let OS's $PATH handle the rest
activate: ->
@regex = '(Parse|Fatal) ' +
'(?<error>error):(\\s*(?<type>parse|syntax) error,?)?\\s*' +
... | {CompositeDisposable} = require 'atom'
module.exports =
config:
executablePath:
type: 'string'
title: 'PHP Executable Path'
default: 'php' # Let OS's $PATH handle the rest
activate: ->
@regex = '(Parse|Fatal) ' +
'(?<error>error):(\\s*(?<type>parse|syntax) error,?)?\\s*' +
... |
Add documentation for the if | # Graph-stuff-code
# Generalised way to send an ajax request to load a chart when a
# link is clicked with data-load="graph"
$('body.coders.show, body.repositories.show').ready ->
$('a[data-load="graph"]').on 'shown.bs.tab', (e) ->
if !$("#chart").hasClass('google-visualization-atl container')
... | # Graph-stuff-code
# Generalised way to send an ajax request to load a chart when a
# link is clicked with data-load="graph"
$('body.coders.show, body.repositories.show').ready ->
$('a[data-load="graph"]').on 'shown.bs.tab', (e) ->
# Only initialise the chart the first time we click the tab
# Googl... |
Create alleys in hall creation | $ ->
# $('#rows').on "change", ->
# $rows = $(this).val()
# console.log $rows
# $('#columns').on "change", ->
# $columns = $(this).val()
# console.log $columns
$('#submit_details').click (e) ->
e.preventDefault()
$rows = parseInt($('#rows').val(), 10)
$columns = parseInt($('#columns'... | $ ->
# $('#rows').on "change", ->
# $rows = $(this).val()
# console.log $rows
# $('#columns').on "change", ->
# $columns = $(this).val()
# console.log $columns
$('#submit_details').click (e) ->
e.preventDefault()
$rows = parseInt($('#rows').val(), 10)
$columns = parseInt($('#columns'... |
Use PolarMap on sensor page | class Workbench.Views.SensorMapView extends Backbone.Marionette.ItemView
template: false
initialize: ->
@zoom = 13
onDestroy: ->
@map.remove() if @map
onShow: ->
if @el.id is ""
console.warn "No Map Element"
else
@location = [@model.get("latitude"), @model.get("longitude")]
... | class Workbench.Views.SensorMapView extends Backbone.Marionette.ItemView
template: false
initialize: ->
@zoom = 13
onDestroy: ->
@map.remove() if @map
onShow: ->
if @el.id is ""
console.warn "No Map Element"
else
@location = [@model.get("latitude"), @model.get("longitude")]
... |
Use reset for better performance | class window.SearchCollection extends Backbone.Collection
constructor: (args...)->
super(args...)
@searchFor ''
emptyState: -> []
searchFor: (query) ->
query = $.trim(query)
return if query == @query
@query = query
@_search()
throttle = (method) -> _.throttle method, 300
_search: th... | class window.SearchCollection extends Backbone.Collection
constructor: (args...)->
super(args...)
@searchFor ''
emptyState: -> []
searchFor: (query) ->
query = $.trim(query)
return if query == @query
@query = query
@_search()
throttle = (method) -> _.throttle method, 300
_search: th... |
Fix bug with read-only view of questioning form | # Newer view to manage Question form.
class ELMO.Views.QuestionFormView extends ELMO.Views.FormView
initialize: (options) ->
@toggleFields()
# We use $= because the start of the ID can vary depending on whether
# it's a question form or questioning form.
# Note, these events must be redefined in any child ... | # Newer view to manage Question form.
class ELMO.Views.QuestionFormView extends ELMO.Views.FormView
initialize: (options) ->
@toggleFields()
# We use $= because the start of the ID can vary depending on whether
# it's a question form or questioning form.
# Note, these events must be redefined in any child ... |
Fix "Git Plus: Add (all)" without open editor | {BufferedProcess} = require 'atom'
StatusView = require './status-view'
# if all param true, then 'git add .'
gitAdd = (all=false)->
dir = atom.project.getRepo().getWorkingDirectory()
currentFile = atom.workspace.getActiveEditor().getPath()
toStage = if all then '.' else currentFile
new BufferedProcess({
c... | {BufferedProcess} = require 'atom'
StatusView = require './status-view'
# if all param true, then 'git add .'
gitAdd = (all=false)->
dir = atom.project.getRepo().getWorkingDirectory()
currentFile = atom.workspace.getActiveEditor()?.getPath()
toStage = if all then '.' else currentFile
if (toStage?)
new Buff... |
Add the to arg doc | path = require 'path'
fs = require 'fs-plus'
optimist = require 'optimist'
Highlights = require './highlights'
module.exports = ->
cli = optimist.describe('help', 'Show this message').alias('h', 'help')
.describe('scope', 'Scope name of grammar to use').alias('s', 'scopeName')
optimist.usage """
... | path = require 'path'
fs = require 'fs-plus'
optimist = require 'optimist'
Highlights = require './highlights'
module.exports = ->
cli = optimist.describe('help', 'Show this message').alias('h', 'help')
.describe('scope', 'Scope name of the grammar to use').alias('s', 'scopeName')
optimist.usage ""... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.