Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Add Increasing Logic to Quality
edsl = (id, name, description, args = {}) -> {defaultValue, defaultProgress, maxProgress, hasProgress, visible} = args defaultValue ?= 0 defaultProgress ?= 0 maxProgress ?= if hasProgress then 100 else 0 visible ?= true Object.freeze new Quality(id, name, description, defaultValue, defaultProgress, maxProgr...
edsl = (id, name, description, args = {}) -> {defaultValue, defaultProgress, maxProgress, hasProgress, progressEscalation, visible} = args defaultValue ?= 0 defaultProgress ?= 0 maxProgress ?= if hasProgress then 100 else 0 progressEscalation ?= 0.10 visible ?= true Object.freeze new Quality(id, name, des...
Fix replacement paths that are absolute paths on Windows
path = require 'path' transformTools = require 'browserify-transform-tools' getReplacement = (file, aliases)-> if aliases[file] return aliases[file] else fileParts = /^([^\/]*)(\/.*)$/.exec(file) pkg = aliases[fileParts?[1]] if pkg? return pkg+fileParts[2] return...
path = require 'path' transformTools = require 'browserify-transform-tools' getReplacement = (file, aliases)-> if aliases[file] return aliases[file] else fileParts = /^([^\/]*)(\/.*)$/.exec(file) pkg = aliases[fileParts?[1]] if pkg? return pkg+fileParts[2] return...
Change how we construct ClickEvents to satisfy PhantomJS.
prettyPrint = require('html').prettyPrint React = require 'react' assertRendersHtml = (reactComponent, done, expectedHtml) -> if typeof(document) == 'undefined' React.renderComponentToString reactComponent, (html) -> html = html.replace /data-reactid="(.*?)"/g, '' html = html.replace /data-reac...
prettyPrint = require('html').prettyPrint React = require 'react' assertRendersHtml = (reactComponent, done, expectedHtml) -> if typeof(document) == 'undefined' React.renderComponentToString reactComponent, (html) -> html = html.replace /data-reactid="(.*?)"/g, '' html = html.replace /data-reac...
Add defensive check for options.plan
kd = require 'kd' KDView = kd.View KDModalView = kd.ModalView CustomLinkView = require 'app/customlinkview' ComputePlansModalFooterLink = require 'app/providers/computeplansmodalfooterlink' MESSAGES = { free : 'Free accounts are restricted t...
kd = require 'kd' KDView = kd.View KDModalView = kd.ModalView CustomLinkView = require 'app/customlinkview' ComputePlansModalFooterLink = require 'app/providers/computeplansmodalfooterlink' MESSAGES = { free : 'Free accounts are restricted t...
Add space to help text
React = require 'react' module?.exports = React.createClass displayName: 'TalkCommentHelp' render: -> <div className="talk-comment-help"> <h1>Guide to commenting on talk</h1> <p>Talk comments are written in <a href='http://daringfireball.net/projects/markdown/basics'>markdown</a></p> <p>Ment...
React = require 'react' module?.exports = React.createClass displayName: 'TalkCommentHelp' render: -> <div className="talk-comment-help"> <h1>Guide to commenting on talk</h1> <p>Talk comments are written in <a href='http://daringfireball.net/projects/markdown/basics'>markdown</a></p> <p>Ment...
Comment out unittest prototype for ts-task-edit because affected coverage.
# Disabled because unittests for directives is extra efforts at the point xdescribe 'tsTaskEdit', () -> beforeEach(module('trackSeatsApp')) beforeEach inject (@$compile, $rootScope, $httpBackend) => $httpBackend.when('GET', '/v1/user/session/').respond({}) @scope = $rootScope.$new() it 'The form has val...
# Disabled because unittests for directives is extra efforts at the point ### xdescribe 'tsTaskEdit', () -> beforeEach(module('trackSeatsApp')) beforeEach inject (@$compile, $rootScope, $httpBackend) => $httpBackend.when('GET', '/v1/user/session/').respond({}) @scope = $rootScope.$new() it 'The form has...
Fix a spec that was saving a test file to disk it no longer saves to cwd now, it saves to tmp
describe 'editor-linter', -> EditorLinter = require('../lib/editor-linter') editorLinter = null textEditor = null beforeEach -> waitsForPromise -> atom.workspace.destroyActivePaneItem() atom.workspace.open('test.txt').then -> editorLinter?.deactivate() textEditor = atom.workspace...
describe 'editor-linter', -> EditorLinter = require('../lib/editor-linter') editorLinter = null textEditor = null beforeEach -> waitsForPromise -> atom.workspace.destroyActivePaneItem() atom.workspace.open('/tmp/test.txt').then -> editorLinter?.deactivate() textEditor = atom.work...
Make reordering sections save them
window.Backbone ||= {} window.Backbone.Views ||= {} class Backbone.Views.SectionNavigationView extends Backbone.View template: Handlebars.templates['section_navigation.hbs'] className: 'section-navigation' initialize: (options) -> @sections = options.sections @listenTo @sections, 'add', @render @li...
window.Backbone ||= {} window.Backbone.Views ||= {} class Backbone.Views.SectionNavigationView extends Backbone.View template: Handlebars.templates['section_navigation.hbs'] className: 'section-navigation' initialize: (options) -> @sections = options.sections @listenTo @sections, 'add', @render @li...
Reset sticky component before clicking back button on browser
App.FoundationExtras = initialize: -> $(document).foundation() $(window).trigger "load.zf.sticky" $(window).trigger "resize" clearSticky = -> $("[data-sticky]").foundation("destroy") if $("[data-sticky]").length $(document).on("page:before-unload", clearSticky)
App.FoundationExtras = initialize: -> $(document).foundation() $(window).trigger "load.zf.sticky" $(window).trigger "resize" clearSticky = -> $("[data-sticky]").foundation("destroy") if $("[data-sticky]").length $(document).on("page:before-unload", clearSticky) window.addEventListene...
Add auras, passives, and actives
#<< main lol.stats = names: armor: "Armor" ap: "Ability Power" ad: "Attack Damage" as: "Attack Speed" crit: "Critical Hit Chance" critDmg: "Critical Hit Damage" health: "Health" mana: "Mana" mr: "Magic Resist" ms: "Movement Speed" aPen: "Armor Penetration" mPen: "Magic ...
#<< main lol.stats = names: armor: "Armor" ap: "Ability Power" ad: "Attack Damage" as: "Attack Speed" crit: "Critical Hit Chance" critDmg: "Critical Hit Damage" health: "Health" mana: "Mana" mr: "Magic Resist" ms: "Movement Speed" aPen: "Armor Penetration" mPen: "Magic ...
Fix object arrow method snippet
".source.js": "Object.assign": prefix: "assign" body: "Object.assign(${1:dest}, ${2:source})" "Object.assign +": prefix: "Object.assign" body: "Object.assign(${1:dest}, ${2:source})" "Object.create": prefix: "create" body: "Object.create(${1:object})" "Object.create +": prefix: "Obj...
".source.js": "Object.assign": prefix: "assign" body: "Object.assign(${1:dest}, ${2:source})" "Object.assign +": prefix: "Object.assign" body: "Object.assign(${1:dest}, ${2:source})" "Object.create": prefix: "create" body: "Object.create(${1:object})" "Object.create +": prefix: "Obj...
Refactor gun generation, shotguns range change
game = require '../game' items = require '../definitions/items' {MapItem} = require '../entities' exports.asMapItem = (x, y, item) -> new MapItem null, x, y, item exports.generatePeculiarObject = -> new items.PeculiarObject exports.generateGun = (type, name) -> type ?= game.random.sample ['handgun', 'shotgun'] ...
game = require '../game' items = require '../definitions/items' {MapItem} = require '../entities' exports.asMapItem = (x, y, item) -> new MapItem null, x, y, item exports.generatePeculiarObject = -> new items.PeculiarObject exports.generateGun = (type, name) -> type ?= game.random.sample ['handgun', 'shotgun'] ...
Use KeyboardEvent.which instead of .key
log = require '../log' events = [] handleEvent = (game, event) -> events.push event if events.length is 1 process.nextTick -> processEvents game, events events = [] processEvents = (game, events) -> [downEvent, pressEvent] = events log.silly 'Key events:', events ch = undefined name = mapKey (downEve...
log = require '../log' events = [] handleEvent = (game, event) -> events.push event if events.length is 1 process.nextTick -> processEvents game, events events = [] processEvents = (game, events) -> [downEvent, pressEvent] = events log.silly 'Key events:', events ch = undefined name = mapKey downEven...
Use correct ENV variable for node popup link targets.
Wheelmap.NodePopupView = Ember.View.extend templateName: 'node-popup' classNames: ['node-popup-view'] aboutFaqLink: (()-> if I18n.locale == 'de' then 'http://wheelmap.org/about/faqs/' else 'http://wheelmap.org/en/faqs/' ).property() linkTarget: (()-> if ENV.EMBEDDED then '_blank' else null ).prope...
Wheelmap.NodePopupView = Ember.View.extend templateName: 'node-popup' classNames: ['node-popup-view'] aboutFaqLink: (()-> if I18n.locale == 'de' then 'http://wheelmap.org/about/faqs/' else 'http://wheelmap.org/en/faqs/' ).property() linkTarget: (()-> if Ember.ENV.EMBEDDED then '_blank' else null )...
Use proper convention for jQuery
# Placeholder Polyfill # https://github.com/mathiasbynens/jquery-placeholder ($ window).load -> ($ 'input, textarea').placeholder();
# Placeholder Polyfill # https://github.com/mathiasbynens/jquery-placeholder $(window).load -> $('input, textarea').placeholder()
Update impersonation session cookie using helper
koding = require './../bongo' module.exports = (req, res) -> { JAccount, JSession } = koding.models { nickname } = req.params { clientId } = req.cookies JSession.fetchSession clientId, (err, result) -> return res.status(400).end() if err or not result { session } = result { ...
koding = require './../bongo' { setSessionCookie } = require '../helpers' module.exports = (req, res) -> { JAccount, JSession } = koding.models { nickname } = req.params { clientId } = req.cookies JSession.fetchSession clientId, (err, result) -> return res.status(400).end() if err ...
Add recursive loop to escape from formatting cells. Change to use jQuery based objects (accessed through Annotator reference).
Annotator = require('annotator') $ = Annotator.$ xpathRange = Annotator.Range Util = Annotator.Util # This plugin implements the UI code for selecting sentences by clicking module.exports = class SentenceSelection extends Annotator.Plugin pluginInit: -> # Register the event handlers required for creating a sele...
Annotator = require('annotator') $ = Annotator.$ xpathRange = Annotator.Range Util = Annotator.Util # This plugin implements the UI code for selecting sentences by clicking module.exports = class SentenceSelection extends Annotator.Plugin pluginInit: -> # Register the event handlers required for creating a sele...
Implement fadeout/in in control iframe; return deferred for completion handlers
class FactlinkJailRoot.ControlIframe constructor: -> @el = document.createElement('iframe') @el.className = 'factlink-control-frame' #need to append to outer document before we can access frame document. FactlinkJailRoot.$factlinkCoreContainer.append(@el) @$el = $(@el) @doc = @el.contentWindow...
control_visibility_transition_time = 300+1000/60 #keep in sync with scss class FactlinkJailRoot.ControlIframe constructor: -> @el = document.createElement('iframe') @el.className = 'factlink-control-frame' #need to append to outer document before we can access frame document. FactlinkJailRoot.$factli...
Initialize window.VoluntaryMusicMetadataEnrichment.Library.YearInReviewTracks.IndexView on music library index page ready.
$(document).ready -> $(document.body).on "change", "select[name^=\"year\"]", -> $.ajax( url: "/users/" + user_id + "/library/music/releases" data: year: $(this).val() type: "GET" dataType: "html" ).success (data) -> $("#releases").empty() $("#releases").append data ...
$(document).ready -> $(document.body).on "change", "select[name^=\"year\"]", -> $.ajax( url: "/users/" + user_id + "/library/music/releases" data: year: $(this).val() type: "GET" dataType: "html" ).success (data) -> $("#releases").empty() $("#releases").append data ...
Change list to listId for clarification
Spine = require('spine') class window.Task extends Spine.Model @configure 'Task', 'name', 'completed', 'priority', 'list' @extend @Local @active: (list) => @select (task) -> !task.completed and (if list then (task.list is list) else yes) @completed: (list) => @select (task) -> task.comple...
Spine = require('spine') class window.Task extends Spine.Model @configure 'Task', 'name', 'completed', 'priority', 'list' @extend @Local @active: (list) => @select (task) -> !task.completed and (if list then (task.list is list) else yes) @completed: (list) => @select (task) -> task.comple...
Change regex formatting to improve readability on GitHub
# Constant strings to print on certain error SYNTAX_ERROR = 'unrecognised syntax: ' # Lexical matchers isString = (str) -> str[0] == '\'' and str[str.length - 1] == '\'' isNumber = (str) -> not isNaN(str) isIdentifier = (str) -> /// ^ [^\s(),'] # anything but whitespace, '(', ')', ',', or '''. + # on...
# Constant strings to print on certain error SYNTAX_ERROR = 'unrecognised syntax: ' # Lexical matchers isString = (str) -> str[0] == '\'' and str[str.length - 1] == '\'' isNumber = (str) -> not isNaN(str) isIdentifier = (str) -> /^[^\s(),']+$/.exec str isCall = (str) -> str[0] == '(' and str[str.length - 1] == ')' ...
Revert "Fix command name =>"
# Description: # hubotに亀の写真を拾ってきてもらう # # Commands: # hubot turtle me - Queries Google Images for turtle and returns a random top result. # Hubotのスクリプトはモジュールとして記述し, # Hubot起動時にrequireされてexportした関数が呼び出されます module.exports = (robot) -> robot.respond /turtle me/i, (msg) -> turtleMe msg, (url) -> msg.send u...
# Description: # hubotに亀の写真を拾ってきてもらう # # Commands: # hubot turtleme - Queries Google Images for turtle and returns a random top result. # Hubotのスクリプトはモジュールとして記述し, # Hubot起動時にrequireされてexportした関数が呼び出されます module.exports = (robot) -> robot.respond /turtleme/i, (msg) -> turtleMe msg, (url) -> msg.send url...
Use fieldmixin, support rendering as read-only
class Lanes.Components.RecordFinder extends Lanes.React.Component propTypes: query: Lanes.PropTypes.State.isRequired model: Lanes.PropTypes.State.isRequired commands: React.PropTypes.object.isRequired contextTypes: viewport: Lanes.PropTypes.State.isRequired showFind...
class Lanes.Components.RecordFinder extends Lanes.React.Component propTypes: query: Lanes.PropTypes.State.isRequired model: Lanes.PropTypes.State.isRequired commands: React.PropTypes.object onModelSet: React.PropTypes.func contextTypes: viewport: Lanes.PropTypes.S...
Update map center when selecting bus
Wmsb.Views.MapView = Backbone.View.extend events: 'click a.student-name': 'updateCurrentStudent' initialize: (options) -> @mapEl = document.getElementById 'map-canvas' @currentAssignment = @collection.find (assignment) -> assignment.get('token') is cookie.get('current_assignment') ...
Wmsb.Views.MapView = Backbone.View.extend events: 'click a.student-name': 'updateCurrentStudent' initialize: (options) -> @mapEl = document.getElementById 'map-canvas' @currentAssignment = @collection.find (assignment) -> assignment.get('token') is cookie.get('current_assignment') ...
Add explanatory comment for model, view-models, and views
GitChanges = require './git-changes' module.exports = class Changes # The view-model for the root ChangesView constructor: -> @git = new GitChanges
# This is the view-model for the root view of the "view and commit changes" tab # It seems as good a place as any to describe the approximate architecture of this # element and how the component parts work together. # # There is one data model, `GitChanges` that can be considered the foundational # object. It performs ...
Use soft wrap instead of font size in example hack
# Your init script # # Atom will evaluate this file each time a new window is opened. It is run # after packages are loaded/activated and after the previous editor state # has been restored. # # An example hack to make opened Markdown files have larger text: # # path = require 'path' # # atom.workspaceView.eachEditorVi...
# Your init script # # Atom will evaluate this file each time a new window is opened. It is run # after packages are loaded/activated and after the previous editor state # has been restored. # # An example hack to make opened Markdown files always be soft wrapped: # # path = require 'path' # # atom.workspaceView.eachEd...
Use same code to print extension-installation message
determineBrowser = -> [ 'chrome', 'firefox', 'safari', 'phantom_js', 'unsupported-browser' ] .filter( (browser) -> $('html.'+browser).length )[0] window.ReactInstallExtensionButton = React.createClass displayName: 'ReactInstallExtensionButton' render: -> extra_class = if @props.huge_button then 'button-hu...
determineBrowser = -> [ 'chrome', 'firefox', 'safari', 'phantom_js', 'unsupported-browser' ] .filter( (browser) -> $('html.'+browser).length )[0] window.ReactInstallExtensionButton = React.createClass displayName: 'ReactInstallExtensionButton' render: -> browserName = determineBrowser() extra_class = ...
Fix test according to changes in smtp mailer.
mailer = null describe "Salad.Mailer", -> before -> mailer = new App.WelcomeMailer describe "#render", -> it "should render templates", -> content = mailer.render "rendering/test" content.should.equal "<h1>Hello World!</h1>" describe "#mail", -> todo = null beforeEach (done) -> ...
mailer = null describe "Salad.Mailer", -> before -> mailer = new App.WelcomeMailer describe "#render", -> it "should render templates", -> content = mailer.render "rendering/test" content.should.equal "<h1>Hello World!</h1>" describe "#mail", -> todo = null beforeEach (done) -> ...
Solve undefined for App.Common when is no App defined
window.Initjs = initialize: -> infos = $("#init-js") controllerClass = infos.data("controller-class") controllerName = infos.data("controller-name") action = infos.data("action") this.execFilter('init') this.exec(controllerClass, controllerName, action) this.execFilter('finish') this.a...
window.Initjs = initialize: -> infos = $("#init-js") controllerClass = infos.data("controller-class") controllerName = infos.data("controller-name") action = infos.data("action") this.execFilter('init') this.exec(controllerClass, controllerName, action) this.execFilter('finish') this.a...
Change mocha reported to 'spec'
module.exports = (grunt) -> grunt.initConfig coffee: compile: files: 'test/test.js': 'test/*.coffee', 'dist/lib/geekywalletlib.js': 'lib/geekywalletlib.coffee' mochaTest: test: src: ['test/**/*.js'] grunt.loadNpmTasks 'grunt-contrib-coffee' grunt.loadNpm...
module.exports = (grunt) -> grunt.initConfig coffee: compile: files: 'test/test.js': 'test/*.coffee', 'dist/lib/geekywalletlib.js': 'lib/geekywalletlib.coffee' mochaTest: test: options: reporter: 'spec' src: ['test/**/*.js'] grunt.loadNpm...
Add flattening for grunt copy
module.exports = (grunt) -> # Project configuration grunt.initConfig { pkg: grunt.file.readJSON 'package.json' uglify: { options: { banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n' } } coffee: { options: { sourceMap: true } compile: { files: { '...
module.exports = (grunt) -> # Project configuration grunt.initConfig { pkg: grunt.file.readJSON 'package.json' uglify: { options: { banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n' } } coffee: { options: { sourceMap: true } compile: { files: { '...
Allow double dollar before period
{ Disposable } = require 'atom' module.exports = class Syntax extends Disposable constructor: (latex) -> @latex = latex dollarsign: -> editor = atom.workspace.getActiveTextEditor() selected = editor.getSelectedText() if selected range = editor.getSelectedBufferRange() range.start.colum...
{ Disposable } = require 'atom' module.exports = class Syntax extends Disposable constructor: (latex) -> @latex = latex dollarsign: -> editor = atom.workspace.getActiveTextEditor() selected = editor.getSelectedText() if selected range = editor.getSelectedBufferRange() range.start.colum...
Add github-hook-manager to list of scripts
fs = require 'fs' path = require 'path' scripts = ['github-event-announcer.coffee'] module.exports = (robot) -> scriptsPath = path.resolve(__dirname, 'src') fs.exists scriptsPath, (exists) -> if exists for script in fs.readdirSync(scriptsPath) if scripts? and '*' not in scripts robot....
fs = require 'fs' path = require 'path' scripts = [ 'github-event-announcer.coffee' 'github-hook-manager.coffee' ] module.exports = (robot) -> scriptsPath = path.resolve(__dirname, 'src') fs.exists scriptsPath, (exists) -> if exists for script in fs.readdirSync(scriptsPath) if scripts? and ...
Update to use new upnp-device API
upnp = require 'upnp' config = app: name: 'Bragi' version: '0.0.1' url: 'http://' device: type: 'MediaServer' version: '1.0' upnp.start config, -> console.log 'Bragi running! :-)'
fs = require 'fs' upnp = require 'upnp-server' Tag = require('taglib').Tag mediaServer = upnp.createDevice 'MediaServer', 'Bragi', (err, device, msg) -> throw err if err device.start (err) -> throw err if err fs.readdir dir, (err, files) -> for file in files try ...
Add wiggle coordinates, show markers, polylines
$ -> myOptions = center: new google.maps.LatLng(-34.397, 150.644) zoom: 8 disableDefaultUI: true mapTypeId: google.maps.MapTypeId.ROADMAP map = new google.maps.Map(document.getElementById("centermap"), myOptions)
$ -> myOptions = center: new google.maps.LatLng(37.76918346431238, -122.43491845703124) zoom: 15 disableDefaultUI: true mapTypeId: google.maps.MapTypeId.ROADMAP map = new google.maps.Map(document.getElementById("centermap"), myOptions) wiggleCoords = [ [37.7743227590708, -122.4358840522766] # Fell and Sc...
Disable URL corruption by TinyMCE
#= override this file in your application to add custom behaviour $ -> $(".tinymce-trigger").click -> tinymce.init selector:'.tinymce-editable', plugins: "image link table media print charmap preview code"
#= override this file in your application to add custom behaviour $ -> $(".tinymce-trigger").click -> tinymce.init selector:'.tinymce-editable', plugins: "image link table media print charmap preview code" convert_urls: false
Check for event object before stopping its propagation
Emberella = window.Emberella get = Ember.get set = Ember.set Emberella.FocusableMixin = Ember.Mixin.create ### @property isFocusable @type Boolean @default true @final ### isFocusable: true attributeBindings: ['tabindex'] tabindex: 0 classNameBindings: [ 'hasFocus:focused' ] hasFocus...
Emberella = window.Emberella get = Ember.get set = Ember.set Emberella.FocusableMixin = Ember.Mixin.create ### @property isFocusable @type Boolean @default true @final ### isFocusable: true attributeBindings: ['tabindex'] tabindex: 0 classNameBindings: [ 'hasFocus:focused' ] hasFocus...
Remove console log on furatto demo
jQuery -> #Pagination Demo $(".pagination a").click (e) -> e.preventDefault() if (!$(this).parent().hasClass("previous") && !$(this).parent().hasClass("next")) $(this).parent().siblings("li").removeClass("active") $(this).parent().addClass("active") $('.panel-content').scroll -> sideba...
jQuery -> #Pagination Demo $(".pagination a").click (e) -> e.preventDefault() if (!$(this).parent().hasClass("previous") && !$(this).parent().hasClass("next")) $(this).parent().siblings("li").removeClass("active") $(this).parent().addClass("active") $('.panel-content').scroll -> sideba...
Remove black-magic from set method
class @IntermediateModel _events: {} data: [] constructor: -> @fetch() get: (key) -> @[key] set: (key, value, silent) -> @[key] = value if not @_events[key] or silent return for callback in @_events[key] (callback)() onChange: (key, callback) -> @_events[key] = @_even...
class @IntermediateModel _events: {} data: [] constructor: -> @fetch() get: (key) -> @[key] set: (key, value) -> @[key] = value on: (eventName, callback) -> @_events[eventName] = @_events[eventName] or [] @_events[eventName].push(callback) onChange: (key, callback) -> @on('cha...
Use position: absolute instead of relative for better positioning
FactlinkJailRoot.showProxyMessage = -> content = """ <div class="proxy-message"> <strong>Factlink Browser</strong> <ul> <li>Get the <a target="_blank" href="https://factlink.com">extension</a> to add discussions on every site</li> <li>Or <a target="_blank" href="https://factlink.com/p/...
FactlinkJailRoot.showProxyMessage = -> content = """ <div class="proxy-message"> <strong>Factlink Browser</strong> <ul> <li>Get the <a target="_blank" href="https://factlink.com">extension</a> to add discussions on every site</li> <li>Or <a target="_blank" href="https://factlink.com/p/...
Set stylesheet path for old android fallback
class App Routers: {} Models: {} Collections: {} Views: {} init: -> window.flight = new Flight() new @Routers.AppRouter Backbone.history.start() @Collections.Activities.fetch() window.app = new App ` String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); }; Str...
class App Routers: {} Models: {} Collections: {} Views: {} init: -> window.flight = new Flight stylesheetPath: '../lib/' new @Routers.AppRouter Backbone.history.start() @Collections.Activities.fetch() window.app = new App ` String.prototype.trim = function() { return this.re...
Use server React with addons by default.
config = require './config' if !config.env.development || require('piping')() # Server-side Google Closure for development. if config.env.development require '../../bower_components/closure-library/closure/goog/bootstrap/nodejs.js' require '../../tmp/deps.js' # Mock client-side stuff for server-side. ...
config = require './config' if !config.env.development || require('piping')() # Server-side Google Closure for development. if config.env.development require '../../bower_components/closure-library/closure/goog/bootstrap/nodejs.js' require '../../tmp/deps.js' # Mock client-side stuff for server-side. ...
Use JSONB not JSON column type
Settings = require "settings-sharelatex" logger = require "logger-sharelatex" _ = require "underscore" if !Settings.analytics?.postgres? module.exports = recordEvent: (user_id, event, segmentation, callback = () ->) -> logger.log {user_id, event, segmentation}, "no event tracking configured, logging event" ca...
Settings = require "settings-sharelatex" logger = require "logger-sharelatex" _ = require "underscore" if !Settings.analytics?.postgres? module.exports = recordEvent: (user_id, event, segmentation, callback = () ->) -> logger.log {user_id, event, segmentation}, "no event tracking configured, logging event" ca...
Revert "Call the callback, really"
class AsciiIo.DataUnpacker unpack: (base64BzippedData, callback) -> data = atob base64BzippedData if data[0] == 'B' and data[1] == 'Z' if window.Worker worker = new Worker(window.unpackWorkerPath) worker.onmessage = (event) => callback event.data worker.postMessage data el...
class AsciiIo.DataUnpacker unpack: (base64BzippedData, callback) -> data = atob base64BzippedData if data[0] == 'B' and data[1] == 'Z' if window.Worker worker = new Worker(window.unpackWorkerPath) worker.onmessage = (event) => callback event.data worker.postMessage data el...
Include an extra line `process.mixin require 'sys'` on the top to let the .js output run using node (v0.1.31)
# Contributed by Jason Huggins http: require 'http' server: http.createServer (req, res) -> res.writeHeader 200, {'Content-Type': 'text/plain'} res.write 'Hello, World!' res.close() server.listen 3000 puts "Server running at http://localhost:3000/"
# Contributed by Jason Huggins process.mixin require 'sys' http: require 'http' server: http.createServer (req, res) -> res.writeHeader 200, {'Content-Type': 'text/plain'} res.write 'Hello, World!' res.close() server.listen 3000 puts "Server running at http://localhost:3000/"
Fix path to use local files
ZXCVBN_SRC = '//dl.dropbox.com/u/209/zxcvbn/zxcvbn.js' # adapted from http://friendlybit.com/js/lazy-loading-asyncronous-javascript/ async_load = -> s = document.createElement 'script' s.src = ZXCVBN_SRC s.type = 'text/javascript' s.async = true first = document.getElementsByTagName('script')[0] first.par...
ZXCVBN_SRC = 'zxcvbn.js' # adapted from http://friendlybit.com/js/lazy-loading-asyncronous-javascript/ async_load = -> s = document.createElement 'script' s.src = ZXCVBN_SRC s.type = 'text/javascript' s.async = true first = document.getElementsByTagName('script')[0] first.parentNode.insertBefore s, first ...
Undo some temporary settings for ngflow chunk size
'use strict' app.factory('uploadService', [ '$q', '$sce', 'constantService', 'routerService', 'messageService', ($q, $sce, constants, router, messages) -> removedAsset: undefined flowOptions: () -> target: router.controllers.uploadChunk.route() method: 'octet' # chunkSize: 4194304 ...
'use strict' app.factory('uploadService', [ '$q', '$sce', 'constantService', 'routerService', 'messageService', ($q, $sce, constants, router, messages) -> removedAsset: undefined flowOptions: () -> target: router.controllers.uploadChunk.route() method: 'octet' chunkSize: 4194304 # ...
Add javascript for search button
#= require_self #= require_tree . window.Neighborly = Common: initPage: -> that = this unless window.Turbolinks is undefined $(document).bind "page:fetch", -> that.Loading.show() $(document).bind "page:restore", -> that.Loading.hide() $(document).bind "pa...
#= require_self #= require_tree . window.Neighborly = Common: initPage: -> that = this unless window.Turbolinks is undefined $(document).bind "page:fetch", -> that.Loading.show() $(document).bind "page:restore", -> that.Loading.hide() $(document).bind "pa...
Add classes to feed selection to allow styling
window.ReactFeedSelection = React.createClass displayName: 'ReactFeedSelection' getInitialState: -> feedChoice: 'global' feeds: global: new GlobalFeedActivities personal: new PersonalFeedActivities handleFeedChoiceChange: (e) -> console.log(e,e.target,e.target.checked, e.target.value) ...
window.ReactFeedSelection = React.createClass displayName: 'ReactFeedSelection' getInitialState: -> feedChoice: 'global' feeds: global: new GlobalFeedActivities personal: new PersonalFeedActivities handleFeedChoiceChange: (e) -> console.log(e,e.target,e.target.checked, e.target.value) ...
Remove accidentally left unused function from CacheService
angular.module('kassa').factory('CacheService', [ '$q' '$parse' ($q, $parse)-> cache = {} [isUndefined, copy] = [angular.isUndefined, angular.copy] _writeToCache = (cacheObj, obj, key)-> if isUndefined(cacheObj[key]) cacheObj[key] = obj else #copy to ensure object referenc...
angular.module('kassa').factory('CacheService', [ '$q' '$parse' ($q, $parse)-> cache = {} [isUndefined, copy] = [angular.isUndefined, angular.copy] set = (obj, prefix, field='id')-> $q.when(obj).then (obj)-> $parse("#{prefix}.#{obj[field]}").assign(cache, obj) get = (key, prefix)-> $...
Handle encoded parameters in request URL to wiki
request = require("request") settings = require("settings-sharelatex") logger = require("logger-sharelatex") ErrorController = require "../Errors/ErrorController" module.exports = WikiController = getPage: (req, res, next) -> page = req.url.replace(/^\/learn/, "").replace(/^\//, "") if page == "" page = "Main...
request = require("request") settings = require("settings-sharelatex") logger = require("logger-sharelatex") ErrorController = require "../Errors/ErrorController" module.exports = WikiController = getPage: (req, res, next) -> page = req.url.replace(/^\/learn/, "").replace(/^\//, "") if page == "" page = "Main...
Change sorting to be done in ascending order first
angular.module("admin.indexUtils").controller "ColumnsCtrl", ($scope, Columns) -> $scope.columns = Columns.columns $scope.predicate = "" $scope.reverse = false
angular.module("admin.indexUtils").controller "ColumnsCtrl", ($scope, Columns) -> $scope.columns = Columns.columns $scope.predicate = "" $scope.reverse = true
Stop jasmine tests at the first sign of problems
module.exports = { options: helperNameSuffix: '.js' specNameSuffix: 'spec.coffee' useHelpers: true unit: specs: [ 'test/unit/**' ] helpers: [ 'test/helpers/**' ] integration: specs: [ 'test/integration/**' ] helpers: [ 'test/helpers/**' ] }
module.exports = { options: helperNameSuffix: '.js' specNameSuffix: 'spec.coffee' stopOnFailure: true useHelpers: true unit: specs: [ 'test/unit/**' ] helpers: [ 'test/helpers/**' ] integration: specs: [ 'test/integration/**' ] helpers: [ 'test/h...
Use package name as config prefix
{_, $, View} = require 'atom' module.exports = class WrapGuideView extends View @activate: -> atom.workspaceView.eachEditorView (editorView) -> if editorView.attached and editorView.getPane() editorView.underlayer.append(new WrapGuideView(editorView)) @content: -> @div class: 'wrap-guide' ...
{_, $, View} = require 'atom' module.exports = class WrapGuideView extends View @activate: -> atom.workspaceView.eachEditorView (editorView) -> if editorView.attached and editorView.getPane() editorView.underlayer.append(new WrapGuideView(editorView)) @content: -> @div class: 'wrap-guide' ...
Make data a Machine instance.
class SidebarMachineBox extends KDView constructor: (options = {}, data) -> super options, data { machine } = data @addSubView @machineItem = new NavigationMachineItem {}, machine @createWorkspacesLabel() @createWorkspacesList() createWorkspacesList: -> { machine, workspaces } = @get...
class SidebarMachineBox extends KDView constructor: (options = {}, data) -> super options, data { machine } = data @machine = new Machine machine: KD.remote.revive machine @addSubView @machineItem = new NavigationMachineItem {}, @machine @createWorkspacesLabel() @createWorkspacesList() ...
Change the data mount point to /resin-data
module.exports = config = apiEndpoint: process.env.API_ENDPOINT ? 'https://api.resin.io' registryEndpoint: process.env.REGISTRY_ENDPOINT ? 'registry.resin.io' pubnub: subscribe_key: process.env.PUBNUB_SUBSCRIBE_KEY ? 'sub-c-bananas' publish_key: process.env.PUBNUB_PUBLISH_KEY ? 'pub-c-bananas' mixpanelToken: pr...
module.exports = config = apiEndpoint: process.env.API_ENDPOINT ? 'https://api.resin.io' registryEndpoint: process.env.REGISTRY_ENDPOINT ? 'registry.resin.io' pubnub: subscribe_key: process.env.PUBNUB_SUBSCRIBE_KEY ? 'sub-c-bananas' publish_key: process.env.PUBNUB_PUBLISH_KEY ? 'pub-c-bananas' mixpanelToken: pr...
Fix react warning when rendering collection without keys
React = require 'react-atom-fork' {div} = require 'reactionary-atom-fork' module.exports = React.createClass getInitialState: -> firstRow: 0 lastRow: 0 totalRows: 0 rowHeight: 0 columnsWidth: [] render: -> {firstRow, lastRow, rowHeight, columnsWidth} = @state console.log columnsWidth ...
React = require 'react-atom-fork' {div} = require 'reactionary-atom-fork' module.exports = React.createClass getInitialState: -> firstRow: 0 lastRow: 0 totalRows: 0 rowHeight: 0 columnsWidth: [] render: -> {firstRow, lastRow, rowHeight, columnsWidth} = @state rows = for row in [firstR...
Set cross-domain allowed to default to '*'
class Postie listenCallback: null constructor: (options = {}) -> send: (frames, data, callback) -> console.log frames # Public: assign listener callback function listen: (callback) -> @listenCallback = callback @bindEventListener onMessage: (event) -> event = @parseEvent(event) ...
class Postie listenCallback: null domain: '*' constructor: (options = {}) -> send: (frames, data, callback) -> console.log frames # Public: assign listener callback function listen: (callback) -> @listenCallback = callback @bindEventListener onMessage: (event) -> event = @parseE...
Revise hashbang snippet added in d181298
".source.apl": Function: prefix: "fn" body: "∇${2:R ←} ${3:X} ${1:NAME} ${4:Y}\n\t$0\n∇" Operator: prefix: "op" body: "∇${2:R ←} ${3:X} (${4:LOP} ${1:NAME} ${5:ROP}) ${6:Y}\n\t$0\n∇" Assignment: prefix: "a" body: "${1:⎕ }← ${2:VALUE}" Hashbang: prefix: "#" body: "#!/usr/${3:local/bin/a...
".source.apl": Function: prefix: "fn" body: "∇${2:R ←} ${3:X} ${1:NAME} ${4:Y}\n\t$0\n∇" Operator: prefix: "op" body: "∇${2:R ←} ${3:X} (${4:LOP} ${1:NAME} ${5:ROP}) ${6:Y}\n\t$0\n∇" Assignment: prefix: "a" body: "${1:⎕ }← ${2:VALUE}" Hashbang: prefix: "apl" body: "#!/usr/bin/env apl -...
Remove debug message from TaskInboxStateCtrl
angular.module('doubtfire.units.states.tasks.inbox', []) # # Task inbox for tasks to deal with # .config(($stateProvider) -> $stateProvider.state 'units/tasks/inbox', { parent: 'units/tasks' url: '/inbox/:taskId' templateUrl: "units/states/tasks/inbox/inbox.tpl.html" controller: "TaskInboxStateCtrl" ...
angular.module('doubtfire.units.states.tasks.inbox', []) # # Task inbox for tasks to deal with # .config(($stateProvider) -> $stateProvider.state 'units/tasks/inbox', { parent: 'units/tasks' url: '/inbox/:taskId' templateUrl: "units/states/tasks/inbox/inbox.tpl.html" controller: "TaskInboxStateCtrl" ...
Call Shortcut in DOM ready script
# ************************************* # # Document Ready # # ************************************* jQuery ($) -> # ----- Functions ----- # Orientation.accordion() Orientation.autoSubmit() Orientation.dropdown() Orientation.headingLink() Orientation.search() Orientation.search $element : $( '.j...
# ************************************* # # Document Ready # # ************************************* jQuery ($) -> # ----- Functions ----- # Orientation.accordion() Orientation.autoSubmit() Orientation.dropdown() Orientation.headingLink() Orientation.search() Orientation.shortcut() Orientation.sea...
Add "->" as a search term separator
class app.models.Entry extends app.Model # Attributes: name, type, path SEPARATORS_REGEXP = /\:?\ |#|::/g PARANTHESES_REGEXP = /\(.*?\)$/ constructor: -> super @text = @searchValue() searchValue: -> @name .toLowerCase() .replace '...', ' ' .replace ' event', '' .replace ...
class app.models.Entry extends app.Model # Attributes: name, type, path SEPARATORS_REGEXP = /\:?\ |#|::|->/g PARANTHESES_REGEXP = /\(.*?\)$/ constructor: -> super @text = @searchValue() searchValue: -> @name .toLowerCase() .replace '...', ' ' .replace ' event', '' .repla...
Use RocketChat Logger as SyncedCron logger
# Config and Start SyncedCron SyncedCron.config collectionName: 'rocketchat_cron_history' generateStatistics = -> statistics = RocketChat.statistics.save() statistics.host = Meteor.absoluteUrl() unless RocketChat.settings.get 'Statistics_opt_out' HTTP.post 'https://rocket.chat/stats', data: statistics return...
# Config and Start SyncedCron logger = new Logger 'SyncedCron' SyncedCron.config logger: (opts) -> logger[opts.level].call(logger, opts.message) collectionName: 'rocketchat_cron_history' generateStatistics = -> statistics = RocketChat.statistics.save() statistics.host = Meteor.absoluteUrl() unless RocketChat.s...
Replace promise with callbacks for UnspentOutputsRestClient
class ledger.api.UnspentOutputsRestClient extends ledger.api.RestClient getUnspentOutputsFromAddresses: (addresses, callback) -> addresses = (address for address in addresses when Bitcoin.Address.validate(address) is true) query = _(addresses).join(',') @http().get(url: "blockchain/addresses/#{query}/un...
class ledger.api.UnspentOutputsRestClient extends ledger.api.RestClient getUnspentOutputsFromAddresses: (addresses, callback) -> addresses = (address for address in addresses when Bitcoin.Address.validate(address) is true) query = _(addresses).join(',') @http().get url: "blockchain/addresses/#{que...
Remove comment in branch test
window.Cosmo = version: '0.1.0' # more # All apps should be an extended instance of this class class Cosmo.Router # app regions, assumes main content goes in a div#container regions: container: $('#container') initialize: -> # do initialization stuff and then start app routing # TODO: Do some url man...
window.Cosmo = version: '0.1.0' # All apps should be an extended instance of this class class Cosmo.Router # app regions, assumes main content goes in a div#container regions: container: $('#container') initialize: -> # do initialization stuff and then start app routing # TODO: Do some url management...
Refactor deprecated method call for setting response status
module.exports = -> { dash } = require 'bongo' bongo = this (req, res, next) -> { channelName, queue: requestQueue } = req.body unless requestQueue?.length res.send 400 return responseQueue = new Array requestQueue.length workQueue = requestQueue.map (message, i) -> -> bong...
module.exports = -> { dash } = require 'bongo' bongo = this (req, res, next) -> { channelName, queue: requestQueue } = req.body unless requestQueue?.length return res.status(400).end() responseQueue = new Array requestQueue.length workQueue = requestQueue.map (message, i) -> -> b...
Remove initial attempt to draw rectangle
#require("./webgl-example/blue-thing") leaflet = require("leaflet") require("./rectangle_editor") $ = require("jquery") tilesUrl = 'http://skogsmaskin.asuscomm.com:3001/kartverk/{z}/{x}/{y}.png' tilesLayer = new L.TileLayer(tilesUrl); $ -> map = new L.Map('map'); map.addLayer(tilesLayer); map.setView(new L.Lat...
#require("./webgl-example/blue-thing") leaflet = require("leaflet") require("./rectangle_editor") $ = require("jquery") tilesUrl = 'http://skogsmaskin.asuscomm.com:3001/kartverk/{z}/{x}/{y}.png' tilesLayer = new L.TileLayer(tilesUrl); $ -> map = new L.Map('map'); map.addLayer(tilesLayer); map.setView(new L.Lat...
Add options parameter to artifact server module
module.exports = (name = '') -> { argv } = require 'optimist' express = require 'express' cors = require 'cors' helmet = require 'helmet' app = express() compression = require 'compression' bodyParser = require 'body-parser' app.use compression() app.use bodyParser.js...
module.exports = (name = '', options = {}) -> { argv } = require 'optimist' express = require 'express' cors = require 'cors' helmet = require 'helmet' app = express() compression = require 'compression' bodyParser = require 'body-parser' app.use compression() app.use...
Clean up stray elements created by MathJax
_ = require 'underscore' React = require 'react' KatexMixin = require './katex-mixin' module.exports = React.createClass displayName: 'ArbitraryHtmlAndMath' propTypes: className: React.PropTypes.string html: React.PropTypes.string block: React.PropTypes.bool mixins: [KatexMixin] render: -> cla...
_ = require 'underscore' React = require 'react' KatexMixin = require './katex-mixin' module.exports = React.createClass displayName: 'ArbitraryHtmlAndMath' propTypes: className: React.PropTypes.string html: React.PropTypes.string block: React.PropTypes.bool mixins: [KatexMixin] render: -> cla...
Fix opening a Inquire via Phone modal on FireFox and IEs
InquireViaPhoneModalView = require '../inquire_via_phone/index.coffee' module.exports = ($el) -> $el .find '.js-artwork-partner-stub-inquire-via-phone' .click (e) -> e.preventDefault() @modal = new InquireViaPhoneModalView width: '500px' copy: login: 'Log in to Artsy to ...
InquireViaPhoneModalView = require '../inquire_via_phone/index.coffee' module.exports = ($el) -> $el .find '.js-artwork-partner-stub-inquire-via-phone' .click (e) -> e.preventDefault() @modal = new InquireViaPhoneModalView width: '500px' copy: login: 'Log in to Artsy to ...
Set metadata to empty hash when missing
Package = require 'package' fs = require 'fs' module.exports = class AtomPackage extends Package metadata: null keymapsDirPath: null autoloadStylesheets: true constructor: -> super @keymapsDirPath = fs.join(@path, 'keymaps') load: -> try @loadMetadata() @loadKeymaps() @loadSty...
Package = require 'package' fs = require 'fs' module.exports = class AtomPackage extends Package metadata: null keymapsDirPath: null autoloadStylesheets: true constructor: -> super @keymapsDirPath = fs.join(@path, 'keymaps') load: -> try @loadMetadata() @loadKeymaps() @loadSty...
Disable Hubot's HTTP server during the tests
Helper = require('hubot-test-helper') nock = require('nock') expect = require('chai').expect helper = new Helper('../src/codenames.coffee') describe 'codenames', -> beforeEach -> nock('http://codenames.clivemurray.com') .get('/data/prefixes.json') .reply(200, [{title: 'black', attributes: ['colour']...
Helper = require('hubot-test-helper') nock = require('nock') expect = require('chai').expect helper = new Helper('../src/codenames.coffee') describe 'codenames', -> beforeEach -> nock('http://codenames.clivemurray.com') .get('/data/prefixes.json') .reply(200, [{title: 'black', attributes: ['colour']...
Allow function for startposition of grid
defaults = require('lodash/defaults') shuffle = require('lodash/shuffle') class Game.LocationGrid constructor: (settings) -> settings = defaults settings, x: {} y: {} settings.x = defaults settings.x, start: 0 steps: 1 stepSize: 1 avoid: [] settings.y = defaults sett...
defaults = require('lodash/defaults') shuffle = require('lodash/shuffle') class Game.LocationGrid constructor: (settings) -> settings = defaults settings, x: {} y: {} settings.x = defaults settings.x, start: 0 steps: 1 stepSize: 1 avoid: [] settings.y = defaults sett...
Update KeypathObserver to have better state management, passing in the previous target to the callback for unbinding.
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) -> @parse() @objectPath = [] @target = @realize() parse: => interfaces = (k for k, v of @view.adapters) if @keypath[0] in interfaces root = @keypath[0] path = @keypath.substr 1 else root = @view.confi...
Index does not need $location
###* IndexController. Responsible for the index view. ### app.controller "IndexController", ($scope, $location) -> $scope.whatsMyName = "Welcome my friend" return
###* IndexController. Responsible for the index view. ### app.controller "IndexController", ($scope) -> $scope.whatsMyName = "Welcome my friend" return
Sort Movies by opening weekend totals
#= require app/models/movie class App.Collections.Movies extends Backbone.Collection model: App.Models.Movie url: '/movies'
#= require app/models/movie class App.Collections.Movies extends Backbone.Collection model: App.Models.Movie url: '/movies' comparator: (model) -> - model.get('opening_weekend')
Fix overlay positioning when scrolled down
class @OverlayDimensions minMargin: 10 constructor: (overlayContent) -> @overlayContent = overlayContent @totalMargin = @minMargin * 2 @maxWidth = -> $(window).width() - @totalMargin width: -> @overlayContent.width() height: -> @overlayContent.height() margin: -> margin = (@...
class @OverlayDimensions minMargin: 10 constructor: (overlayContent) -> @overlayContent = overlayContent @totalMargin = @minMargin * 2 @maxWidth = -> $(window).width() - @totalMargin width: -> @overlayContent.width() height: -> @overlayContent.height() margin: -> margin = (@...
Use @ in stead of this.
class window.RelatedChannelsView extends Backbone.Marionette.CompositeView className: "related-channels-for-channel" template: "channels/related_channels", itemViewContainer: "ul", itemView: RelatedChannelView itemViewOptions: => addToCollection : @addToCollection templateHelpers: => is_mine: this....
class window.RelatedChannelsView extends Backbone.Marionette.CompositeView className: "related-channels-for-channel" template: "channels/related_channels", itemViewContainer: "ul", itemView: RelatedChannelView itemViewOptions: => addToCollection : @addToCollection templateHelpers: => is_mine: @mode...
Update Shere to Sphere (typo)
Models = 'models/cube.js': name: 'Cube' 'models/sphere.js': name: 'Shere' 'models/torus.js': name: 'Torus' 'models/dragon.js': name: 'Dragon' scale: 1.2 'models/hexmkii.js': name: 'Hex MKII' scale: 0.01 'models/suzanne_low.js': name: 'Suzanne (low)' 'models/suzanne_h...
Models = 'models/cube.js': name: 'Cube' 'models/sphere.js': name: 'Sphere' 'models/torus.js': name: 'Torus' 'models/dragon.js': name: 'Dragon' scale: 1.2 'models/hexmkii.js': name: 'Hex MKII' scale: 0.01 'models/suzanne_low.js': name: 'Suzanne (low)' 'models/suzanne_...
Set accept-cookies cookie to expire in the very far future (year 9.999).
######################################################## # AngularJS service to manipulate cookies ######################################################## angular.module('feedbunch').service 'cookiesSvc', ['$window', ($window)-> #--------------------------------------------- # Set an "accepted_cookies" cookie wi...
######################################################## # AngularJS service to manipulate cookies ######################################################## angular.module('feedbunch').service 'cookiesSvc', ['$window', ($window)-> #--------------------------------------------- # Set an "accepted_cookies" cookie wi...
Fix shooting orientation when enemy turns around
Crafty.c 'ShootOnSight', remove: -> @unbind('GameLoop', @_checkForShot) shootOnSight: (options) -> @shootConfig = _.defaults(options, targetType: 'PlayerControlledShip' sightAngle: 10 shootWhenHidden: no cooldown: 800 ) @bind('GameLoop', @_checkForShot) _checkForShot: (...
Crafty.c 'ShootOnSight', remove: -> @unbind('GameLoop', @_checkForShot) shootOnSight: (options) -> @shootConfig = _.defaults(options, targetType: 'PlayerControlledShip' sightAngle: 10 shootWhenHidden: no cooldown: 800 ) @bind('GameLoop', @_checkForShot) _checkForShot: (...
Add analytics to home path
Backbone = require 'backbone' template = -> require('./index.jade') arguments... module.exports = class HomePathFieldView extends Backbone.View className: 'Fieldset' events: 'change select': 'select' initialize: -> @listenTo @model, 'change:home_path', @render select: (e) -> $target = $(e.curren...
Backbone = require 'backbone' analytics = require '../../../../lib/analytics.coffee' template = -> require('./index.jade') arguments... module.exports = class HomePathFieldView extends Backbone.View className: 'Fieldset' events: 'change select': 'select' initialize: -> @listenTo @model, 'change:home_pa...
Modify EOL code from CRLF to LF
Math._random ?= Math.random pesudoRandomValues = [] pesudoRandom = -> pesudoRandomValues.shift() ? Math._random() pesudoRandom.MIN_VALUE = 0 pesudoRandom.MAX_VALUE = 0.99999999 pesudoRandom.push = -> pesudoRandomValues.push arguments... @ pesudoRandom.set = -> @clear() .push arguments...
Math._random ?= Math.random pesudoRandomValues = [] pesudoRandom = -> pesudoRandomValues.shift() ? Math._random() pesudoRandom.MIN_VALUE = 0 pesudoRandom.MAX_VALUE = 0.99999999 pesudoRandom.push = -> pesudoRandomValues.push arguments... @ pesudoRandom.set = -> @clear() .push arguments... pesudoRandom...
Add Correct Display Name when Visiting Stats of Other User
React = require 'react' ClassificationsRibbon = require '../../components/classifications-ribbon' PromiseRenderer = require '../../components/promise-renderer' ProjectIcon = require '../../components/project-icon' module.exports = React.createClass getDefaultProps: -> user: null render: -> <div className=...
React = require 'react' ClassificationsRibbon = require '../../components/classifications-ribbon' PromiseRenderer = require '../../components/promise-renderer' ProjectIcon = require '../../components/project-icon' module.exports = React.createClass getDefaultProps: -> user: null render: -> <div className=...
Use instanceof instead of nodeName for consistency's sake
class Written.Cursor constructor: (element, selection) -> @element = -> element @selection = selection children = Array.prototype.slice.call(@element().children, 0) @offset = selection.focusOffset node = selection.focusNode while node && !children.includes(node) parent = node.par...
class Written.Cursor constructor: (element, selection) -> @element = -> element @selection = selection children = Array.prototype.slice.call(@element().children, 0) @offset = selection.focusOffset node = selection.focusNode while node && !children.includes(node) parent = node.par...
Fix bug with including underscore.js.
# Include lib. for file in ['buildable', 'arrayFilters', 'underscore'] Ti.include('lib/' + file + '.js') # Include expansions. for file in ['citiesAndKnights'] Ti.include('models/expansions/' + file + '.js') # Include models. for file in [ 'city', 'game', 'largestArmy', 'longestRoad', 'player', 'settl...
# Include lib. for file in ['buildable', 'arrayFilters'] Ti.include('lib/' + file + '.js') # Include vendor. for file in ['underscore'] Ti.include('vendor/' + file + '.js') # Include expansions. for file in ['citiesAndKnights'] Ti.include('models/expansions/' + file + '.js') # Include models. for file in [ '...
Mark all episodes as viewed from anime pages.
Hummingbird.AnimeRoute = Ember.Route.extend model: (params) -> @store.find('fullAnime', params.id) saveLibraryEntry: (libraryEntry) -> anime = @currentModel Messenger().expectPromise (-> libraryEntry.save()), progressMessage: "Saving " + anime.get('canonicalTitle') + "..." successMessage: "...
Hummingbird.AnimeRoute = Ember.Route.extend model: (params) -> @store.find('fullAnime', params.id) saveLibraryEntry: (libraryEntry) -> anime = @currentModel Messenger().expectPromise (-> libraryEntry.save()), progressMessage: "Saving " + anime.get('canonicalTitle') + "..." successMessage: "...
Support attaching behaviour to multiple collections
behaviours = {} share.attach = attach = (behaviour, args...) -> if _.isString behaviour options = behaviours[behaviour].options behaviour = behaviours[behaviour].behaviour if _.isFunction behaviour context = collection: @ options: options or {} behaviour.apply context, args else ...
behaviours = {} share.attach = attach = (behaviour, args...) -> if _.isString behaviour options = behaviours[behaviour].options behaviour = behaviours[behaviour].behaviour if _.isFunction behaviour context = collection: @ options: options or {} behaviour.apply context, args else ...
Fix event bindings for variable-length keypaths for realsies.
#= require ./abstract_attribute_binding class Batman.DOM.EventBinding extends Batman.DOM.AbstractAttributeBinding onlyObserve: Batman.BindingDefinitionOnlyObserve.Data bindImmediately: false constructor: -> super callback = => func = @get('filteredValue') target = @view.targetForKeypathBase...
#= require ./abstract_attribute_binding class Batman.DOM.EventBinding extends Batman.DOM.AbstractAttributeBinding onlyObserve: Batman.BindingDefinitionOnlyObserve.Data bindImmediately: false constructor: -> super callback = => func = @get('filteredValue') target = @view.targetForKeypathBase...
Use correct CTA Bar on New Artist Pages
{ MEDIUM, CURRENT_USER } = require('sharify').data AuthModalView = require '../../../components/auth_modal/view.coffee' CTABarView = require '../../../components/cta_bar/view.coffee' module.exports = (artist) -> return unless MEDIUM is 'search' and not CURRENT_USER? name = 'artist_cta' ctaHeadline = "Get update...
{ MEDIUM, CURRENT_USER } = require('sharify').data AuthModalView = require '../../../components/auth_modal/view.coffee' CTABarView = require '../../../components/cta_bar/view.coffee' module.exports = (artist) -> return unless MEDIUM is 'search' and not CURRENT_USER? name = 'artist_cta' ctaHeadline = "Get update...
Set check cycles to 2
storage = require 'node-persist' storage.initSync() config = storage.getItemSync 'config' module.exports = getConfig: -> defaultDelay: 3 defaultDuration: 0.5 defaultTransition: "none" checkCycles: 20
storage = require 'node-persist' storage.initSync() config = storage.getItemSync 'config' module.exports = getConfig: -> defaultDelay: 3 defaultDuration: 0.5 defaultTransition: "none" checkCycles: 2
Fix rec popover behaviour when rec icon appears and page isn't reloaded.
Template.room_list.helpers rooms: -> searchQuery = Session.get 'search-query' query = {} query.displayName = new RegExp searchQuery, 'i' Rooms.find query, { sort: { displayName: 1 } } Template.room_list.rendered = -> @$('[data-toggle="tooltip"]').tooltip() @$('[data-toggle="popover"]').each -> ...
Template.room_list.helpers rooms: -> searchQuery = Session.get 'search-query' query = {} query.displayName = new RegExp searchQuery, 'i' Rooms.find query, { sort: { displayName: 1 } } Template.room_list.rendered = -> @$('[data-toggle="tooltip"]').tooltip() Template.room_summary.helpers zoom: ->...
Refactor test case around to use a test method for each test
{expect} = require "chai" utils = require "../utils" {Collections} = utils.require "common/base" describe "categorical mapper", -> mapper = null before -> mapper = Collections('CategoricalMapper').create( source_range: Collections('FactorRange').create factors: ['foo', 'bar', 'baz'] target...
{expect} = require "chai" utils = require "../utils" {Collections} = utils.require "common/base" describe "categorical mapper", -> factors = ["foo", "bar", "baz"] start = 20 end = 80 testMapping = (key, expected) -> mapper = Collections("CategoricalMapper").create source_range: Collections("FactorR...
Fix error where path was not required
remote = require "remote" dialog = remote.require "dialog" module.exports = class FileUtil constructor: () -> @prepareFile: (buffer) -> if buffer.file? && buffer.file.existsSync FileUtil.saveIfModified(buffer) else FileUtil.saveNewFile(buffer) @getPngFilePath:(file) -> pngFileName = File...
remote = require "remote" path = require "path" dialog = remote.require "dialog" module.exports = class FileUtil constructor: () -> @prepareFile: (buffer) -> if buffer.file? && buffer.file.existsSync FileUtil.saveIfModified(buffer) else FileUtil.saveNewFile(buffer) @getPngFilePath:(file) -...
Allow observing [] for all keys
module.exports = (observed, keys, callback) -> Object.observe observed, (changes) => for change in changes if change.name in keys callback() break
module.exports = (observed, keys, callback) -> Object.observe observed, (changes) => for change in changes if (change.name in keys) or (keys.length is 0) callback() break
Add missing debug pass through
_ = require('underscore') YAML = require('libyaml') colors = require('colors') fs = require('fs') commander = require('commander') proxy = require('./proxy') commander .usage("Run it in the root of your project to start proxying requests as defined in the project's .vee file") .option('-p, --port [port number]', ...
_ = require('underscore') YAML = require('libyaml') colors = require('colors') fs = require('fs') commander = require('commander') proxy = require('./proxy') commander .usage("Run it in the root of your project to start proxying requests as defined in the project's .vee file") .option('-p, --port [port number]', ...
Add options to the AddModelToCollection addDefaultModel.
Backbone.Factlink ||= {} Backbone.Factlink.AddModelToCollectionMixin = addModel: (model) -> @options.addToCollection.add(model) model.save {}, success: => @addModelSuccess(model) if @addModelSuccess error: => @options.addToCollection.remove(model) @addModelError(model) if ...
Backbone.Factlink ||= {} Backbone.Factlink.AddModelToCollectionMixin = addModel: (model, options) -> @options.addToCollection.add(model, options) model.save {}, success: => @addModelSuccess(model) if @addModelSuccess error: => @options.addToCollection.remove(model) @addMod...
Fix a few cases that caused us to lose our lovely hacks
window.slackReadyFunction = (func) -> TS.groups.message_received_sig.add func TS.channels.message_received_sig.add func TS.ims.message_received_sig.add func TS.channels.switched_sig.add func TS.groups.switched_sig.add func TS.ims.switched_sig.add func func()
# 🙈 slackRebuildMsg = TS.client.msg_pane.rebuildMsg TS.client.msg_pane.rebuild_sig = new signals.Signal TS.client.msg_pane.rebuildMsg = -> slackRebuildMsg() TS.client.msg_pane.rebuild_sig.dispatch() window.slackReadyFunction = (func) -> TS.client.msg_pane.rebuild_sig.add func for channel_type in ["groups", "...
Mark notifications as read first and then set the unread count
Promise = require 'bluebird-q' { delay } = require 'underscore' Backbone = require 'backbone' template = -> require('./index.jade') arguments... module.exports = class NotificationsView extends Backbone.View events: 'click a': -> delay (=> @render()), 250 initialize: ({ @state }) -> @listenTo @collection,...
Promise = require 'bluebird-q' { delay } = require 'underscore' Backbone = require 'backbone' template = -> require('./index.jade') arguments... module.exports = class NotificationsView extends Backbone.View events: 'click a': -> delay (=> @render()), 250 initialize: ({ @state }) -> @listenTo @collection,...
Implement destroying bindings on deactivation
{CompositeDisposable} = require 'atom' MinimapBookmarksBinding = null module.exports = active: false isActive: -> @active activate: (state) -> @subscriptions = new CompositeDisposable consumeMinimapServiceV1: (@minimap) -> @minimap.registerPlugin 'bookmarks', this deactivate: -> @minimap?.u...
{CompositeDisposable} = require 'atom' MinimapBookmarksBinding = null module.exports = active: false isActive: -> @active bindings: {} activate: (state) -> consumeMinimapServiceV1: (@minimap) -> @minimap.registerPlugin 'bookmarks', this deactivate: -> @minimap?.unregisterPlugin 'bookmarks' ...