Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Use updated wording for help | _ = require 'underscore'
React = require 'react'
BS = require 'react-bootstrap'
TutorLink = require './link'
CourseGroupingLabel = require './course-grouping-label'
NoPeriods = React.createClass
propTypes:
courseId: React.PropTypes.string.isRequired
noPanel: React.PropTypes.bool
link: React.PropTypes... | _ = require 'underscore'
React = require 'react'
BS = require 'react-bootstrap'
TutorLink = require './link'
CourseGroupingLabel = require './course-grouping-label'
NoPeriods = React.createClass
propTypes:
courseId: React.PropTypes.string.isRequired
noPanel: React.PropTypes.bool
link: React.PropTypes.... |
Revert "Try to put line back in" | if Meteor.isClient
if Package.ui
Handlebars = Package.ui.Handlebars
Handlebars.registerHelper 't9n', (x, prefix='') ->
T9n.get(x, prefix)
class T9n
@get: (x, prefix='') ->
_get(x, prefix)
@map: (language, map) ->
if not i18n.map[language]
i18n.map[language] = {}
_extend(i18n.map[la... | if Meteor.isClient
if Package.ui
Handlebars = Package.ui.Handlebars
Handlebars.registerHelper 't9n', (x, prefix='') ->
T9n.get(x, prefix)
class T9n
@get: (x, prefix='') ->
_get(x, prefix)
@map: (language, map) ->
if not i18n.map[language]
i18n.map[language] = {}
_extend(i18n.map[la... |
Remove rmdir from test helpers. | util = require 'util'
path = require 'path'
express = require 'express'
{spawn} = require 'child_process'
exports.removeDirectory = (destination, callback) ->
rm = spawn 'rm', ['-R', destination]
rm.stderr.on 'data', (data) ->
console.log "Error on directory removal: #{data}"
rm.on 'exit', (-> callback?())
... | util = require 'util'
path = require 'path'
express = require 'express'
{spawn} = require 'child_process'
exports.runServer = (appPath, callback = (->)) ->
app = express.createServer()
app.configure ->
app.use express.static appPath
app.set 'views', appPath
app.set 'view options', layout: no
app.re... |
Add additional entries to the Idris main menu | 'menu':
[
{
'label': 'Packages'
'submenu':
[
'label': 'Idris'
'submenu':
[
{
'label': 'Typecheck'
'command': 'language-idris:typecheck'
}
]
]
}
]
'context-menu':
'atom-text-e... | 'menu':
[
{
'label': 'Packages'
'submenu':
[
'label': 'Idris'
'submenu':
[
{
'label': 'Typecheck'
'command': 'language-idris:typecheck'
}
{
'label': 'Open REPL'
... |
Improve checking for presence of saved filters | angular.module("admin.indexUtils").factory 'QueryPersistence', (localStorageService)->
new class QueryPersistence
storageKey: ''
storableFilters: []
constructor: ->
localStorageService.setStorageType("sessionStorage")
getStoredFilters: ->
localStorageService.get(@storageKey) || {}
s... | angular.module("admin.indexUtils").factory 'QueryPersistence', (localStorageService)->
new class QueryPersistence
storageKey: ''
storableFilters: []
constructor: ->
localStorageService.setStorageType("sessionStorage")
getStoredFilters: ->
localStorageService.get(@storageKey) || {}
s... |
Test to ensure compilation issues are caught. | path = require 'path'
vows = require 'vows'
assert = require 'assert'
coffeelint = require path.join('..', 'lib', 'coffeelint')
vows.describe('coffeelint').addBatch({
"CoffeeLint's version number" :
topic : coffeelint.VERSION
'exists' : (version) ->
assert.isString(version)
"Co... | path = require 'path'
vows = require 'vows'
assert = require 'assert'
coffeelint = require path.join('..', 'lib', 'coffeelint')
vows.describe('coffeelint').addBatch({
"CoffeeLint's version number" :
topic : coffeelint.VERSION
'exists' : (version) ->
assert.isString(version)
"Co... |
Improve behaviour if there is a selenium error | {parallel} = require 'async'
cleaner = require '../cleaner'
{wd40, browser} = require 'wd40'
base_url = process.env.CU_TEST_URL ? 'http://localhost:3001'
login_url = "#{base_url}/login"
logout_url = "#{base_url}/logout"
before (done) ->
console.log "[scraperwiki global before]"
parallel [
(cb) ->
... | {parallel} = require 'async'
cleaner = require '../cleaner'
{wd40, browser} = require 'wd40'
base_url = process.env.CU_TEST_URL ? 'http://localhost:3001'
login_url = "#{base_url}/login"
logout_url = "#{base_url}/logout"
before (done) ->
console.log "[scraperwiki global before]"
parallel [
(cb) ->
... |
Exit app if exitAppWhenFinished is set | {$$} = require 'space-pen'
nakedLoad 'jasmine'
nakedLoad 'jasmine-html'
nakedLoad 'jasmine-focused'
$ = require 'jquery'
document.title = "Benchmark Suite"
$('head').append $$ ->
@link rel: "stylesheet", type: "text/css", href: "static/jasmine.css"
$('body').append $$ ->
@div id: 'jasmine_runner'
@div id: 'ja... | {$$} = require 'space-pen'
nakedLoad 'jasmine'
nakedLoad 'jasmine-html'
nakedLoad 'jasmine-focused'
$ = require 'jquery'
document.title = "Benchmark Suite"
$('head').append $$ ->
@link rel: "stylesheet", type: "text/css", href: "static/jasmine.css"
$('body').append $$ ->
@div id: 'jasmine_runner'
@div id: 'ja... |
Disable button and change text while loading. | class App.Views.Users.Edit extends App.View
template: JST['application/templates/users/edit']
events:
'submit form' : 'onFormSubmit'
render: ->
@$el.html(@template(@model.attributes))
onFormSubmit: ->
form = @$el.find "form"
newAttrs = @updateModelFromForm(form)
success = =>
gh_handl... | class App.Views.Users.Edit extends App.View
template: JST['application/templates/users/edit']
events:
'submit form' : 'onFormSubmit'
render: ->
@$el.html(@template(@model.attributes))
onFormSubmit: ->
$('#get_api').attr('disabled', true)
$('#get_api').val('Loading...')
form = @$el.find "fo... |
Reconnect dongle at the end of FUP | class @UpdateDoneViewController extends @UpdateViewController
localizablePageSubtitle: "update.done.update_succeeded"
localizableNextButton: "common.restore"
navigation:
nextRoute: "/onboarding/management/welcome"
navigateNext: ->
ledger.app.setExecutionMode(ledger.app.Modes.Wallet)
super | class @UpdateDoneViewController extends @UpdateViewController
localizablePageSubtitle: "update.done.update_succeeded"
localizableNextButton: "common.restore"
navigation:
nextRoute: "/onboarding/device/connecting"
navigateNext: ->
@getRequest().cancel()
ledger.app.reconnectDongleAndEnterWalletMode(... |
Add Caman process event listeners | do ->
mapOptions =
center: new (google.maps.LatLng)(43.8321591, 4.3428536)
mapTypeId: google.maps.MapTypeId.ROADMAP
streetViewControl: false
scrollwheel: false
navigationControl: false
mapTypeControl: false
scaleControl: false
draggable: false
zoomControlOptions: style: google.maps.ZoomControlStyle.... | do ->
mapOptions =
center: new (google.maps.LatLng)(43.8321591, 4.3428536)
mapTypeId: google.maps.MapTypeId.ROADMAP
streetViewControl: false
scrollwheel: false
navigationControl: false
mapTypeControl: false
scaleControl: false
draggable: false
zoomControlOptions: style: google.maps.ZoomControlStyle.... |
Adjust user model to twitterbot | orm = require('orm')
module.exports = (db, callback) ->
db.define("user", {
id_str: String,
screen_name: String,
name: String,
profile_image_url: String,
location: String,
favourites_count: Number,
url: String,
lang: String,
statuses_count: Number,
friends_count: Number,
followers_count: Number
... | orm = require('orm')
module.exports = (db, callback) ->
db.define("user", {
id_str: String,
screen_name: String,
name: String,
description: String,
created_at: String,
location: String,
profile_image_url: String,
profile_image_url_https: String,
url: String,
listed_count: Number,
favourites_coun... |
Convert weird object notation to proper arrays | process = () =>
if @JasmineReporter.finished
results = @JasmineReporter.results()
json = JSON.stringify(results)
# attach it to the DOM, so the it can be retrieved by webdriver
element = @document.createElement("div")
text = @document.createTextNode(json)
element.appendChild text
element.... | process = () =>
if @JasmineReporter.finished
results = @JasmineReporter.results()
results = (v for k,v of results)
json = JSON.stringify(results)
# attach it to the DOM, so the it can be retrieved by webdriver
element = @document.createElement("div")
text = @document.createTextNode(json)
... |
Rename flag value recalculating function | ---
---
pow2 = (exp) ->
base = 1
base *= 2 while exp-- > 0
base
update = ->
val = 0
for el in document.querySelectorAll '.flag-list input'
val += pow2 el.getAttribute 'value' if el.checked
document.querySelector('.page-heading strong').innerHTML = val
return
document.addEventListener 'DOMContentLoaded', -... | ---
---
pow2 = (exp) ->
base = 1
base *= 2 while exp-- > 0
base
recalculate = ->
val = 0
for el in document.querySelectorAll '.flag-list input'
val += pow2 el.getAttribute 'value' if el.checked
document.querySelector('.page-heading strong').innerHTML = val
return
document.addEventListener 'DOMContentLoade... |
Fix text in demo workflow | Store = require './store'
EXAMPLE_WORKFLOW =
id: 'GZ_MAIN_WORKFLOW'
firstTask: 'interest'
tasks:
interest:
type: 'drawing'
question: 'Color some points'
tools: [
{value: 'red', label: 'Red', type: 'point', color: 'red'}
{value: 'green', label: 'Green', type: 'point', color: ... | Store = require './store'
EXAMPLE_WORKFLOW =
id: 'GZ_MAIN_WORKFLOW'
firstTask: 'interest'
tasks:
interest:
type: 'drawing'
question: 'Color some points'
tools: [
{value: 'red', label: 'Red', type: 'point', color: 'red'}
{value: 'green', label: 'Green', type: 'point', color: ... |
Fix controller name for the ws connection params | define ['controllers/main_controller', 'jquery', 'websocket_rails', 'underscore', 'backbone', 'marionette'], (MainController, $) ->
# Create the single page application
App = new Backbone.Marionette.Application();
App.addInitializer ->
# Get websocket connection info
connection_params = {}
$.get('web... | define ['controllers/main_controller', 'jquery', 'websocket_rails', 'underscore', 'backbone', 'marionette'], (MainController, $) ->
# Create the single page application
App = new Backbone.Marionette.Application();
App.addInitializer ->
# Get websocket connection info
connection_params = {}
$.get('ws/... |
Update repl prompt to work with async requests | Readline = require 'readline'
Robot = require '../robot'
Adapter = require '../adapter'
class Shell extends Adapter
constructor: (robot) ->
super robot
@repl = null
send: (user, strings...) ->
console.log str for str in strings
@repl.prompt()
reply: (user, strings...) ->
@send user, st... | Readline = require 'readline'
Robot = require '../robot'
Adapter = require '../adapter'
class Shell extends Adapter
send: (user, strings...) ->
unless process.platform is "win32"
console.log "\033[01;32m#{str}\033[0m" for str in strings
else
console.log "#{str}" for str in strings
@repl.... |
Add march=native flag to OFast | module.exports = FLAGS =
oF: '-Ofast'
oS: '-Os'
o3: ['-O3', '-march=native']
o2: '-O2'
o1: '-O1'
o0: '-O0'
g: '-g'
pg: '-pg'
s: '-static'
ni: '-fno-inline'
pca: ['-O3', '-march=native', '-mfpmath=sse', '-ffloat-store', '-Wl,-s,-O1', '-lm']
ALIAS =
0: 'o0'
1: 'o1'
... | module.exports = FLAGS =
oF: ['-Ofast', '-march=native']
oS: '-Os'
o3: ['-O3', '-march=native']
o2: '-O2'
o1: '-O1'
o0: '-O0'
g: '-g'
pg: '-pg'
s: '-static'
ni: '-fno-inline'
pca: ['-O3', '-march=native', '-mfpmath=sse', '-ffloat-store', '-Wl,-s,-O1', '-lm']
ALIAS =
0:... |
Fix question debounce bug that john already fixed. | ETahi.QuestionComponent = Ember.Component.extend
tagName: 'div'
helpText: null
displayContent: false
model: (->
ident = @get('ident')
throw "you must specify an ident" unless ident
question = @get('task.questions').findProperty('ident', ident)
unless question
task = @get('task')
q... | ETahi.QuestionComponent = Ember.Component.extend
tagName: 'div'
helpText: null
displayContent: false
model: (->
ident = @get('ident')
throw "you must specify an ident" unless ident
question = @get('task.questions').findProperty('ident', ident)
unless question
task = @get('task')
q... |
Handle callbacks as well as promises | fs = require "fs"
path = require "path"
Coffee = require "coffee-script"
Q = require "q"
Jsdom = require "jsdom"
MARKBACK_FILE = path.join(__dirname, '../build/markback.js')
readMarkback = Q.nfcall(fs.readFile, MARKBACK_FILE).then (file) ->
Q.fcall -> file.toString('utf-8')
convertHtml = (html) ->
readMarkback.t... | fs = require "fs"
path = require "path"
Coffee = require "coffee-script"
Q = require "q"
Jsdom = require "jsdom"
MARKBACK_FILE = path.join(__dirname, '../build/markback.js')
readMarkback = Q.nfcall(fs.readFile, MARKBACK_FILE).then (file) ->
Q.fcall -> file.toString('utf-8')
convertHtml = (html, callback = ->) ->
... |
Switch default browser to Chrome until Phantom 2.0 | _ = require('lodash')
browsers = require('../browsers')
remoteReporters = ['dots']
remoteReporters.push('saucelabs') if process.env.TRAVIS_BRANCH == 'master'
remoteKarma = _.reduce(browsers, (memo, config, browser) ->
memo[browser] =
browsers: [browser]
browserDisconnectTimeout: 10000
browserDisconnect... | _ = require('lodash')
browsers = require('../browsers')
remoteReporters = ['dots']
remoteReporters.push('saucelabs') if process.env.TRAVIS_BRANCH == 'master'
remoteKarma = _.reduce(browsers, (memo, config, browser) ->
memo[browser] =
browsers: [browser]
browserDisconnectTimeout: 10000
browserDisconnect... |
Update brunch to also include normalize.css in build | # noop.pw
moment = require 'moment'
{renderVita} = require './demi'
global.vita = renderVita './riptide/vita.yaml'
global._now = moment()
global.DEBUG = '-p' not in global.process.argv
module.exports = config:
paths:
watched: ['riptide']
plugins:
autoReload:
enabled: yes
coffeelint:
patter... | # noop.pw
moment = require 'moment'
{renderVita} = require './demi'
global.vita = renderVita './riptide/vita.yaml'
global._now = moment()
global.DEBUG = '-p' not in global.process.argv
module.exports = config:
paths:
watched: ['riptide']
plugins:
autoReload:
enabled: yes
coffeelint:
patter... |
Implement meta-G (redo search in reverse) | window.keymap.bindKeys '*'
'meta-:': 'command-panel:toggle'
window.keymap.bindKeys '.command-panel .editor',
escape: 'command-panel:toggle'
enter: 'command-panel:execute'
window.keymap.bindKeys '.editor',
'meta-g': 'command-panel:repeat-relative-address'
'meta-e': 'command-panel:set-selection-as-regex-addre... | window.keymap.bindKeys '*'
'meta-:': 'command-panel:toggle'
window.keymap.bindKeys '.command-panel .editor',
escape: 'command-panel:toggle'
enter: 'command-panel:execute'
window.keymap.bindKeys '.editor',
'meta-g': 'command-panel:repeat-relative-address'
'meta-G': 'command-panel:repeat-relative-address-in-r... |
Add benchmark for inserting at the end of a file | Buffer = require 'buffer'
fs = require 'fs'
require 'benchmark-helper'
describe "Editor", ->
editor = null
beforeEach ->
window.rootViewParentSelector = '#jasmine-content'
window.startup()
editor = rootView.editor
afterEach ->
window.shutdown()
benchmark "inserting and deleting a character i... | Buffer = require 'buffer'
fs = require 'fs'
require 'benchmark-helper'
describe "Editor", ->
editor = null
beforeEach ->
window.rootViewParentSelector = '#jasmine-content'
window.startup()
editor = rootView.editor
afterEach ->
window.shutdown()
benchmark "inserting and deleting a character i... |
Update score and deactivate rating properly. | $('.rating').raty
path: '/assets'
score: ->
$(this).attr('data-score')
click: (score, _) ->
$.ajax
type: 'post',
url: $(this).attr('data-uri'),
data:
picture:
score: score
$(this).find('img').unbind('click')
| $('.rating').raty
path: '/assets'
score: ->
$(this).attr('data-score')
click: (score, _) ->
self = $(this)
url = self.attr('data-uri')
self.find('img').unbind('click')
$.ajax
type: 'post'
url: url
data:
picture:
score: score
success: ->
$.aj... |
Load snippets for cocoatouch after loading | _ = require 'underscore-plus'
RubyMotionAutocompleteView = require './rubymotion-autocomplete-view'
module.exports =
autocompleteViews: []
editorSubscription: null
snippetPrefixes: []
activate: (state) ->
@editorSubscription = atom.workspaceView.eachEditorView (editor) =>
if editor.attached and not ... | _ = require 'underscore-plus'
RubyMotionAutocompleteView = require './rubymotion-autocomplete-view'
Snippet = require(atom.packages.resolvePackagePath('snippets') + '/lib/snippet')
Snippets = require(atom.packages.resolvePackagePath('snippets') + '/lib/snippets')
module.exports =
autocompleteViews: []
editorSubscr... |
Fix selector in tabs spec | describe "tabs", ->
beforeEach ->
# run all Blacklight.onload functions
Blacklight.activate()
describe "dashboard tabs", ->
beforeEach ->
# setup the tabs like the homepage featured and recent tabs
setFixtures '<ul id="homeTabs" class="nav nav-tabs">
<li><a hr... | describe "tabs", ->
beforeEach ->
# run all Blacklight.onload functions
Blacklight.activate()
describe "dashboard tabs", ->
beforeEach ->
# setup the tabs like the homepage featured and recent tabs
setFixtures '<ul id="homeTabs" class="nav nav-tabs">
<li><a hr... |
Make commit calendar size depend on window size | class @Calendar
options =
month: "short"
day: "numeric"
year: "numeric"
constructor: (timestamps, starting_year, starting_month, calendar_activities_path) ->
cal = new CalHeatMap()
cal.init
itemName: ["contribution"]
data: timestamps
start: new Date(starting_year, starting_mon... | class @Calendar
options =
month: "short"
day: "numeric"
year: "numeric"
constructor: (timestamps, starting_year, starting_month, calendar_activities_path) ->
cal = new CalHeatMap()
cal.init
itemName: ["contribution"]
data: timestamps
start: new Date(starting_year, starting_mon... |
Convert to using newer property initializers in the JS for Jitter | _ = require "underscore"
Transform = require "./transform"
class Jitter extends Transform.Model
initialize: (attrs, options) ->
super(attrs, options)
defaults: ->
return _.extend({}, super(), {
interval: 1
})
compute: (x) ->
# Apply the transform to a single value
return(x + ((Math.ra... | _ = require "underscore"
Transform = require "./transform"
class Jitter extends Transform.Model
initialize: (attrs, options) ->
super(attrs, options)
defaults: ->
return _.extend {}, super(), {
interval: [ p.Number, 1]
}
compute: (x) ->
# Apply the transform to a single value
return(x... |
Create JSON of creator in Comment templateHelper | class window.Comment extends Backbone.Model
templateHelpers: =>
creator: @creator
creator: -> new User(@get('created_by'))
can_destroy: -> @creator().get('id') == currentUser.get('id')
| class window.Comment extends Backbone.Model
templateHelpers: =>
creator: @creator
creator: -> new User(@get('created_by')).toJSON()
can_destroy: -> @creator().get('id') == currentUser.get('id')
|
Use ArrayPort to allow keying for 'in' and 'ready' | noflo = require "noflo"
_s = require "underscore.string"
{ CacheStorage } = require "../lib/cache_storage"
class Cache extends noflo.Component
description: _s.clean "save incoming IPs and send the saved IPs to
port 'out' upon any data IP from 'ready'"
constructor: ->
@key = null
@cache = new CacheStora... | noflo = require "noflo"
_s = require "underscore.string"
{ CacheStorage } = require "../lib/cache_storage"
class Cache extends noflo.Component
description: _s.clean "save incoming IPs and send the saved IPs to
port 'out' upon any data IP from 'ready'"
constructor: ->
@key = null
@cache = new CacheStora... |
Fix merging of participation and page views | define [
'analytics/compiled/BaseData'
'timezone'
], (BaseData, tz) ->
##
# Loads the participation data for the student and course. Exposes the data
# as the 'pageViews' and 'participations' properties once loaded.
class ParticipationData extends BaseData
constructor: (student) ->
course = stude... | define [
'analytics/compiled/BaseData'
'timezone'
], (BaseData, tz) ->
##
# Loads the participation data for the student and course. Exposes the data
# as the 'pageViews' and 'participations' properties once loaded.
class ParticipationData extends BaseData
constructor: (student) ->
course = stude... |
Use subscribe instead of on | {View} = require 'space-pen'
$ = require 'jquery'
Git = require 'git'
fs = require 'fs'
module.exports =
class FileView extends View
@content: ({file} = {}) ->
@li class: 'file entry', =>
@span file.getBaseName(), class: 'name', outlet: 'fileName'
@span '', class: 'highlight'
file: null
initia... | {View} = require 'space-pen'
$ = require 'jquery'
Git = require 'git'
fs = require 'fs'
module.exports =
class FileView extends View
@content: ({file} = {}) ->
@li class: 'file entry', =>
@span file.getBaseName(), class: 'name', outlet: 'fileName'
@span '', class: 'highlight'
file: null
initia... |
Add references to internal modules as member variables of class EyeTribe | class EyeTribe
@Tracker = require('./tracker')
@version = require('./version')
@loop = (config, callback)->
if typeof config == 'function'
[callback, config] = [config, {}]
@loopTracker = new @Tracker config
.loop callback
module.exports = EyeTribe
| class EyeTribe
@Tracker = require('./tracker')
@version = require('./version')
@Protocol = require('./protocol')
@GazeData = require('./gazedata')
@Point2D = require('./point2d')
@_ = require('underscore')
@loop = (config, callback)->
if typeof config == 'function'
[callback, config] = [config,... |
Fix flatten function (bug introduce by coffee migration) |
module.exports.pad = (n, size) ->
n = n.toString()
pad = ''
size = size - n.length
for i in [0 .. size]
pad += ' '
n + pad
module.exports.flatten = (arr, ret) ->
ret ?= []
len = arr.length
for i in [0 .. len]
if Array.isArray arr[i]
exports.flatten arr[i], ret
else
... |
path = require 'path'
module.exports =
pad: (n, size) ->
n = n.toString()
pad = ''
size = size - n.length
for i in [0 .. size]
pad += ' '
n + pad
flatten: (arr, ret) ->
ret ?= []
for i in [0 ... arr.length]
if Array.isArray arr[i]... |
Deal with YAML parse errors | noflo = require 'noflo'
fbpSpec = require 'fbp-spec'
exports.getComponent = ->
c = new noflo.Component
c.inPorts.add 'in',
datatype: 'object'
description: 'Project'
c.inPorts.add 'runtime',
datatype: 'object'
required: yes
c.outPorts.add 'context',
datatype: 'object'
c.outPorts.add 'error... | noflo = require 'noflo'
fbpSpec = require 'fbp-spec'
exports.getComponent = ->
c = new noflo.Component
c.inPorts.add 'in',
datatype: 'object'
description: 'Project'
c.inPorts.add 'runtime',
datatype: 'object'
required: yes
c.outPorts.add 'context',
datatype: 'object'
c.outPorts.add 'error... |
Switch to Spree.ajax & success / error callbacks | $(document).ready ->
return unless $('#sc_memo_edit_form').length > 0
$('.js-edit-memo').on('click', (ev) =>
ev.preventDefault()
originalValue = $('#memo-edit-row').data('original-value')
$('#sc_memo_edit_form').find("[name='store_credit[memo]']").val(originalValue)
$('#memo-display-row').addClass(... | $(document).ready ->
return unless $('#sc_memo_edit_form').length > 0
$('.js-edit-memo').on('click', (ev) =>
ev.preventDefault()
originalValue = $('#memo-edit-row').data('original-value')
$('#sc_memo_edit_form').find("[name='store_credit[memo]']").val(originalValue)
$('#memo-display-row').addClass(... |
Fix home page when not logged in | TentStatus.Routers.posts = new class PostsRouter extends TentStatus.Router
routerKey: 'posts'
routes:
"" : "root"
"profile" : "myProfile"
"posts" : "index"
"posts/:entity/:post_id" : "conversation"
"posts/:post_id" : "conversation"
index: =>
unless Ten... | TentStatus.Routers.posts = new class PostsRouter extends TentStatus.Router
routerKey: 'posts'
routes:
"" : "root"
"profile" : "myProfile"
"posts" : "index"
"posts/:entity/:post_id" : "conversation"
"posts/:post_id" : "conversation"
index: =>
if !TentSt... |
Update packages for new naming scheme | {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.openSync('sample.js')
atom.a... | {RootView} = require 'atom'
shell = require 'shell'
describe "link package", ->
[editor] = []
beforeEach ->
atom.activatePackage('language-javascript', sync: true)
atom.activatePackage('language-hyperlink', sync: true)
window.rootView = new RootView
rootView.openSync('sample.js')
atom.activate... |
Remove bullets when collide with env. | game.ToastEntity = me.ObjectEntity.extend(
init: (x, y, settings) ->
settings.image = 'toast'
settings.spritewidth = '12'
settings.spriteheight = '12'
@parent x, y, settings
@maxVelocity = 5
@gravity = 0
targetVector = new me.Vector2d(settings.target.x - x, settings.target.y - y)
... | game.ToastEntity = me.ObjectEntity.extend(
init: (x, y, settings) ->
settings.image = 'toast'
settings.spritewidth = '12'
settings.spriteheight = '12'
@parent x, y, settings
@maxVelocity = 5
@gravity = 0
targetVector = new me.Vector2d(settings.target.x - x, settings.target.y - y)
... |
Make sure each pair of radio buttons gets a unique name attribute in the toggle switch directive. | define [
"base"
], (App) ->
App.directive "toggleSwitch", () ->
restrict: "E"
scope:
description: "@"
labelFalse: "@"
labelTrue: "@"
ngModel: "="
template: """
<fieldset class="toggle-switch">
<legend class="sr-only">{{description}}</legend>
<input
type="radio"
... | define [
"base"
], (App) ->
App.directive "toggleSwitch", () ->
restrict: "E"
scope:
description: "@"
labelFalse: "@"
labelTrue: "@"
ngModel: "="
template: """
<fieldset class="toggle-switch">
<legend class="sr-only">{{description}}</legend>
<input
type="radio"
... |
Make each username in InlineUsers link to the userpage | React = require 'react'
EnrollButton = require '../students/enroll_button'
InlineUsers = React.createClass(
displayName: 'InlineUsers'
render: ->
key = @props.title + '_' + @props.role
user_list = @props.users.map (user) ->
if user.real_name?
"#{user.real_name} (#{user.wiki_i... | React = require 'react'
EnrollButton = require '../students/enroll_button'
InlineUsers = React.createClass(
displayName: 'InlineUsers'
render: ->
key = @props.title + '_' + @props.role
user_list = @props.users.map (user) ->
link = "https://en.wikipedia.org/wiki/User:#{user.wiki_id}"
... |
Add tests for new get/format data methods | assert = require('chai').assert
_ = require('underscore')
sinon = require('sinon')
Indicator = require('../../models/indicator')
fs = require 'fs'
suite('Indicator')
test(".find reads the definition from definitions/indicators.json
and returns an indicator with the correct attributes for that ID", (done)->
definiti... | assert = require('chai').assert
_ = require('underscore')
sinon = require('sinon')
Indicator = require('../../models/indicator')
fs = require 'fs'
suite('Indicator')
test(".find reads the definition from definitions/indicators.json
and returns an indicator with the correct attributes for that ID", (done)->
definiti... |
Fix id generation within the resource combiner | resourceRequest = require './resource-request.coffee'
virtual = require './virtual-resource.coffee'
resources = {}
# TODO : Implement cache invalidation on a periodic basis here
exports.combine = ({resources, req, separator, contentType, prefix}) ->
id = resources.length + (resources.href for resource in resources)... | resourceRequest = require './resource-request.coffee'
virtual = require './virtual-resource.coffee'
resources = {}
# TODO : Implement cache invalidation on a periodic basis here
exports.combine = ({resources, req, separator, contentType, prefix}) ->
id = resources.length + (resource.href for resource in resources).... |
Update product ownership to refer to Product Manager | # This script teaches Hubot to answer questions like "Who owns Collections Publisher?"
# and "Who owns publishing-api?"
module.exports = (robot) ->
robot.hear /who owns (.*)\?/i, (res) ->
# Best guess of the intended application.
application = res.match[1].replace(/\s/g, '-').toLowerCase()
console.log("Fe... | # This script teaches Hubot to answer questions like "Who owns Collections Publisher?"
# and "Who owns publishing-api?"
module.exports = (robot) ->
robot.hear /who owns (.*)\?/i, (res) ->
# Best guess of the intended application.
application = res.match[1].replace(/\s/g, '-').toLowerCase()
console.log("Fe... |
Make syntax more coffee like. | exports.app = app = require('../config/app').app
exports.vows = require 'vows'
exports.assert = require 'assert'
exports.should = require 'should'
exports.zombie = require 'zombie'
exports.zombie.browser = new exports.zombie.Browser
debug: false
runScripts: false
exports.tobi = r... | exports.app = app = require('../config/app').app
exports.vows = require 'vows'
exports.assert = require 'assert'
exports.should = require 'should'
exports.zombie = require 'zombie'
exports.zombie.browser = new exports.zombie.Browser
debug: false
runScripts: false
exports.tobi = r... |
Use atom.rootView as target value | KeybindingResolverView = require '../lib/keybinding-resolver-view'
{$, RootView} = require 'atom'
describe "KeybindingResolverView", ->
beforeEach ->
atom.rootView = new RootView
atom.packages.activatePackage('keybinding-resolver', immediate: true)
describe "when the keybinding-resolver:toggle event is tr... | KeybindingResolverView = require '../lib/keybinding-resolver-view'
{$, RootView} = require 'atom'
describe "KeybindingResolverView", ->
beforeEach ->
atom.rootView = new RootView
atom.packages.activatePackage('keybinding-resolver', immediate: true)
describe "when the keybinding-resolver:toggle event is tr... |
Remove unused methods from PaneAxis | {View} = require './space-pen-extensions'
Pane = null
### Internal ###
module.exports =
class PaneAxis extends View
initialize: (@model) ->
@onChildAdded(child) for child in @model.children
@subscribe @model.children, 'changed', @onChildrenChanged
viewForModel: (model) ->
viewClass = model.getViewClas... | {View} = require './space-pen-extensions'
Pane = null
### Internal ###
module.exports =
class PaneAxis extends View
initialize: (@model) ->
@onChildAdded(child) for child in @model.children
@subscribe @model.children, 'changed', @onChildrenChanged
viewForModel: (model) ->
viewClass = model.getViewClas... |
Fix a typo the file description | # The global namespace, the `Batman` function will also create also create a new
# instance of Batman.Object and mixin all arguments to it.
Batman = (mixins...) ->
new Batman.Object(mixins...)
Batman.version = '0.14.1'
Batman.config =
pathToApp: '/'
usePushState: true
pathToHTML: 'html'
fetchRemoteHTML: tr... | # The global namespace, the `Batman` function will also create a new
# instance of Batman.Object and mixin all arguments to it.
Batman = (mixins...) ->
new Batman.Object(mixins...)
Batman.version = '0.14.1'
Batman.config =
pathToApp: '/'
usePushState: true
pathToHTML: 'html'
fetchRemoteHTML: true
cacheVi... |
Remove the report ID from the Reports page | React = require 'react'
module.exports = React.createClass
displayName: 'ChooseSubjectSet'
getInitialState: ->
subject_sets: []
componentWillMount: ->
@props.workflow?.get 'subject_sets', page_size: 40
.then (subject_sets) =>
subject_sets.sort (a, b) ->
return 1 if a.metad... | React = require 'react'
module.exports = React.createClass
displayName: 'ChooseSubjectSet'
getInitialState: ->
subject_sets: []
componentWillMount: ->
@props.workflow?.get 'subject_sets', page_size: 40
.then (subject_sets) =>
subject_sets.sort (a, b) ->
return 1 if a.metad... |
Set owner=only on form 4 requests | {DOMParser} = require 'xmldom'
xpath = require 'xpath'
request = require 'request'
module.exports =
getTransactions: (cik, type, callback) ->
baseUrl = process.env.SEC_EDGAR_URL ? 'http://www.sec.gov/cgi-bin/browse-edgar'
url = "#{baseUrl}?action=getcompany&output=atom&start=0&count=1000&CIK=#{cik}&type=#{ty... | {DOMParser} = require 'xmldom'
xpath = require 'xpath'
request = require 'request'
module.exports =
getTransactions: (cik, type, callback) ->
baseUrl = process.env.SEC_EDGAR_URL ? 'http://www.sec.gov/cgi-bin/browse-edgar'
url = "#{baseUrl}?action=getcompany&output=atom&start=0&count=1000&CIK=#{cik}&type=#{ty... |
Add ability to set output display options. | noflo = require "noflo"
class Output extends noflo.Component
description: "This component receives input on a single inport, and sends the data items directly to console.log"
constructor: ->
@inPorts =
in: new noflo.ArrayPort()
@outPorts = {}
@inPorts.in.on "data", (data... | noflo = require "noflo"
util = require "util"
class Output extends noflo.Component
description: "This component receives input on a single inport, and sends the data items directly to console.log"
constructor: ->
@options =
showHidden: false
depth: 2
colors: false
... |
Rework the context menu entries. | # See https://atom.io/docs/latest/creating-a-package#menus for more details
'context-menu':
'.conflicted':
'Resolve: Current': 'merge-conflicts:accept-current'
'Resolve: Ours': 'merge-conflicts:accept-ours'
'Resolve: Theirs': 'merge-conflicts:accept-theirs'
'Resolve: Ours Then Theirs': 'merge-conflict... | # See https://atom.io/docs/latest/creating-a-package#menus for more details
'context-menu':
'atom-text-editor': [{
label: 'Resolve Conflict',
submenu: [
{ label: 'Current', command: 'merge-conflicts:accept-current' }
{ label: 'Ours', command: 'merge-conflicts:accept-ours' }
{ label: 'Theirs'... |
Add filter widget to frames list. PP-8 | Steam.FrameListView = (_) ->
_items = do nodes$
activate = (item) ->
for other in _items()
if other is item
other.isActive yes
else
other.isActive no
_.displayFrame item.data
return
createItem = (frame) ->
#TODO replace with type checking
console.assert isArray ... | Steam.FrameListView = (_) ->
_predicate = node$ type: 'all'
_items = do nodes$
_hasItems = lift$ _items, (items) -> items.length > 0
_canClearPredicate = lift$ _predicate, (predicate) -> predicate.type isnt 'all'
_predicateCaption = lift$ _predicate, (predicate) ->
switch predicate.type
when 'all'
... |
Use SPA_MONGO_URL env. variable for remote mongodb. | if Meteor.isServer
CuratorSources = require './curatorSources.coffee'
PromedPosts = null
try
# spaDb = new MongoInternals.RemoteCollectionDriver(process.env.SPA_MONGO_URL)
# PromedPosts = new Meteor.Collection("posts", { _driver: spaDb })
PromedPosts = new Meteor.Collection("posts")
catch e
con... | if Meteor.isServer
CuratorSources = require './curatorSources.coffee'
PromedPosts = null
try
spaDb = new MongoInternals.RemoteCollectionDriver(process.env.SPA_MONGO_URL)
PromedPosts = new Meteor.Collection("posts", { _driver: spaDb })
catch e
console.warn 'Unable to connect to remote SPA mongodb.'
... |
Revert changes made in sticky_footer as it's not working | position_footer = ->
mFoo = $('#footer')
if $(document.body).height() + mFoo.outerHeight() < $(window).height() and mFoo.css('position') == 'fixed' or $(document.body).height() < $(window).height() and mFoo.css('position') != 'fixed'
mFoo.css
position: 'fixed'
bottom: '0'
else
mFoo.css positio... | position_footer = ->
mFoo = $('#footer')
if $(document.body).height() + mFoo.outerHeight() < $(window).height() and mFoo.css('position') == 'fixed' or $(document.body).height() < $(window).height() and mFoo.css('position') != 'fixed'
mFoo.css
position: 'fixed'
bottom: '0'
else
mFoo.css positio... |
Handle function keys when clicking on a factrelation | class window.FactBottomView extends Backbone.Marionette.ItemView
className: 'fact-bottom'
template: 'facts/fact_bottom'
events:
"click .js-add-to-channel": "showAddToChannel"
"click .js-start-conversation": "showStartConversation"
"click .js-open-proxy-link" : "openProxyLink"
"click .js-argument... | class window.FactBottomView extends Backbone.Marionette.ItemView
className: 'fact-bottom'
template: 'facts/fact_bottom'
events:
"click .js-add-to-channel": "showAddToChannel"
"click .js-start-conversation": "showStartConversation"
"click .js-open-proxy-link" : "openProxyLink"
"click .js-argument... |
Fix ad hoc template name | ETahi.NewAdHocTaskOverlayView = ETahi.OverlayView.extend
templateName: 'overlays/new_adhoc_task_overlay'
layoutName: 'layouts/new_task_overlay_layout'
| ETahi.NewAdHocTaskOverlayView = ETahi.OverlayView.extend
templateName: 'overlays/new_ad_hoc_task_overlay'
layoutName: 'layouts/new_task_overlay_layout'
|
Fix store reference and log which store is using | if Meteor.isServer
storeType = 'GridFS'
if Meteor.settings?.public?.avatarStore?.type?
storeType = Meteor.settings.public.avatarStore.type
RocketStore = RocketFile[storeType]
if not RocketStore?
throw new Error "Invalid RocketStore type [#{storeType}]"
transformWrite = undefined
if Meteor.settings?.public... | if Meteor.isServer
storeType = 'GridFS'
if Meteor.settings?.public?.avatarStore?.type?
storeType = Meteor.settings.public.avatarStore.type
RocketStore = RocketFile[storeType]
if not RocketStore?
throw new Error "Invalid RocketStore type [#{storeType}]"
console.log "Using #{storeType} for Avatar storage".gr... |
Use OptimistParser to determine the command | OptimistParser = require './optimist_parser'
commands =
run: "Runs all tests found in /test"
watch: "Runs all tests in /test and watches for changes"
help: "Shows this help page"
usage_text = """
Usage: mycha <command> [options]
where <command> is one of:
#{(" ... | OptimistParser = require './optimist_parser'
commands =
run: "Runs all tests found in /test"
watch: "Runs all tests in /test and watches for changes"
help: "Shows this help page"
usage_text = """
Usage: mycha <command> [options]
where <command> is one of:
#{(" ... |
Revert "terminal: fetch account's group associated VMs in "VM selection" modal" | # FIXME - Move this in a seperate file ~ GG
class VmListItem extends KDListItemView
click: ->
@getDelegate().emit 'VMSelected', @getData()
viewAppended: ->
JView::viewAppended.call this
pistachio: ->
"""
<div class="vm-info">
<cite></cite>
#{@getData()}
</div>
"""
... | # FIXME - Move this in a seperate file ~ GG
class VmListItem extends KDListItemView
click: ->
@getDelegate().emit 'VMSelected', @getData()
viewAppended: ->
JView::viewAppended.call this
pistachio: ->
"""
<div class="vm-info">
<cite></cite>
#{@getData()}
</div>
"""
... |
Make error use the standard addError function. | 'use strict'
app.factory('uploadService', [
'routerService',
(router) ->
removedAsset: undefined
# callbacks for ng-flow:
fileSuccess: (file) ->
file.store.progress = 1
file.store.save()
return
fileError: (file, message, flow) ->
file.abort()
alert("There was an err... | 'use strict'
app.factory('uploadService', [
'routerService', 'messageService'
(router, messages) ->
removedAsset: undefined
# callbacks for ng-flow:
fileSuccess: (file) ->
file.store.progress = 1
file.store.save()
return
fileError: (file, message, flow) ->
file.abort()
... |
Use property vs state to determine toggled status | React = require 'react'
BS = require 'react-bootstrap'
TeacherContentToggle = React.createClass
getInitialState: ->
isShowing: false
propTypes:
onChange: React.PropTypes.func.isRequired
onClick: ->
isShowing = not @state.isShowing
@setState({isShowing})
@props.onChange(isShowing)
render... | React = require 'react'
BS = require 'react-bootstrap'
TeacherContentToggle = React.createClass
propTypes:
onChange: React.PropTypes.func.isRequired
isShowing: React.PropTypes.bool.isRequired
onClick: ->
@props.onChange(not @props.isShowing)
render: ->
teacherLinkText = if @props.isShowing
... |
Check that index page is legitimate | d = ->
console.log arguments...
base = global.wolisconfig.test_url
casper.start base, ->
this.test.assertHttpStatus 200
casper.run ->
@test.done()
| d = ->
console.log arguments...
base = global.wolisconfig.test_url
casper.start base, ->
@test.assertHttpStatus 200
# check that the index page has expected text
@test.assertTextExists 'Your first forum'
casper.run ->
@test.done()
|
Sort out ES6 import confusion; add POST to /api/me to record user visit | `import BaseRoute from './_base'`
Route = BaseRoute.extend
model: ->
# return the current user as the model if authenticated, otherwise a blank object
new Ember.RSVP.Promise (resolve, reject) =>
promise = $.ajax
url: '/api/me'
dataType: 'json'
promise.done (result) =>
user... | `import BaseRoute from './_base'`
`import ajax from 'ic-ajax'`
Route = BaseRoute.extend
model: ->
mePath = '/api/me'
# return the current user as the model if authenticated, otherwise a blank object
new Ember.RSVP.Promise (resolve, reject) =>
ajax
url: mePath
dataType: 'json'
... |
Fix xmlDate and add baseURL | path = require 'path'
ROOT = process.env.APP_ROOT
express = require 'express'
handlebars = require 'express-handlebars'
bodyParser = require 'body-parser'
morgan = require 'morgan'
favicon = require 'serve-favicon'
mincer = require 'mincer'
## Set up the app
module.exports = app = express()
# Logging
app.use morgan... | path = require 'path'
ROOT = process.env.APP_ROOT
express = require 'express'
handlebars = require 'express-handlebars'
bodyParser = require 'body-parser'
morgan = require 'morgan'
favicon = require 'serve-favicon'
mincer = require 'mincer'
## Set up the app
module.exports = app = express()
# Logging
app.use morgan... |
Check whether there are currently any scrollbars | scrollbarWidth = 0
FactlinkJailRoot.loaded_promise.then ->
# Create the measurement nod; see http://davidwalsh.name/detect-scrollbar-width
scrollDiv = document.createElement("div");
$(scrollDiv).css(
width: "100px"
height: "100px"
overflow: "scroll"
position: "absolute"
top: "-9999px"
)
do... | scrollbarWidth = 0
FactlinkJailRoot.loaded_promise.then ->
# Create the measurement nod; see http://davidwalsh.name/detect-scrollbar-width
scrollDiv = document.createElement("div");
$(scrollDiv).css(
width: "100px"
height: "100px"
overflow: "scroll"
position: "absolute"
top: "-9999px"
)
do... |
Update the test descriptions to match the tests | Transport = require "../src/redis-transport"
RemoteChannel = require "../src/remote-channel"
helpers = require "./helpers"
{testify,assert,events} = helpers
make = ->
transport = new Transport
host: "localhost"
port: 6379
transport.events.forward events
channel = new RemoteChannel
name: "greetin... | Transport = require "../src/redis-transport"
RemoteChannel = require "../src/remote-channel"
helpers = require "./helpers"
{testify,assert,events} = helpers
make = ->
transport = new Transport
host: "localhost"
port: 6379
transport.events.forward events
channel = new RemoteChannel
name: "greetin... |
Create keymaps for other platforms. | # 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... |
Set default zoom level to 16 | # This file uses the Garber-Irish method for allowing "per-page Javascript."
# I'm using the `gistyle` gem to handle the actual implementation of the pattern.
APP.init = ->
console.log "application"
APP.bikeway_segments =
init: ->
$ ->
console.log "bikeway_segments (controller)"
index: ->
$ ->
... | # This file uses the Garber-Irish method for allowing "per-page Javascript."
# I'm using the `gistyle` gem to handle the actual implementation of the pattern.
APP.init = ->
console.log "application"
APP.bikeway_segments =
init: ->
$ ->
console.log "bikeway_segments (controller)"
index: ->
$ ->
... |
Add remove-brackets command to menu | 'menu': [
{
'label': 'Packages'
'submenu': [
'label': 'Bracket Matcher'
'submenu': [
{ 'label': 'Go To Matching Bracket', 'command': 'bracket-matcher:go-to-matching-bracket' }
{ 'label': 'Select Inside Brackets', 'command': 'bracket-matcher:select-inside-brackets' }
]
]
... | 'menu': [
{
'label': 'Packages'
'submenu': [
'label': 'Bracket Matcher'
'submenu': [
{ 'label': 'Go To Matching Bracket', 'command': 'bracket-matcher:go-to-matching-bracket' }
{ 'label': 'Select Inside Brackets', 'command': 'bracket-matcher:select-inside-brackets' }
{ 'labe... |
Update Google client secret to fix login - all values set for meta.socrench.us | Meteor.accounts.google.setSecret "LeeZILT05svXh5PvNi7PrkrJ"
Meteor.accounts.facebook.setSecret "b367d5310e20d877be768f000d61d7b9"
| Meteor.accounts.google.setSecret "E3qfhdn-_0oyetC1TGRV4DSv"
Meteor.accounts.facebook.setSecret "e12a0e452638d3d64bd251c64152e1b0" |
Remove registerView from Panel Model | class Panel
constructor: (@Linter)->
@Decorations = []
@Type = 'file'
registerView: (View)->
@View = View
@View.Model = this
removeDecorations: ->
@Decorations.forEach (decoration) ->
try decoration.destroy()
@Decorations = []
render: (Messages)->
@removeDecorations()
Messa... | class Panel
constructor: (@Linter)->
@Decorations = []
@Type = 'file'
removeDecorations: ->
return unless @Decorations.length
@Decorations.forEach (decoration) ->
try decoration.destroy()
@Decorations = []
render: (Messages)->
@removeDecorations()
Messages.forEach (Message) =>
... |
Fix spelling error & remove link function in address-selection | Sprangular.directive 'addressSelection', ->
restrict: 'E'
templateUrl: 'addresses/selection.html'
scope:
address: '='
addresses: '='
countries: '='
disabled: '=disabledFields'
submitted: '='
existingAddress: '='
controller: ($scope) ->
$scope.$watch 'addresses', (addresses) ->
... | Sprangular.directive 'addressSelection', ->
restrict: 'E'
templateUrl: 'addresses/selection.html'
scope:
address: '='
addresses: '='
countries: '='
disabled: '=disabledFields'
submitted: '='
existingAddress: '='
controller: ($scope) ->
$scope.$watch 'addresses', (addresses) ->
... |
Fix CSS class for N/As on Accounts Page | @CodequestManager.module 'Dashboard', (Dashboard, App, Backbone, Marionette, $, _) ->
Dashboard.Account = Marionette.ItemView.extend
template: 'dashboard/account'
className: ->
"user-box #{@amountClass()}"
templateHelpers: ->
formattedNumber: @formattedNumber()
formattedBalance: @format... | @CodequestManager.module 'Dashboard', (Dashboard, App, Backbone, Marionette, $, _) ->
Dashboard.Account = Marionette.ItemView.extend
template: 'dashboard/account'
className: ->
"user-box #{@amountClass()}"
templateHelpers: ->
formattedNumber: @formattedNumber()
formattedBalance: @format... |
Make sure `/repo/poll` endpoint sends a response | # Trigger implementation for being told when to poll
Bacon = require 'baconjs'
router = require '../../../router'
module.exports = (config) ->
bus = new Bacon.Bus
url = if config.url? then "/repo/poll/#{url}" else '/repo/poll'
router.api.post url, (req, res) -> bus.push reason: "request from #{req.ip}"
bus.toEv... | # Trigger implementation for being told when to poll
Bacon = require 'baconjs'
router = require '../../../router'
module.exports = (config) ->
bus = new Bacon.Bus
url = if config.url? then "/repo/poll/#{url}" else '/repo/poll'
router.api.post url, (req, res) ->
bus.push reason: "request from #{req.ip}"
res.se... |
Initialize the model with the default code in the source editor | # Eventful code comes here
# Program state should not be manipulated outside events files
# Initialize the canvas element (size, aspect ratio etc)
canvasInit = () ->
windowResize()
# Initialize nodes in the scene graph
sceneInit = () ->
shaderDef =
type: 'shader',
id: 'main-shader',
shaders: [
s... | # Eventful code comes here
# Program state should not be manipulated outside events files
# Initialize the canvas element (size, aspect ratio etc)
canvasInit = () ->
windowResize()
# Initialize nodes in the scene graph
sceneInit = () ->
compileCSM ($ '#source-code').val(),
(result) ->
shaderDef =
... |
Revert "Add jQuery notify back in" | # This is a manifest file that'll be compiled into application.js, which will include all the files
# listed below.
#
# Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
# or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
#
... | # This is a manifest file that'll be compiled into application.js, which will include all the files
# listed below.
#
# Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
# or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
#
... |
Remove use of colors for now |
fs = require 'fs-extra'
path = require 'path-extra'
stringify = (str) ->
return str if typeof str == 'string'
if str.toString() == '[object Object]'
str = JSON.stringify str
else
str = str.toString()
return str
module.exports =
remoteStringify: JSON.stringify
log: (str) ->
str = stringify str... |
fs = require 'fs-extra'
path = require 'path-extra'
stringify = (str) ->
return str if typeof str == 'string'
if str.toString() == '[object Object]'
str = JSON.stringify str
else
str = str.toString()
return str
module.exports =
remoteStringify: JSON.stringify
log: (str) ->
str = stringify str... |
Add command after first argument | module.exports =
class Task
aborted: false
constructor: (@path) ->
start: ->
throw new Error("Task already started") if @worker?
@worker = new Worker(require.getPath('task-shell'))
@worker.onmessage = ({data}) =>
if @aborted
@done()
return
if data.method and this[data.m... | module.exports =
class Task
aborted: false
constructor: (@path) ->
start: ->
throw new Error("Task already started") if @worker?
@worker = new Worker(require.getPath('task-shell'))
@worker.onmessage = ({data}) =>
if @aborted
@done()
return
if data.method and this[data.m... |
Remove div around toilet list | riot = require('riot')
React = require('react')
LocationInput = React.createClass
render: -> `(
<form>
<input type="text"></input>
<input type="submit"></input>
</form>
)`
ToiletItem = React.createClass
render: -> `(
<li><h3>{this.props.name}</h3>{this.props.address}</li>
)`
ToiletLis... | riot = require('riot')
React = require('react')
NCN = require('./ncn')
LocationInput = React.createClass
render: -> `(
<form>
<input type="text"></input>
<input type="submit"></input>
</form>
)`
ToiletItem = React.createClass
render: -> `(
<li><h3>{this.props.name}</h3>{this.props.addres... |
Make backup task exit when finishd | mongoose = require('mongoose')
mongoose.connect("mongodb://localhost/nrt_development")
IndicatorData = require('../../models/indicator_data').model
fs = require('fs')
console.log "Yo"
IndicatorData.dataToSeedJSON().then((json)->
fs.writeFile("./lib/indicator_data.json", json, (err) ->
if err
console.error ... | mongoose = require('mongoose')
mongoose.connect("mongodb://localhost/nrt_development")
IndicatorData = require('../../models/indicator_data').model
fs = require('fs')
console.log "Backing up Indicator Data"
IndicatorData.dataToSeedJSON().then((json)->
fs.writeFile("./lib/indicator_data.json", json, (err) ->
if e... |
Allow more complex contentType fields | module.exports =
processResponse: (res) ->
# Check to see if the contentype is "something/json" or
# "something/somethingelse+json"
if res.contentType and (/^.*\/(?:.*\+)?json$/i).test res.contentType
# If the body hasn't been parsed yet, parse it.
raw = if typeof res.body is 'string' then res... | module.exports =
processResponse: (res) ->
# Check to see if the contentype is "something/json" or
# "something/somethingelse+json"
if res.contentType and (/^.*\/(?:.*\+)?json(;|\z)/i).test res.contentType
# If the body hasn't been parsed yet, parse it.
raw = if typeof res.body is 'string' the... |
Check result of dependent service | should = require 'should'
{join} = require 'path'
# lib stuff
{load, process, applyPolicy, print, create, print} = require '../lib/main'
# sample stuff
jargon = require '../sample/app/domain/auth/jargon'
serviceLocation = join __dirname, '../sample/app/domain/auth/services'
policy = require '../sample/app/domain/auth... | should = require 'should'
{join} = require 'path'
# lib stuff
{load, process, applyPolicy, print, create, print} = require '../lib/main'
# sample stuff
jargon = require '../sample/app/domain/auth/jargon'
serviceLocation = join __dirname, '../sample/app/domain/auth/services'
policy = require '../sample/app/domain/auth... |
Add placeholder test for ng-class. | assert = require 'assert'
htmlParse = require '../lib/html-parse'
describe 'HTML Parser', ->
it 'Extracts HTML classes', ->
html = """
<!DOCTYPE html>
<html class="htmlclass">
<head>
</head>
<body class="bodyclass">
<div class="class1 cla... | assert = require 'assert'
htmlParse = require '../lib/html-parse'
describe 'HTML Parser', ->
it 'Extracts HTML classes', ->
html = """
<!DOCTYPE html>
<html class="htmlclass">
<head>
</head>
<body class="bodyclass">
<div class="class1 cla... |
Use the `USER` env var instead of `whoami` | module.exports = (Impromptu, register, system) ->
register 'pwd',
update: ->
process.env.PWD
register 'prettyPwd',
update: ->
cwd = process.env.PWD
if cwd.indexOf(process.env.HOME) == 0
cwd = '~' + cwd.slice process.env.HOME.length
cwd
register 'user',
update: (done) ... | module.exports = (Impromptu, register, system) ->
register 'pwd',
update: ->
process.env.PWD
register 'prettyPwd',
update: ->
cwd = process.env.PWD
if cwd.indexOf(process.env.HOME) == 0
cwd = '~' + cwd.slice process.env.HOME.length
cwd
register 'user',
update: ->
... |
Change org coffee to string interpolation | window.addAddressRow = (count) ->
newRow = $ """
<div class="form-group">
<label for="organization_addresses_attributes_""" + count + """_address">Mailing Address</label>
<div>
<input class="form-control" data-guard="different" type="text" value="" name="organization[addresses_attributes][""" + count... | window.addAddressRow = (count) ->
newRow = $ """
<div class="form-group">
<label for="organization_addresses_attributes_#{count}_address">Mailing Address</label>
<div>
<input class="form-control" data-guard="different" type="text" value="" name="organization[addresses_attributes][#{count}][address]" ... |
Add headers to settings app | @index = (req, res, next) ->
user = req.user
{ customer, policy } = user.related()
policy.authenticate(user.get('access_token'))
customer.authenticate(user.get('access_token'))
Promise.all [
user.fetch()
policy.fetch()
customer.fetch()
.catch -> #
]
.then ->
res.locals.sd.USER =... | @index = (req, res, next) ->
user = req.user
{ customer, policy } = user.related()
policy.authenticate(user.get('access_token'))
customer.authenticate(user.get('access_token'))
headers = {
'X-AUTH-TOKEN': user.get('access_token'),
}
Promise.all [
user.fetch({ headers })
policy.fetch()
... |
Fix transitions when editable isn’t actually changing | ETahi.RedirectsIfEditable = Em.Mixin.create
toggleEditable: ->
@get('controller').send('editableDidChange')
setupEditableToggle: (->
@addObserver('controller.model.editable', @, @toggleEditable)
).on('didInsertElement')
teardownEditableToggle: (->
@removeObserver('controller.model.editable', @, @t... | ETahi.RedirectsIfEditable = Em.Mixin.create
editable: Ember.computed.alias('controller.model.editable')
toggleEditable: ->
if @get('editable') != @get('lastEditable')
@set('lastEditable', @get('editable'))
@get('controller').send('editableDidChange')
setupEditableToggle: (->
@set('lastEditab... |
Convert http to Q instead of old promise library. | Promise = require 'promise'
Log = require 'log'
logger = new Log(process.env.HUBOT_LOG_LEVEL or 'info')
getHttpJson = (robot, url) ->
logger.debug "Loading", url
new Promise (resolve, reject) ->
robot.http(url)
.header('Accept', 'application/json')
.get() (err, res, body) ->
if err
... | Q = require 'q'
Log = require 'log'
logger = new Log(process.env.HUBOT_LOG_LEVEL or 'info')
getHttpJson = (robot, url) ->
logger.debug "Loading", url
new Q.Promise (resolve, reject) ->
robot.http(url)
.header('Accept', 'application/json')
.get() (err, res, body) ->
if err
... |
Destroy the demo view on core:cancel |
module.exports =
activate: (state) ->
atom.workspaceView.command 'table-edit:demo', ->
Table = require './table'
TableView = require './table-view'
table = new Table
table.addColumn 'key'
table.addColumn 'value'
table.addColumn 'foo'
for i in [0...100]
table.a... |
module.exports =
activate: (state) ->
atom.workspaceView.command 'table-edit:demo', ->
Table = require './table'
TableView = require './table-view'
table = new Table
table.addColumn 'key'
table.addColumn 'value'
table.addColumn 'foo'
for i in [0...100]
table.a... |
Support copy, cut, and plain text pastes | class Trix.Input
@events: "keydown keypress drop cut copy paste input".split(" ")
@keys:
0x08: "backspace"
0x0D: "return"
constructor: (@element, @responder) ->
for event in @constructor.events
@element.addEventListener(event, @[event], true)
keydown: (event) =>
if keyName = @constructor... | class Trix.Input
@events: "keydown keypress drop cut paste input".split(" ")
@keys:
0x08: "backspace"
0x0D: "return"
constructor: (@element, @responder) ->
for event in @constructor.events
@element.addEventListener(event, @[event], true)
keydown: (event) =>
if keyName = @constructor.keys... |
Add message when user created | angular.module 'keranbeandco.user'
.controller 'login', ($scope, $state, ImprovedUser) ->
$scope.login = ->
ImprovedUser.login
email: $scope.loginEmail
password: $scope.loginPassword
.$promise
.then () ->
$state.go 'home'
$scope.createUser = ->
ImprovedUser.create
firstName... | angular.module 'keranbeandco.user'
.controller 'login', ($scope, $state, ImprovedUser, $mdToast) ->
$scope.login = ->
ImprovedUser.login
email: $scope.loginEmail
password: $scope.loginPassword
.$promise
.then () ->
$state.go 'home'
$scope.createUser = ->
ImprovedUser.create
... |
Allow fragment to track to be specified | define (require) ->
Backbone = require('backbone')
settings = require('settings')
# Class to handle loading analytics scripts and wrapping
# handlers around them so that modules don't have to
# interact with global variables directly
return new class AnalyticsHandler
constructor: () ->
# Setup te... | define (require) ->
Backbone = require('backbone')
settings = require('settings')
# Class to handle loading analytics scripts and wrapping
# handlers around them so that modules don't have to
# interact with global variables directly
return new class AnalyticsHandler
constructor: () ->
# Setup te... |
Set up a `creditCards` relation on the User | _ = require 'underscore'
Backbone = require 'backbone'
{ API_URL } = require('sharify').data
module.exports =
related: ->
return @__related__ if @__related__?
CollectorProfile = require '../../collector_profile.coffee'
Location = require '../../location.coffee'
collectorProfile = new CollectorProfi... | _ = require 'underscore'
Backbone = require 'backbone'
{ API_URL } = require('sharify').data
module.exports =
related: ->
return @__related__ if @__related__?
CollectorProfile = require '../../collector_profile.coffee'
Location = require '../../location.coffee'
collectorProfile = new CollectorProfi... |
Remove clutter from bounties page | # 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/
$('body.bounties.index').ready ->
# Added a parser for the my-bounty input fields
$.fn.dataTable.ex... | # 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/
$('body.bounties.index').ready ->
# Added a parser for the my-bounty input fields
$.fn.dataTable.ex... |
Clean up JS for editable. | $ ->
$('span.editable').editable (value, settings) ->
$span = $(this)
url = $span.data('url')
data = {_method: 'PUT'}
data[$span.data('attribute')] = value
$.post(url, data)
value
, tooltip: 'Click to edit', indicator: 'Saving...', submitdata: {}
#$ ->
# $('body').on 'click', 'span.editab... | $ ->
$('span.editable').editable (value, settings) ->
$span = $(this)
data = {_method: 'PUT'}
data[$span.data('attribute')] = value
# TODO: We should handle failures and timeouts in POSTing, and make our own "Saving..." indicator.
$.post($span.data('url'), data)
value
, tooltip: 'Click to ed... |
Split language out of domain by - or . | i18n = require("i18next")
_ = require("underscore")
path = require("path")
module.exports =
setup: (options) ->
subdomainLang = options?.subdomainLang || {}
availableLngs = _.pluck(_.values(subdomainLang), "lngCode")
i18n.init
resGetPath: path.resolve(__dirname,"../../", "locales/__lng__.json")
saveMiss... | i18n = require("i18next")
_ = require("underscore")
path = require("path")
module.exports =
setup: (options) ->
subdomainLang = options?.subdomainLang || {}
availableLngs = _.pluck(_.values(subdomainLang), "lngCode")
i18n.init
resGetPath: path.resolve(__dirname,"../../", "locales/__lng__.json")
saveMiss... |
Patch IE's missing logging methods | {forwardMethods} = Trix.Helpers
class Trix.Logger
loggers = {}
@get: (name) ->
loggers[name] ?= new Trix.Logger(console)
forwardMethods ofObject: console, onConstructor: this, toProperty: "console"
constructor: (@console, enabled) ->
@disable() unless enabled
enable: ->
if @disabledConsole? a... | {forwardMethods} = Trix.Helpers
class Trix.Logger
loggers = {}
@get: (name) ->
loggers[name] ?= new Trix.Logger(console)
forwardMethods ofObject: console, onConstructor: this, toProperty: "console"
constructor: (@console, enabled) ->
@disable() unless enabled
enable: ->
if @disabledConsole? a... |
Remove rootView as parameter to activate | module.exports =
treeView: null
activate: (rootView, @state) ->
if state
@createView().attach() if state.attached
else if rootView.project.getPath() and not rootView.pathToOpenIsFile
@createView().attach()
rootView.command 'tree-view:toggle', => @createView().toggle()
rootView.command ... | module.exports =
treeView: null
activate: (@state) ->
if state
@createView().attach() if state.attached
else if rootView.project.getPath() and not rootView.pathToOpenIsFile
@createView().attach()
rootView.command 'tree-view:toggle', => @createView().toggle()
rootView.command 'tree-view... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.