Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Fix for when an app has no displayName | BaseCollection = require 'lib/base_collection'
Application = require 'models/application'
# List of installed applications.
module.exports = class ApplicationCollection extends BaseCollection
model: Application
url: 'api/applications/'
apps: []
get: (idorslug) ->
out = super idorslug
... | BaseCollection = require 'lib/base_collection'
Application = require 'models/application'
# List of installed applications.
module.exports = class ApplicationCollection extends BaseCollection
model: Application
url: 'api/applications/'
apps: []
get: (idorslug) ->
out = super idorslug
... |
Return JSON object instead of a primitive | request = require 'request'
_ = require 'lodash'
class TemperatureController
celsius: (req, res) =>
{city, state, country} = req.query
location = _.compact([city, state, country]).join ','
@request 'metric', location, (error, response, body) =>
return res.status(500).send(error) if error?
... | request = require 'request'
_ = require 'lodash'
class TemperatureController
celsius: (req, res) =>
{city, state, country} = req.query
location = _.compact([city, state, country]).join ','
@request 'metric', location, (error, response, body) =>
return res.status(500).send(error) if error?
... |
Add refresh task end point | angular.module("doubtfire.api.models.project", [])
.factory("Project", (resourcePlus) ->
Project = resourcePlus "/projects/:id", { id: "@id" }
Project.tutorialEnrolment = resourcePlus "/units/:id/tutorials/:tutorial_abbreviation/enrolments/:project_id", {id: "@id", tutorial_abbreviation: "@tutorial_abbreviation", ... | angular.module("doubtfire.api.models.project", [])
.factory("Project", (resourcePlus) ->
Project = resourcePlus "/projects/:id", { id: "@id" }
Project.tutorialEnrolment = resourcePlus "/units/:id/tutorials/:tutorial_abbreviation/enrolments/:project_id", {id: "@id", tutorial_abbreviation: "@tutorial_abbreviation", ... |
Fix login prompt button shadows and outlines | $(document).on 'ajax:error', (event, xhr, status, error) ->
if error == 'Unauthorized'
$.fancybox.open
href: '#js-login-prompt'
$('.js-login-confirm').click ->
window.location = '/auth/facebook'
$('.js-login-cancel').click ->
$.fancybox.close()
| $(document).on 'ajax:error', (event, xhr, status, error) ->
if error == 'Unauthorized'
$.fancybox.open
href: '#js-login-prompt'
scrolling: 'visible' # for button outlines and shadows
$('.js-login-confirm').click ->
window.location = '/auth/facebook'
$('.js-login-cancel').click ->
$.fancybox.clos... |
Fix platform check when rendering logo | React = require 'react'
class Header extends React.Component
@displayName = 'Header'
render: =>
<div className="header-inner">
{@_renderLogo()}
<ul className="list list-reset tabs-list">
<li className="tabs-tab active">
<a className="tabs-item">MAMP/wordpress</a>
<span... | React = require 'react'
class Header extends React.Component
@displayName = 'Header'
render: =>
<div className="header-inner">
{@_renderLogo()}
<ul className="list list-reset tabs-list">
<li className="tabs-tab active">
<a className="tabs-item">MAMP/wordpress</a>
<span... |
Send response instead of reply | # Description:
# Evaluate one line of Clojure script
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot clojure|clj <script> - Evaluate one line of Clojure script
#
# Author:
# jingweno
ringSessionID = ''
module.exports = (robot) ->
robot.hear /(\(.*\))/i, (msg)->
script = msg.ma... | # Description:
# Evaluate one line of Clojure script
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot clojure|clj <script> - Evaluate one line of Clojure script
#
# Author:
# jingweno
ringSessionID = ''
module.exports = (robot) ->
robot.hear /(\(.*\))/i, (msg)->
script = msg.ma... |
Implement docker based latex compilation. | spawn = require("child_process").spawn
exec = require("child_process").exec
logger = require "logger-sharelatex"
module.exports = DockerRunner =
_docker: 'docker'
_baseCommand: ['run', '--rm=true', '-t', '-v', '$COMPILE_DIR:/source', '--name=texlive-$PROJECT_ID', 'texlive']
run: (project_id, command, directory... | spawn = require("child_process").spawn
exec = require("child_process").exec
logger = require "logger-sharelatex"
Settings = require "settings-sharelatex"
module.exports = DockerRunner =
_docker: 'docker'
_baseCommand: ['run', '--rm=true', '-t', '-v', '$COMPILE_DIR:/source', '--name=texlive-$PROJECT_ID']
run: ... |
Fix ListString bug when pushing ListString elems | _ = require 'lodash'
assert = require 'assert'
module.exports = class ListString
string: ""
push = (how, elems...) ->
for elem in elems
if _.isArray elem
push how, elem...
else if _.isString elem
elem = _.trim elem, ' '
continue i... | _ = require 'lodash'
assert = require 'assert'
module.exports = class ListString
string: ""
push = (how, elems...) ->
for elem in elems
if _.isArray elem
push how, elem...
else if _.isString elem
elem = _.trim elem, ' '
continue i... |
Make sure there is a conversations variable | class ChatConversationListController extends CommonChatController
constructor:->
super
@getListView().on 'moveToIndexRequested', @bound 'moveItemToIndex'
addItem:(data)->
# Make sure there is one conversation with same channel name
{conversation, chatChannel} = data
for chat in @itemsOrdered
... | class ChatConversationListController extends CommonChatController
constructor:->
super
@getListView().on 'moveToIndexRequested', @bound 'moveItemToIndex'
addItem:(data)->
# Make sure there is one conversation with same channel name
{conversation, chatChannel} = data
for chat in @itemsOrdered
... |
Adjust user reloading, to ensure password is always empty | Sprangular.controller 'AccountCtrl', ($scope, $location, $routeParams, Status, Account) ->
Status.pageTitle = 'My Account'
user = Account.user
user.password = ''
user.password_confirmation = ''
$scope.editing = false
$scope.user = user
refreshAccount = ->
Account.init().then ->
$scope.user = ... | Sprangular.controller 'AccountCtrl', ($scope, $location, $routeParams, Status, Account) ->
Status.pageTitle = 'My Account'
user = Account.user
$scope.editing = false
$scope.user = user
refreshAccount = ->
Account.init().then ->
user = Account.user
user.password = ''
user.password_conf... |
Make clearer social buttons = login, not share | React = require 'react'
module.exports = React.createClass
displayName: 'YaleLogin'
render:->
return <div className="login-page">
<div className="hero-overlay-container">
<div className="hero-overlay-title">Welcome</div>
<div className="hero-overlay-text">To begin marking and transcr... | React = require 'react'
module.exports = React.createClass
displayName: 'YaleLogin'
render:->
return <div className="login-page">
<div className="hero-overlay-container">
<div className="hero-overlay-title">Welcome</div>
<div className="hero-overlay-text">To begin marking and transcr... |
Include colon as a word boundary | SpellChecker = require 'spellchecker'
module.exports =
findMisspellings: (text) ->
wordRegex = /(?:^|[\s\[\]])([a-zA-Z']+)(?=[\s\.\[\]]|$)/g
row = 0
misspellings = []
for line in text.split('\n')
while matches = wordRegex.exec(line)
word = matches[1]
continue unless SpellChecker... | SpellChecker = require 'spellchecker'
module.exports =
findMisspellings: (text) ->
wordRegex = /(?:^|[\s\[\]])([a-zA-Z']+)(?=[\s\.\[\]:]|$)/g
row = 0
misspellings = []
for line in text.split('\n')
while matches = wordRegex.exec(line)
word = matches[1]
continue unless SpellChecke... |
Include type in refs and mentions for reposts | Marbles.Views.PostActionRepost = class PostActionRepostView extends Marbles.Views.PostAction
@view_name: 'post_action_repost'
performAction: =>
post = TentStatus.Models.Post.find(cid: @parentView().post_cid)
data = {
permissions:
public: true
type: "https://tent.io/types/repost/v0##{(ne... | Marbles.Views.PostActionRepost = class PostActionRepostView extends Marbles.Views.PostAction
@view_name: 'post_action_repost'
performAction: =>
post = TentStatus.Models.Post.find(cid: @parentView().post_cid)
data = {
permissions:
public: true
type: "https://tent.io/types/repost/v0##{(ne... |
Handle scenario where toolbar items rapidly removed (Sentry 2861) | _ = require 'underscore'
React = require 'react'
classNames = require 'classnames'
{Actions,
WorkspaceStore,
FocusedContentStore} = require 'nylas-exports'
{Menu,
Popover,
RetinaImg,
InjectedComponentSet} = require 'nylas-component-kit'
class MessageToolbarItems extends React.Component
@displayName: "MessageT... | _ = require 'underscore'
React = require 'react'
classNames = require 'classnames'
{Actions,
WorkspaceStore,
FocusedContentStore} = require 'nylas-exports'
{Menu,
Popover,
RetinaImg,
InjectedComponentSet} = require 'nylas-component-kit'
class MessageToolbarItems extends React.Component
@displayName: "MessageT... |
Format link to be proper Markdown link. | username_strategy =
match: /(^|\s)@(\w*)$/;
search: (name, callback)->
search_call = $.getJSON("/user_lookup",{query: name})
search_call.done (result)->
callback( result.map (r)-> r.name)
search_call.fail -> callback([],true)
replace: (entry)->
"@#{entry} "
template: (entry)->
"@#{entr... | username_strategy =
match: /(^|\s)@(\w*)$/;
search: (name, callback)->
search_call = $.getJSON("/user_lookup", {query: name})
search_call.done (result)->
callback( result.map (r)-> r.name)
search_call.fail -> callback([],true)
replace: (entry)->
"@#{entry} "
template: (entry)->
"@#{ent... |
Add links to zh-TW and ar help manual translations | angular.module('loomioApp').factory 'UserHelpService', (CurrentUser) ->
new class UserHelpService
helpLocale: ->
switch CurrentUser.locale
when 'es', 'an', 'ca', 'gl' then 'es'
else 'en'
helpLink: ->
"https://loomio.gitbooks.io/manual/content/#{@helpLocale()}/index.html"
| angular.module('loomioApp').factory 'UserHelpService', (CurrentUser) ->
new class UserHelpService
helpLocale: ->
switch CurrentUser.locale
when 'es', 'an', 'ca', 'gl' then 'es'
when 'zh-TW' then 'zh'
when 'ar' then 'ar'
else 'en'
helpLin... |
Add resizing to toggled image panel | class CMSimple.Panels.ImageLibrary extends Mercury.Panel
@toggle: (region)->
@instance ?= new CMSimple.Panels.ImageLibrary()
@instance.toggle()
constructor: ()->
super(null, 'insertMedia', title: 'Image Library', appendTo: '.mercury-toolbar-container', closeButton: true)
@button = $('.mercury-inser... | class CMSimple.Panels.ImageLibrary extends Mercury.Panel
@toggle: (region)->
@instance ?= new CMSimple.Panels.ImageLibrary()
@instance.toggle()
constructor: ()->
super(null, 'insertMedia', title: 'Image Library', appendTo: '.mercury-toolbar-container', closeButton: true)
@button = $('.mercury-inser... |
Fix weird discussion padding bug. | #= require_tree ../../../templates/events
#= require marked
markdown = (text) ->
marked(text || '')
underscore = (text) ->
text.replace(/([a-z\d])([A-Z]+)/g, '$1_$2')
.replace(/[-\s]+/g, '_')
.toLowerCase()
endsWith = (str, suffix)->
str.indexOf(suffix, str.length - suffix.length) != -1
pluralize ... | #= require_tree ../../../templates/events
#= require marked
markdown = (text) ->
marked(text || '')
underscore = (text) ->
text.replace(/([a-z\d])([A-Z]+)/g, '$1_$2')
.replace(/[-\s]+/g, '_')
.toLowerCase()
endsWith = (str, suffix)->
str.indexOf(suffix, str.length - suffix.length) != -1
pluralize ... |
Correct Mistake in file check | fs = require('fs')
path = require('path')
Sequelize = require('sequelize')
lodash = require('lodash')
config = require('../../config/config')
db = {}
sequelize = new Sequelize config.db
fs.readdirSync(__dirname)
.filter (file) ->
~file.indexOf('.') and file != 'index.coffee'
.forEach (file) ->
model = seq... | fs = require('fs')
path = require('path')
Sequelize = require('sequelize')
lodash = require('lodash')
config = require('../../config/config')
db = {}
sequelize = new Sequelize config.db
fs.readdirSync(__dirname)
.filter (file) ->
file.indexOf('.') != 0 and file != 'index.coffee'
.forEach (file) ->
model =... |
Fix the spec bootstrap to load the package file | @pkgJson = require '../../package.json'
# Start the crash reporter before anything else.
require('crash-reporter').start(productName: @pkgJson.name, companyName: 'atom-shell-starter')
| @pkgJson = require 'package.json'
# Start the crash reporter before anything else.
require('crash-reporter').start(productName: @pkgJson.name, companyName: 'atom-shell-starter')
h1 = document.createElement 'h1'
h1.innerText = 'Spec Suite'
document.body.appendChild h1
|
Fix dictionary page letters sorting problem | class Controller
constructor: ($scope, $rootScope, $location, entryService, i18nService) ->
$rootScope.$emit 'navigationConfig',
labelForTitle: i18nService.get 'dictionaryTitle'
backAction: () ->
$location.path('/home')
entryService.all().then (entries) =>
first_letters = _.map(entr... | class Controller
constructor: ($scope, $rootScope, $location, entryService, i18nService) ->
$rootScope.$emit 'navigationConfig',
labelForTitle: i18nService.get 'dictionaryTitle'
backAction: () ->
$location.path('/home')
entryService.all().then (entries) =>
first_letters = _.map(entr... |
Resolve promise when shared_queries collection is reset | define [
'../core'
'./base'
], (c, base) ->
class QueryModel extends base.Model
class QueryCollection extends base.Collection
model: QueryModel
url: ->
c.session.url('queries')
initialize: ->
super
c.subscribe c.SESSION_OPENED, => @fetch(re... | define [
'../core'
'./base'
], (c, base) ->
class QueryModel extends base.Model
class QueryCollection extends base.Collection
model: QueryModel
url: ->
c.session.url('queries')
initialize: ->
super
c.subscribe c.SESSION_OPENED, => @fetch(re... |
Add validation before add user to db | mongo = require 'mongoskin'
uuid = require 'uuid'
DB = process.env.DBPORT || 'users'
db = mongo.db('mongodb://localhost:27017/#{DB}', {native_parser: true})
db.bind('user').bind({
getByID: (userID, callback) ->
this.findOne({userID: userID}, callback)
})
# Class for interracting with MongoDB using Mongosk... | mongo = require 'mongoskin'
uuid = require 'uuid'
DB = process.env.DBPORT || 'users'
db = mongo.db("mongodb://localhost:27017/#{DB}", {native_parser: true})
db.bind('user').bind({
getByID: (userID, callback) ->
this.findOne({userID: userID}, callback)
})
# Class for interracting with MongoDB using Mongosk... |
Add `recentV1TemplateIdsActivity` proxy to AnalyticRouter | AuthenticationController = require './../Authentication/AuthenticationController'
AnalyticsController = require('./AnalyticsController')
AnalyticsProxy = require('./AnalyticsProxy')
module.exports =
apply: (webRouter, privateApiRouter, publicApiRouter) ->
webRouter.post '/event/:event', AnalyticsController.recordEv... | AuthenticationController = require './../Authentication/AuthenticationController'
AnalyticsController = require('./AnalyticsController')
AnalyticsProxy = require('./AnalyticsProxy')
module.exports =
apply: (webRouter, privateApiRouter, publicApiRouter) ->
webRouter.post '/event/:event', AnalyticsController.recordEv... |
Add test for whether players get an emitted event. | {BattleServer} = require '../server'
{Engine} = require '../engine'
sinon = require 'sinon'
describe 'BattleServer', ->
describe '#queuePlayer', ->
it "adds a new player to the server's queue", ->
server = new BattleServer()
server.queuePlayer({})
server.queuedPlayers().should.have.length 1
... | {BattleServer} = require '../server'
{Engine} = require '../engine'
sinon = require 'sinon'
describe 'BattleServer', ->
describe '#queuePlayer', ->
it "adds a new player to the server's queue", ->
server = new BattleServer()
server.queuePlayer({})
server.queuedPlayers().should.have.length 1
... |
Fix attendance submission when clicking icon | $('input.icon-check[type="checkbox"]').each ->
elm = $(this)
icon = $('<i>', class: 'fa fa-fw clickable')
icon.insertAfter(elm)
change = ->
if elm.is(':checked')
icon.removeClass('fa-square-o').addClass('fa-check-square')
else
icon.addClass('fa-square-o').removeClass('fa-check-square')
elm... | $('input.icon-check[type="checkbox"]').each ->
elm = $(this)
icon = $('<i>', class: 'fa fa-fw clickable')
icon.insertAfter(elm)
change = ->
if elm.is(':checked')
icon.removeClass('fa-square-o').addClass('fa-check-square')
else
icon.addClass('fa-square-o').removeClass('fa-check-square')
elm... |
Load the Facebook SDK on all pages if the app ID is set and enable xfbml | # Listens for a ready event from the framework, trigger init()
# if the application ID is configured.
$(Sugar).bind "ready", ->
@Facebook.init() if @Configuration.FacebookAppId
Sugar.Facebook =
appId: false
init: ->
@appId = Sugar.Configuration.FacebookAppId
if $(".fb_button").length > 0
$(".fb_bu... | # Listens for a ready event from the framework, trigger init()
# if the application ID is configured.
$(Sugar).bind "ready", ->
@Facebook.init() if @Configuration.FacebookAppId
Sugar.Facebook =
appId: false
init: ->
@appId = Sugar.Configuration.FacebookAppId
if $(".fb_button").length > 0
$(".fb_bu... |
Make sure callback exists before binding | class Creator
update: (el) =>
model = el.getAttribute(ObserveJS.attributeName)
if model?
@create(el, model)
else
@destroy(el)
create: (el) =>
model = el.getAttribute(ObserveJS.attributeName)
if ObserveJS.cache[model]?
if el.instance?
el.instance.loaded()
retur... | class Creator
update: (el) =>
model = el.getAttribute(ObserveJS.attributeName)
if model?
@create(el, model)
else
@destroy(el)
create: (el) =>
model = el.getAttribute(ObserveJS.attributeName)
if ObserveJS.cache[model]?
if el.instance?
el.instance.loaded()
retur... |
Make action understand that timeout is in milliseconds | import callApi from '../lib/callApi'
import {getRawData} from './getters'
export GET_DATA = 'GET_DATA'
export INVALIDATE_DATA = 'INVALIDATE_DATA'
export INVALIDATE_ALL_DATA = 'INVALIDATE_ALL_DATA'
export SAVE_DATA_PROMISES = 'SAVE_DATA_PROMISES'
export LOGOUT = 'LOGOUT'
export LOGIN = 'POST_LOGIN'
export SET_UNKNOWN_... | import callApi from '../lib/callApi'
import {getRawData} from './getters'
export GET_DATA = 'GET_DATA'
export INVALIDATE_DATA = 'INVALIDATE_DATA'
export INVALIDATE_ALL_DATA = 'INVALIDATE_ALL_DATA'
export SAVE_DATA_PROMISES = 'SAVE_DATA_PROMISES'
export LOGOUT = 'LOGOUT'
export LOGIN = 'POST_LOGIN'
export SET_UNKNOWN_... |
Add a limit to file upload | $ ->
return unless $('#new_document')
$('#files_uploader').fileupload
dataType: 'json'
maxFileSize: 10000000
acceptFileTypes: /(\.|\/)(pdf|txt|doc|docx|html)$/i
#limitConcurrentUploads: 5
#progressall: (e, data) ->
#progress = parseInt(data.loaded / data.total * 100, 10)
#$('#progre... | $ ->
return unless $('#new_document')
$('#files_uploader').fileupload
dataType: 'json'
maxFileSize: 10000000
acceptFileTypes: /(\.|\/)(pdf|txt|doc|docx|html)$/i
limitConcurrentUploads: 5
|
Fix ruby like array convert | angular.module('kassa').service('ProductService',[
'$http'
'$routeParams'
($http, $routeParams)->
#handle price as a float, not a string
convert = (resp)->
products = Array(resp.data.products || resp.data.product)
for product in products
product.price = parseFloat(product.price)
... | angular.module('kassa').service('ProductService',[
'$http'
'$routeParams'
($http, $routeParams)->
#handle price as a float, not a string
convertProduct = (product)->
product.price = parseFloat(product.price)
convert = (resp)->
products = resp.data.products
if products?
conve... |
Send default size options and fix sharable terminal mode. | class SharableClientTerminalPane extends TerminalPane
constructor: (options = {}, data) ->
sessionOptions = options.sessionKey
options.vmName = sessionOptions.vmName
options.vmRegion = sessionOptions.vmRegion
options.joinUser = sessionOptions.host
options.session = sessionOptions.key
op... | class SharableClientTerminalPane extends TerminalPane
constructor: (options = {}, data) ->
sessionOptions = options.sessionKey
options.vmName = sessionOptions.vmName
options.vmRegion = sessionOptions.vmRegion
options.joinUser = sessionOptions.host
options.session = sessionOptions.key
op... |
Add event to add new playlist option | $("#post_playlist_id").select2({
language: {
noResults: () ->
term = $('.select2-search__field')[0].value || Playlist
return '<a href="http://google.com">Add '+term+ '</a>'
}
escapeMarkup:
(markup) -> return markup
});
| addnew = 'Add new playlist'
$('#post_playlist_id').append('<option>Add new playlist</option>')
matchWithNew = (params, data) ->
params.term = params.term || ''
if (data.text.indexOf(addnew) != -1 || data.text.indexOf(params.term) != -1)
return data;
return null;
formatAddNew = (data) ->
if ($('.select2-s... |
Use textContent instead of innerText | window.Tahi ||= {}
class Tahi.PlaceholderElement
constructor: (@element, options={}) ->
@placeholder = @element.attributes['placeholder'].value
$element = $(@element)
$element.on 'focus', => @clearPlaceholder()
$element.on 'blur', => @setPlaceholder()
$element.on 'keydown', (e) => @supressEnterKe... | window.Tahi ||= {}
class Tahi.PlaceholderElement
constructor: (@element, options={}) ->
@placeholder = @element.attributes['placeholder'].value
$element = $(@element)
$element.on 'focus', => @clearPlaceholder()
$element.on 'blur', => @setPlaceholder()
$element.on 'keydown', (e) => @supressEnterKe... |
Change ridiculous WebSocketRails.Event description comments. | ###
The Event object stores all the releavant information for events
that are being queued for sending to the server.
###
class WebSocketRails.Event
constructor: (data) ->
@name = data[0]
attr = data[1]
@id = (((1+Math.random())*0x10000)|0) unless attr['id']?
@channel = if attr.channel? ... | ###
The Event object stores all the relevant event information.
###
class WebSocketRails.Event
constructor: (data) ->
@name = data[0]
attr = data[1]
@id = (((1+Math.random())*0x10000)|0) unless attr['id']?
@channel = if attr.channel? then attr.channel
@data = if attr.data? then at... |
Fix Menu Link editing error on jquery autocomplete | class Georgia.Views.LinkFormContent extends Backbone.View
template: JST['links/form_content']
className: 'tab-pane'
events:
'change input': 'attributeChanged'
'change textarea': 'attributeChanged'
initialize: (options) ->
$(@el).attr 'id', "content_#{@model.cid}"
render: ->
$(@el).html(@tem... | class Georgia.Views.LinkFormContent extends Backbone.View
template: JST['links/form_content']
className: 'tab-pane'
events:
'change input': 'attributeChanged'
'change textarea': 'attributeChanged'
initialize: (options) ->
$(@el).attr 'id', "content_#{@model.cid}"
render: ->
$(@el).html(@tem... |
Tweak labels for filter button | Darkswarm.factory "FilterSelectorsService", ->
# This stores all filters so we can access in-use counts etc
# Accessed via activeSelector Directive
new class FilterSelectorsService
selectors: []
new: (obj = {})->
obj.active = false
@selectors.push obj
obj
totalActive: =>
@sele... | Darkswarm.factory "FilterSelectorsService", ->
# This stores all filters so we can access in-use counts etc
# Accessed via activeSelector Directive
new class FilterSelectorsService
selectors: []
new: (obj = {})->
obj.active = false
@selectors.push obj
obj
totalActive: =>
@sele... |
Reset sticky component before leaving the page using Turbolinks | App.FoundationExtras =
initialize: ->
$(document).foundation()
$(window).trigger "load.zf.sticky"
$(window).trigger "resize"
| 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)
|
Clear new message content on cancel. | ETahi.MessageTaskController = ETahi.TaskController.extend
newCommentBody: ""
actions:
clearMessageContent: -> null
postComment: ->
userId = Tahi.currentUser.id.toString()
commenter = @store.all('user').findBy('id', userId)
commentFields =
commenter: commenter
messageTask: ... | ETahi.MessageTaskController = ETahi.TaskController.extend
newCommentBody: ""
actions:
clearMessageContent: ->
@set('newCommentBody', "")
postComment: ->
userId = Tahi.currentUser.id.toString()
commenter = @store.all('user').findBy('id', userId)
commentFields =
commenter: co... |
Use empty className for ExtendedFact | #= require ./fact_view.js
class window.ExtendedFactView extends FactView
tagName: "section"
template: "facts/_extended_fact"
showLines: 6;
onRender: ->
super()
@renderUserPassportViews();
renderUserPassportViews: ()->
interacting_users = this.model.get('interacting_users')
for user_activ... | #= require ./fact_view.js
class window.ExtendedFactView extends FactView
tagName: "section"
className: ""
template: "facts/_extended_fact"
showLines: 6;
onRender: ->
super()
@renderUserPassportViews();
renderUserPassportViews: ()->
interacting_users = this.model.get('interacting_users')
... |
Increase margin value for use more free space on tab handler | kd = require 'kd'
KDTabView = kd.TabView
module.exports = class ApplicationTabView extends KDTabView
constructor: (options = {}, data) ->
options.resizeTabHandles ?= yes
options.lastTabHandleMargin ?= 80
options.closeAppWhenAllTabsClosed ?= yes
options.enableMoveTabHand... | kd = require 'kd'
KDTabView = kd.TabView
module.exports = class ApplicationTabView extends KDTabView
constructor: (options = {}, data) ->
options.resizeTabHandles ?= yes
options.lastTabHandleMargin ?= 90
options.closeAppWhenAllTabsClosed ?= yes
options.enableMoveTabHand... |
Return an error if room not found | Meteor.methods
getRoomIdByNameOrId: (rid) ->
if not Meteor.userId()
throw new Meteor.Error 'error-invalid-user', 'Invalid user', { method: 'getRoomIdByNameOrId' }
room = RocketChat.models.Rooms.findOneById(rid) or RocketChat.models.Rooms.findOneByName(rid)
return null unless room?
if room.usernames.index... | Meteor.methods
getRoomIdByNameOrId: (rid) ->
if not Meteor.userId()
throw new Meteor.Error 'error-invalid-user', 'Invalid user', { method: 'getRoomIdByNameOrId' }
room = RocketChat.models.Rooms.findOneById(rid) or RocketChat.models.Rooms.findOneByName(rid)
if not room?
throw new Meteor.Error 'error-not-a... |
Check for existence of hotkey label | class Ribs.KeyboardHelpView extends Backbone.View
className: "ribs-keyboard-shortcuts-overlay"
events:
'click' : "remove"
initialize: (options) ->
@views = options.views
$(window).on "keyup", @handleKeyup
remove: ->
$(window).off "keyup", @handleKeyup
super
... | class Ribs.KeyboardHelpView extends Backbone.View
className: "ribs-keyboard-shortcuts-overlay"
events:
'click' : "remove"
initialize: (options) ->
@views = options.views
$(window).on "keyup", @handleKeyup
remove: ->
$(window).off "keyup", @handleKeyup
super
... |
Add missing ngModel attribute to task-def-selector | angular.module('doubtfire.tasks.task-definition-selector',[])
#
# A switch that that the selection of a specified task definition
# Only handles task definition - not tasks in a project
#
.directive('taskDefinitionSelector', ->
replace: true
restrict: 'E'
templateUrl: 'tasks/task-definition-selector/task-definit... | angular.module('doubtfire.tasks.task-definition-selector',[])
#
# A switch that that the selection of a specified task definition
# Only handles task definition - not tasks in a project
#
.directive('taskDefinitionSelector', ->
replace: true
restrict: 'E'
templateUrl: 'tasks/task-definition-selector/task-definit... |
Set user to admin for spec | describe "Skr.Models.Customer", ->
it "can be instantiated", ->
model = new Skr.Models.Customer()
expect(model).toEqual(jasmine.any(Skr.Models.Customer))
it "sends failure messages when code isn't set", (done)->
model = new Skr.Models.Customer()
Lanes.Testing.ModelSaver.perfor... | describe "Skr.Models.Customer", ->
beforeEach ->
Lanes.Testing.ModelSaver.setUser('admin')
it "can be instantiated", ->
model = new Skr.Models.Customer()
expect(model).toEqual(jasmine.any(Skr.Models.Customer))
it "sends failure messages when code isn't set", (done)->
mode... |
Enable auto-indentation for literal blocks. | '.text.restructuredtext':
'editor':
'commentStart': '.. '
| '.text.restructuredtext':
'editor':
'commentStart': '.. '
'increaseIndentPattern': '::\\s*$'
|
Make draft mode regex global | fs = require "fs"
logger = require "logger-sharelatex"
module.exports = DraftModeManager =
injectDraftMode: (filename, callback = (error) ->) ->
fs.readFile filename, "utf8", (error, content) ->
return callback(error) if error?
modified_content = DraftModeManager._injectDraftOption content
logger.log {
... | fs = require "fs"
logger = require "logger-sharelatex"
module.exports = DraftModeManager =
injectDraftMode: (filename, callback = (error) ->) ->
fs.readFile filename, "utf8", (error, content) ->
return callback(error) if error?
modified_content = DraftModeManager._injectDraftOption content
logger.log {
... |
Add optional schema test for empty arrays | assert = require 'assert'
joi = require 'joi'
schema = require '../../../coffee/helper/schema'
data =
grupper : require '../../data/gruppe.json'
bilder : require '../../data/bilde.json'
turer : require '../../data/tur.json'
områder : require '../../data/omrade.json'
steder : require '../../data/ste... | assert = require 'assert'
joi = require 'joi'
schema = require '../../../coffee/helper/schema'
data =
grupper : require '../../data/gruppe.json'
bilder : require '../../data/bilde.json'
turer : require '../../data/tur.json'
områder : require '../../data/omrade.json'
steder : require '../../data/ste... |
Refresh a page automatically, without using turbolinks. | #= require jquery
#= require jquery_ujs
#= require_self
autoRefreshInterval = 3000
timeout = undefined
scrollToBottom = ($container) ->
if $container.length > 0
$container.scrollTop($container[0].scrollHeight)
toggleRefreshButton = ->
$('#auto-refresh').toggleClass('active')
$('#auto-refresh i').toggleCla... | #= require jquery
#= require jquery_ujs
#= require_self
autoRefreshInterval = 3000
timeout = undefined
scrollToBottom = ($container) ->
if $container.length > 0
$container.scrollTop($container[0].scrollHeight)
toggleRefreshButton = ->
$('#auto-refresh').toggleClass('active')
$('#auto-refresh i').toggleCla... |
Add a native confirm dialog | BlockView = Backbone.View.extend(
tagName: 'li'
className: 'ui-model-blocks'
events:
'click i.block-param': 'paramBlock'
'click i.block-remove': 'removeBlock'
initialize: (options) ->
@block = options.block
@height = options.height
@direction = options.direction || 'height'
@displayClass... | BlockView = Backbone.View.extend(
tagName: 'li'
className: 'ui-model-blocks'
events:
'click i.block-param': 'paramBlock'
'click i.block-remove': 'confirmRemoveBlock'
initialize: (options) ->
@block = options.block
@height = options.height
@direction = options.direction || 'height'
@displ... |
Remove auth tokens from task completion url | angular.module("doubtfire.api.models.task-completion-csv", [])
.service("TaskCompletionCsv", (DoubtfireConstants, $window, currentUser, fileDownloaderService) ->
this.downloadFile = (unit) ->
fileDownloaderService.downloadFile "#{DoubtfireConstants.API_URL}/csv/units/#{unit.id}/task_completion.json?auth_token=#{... | angular.module("doubtfire.api.models.task-completion-csv", [])
.service("TaskCompletionCsv", (DoubtfireConstants, $window, currentUser, fileDownloaderService) ->
this.downloadFile = (unit) ->
fileDownloaderService.downloadFile "#{DoubtfireConstants.API_URL}/csv/units/#{unit.id}/task_completion.json", "#{unit.nam... |
Add Authentication via API key | Organization = require "../../models/organization"
# Need to support authentication via Organization API key as well
module.exports = (req, res, next) ->
if req.session.org_id
Organization.findById req.session.org_id, (err, org)->
req.org = org
req.session.org_id = org.id
next()
else
res... | Organization = require "../../models/organization"
# Need to support authentication via Organization API key as well
module.exports = (req, res, next) ->
unauthorzed = ->
if req.xhr
res.send 403
else
res.redirect('/login')
if api_key = req.query.api_key
Organization.findOne {api_key: api_... |
FIX bug in coffeescript code when no preloader | PlayScene =
preload: ->
create: ->
update: ->
game = new Phaser.Game 640, 480, Phaser.AUTO, 'game'
game.state.add 'play', PlayScene
game.state.start.play
| PlayScene =
preload: ->
create: ->
update: ->
game = new Phaser.Game 640, 480, Phaser.AUTO, 'game'
game.state.add 'play', PlayScene
game.state.start 'play'
|
Disable for now, lets keep conversations with users own name. | class ChatConversationListItemTitle extends JView
constructor:(options = {}, data)->
options.cssClass = 'chat-item'
data = [nick for nick in data when nick isnt KD.nick()].first
super
viewAppended:->
invitees = @getData()
@accounts = []
for invitee in invitees
KD.remote.cacheable i... | class ChatConversationListItemTitle extends JView
constructor:(options = {}, data)->
options.cssClass = 'chat-item'
# data = [nick for nick in data when nick isnt KD.nick()].first
super
viewAppended:->
invitees = @getData()
@accounts = []
for invitee in invitees
KD.remote.cacheable... |
Hide tabs unless current user | window.ReactUserTabs = React.createBackboneClass
render: ->
spaced_middle_dot = " \u00b7 "
_div ['main-region-tabs'],
_a [
'active' if @props.page == 'about'
rel: 'backbone'
href: "/#{@model().get('username')}"
],
'About'
spaced_middle_dot
_a [
... | window.ReactUserTabs = React.createBackboneClass
render: ->
return _span() unless FactlinkApp.isCurrentUser @model()
spaced_middle_dot = " \u00b7 "
_div ['main-region-tabs'],
_a [
'active' if @props.page == 'about'
rel: 'backbone'
href: "/#{@model().get('username')}"
... |
Remove hover class when leaving the drop zone. | ignoreEvent = (event) ->
event.stopPropagation()
event.preventDefault()
class @JackUp.DragAndDrop
constructor: (@droppableElement, @processor) ->
@droppableElement
.bind("dragenter", @_drag)
.bind("drop", @_drop)
.bind("drop", @_dragOut)
_drag: (event) =>
ignoreEvent event
event.... | ignoreEvent = (event) ->
event.stopPropagation()
event.preventDefault()
class @JackUp.DragAndDrop
constructor: (@droppableElement, @processor) ->
@droppableElement
.bind("dragenter", @_dragEnter)
.bind("dragleave", @_dragLeave)
.bind("drop", @_drop)
_dragEnter: (event) =>
ignoreEvent... |
Revert the slow fade :) | Backbone.Factlink ||= {}
class Backbone.Factlink.CrossFadeRegion extends Backbone.Marionette.Region
defaultFadeTime = 560
initialize: -> @on 'close', -> @$el?.stop()
crossFade: (newView) ->
if @currentView
@$el.stop().fadeOut(@_fadeTime(), => @show newView)
else
@show(newView)
open: (vi... | Backbone.Factlink ||= {}
class Backbone.Factlink.CrossFadeRegion extends Backbone.Marionette.Region
defaultFadeTime = 560
initialize: -> @on 'close', -> @$el?.stop()
crossFade: (newView) ->
if @currentView
@$el.stop().fadeOut(@_fadeTime(), => @show newView)
else
@show(newView)
open: (vi... |
Make editable and track changes | define (require) ->
$ = require('jquery')
Mathjax = require('mathjax')
BaseView = require('cs!helpers/backbone/views/base')
template = require('hbs!./body-template')
require('less!./body')
return class MediaBodyView extends BaseView
template: template
events:
'click .solution > .ui-toggle-wr... | define (require) ->
$ = require('jquery')
Mathjax = require('mathjax')
BaseView = require('cs!helpers/backbone/views/base')
template = require('hbs!./body-template')
require('less!./body')
return class MediaBodyView extends BaseView
template: template
events:
'click .solution > .ui-toggle-wr... |
Fix fetching replies for conversation view | TentStatus.Models.StatusPost = class StatusPostModel extends TentStatus.Models.Post
@model_name: 'status_post'
@post_type: new TentClient.PostType(TentStatus.config.POST_TYPES.STATUS)
@validate: (attrs, options = {}) ->
errors = []
if (attrs.content?.text and attrs.content.text.match /^[\s\r\t]*$/) || (... | TentStatus.Models.StatusPost = class StatusPostModel extends TentStatus.Models.Post
@model_name: 'status_post'
@post_type: new TentClient.PostType(TentStatus.config.POST_TYPES.STATUS)
@validate: (attrs, options = {}) ->
errors = []
if (attrs.content?.text and attrs.content.text.match /^[\s\r\t]*$/) || (... |
Fix one thing with s3 | AWS = Meteor.require 'aws-sdk'
AWS.config.update
'accessKeyId' : "AKIAJ4QROL3BSAMJTI7Q",
'secretAccessKey' : "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",
'region' : "us-west-2"
s3 = new AWS.S3()
bucket = "d2mpclient"
Meteor.startup ->
s3.listBuckets {}, (err, data)->
console.log "=== buckets ==... | AWS = Meteor.require 'aws-sdk'
bucket = "d2mpclient"
AWS.config.update
'accessKeyId' : "AKIAJ4QROL3BSAMJTI7Q",
'secretAccessKey' : "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",
'region' : "us-west-2"
s3 = new AWS.S3()
Meteor.startup ->
s3.listBuckets {}, (err, data)->
console.log "client bucket:... |
Use ExerciseCard component with all content shown | _ = require 'underscore'
React = require 'react'
{ExerciseCardMixin} = require '../task-plan/homework/exercises'
{ExerciseStore} = require '../../flux/exercise'
String = require '../../helpers/string'
Exercise = React.createClass
mixins: [ExerciseCardMixin]
propTypes:
exercise: React.PropTypes.object.isRequ... | _ = require 'underscore'
React = require 'react'
{ExerciseStore} = require '../../flux/exercise'
String = require '../../helpers/string'
ExerciseCard = require '../exercise-card'
Exercise = React.createClass
propTypes:
exercise: React.PropTypes.object.isRequired
renderHeader: ->
<div className='pools'>
... |
Move css setup to window.coffee | require 'coffee-react/register'
require "#{ROOT}/views/env"
# i18n
{join} = require 'path-extra'
window.i18n = {}
window.i18n.main = new(require 'i18n-2')
locales: ['en-US', 'ja-JP', 'zh-CN', 'zh-TW']
defaultLocale: 'zh-CN'
directory: join(__dirname, 'assets', 'i18n')
extension: '.json'
updateFiles: false
... | require 'coffee-react/register'
require "#{ROOT}/views/env"
# i18n
{join} = require 'path-extra'
window.i18n = {}
window.i18n.main = new(require 'i18n-2')
locales: ['en-US', 'ja-JP', 'zh-CN', 'zh-TW']
defaultLocale: 'zh-CN'
directory: join(__dirname, 'assets', 'i18n')
extension: '.json'
updateFiles: false
... |
Use preventDefault instead of returning false (less implicit) | popupCenter = (url, width, height, name) ->
left = (screen.width/2)-(width/2)
top = (screen.height/2)-(height/2)
window.open(url, name, "menubar=no,toolbar=no,status=no,width=#{width},height=#{height},toolbar=no,left=#{left},top=#{top}")
$("span.social-services-button a.popup").click((e) ->
popupCenter($(this)... | popupCenter = (url, width, height, name) ->
left = (screen.width/2)-(width/2)
top = (screen.height/2)-(height/2)
window.open(url, name, "menubar=no,toolbar=no,status=no,width=#{width},height=#{height},toolbar=no,left=#{left},top=#{top}")
$("span.social-services-button a.popup").click((e) ->
popupCenter($(this)... |
Fix profile graph x-axis scaling | jQuery ->
percentageFormatter = (x) -> x * 100.0 + "%"
$('.tournament.plot').each (i, element) ->
element_id = $(element).attr('id')
data = $.parseJSON($(element).attr('data-ratings'))
options = {
series: {
lines: { show: true }
},
yaxis: {
min: 0.0,
max: 0.0,
... | jQuery ->
percentageFormatter = (x) -> x * 100.0 + "%"
$('.tournament.plot').each (i, element) ->
element_id = $(element).attr('id')
data = $.parseJSON($(element).attr('data-ratings'))
options = {
series: {
lines: { show: true }
},
yaxis: {
min: 0.0,
max: 0.0,
... |
Set newBody property when rendering errors | #= require ./renderer
class Turbolinks.ErrorRenderer extends Turbolinks.Renderer
constructor: (@html) ->
render: (callback) ->
@renderView =>
@replaceDocumentHTML()
@activateBodyScriptElements()
callback()
replaceDocumentHTML: ->
document.documentElement.innerHTML = @html
activateB... | #= require ./renderer
class Turbolinks.ErrorRenderer extends Turbolinks.Renderer
constructor: (html) ->
htmlElement = document.createElement("html")
htmlElement.innerHTML = html
@newHead = htmlElement.querySelector("head")
@newBody = htmlElement.querySelector("body")
render: (callback) ->
@ren... |
Adjust text so there's a space after "Delete Assignment" | React = require 'react'
BS = require 'react-bootstrap'
{TaskPlanStore} = require '../../../flux/task-plan'
buildTooltip = ({isPublished}) ->
saveMessage = if isPublished
<div>
<p>
<strong>Save</strong> will update the assignment.
</p>
</div>
else
<div>
<p>
<strong>Publ... | React = require 'react'
BS = require 'react-bootstrap'
{TaskPlanStore} = require '../../../flux/task-plan'
buildTooltip = ({isPublished}) ->
saveMessage = if isPublished
<div>
<p>
<strong>Save</strong> will update the assignment.
</p>
</div>
else
<div>
<p>
<strong>Publ... |
Use parse in EvidenceCollection to add the correct model | class window.EvidenceCollection extends Backbone.Collection
comparator: (evidence) ->
# TODO: breaks with relevance > 1000
-parseFloat(evidence.get('opinions')?.formatted_relevance || '0.0');
model: (attrs, options) ->
switch attrs.evidence_type
when 'FactRelation'
new FactRelation attrs,... | class window.EvidenceCollection extends Backbone.Collection
comparator: (evidence) ->
# TODO: breaks with relevance > 1000
-parseFloat(evidence.get('opinions')?.formatted_relevance || '0.0');
parse: (data) ->
results = []
_.each data, (item) =>
switch item.evidence_type
when 'FactRela... |
Update door tablet weather information | RefreshWeather = (options) ->
options = options or {}
options.elem = options.elem or "#weather-general"
options.update_interval = options.update_interval or FAST_UPDATE
elem = jq options.elem
update_interval = null
setWeatherInfo = (icon, temperature) ->
elem.html "<img src='/homecontroller/static/ima... | RefreshWeather = (options) ->
options = options or {}
options.elem = options.elem or "#weather-general"
options.update_interval = options.update_interval or FAST_UPDATE
elem = jq options.elem
update_interval = null
setWeatherInfo = (icon, temperature) ->
elem.html "<img src='/homecontroller/static/byo... |
Change decorateMarker to invalidate on changes | MixedIndentWarningView = require './mixed-indent-warning-view'
IndentChecker = require '../lib/indent-checker'
{CompositeDisposable} = require 'atom'
module.exports = MixedIndentWarning =
editor: null
mixedIndentWarningView: null
modalPanel: null
subscriptions: null
activate: (state) ->
# Events subscri... | MixedIndentWarningView = require './mixed-indent-warning-view'
IndentChecker = require '../lib/indent-checker'
{CompositeDisposable} = require 'atom'
module.exports = MixedIndentWarning =
editor: null
mixedIndentWarningView: null
modalPanel: null
subscriptions: null
activate: (state) ->
# Events subscri... |
Fix for reusing UserList (.model not guaranteed now) | Controller = require 'lib/controller'
User = require 'models/user'
Users = require 'models/users'
BasicSettingsView = require 'views/settings/basic'
UsersList = require 'views/users/list'
module.exports = class SettingsController extends Controller
basic: ->
@adjustTitle 'Settings'
@view = new BasicSettingsV... | Controller = require 'lib/controller'
User = require 'models/user'
Users = require 'models/users'
BasicSettingsView = require 'views/settings/basic'
UsersList = require 'views/users/list'
module.exports = class SettingsController extends Controller
basic: ->
@adjustTitle 'Settings'
@view = new BasicSettingsV... |
Rename .ctags file to ctags-config in unpack list | asar = require 'asar'
fs = require 'fs'
path = require 'path'
module.exports = (grunt) ->
{cp, rm} = require('./task-helpers')(grunt)
grunt.registerTask 'generate-asar', 'Generate asar archive for the app', ->
done = @async()
unpack = [
'*.node'
'.ctags'
'ctags-darwin'
'ctags-linu... | asar = require 'asar'
fs = require 'fs'
path = require 'path'
module.exports = (grunt) ->
{cp, rm} = require('./task-helpers')(grunt)
grunt.registerTask 'generate-asar', 'Generate asar archive for the app', ->
done = @async()
unpack = [
'*.node'
'ctags-config'
'ctags-darwin'
'ctag... |
Allow all the homepage rail! | module.exports = """
query($showHeroUnits: Boolean!) {
home_page {
artwork_modules(
max_rails: 7,
order: [
ACTIVE_BIDS,
RECENTLY_VIEWED_WORKS
RECOMMENDED_WORKS,
FOLLOWED_ARTISTS,
RELATED_ARTISTS,
FOLLOWED_GALLERIES,
SAVED_... | module.exports = """
query($showHeroUnits: Boolean!) {
home_page {
artwork_modules(
max_rails: -1,
max_followed_gene_rails: -1,
order: [
ACTIVE_BIDS,
RECENTLY_VIEWED_WORKS
RECOMMENDED_WORKS,
FOLLOWED_ARTISTS,
RELATED_ARTISTS,
... |
Remove 'Workspace from here' menu item unless machine is mine. | class IDE.FinderContextMenuController extends NFinderContextMenuController
getFolderMenu: (fileView) ->
fileData = fileView.getData()
items =
Expand :
action : "expand"
separator : yes
Collapse :
... | class IDE.FinderContextMenuController extends NFinderContextMenuController
getFolderMenu: (fileView) ->
fileData = fileView.getData()
items =
Expand :
action : "expand"
separator : yes
Collapse :
... |
Fix alternate title not being updated on switching between anime pages. | Hummingbird.BootstrapTooltipComponent = Ember.Component.extend
tagName: 'a'
didInsertElement: ->
@$().tooltip
placement: @get('placement')
title: @get('title')
| Hummingbird.BootstrapTooltipComponent = Ember.Component.extend
tagName: 'a'
initializeTooltip: (->
@$().tooltip
placement: @get('placement')
title: @get('title')
).on('didInsertElement')
updateTooltip: (->
@$().tooltip 'destroy'
@initializeTooltip()
).observes('title', 'placement')
|
Check if opElement exists before setting in manage users search | #= require "../users/new"
$ ->
if isOnPage 'manage', 'users'
mconf.Resources.addToBind ->
mconf.Users.New.bind()
window.onpopstate = (event) ->
window.location.href = mconf.Base.urlFromParts(event.state)
event.state
$('input.resource-filter-field').each ->
input = $(this)
... | #= require "../users/new"
$ ->
if isOnPage 'manage', 'users'
mconf.Resources.addToBind ->
mconf.Users.New.bind()
window.onpopstate = (event) ->
window.location.href = mconf.Base.urlFromParts(event.state)
event.state
$('input.resource-filter-field').each ->
input = $(this)
... |
Refactor PlayerController to use states | Yossarian.PlayerController = Ember.Controller.extend
artists: null
currentRecording: null
lastRecording: null
recordings: (->
@get('artists').toArray().map((artist) -> artist.get('recordings')).flatten().uniq().shuffle()
).property('artists.@each.recordings.@each')
playing: (->
@get('currentRec... | Yossarian.PlayerController = Ember.Controller.extend
states: { stopped: 0, playing: 1 }
artists: null
currentRecording: null
currentState: 0
recordings: (->
@get('artists').map((artist) -> artist.get('recordings').toArray().shuffle()[0..1]).flatten().sortBy('id')
).property('artists.@each... |
Check active element when store it | {CompositeDisposable} = require 'atom'
{$, View} = require 'space-pen'
module.exports = class ToolBarButtonView extends View
@content: ->
@button class: 'btn btn-default tool-bar-btn'
initialize: (options) ->
@subscriptions = new CompositeDisposable
@priority = options.priority
if options.toolti... | {CompositeDisposable} = require 'atom'
{$, View} = require 'space-pen'
module.exports = class ToolBarButtonView extends View
@content: ->
@button class: 'btn btn-default tool-bar-btn'
initialize: (options) ->
@subscriptions = new CompositeDisposable
@priority = options.priority
if options.toolti... |
Implement resizer that sets outer size of frame to inner control size |
class ControlIframe
constructor: ->
@el = document.createElement('iframe')
#need to append to outer document before we can access frame document.
FactlinkJailRoot.$factlinkCoreContainer.append(@el)
@$el = $(@el)
@doc = @el.contentWindow.document;
@doc.open()
#need doctype to avoid quirks ... |
class ControlIframe
constructor: ->
@el = document.createElement('iframe')
#need to append to outer document before we can access frame document.
FactlinkJailRoot.$factlinkCoreContainer.append(@el)
@$el = $(@el)
@doc = @el.contentWindow.document;
@doc.open()
#need doctype to avoid quirks ... |
Fix bug in code that repopulated the input field | Chamber.Views.Rooms ||= {}
class Chamber.Views.Rooms.ShowView extends Backbone.View
template: JST["backbone/templates/rooms/show"]
events: {
"click input[type=submit]": "doSubmit",
}
initialize: ->
@messages_index_view = new Chamber.Views.Messages.IndexView(
{
el: $("#messages", @el... | Chamber.Views.Rooms ||= {}
class Chamber.Views.Rooms.ShowView extends Backbone.View
template: JST["backbone/templates/rooms/show"]
events: {
"click input[type=submit]": "doSubmit",
}
initialize: ->
@messages_index_view = new Chamber.Views.Messages.IndexView(
{
el: $("#messages", @el... |
Add copy icon to keymaps in package view | _ = require 'underscore-plus'
{$$$, View} = require 'atom'
# Displays the keybindings for a package namespace
module.exports =
class PackageKeymapView extends View
@content: ->
@section =>
@div class: 'section-heading icon icon-keyboard', 'Keybindings'
@table class: 'package-keymap-table table native... | path = require 'path'
_ = require 'underscore-plus'
{$, $$$, View} = require 'atom'
# Displays the keybindings for a package namespace
module.exports =
class PackageKeymapView extends View
@content: ->
@section =>
@div class: 'section-heading icon icon-keyboard', 'Keybindings'
@table class: 'package-... |
Implement the different modes of the StepInterpolator | _ = require "underscore"
Transform = require "./transform"
Interpolator = require "./interpolator"
p = require "../../core/properties"
class StepInterpolator extends Interpolator.Model
initialize: (attrs, options) ->
super(attrs, options)
props: ->
return _.extend {}, super(), {
mode: [ p.String, ... | _ = require "underscore"
Transform = require "./transform"
Interpolator = require "./interpolator"
p = require "../../core/properties"
class StepInterpolator extends Interpolator.Model
initialize: (attrs, options) ->
super(attrs, options)
props: ->
return _.extend {}, super(), {
mode: [ p.String, ... |
Make publishing and viewing templates separate features | Settings = require 'settings-sharelatex'
module.exports = Features =
externalAuthenticationSystemUsed: ->
Settings.ldap? or Settings.saml? or Settings.overleaf?.oauth?
hasFeature: (feature) ->
switch feature
when 'homepage'
return Settings.enableHomepage
when 'registration'
return not Features.ext... | Settings = require 'settings-sharelatex'
module.exports = Features =
externalAuthenticationSystemUsed: ->
Settings.ldap? or Settings.saml? or Settings.overleaf?.oauth?
hasFeature: (feature) ->
switch feature
when 'homepage'
return Settings.enableHomepage
when 'registration'
return not Features.ext... |
Make sure count chart + preview always show the same thing |
svg = require 'svg.js'
AppConfig = require 'shared/services/app_config.coffee'
angular.module('loomioApp').directive 'progressChart', ->
template: '<div class="progress-chart"></div>'
replace: true
scope:
stanceCounts: '='
goal: '='
size: '@'
restrict: 'E'
controller: ['$scope', '$element'... |
svg = require 'svg.js'
AppConfig = require 'shared/services/app_config.coffee'
angular.module('loomioApp').directive 'progressChart', ->
template: '<div class="progress-chart"></div>'
replace: true
scope:
stanceCounts: '='
goal: '='
size: '@'
restrict: 'E'
controller: ['$scope', '$element'... |
Update Intercom / Segment integration | module.exports = loadSegmentio = if not me.useSocialSignOn() then -> Promise.resolve([]) else _.once ->
return new Promise (accept, reject) ->
analytics = window.analytics = window.analytics or []
analytics.invoked = true
analytics.methods = [
'trackSubmit'
'trackClick'
'trackLink'
... | module.exports = loadSegmentio = if not me.useSocialSignOn() then -> Promise.resolve([]) else _.once ->
return new Promise (accept, reject) ->
analytics = window.analytics = window.analytics or []
analytics.invoked = true
analytics.methods = [
'trackSubmit'
'trackClick'
'trackLink'
... |
Fix non-working button after converted from link | # Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
# See the LICENCE file in the repository root for full licence text.
import * as React from 'react'
import { button, div, i } from 'react-dom-factories'
el = React.createElement
export class UserEntry extends Reac... | # Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
# See the LICENCE file in the repository root for full licence text.
import * as React from 'react'
import { button, div, i } from 'react-dom-factories'
el = React.createElement
export class UserEntry extends Reac... |
Make it possible to pass S3 service to Uploader. | {EventEmitter} = require 'events'
aws = require 'aws-sdk'
class Uploader extends EventEmitter
# Constructor
constructor: ({accessKey, secretKey, sessionToken, region, stream, objectName, objectParams, bucket, partSize, maxBufferSize, waitForPartAttempts, waitTime, debug}, @cb) ->
super()
aws.co... | {EventEmitter} = require 'events'
aws = require 'aws-sdk'
class Uploader extends EventEmitter
# Constructor
constructor: ({accessKey, secretKey, sessionToken, region, stream, objectName, objectParams, bucket, partSize, maxBufferSize, waitForPartAttempts, waitTime, service, debug}, @cb) ->
super()
... |
Fix broken syntax in multiple angular files | window.Darkswarm = angular.module("Darkswarm", [
'ngResource',
'mm.foundation',
'LocalStorageModule',
'infinite-scroll',
'angular-flash.service',
'templates',
'ngSanitize',
'ngAnimate',
'uiGmapgoogle-maps',
'duScroll',
'angularFileUpload',
'angularSlideables'
]).config ($httpProvider, $tooltipPr... | window.Darkswarm = angular.module("Darkswarm", [
'ngResource',
'mm.foundation',
'LocalStorageModule',
'infinite-scroll',
'angular-flash.service',
'templates',
'ngSanitize',
'ngAnimate',
'uiGmapgoogle-maps',
'duScroll',
'angularFileUpload',
'angularSlideables'
]).config ($httpProvider, $tooltipPr... |
Fix image javascript in safari | class PhotoGallery
constructor: (options) ->
@$el = options.el
@thumbnails = options.thumbnails
@project = options.project
setup: ->
for thumbnail in @thumbnails
new Thumbnail({ el: @$el, thumbnail: thumbnail, project: @project }).listen()
class Thumbnail
constructor: (option... | class PhotoGallery
constructor: (options) ->
@$el = options.el
@thumbnails = options.thumbnails
@project = options.project
setup: ->
for thumbnail in @thumbnails
new Thumbnail({ el: @$el, thumbnail: thumbnail, project: @project }).listen()
class Thumbnail
constructor: (option... |
Fix chart object being destroyed | # 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/
draw_scoreboard = ->
if !document.getElementById('scoreboard_graph')
return
$.get 'teams/get_score_... | # 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/
draw_scoreboard = (chart) ->
if !document.getElementById('scoreboard_graph')
return
$.get 'teams/ge... |
Make notifyOnError handler try to parse response as JSON | AjaxPrefix.addAjaxPrefix(jQuery, -> CMS.prefix)
@CMS =
Models: {}
Views: {}
prefix: $("meta[name='path_prefix']").attr('content')
_.extend CMS, Backbone.Events
$ ->
Backbone.emulateHTTP = true
$.ajaxSetup
headers : { 'X-CSRFToken': $.cookie 'csrftoken' }
dataType: 'json'
$(document).ajaxError ... | AjaxPrefix.addAjaxPrefix(jQuery, -> CMS.prefix)
@CMS =
Models: {}
Views: {}
prefix: $("meta[name='path_prefix']").attr('content')
_.extend CMS, Backbone.Events
$ ->
Backbone.emulateHTTP = true
$.ajaxSetup
headers : { 'X-CSRFToken': $.cookie 'csrftoken' }
dataType: 'json'
$(document).ajaxError ... |
Fix unnecessary loading of categories in map route. | Wheelmap.MapRoute = Ember.Route.extend
setupController: (controller, model)->
@_super(controller, model)
@controllerFor('toolbar').set('content', @store.findAll('category'))
renderTemplate: (controller, model)->
@render 'index',
outlet: 'map' | Wheelmap.MapRoute = Ember.Route.extend
setupController: (controller, model)->
@_super(controller, model)
toolbarController = @controllerFor('toolbar')
unless toolbarController.get('model') instanceof DS.PromiseArray
toolbarController.set('model', @store.findAll('category'))
renderTemplate: (con... |
Document reason for exception in the console. | gravatar_url = (email_address) ->
hash = CryptoJS.MD5 email_address.trim().toLowerCase()
"http://www.gravatar.com/avatar/" + hash + "?d=404&s=50"
Template.profilePage.onRendered ->
url = gravatar_url(Template.parentData().emails[0].address)
HTTP.get url, (error, response) ->
if not error
$('#gravatar... | gravatar_url = (email_address) ->
hash = CryptoJS.MD5 email_address.trim().toLowerCase()
"http://www.gravatar.com/avatar/" + hash + "?d=404&s=50"
Template.profilePage.onRendered ->
url = gravatar_url(Template.parentData().emails[0].address)
HTTP.get url, (error, response) ->
# If you're wondering why there... |
Add permissions prop to manage steps | 'use strict'
React = require 'react'
ManageStepsView = require './ManageStepsView'
{ connect } = require 'react-redux'
{ loadStepsByProject } = require 'appirio-tech-client-app-layer'
ManageSteps = React.createClass
propTypes:
projectId: React.PropTypes.string.isRequired
co... | 'use strict'
React = require 'react'
ManageStepsView = require './ManageStepsView'
{ connect } = require 'react-redux'
{ loadStepsByProject } = require 'appirio-tech-client-app-layer'
ManageSteps = React.createClass
propTypes:
projectId: React.PropTypes.string.isRequired
p... |
Update `shipping-rate-selection` to use `Order.shippingAddress` directly | Sprangular.directive 'shippingRateSelection', ->
restrict: 'E'
templateUrl: 'shipping/rates.html'
scope:
order: '='
controller: ($scope, Checkout, Env) ->
$scope.loading = false
$scope.address = {}
$scope.currencySymbol = Env.currency.symbol
$scope.$watch 'order.shippingRate', (rate, oldRa... | Sprangular.directive 'shippingRateSelection', ->
restrict: 'E'
templateUrl: 'shipping/rates.html'
scope:
order: '='
controller: ($scope, Checkout, Env) ->
$scope.loading = false
$scope.address = {}
$scope.currencySymbol = Env.currency.symbol
$scope.$watch 'order.shippingRate', (rate, oldRa... |
Clean textarea when add a translation | jQuery ->
$('#form-translation textarea').autosize()
$('.add-translation').click (event) ->
event.preventDefault()
$('#form-translation #locale').val('')
$('#form-translation #key').val('')
$('#form-translation #value').trigger('autosize')
$('#form-translation #value').focus()
$('.edit-trans... | jQuery ->
$('#form-translation textarea').autosize()
$('.add-translation').click (event) ->
event.preventDefault()
$('#form-translation #locale').val('')
$('#form-translation #key').val('')
$('#form-translation #value').val('')
$('#form-translation #value').trigger('autosize')
$('#form-tran... |
Fix translation in different pages context | $ ->
selectors = [
# newsletter modal
'.subscribe-banner'
'.modal-title'
'.modal-body p'
'.modal-body .button-add.wide'
# default view
'.read-more'
'.older-posts'
'.newer-posts'
'.poweredby'
# post view
'footer .button-add.large.wide'
'a.post-meta'
'.prefix-date... | $ ->
selectors = [
# newsletter modal
'.subscribe-banner'
'.modal-title'
'.modal-body p'
'.modal-body .button-add.wide'
# default view
'.read-more'
'.older-posts'
'.newer-posts'
'.poweredby'
# post view
'footer .button-add.large.wide'
'a.post-meta'
'.prefix-dat... |
Work around for lodash -> index | module.exports =
karma: true,
shims:
underscore: {exports: '_'}
backbone: {exports: 'Backbone', deps: ['underscore']}
'backbone-orm': {exports: 'BackboneORM', deps: ['backbone', 'stream']}
'parameters': {exports: '__test__parameters__', deps: ['backbone-orm']}
post_load: 'window._ = window.Backbon... | module.exports =
karma: true,
shims:
underscore: {exports: '_'}
backbone: {exports: 'Backbone', deps: ['underscore']}
'backbone-orm': {exports: 'BackboneORM', deps: ['backbone', 'stream']}
'parameters': {exports: '__test__parameters__', deps: ['backbone-orm']}
post_load: 'window._ = window.Backbon... |
Update output of 'pb last' | # Description:
# <placeholder>
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# <placeholder>
#
# Author:
# dualmoon
if not process.env.HUBOT_PUSHBULLET_API_KEY
console.log "HUBOT_PUSHBULLET_API_KEY was not set! This plugin won't work!"
else
apiKey = process.env.HUBOT_PUSHBULLET_API_KEY... | # Description:
# <placeholder>
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# <placeholder>
#
# Author:
# dualmoon
if not process.env.HUBOT_PUSHBULLET_API_KEY
console.log "HUBOT_PUSHBULLET_API_KEY was not set! This plugin won't work!"
else
apiKey = process.env.HUBOT_PUSHBULLET_API_KEY... |
Add current_opinion getter to FactRelation | class window.FactRelation extends Backbone.Model
defaults:
evidence_type: 'FactRelation'
setOpinion: (type) ->
$.ajax
url: @url() + "/opinion/" + type
success: (data) =>
mp_track "Evidence: opinionate",
type: type
evidence_id: @id
@set data
type: "po... | class window.FactRelation extends Backbone.Model
defaults:
evidence_type: 'FactRelation'
setOpinion: (type) ->
$.ajax
url: @url() + "/opinion/" + type
success: (data) =>
mp_track "Evidence: opinionate",
type: type
evidence_id: @id
@set data
type: "po... |
Add a toggle to show / not show user list | # See https://atom.io/docs/latest/creating-a-package#menus for more details
'context-menu':
'atom-workspace': [
# { 'label': 'Enable Floobits', 'command': 'Floobits: Join Workspace' }
# { 'label': 'Enable Floobits', 'command': 'Floobits: Join Recent Workspace' }
]
'menu': [
{
'label': 'Packages'
... | # See https://atom.io/docs/latest/creating-a-package#menus for more details
'context-menu':
'atom-workspace': [
# { 'label': 'Enable Floobits', 'command': 'Floobits: Join Workspace' }
# { 'label': 'Enable Floobits', 'command': 'Floobits: Join Recent Workspace' }
]
'menu': [
{
'label': 'Packages'
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.