Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Fix handling of multiple GA tracking numbers | define (require) ->
Backbone = require('backbone')
settings = require('settings')
# Class to handle loading analytics scripts and wrapping
# handlers around them so that modules don't have to
# interact with global variables directly
return new class AnalyticsHandler
constructor: () ->
# Setup te... | define (require) ->
Backbone = require('backbone')
settings = require('settings')
# Class to handle loading analytics scripts and wrapping
# handlers around them so that modules don't have to
# interact with global variables directly
return new class AnalyticsHandler
constructor: () ->
# Setup te... |
Fix improperly named snippet prefix | # Paper Input components snippets
".text.html":
"paper-input-container":
"prefix": "paper-input"
"body": """
<paper-input-container id="$1">
<label>${2:Input label}</label>
<input is="iron-input"$3>
</paper--container>
"""
"paper input error":
"prefix": "paper-input-error"
"... | # Paper Input components snippets
".text.html":
"paper-input-container":
"prefix": "paper-input-container"
"body": """
<paper-input-container id="$1">
<label>${2:Input label}</label>
<input is="iron-input"$3>
</paper--container>
"""
"paper input error":
"prefix": "paper-input-er... |
Include resource expansion in middleware route def processing | Router = require 'routes'
_ = require 'lodash'
noService = require './noService'
resolve = require './resolve'
makeRouter = require './makeRouter'
# Given a collection of route defs with resolved law services
# and a request object, return an object containing the service,
# and the HTTP request-extracted arguments ... | Router = require 'routes'
_ = require 'lodash'
noService = require './noService'
resolve = require './resolve'
makeRouter = require './makeRouter'
expandResources = require './expandResources'
# Given a collection of route defs with resolved law services
# and a request object, return an object containing the servic... |
Use $ to match end of string | module.exports =
processResponse: (res) ->
# Check to see if the contentype is "something/json" or
# "something/somethingelse+json"
if res.contentType and (/^.*\/(?:.*\+)?json(;|\z)/i).test res.contentType
# If the body hasn't been parsed yet, parse it.
raw = if typeof res.body is 'string' the... | module.exports =
processResponse: (res) ->
# Check to see if the contentype is "something/json" or
# "something/somethingelse+json"
if res.contentType and (/^.*\/(?:.*\+)?json(;|$)/i).test res.contentType
# If the body hasn't been parsed yet, parse it.
raw = if typeof res.body is 'string' then... |
Use spaces instead of tabs for coffeescript indent | # 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://jashkenas.github.com/coffee-script/
if window.location.pathname.match(/\/apply$/)
$ ->
changeSection = (e, noscroll)->
h... | if window.location.pathname.match(/\/apply$/)
$ ->
changeSection = (e, noscroll)->
hash = window.location.hash
sectionId = hash.substring 1
$('.section').each ()->
section = $ @
if section.attr('id') is sectionId
section.toggleClass 'hide', false
else
... |
Revert "Clean dropdown binding code" | define ['jquery', 'semantic', 'utils', 'charts'], ($, semantic, utils, charts) ->
currentCity = utils.getCookie('city')
availableCity = ['Guangzhou', 'Beijing', 'Shanghai', 'Chengdu', 'Shenyang']
currentCity = 'Guangzhou' if currentCity not in availableCity
charts.renderChart currentCity
# listen city click... | define ['jquery', 'semantic', 'utils', 'charts'], ($, semantic, utils, charts) ->
currentCity = utils.getCookie('city')
availableCity = ['Guangzhou', 'Beijing', 'Shanghai', 'Chengdu', 'Shenyang']
currentCity = 'Guangzhou' if currentCity not in availableCity
charts.renderChart currentCity
# listen city click... |
Use path, since required it | # DocPad Configuration File
# http://docpad.org/docs/config
path = require 'path'
#@poweredByDocPad = false
@templateData =
site:
title: "My Website"
getPreparedTitle: ->
if @document.title
"#{@document.title} | #{@site.title}"
else
@site.title
@collections =
pages: ->
@getCollect... | # DocPad Configuration File
# http://docpad.org/docs/config
path = require 'path'
#@poweredByDocPad = false
@templateData =
site:
title: "My Website"
getPreparedTitle: ->
if @document.title
"#{@document.title} | #{@site.title}"
else
@site.title
@collections =
pages: ->
@getCollect... |
Refactor inserting help text into stack template editor | BaseStackEditorView = require './basestackeditorview'
module.exports = class StackTemplateEditorView extends BaseStackEditorView
constructor: (options = {}, data) ->
unless options.content
options.content = require '../defaulttemplate'
super options, data
ace = @getAce()
@once 'EditorRea... | BaseStackEditorView = require './basestackeditorview'
module.exports = class StackTemplateEditorView extends BaseStackEditorView
constructor: (options = {}, data) ->
unless options.content
options.content = require '../defaulttemplate'
super options, data
if options.showHelpContent
@onc... |
Destroy guest when the embedder is gone | ipc = require 'ipc'
webContents = require 'web-contents'
webViewManager = null # Doesn't exist in early initialization.
nextInstanceId = 0
guestInstances = {}
# Generate guestInstanceId.
getNextInstanceId = (webContents) ->
++nextInstanceId
# Create a new guest instance.
createGuest = (embedder, params) ->
webV... | ipc = require 'ipc'
webContents = require 'web-contents'
webViewManager = null # Doesn't exist in early initialization.
nextInstanceId = 0
guestInstances = {}
# Generate guestInstanceId.
getNextInstanceId = (webContents) ->
++nextInstanceId
# Create a new guest instance.
createGuest = (embedder, params) ->
webV... |
Send only on finish event | noflo = require 'noflo'
animated = require 'animated-gif-detector'
fs = require 'fs'
# @runtime noflo-nodejs
# @name DetectAnimatedGif
exports.getComponent = ->
c = new noflo.Component
c.icon = 'expand'
c.description = 'Detect if a given GIF is animated'
c.inPorts.add 'buffer',
datatype: 'all'
descri... | noflo = require 'noflo'
animated = require 'animated-gif-detector'
fs = require 'fs'
# @runtime noflo-nodejs
# @name DetectAnimatedGif
exports.getComponent = ->
c = new noflo.Component
c.icon = 'expand'
c.description = 'Detect if a given GIF is animated'
c.inPorts.add 'buffer',
datatype: 'all'
descri... |
Fix feed removal - get user id by calling meteors user method | Feeds = require '/imports/collections/feeds'
{ regexEscape } = require '/imports/utils'
Meteor.methods
addFeed: (feed) ->
url = feed.url
user = Meteor.user()
urlWithoutProtocol = url.replace(/^https?\:\/\//i, '');
regex = new RegExp "^https?:\/\/#{regexEscape(urlWithoutProtocol)}"
if Feeds.findOn... | Feeds = require '/imports/collections/feeds'
{ regexEscape } = require '/imports/utils'
Meteor.methods
addFeed: (feed) ->
url = feed.url
user = Meteor.user()
urlWithoutProtocol = url.replace(/^https?\:\/\//i, '');
regex = new RegExp "^https?:\/\/#{regexEscape(urlWithoutProtocol)}"
if Feeds.findOn... |
Use deferred to ensure render order for chart | class Workbench.Views.DatastreamShowView extends Backbone.View
template: JST["workbench/workbench/templates/datastream"]
tagName: "li"
className: "datastream"
initialize: ->
@chartView = new Workbench.Views.DatastreamChartView
model: @model
@latestView = new Workbench.Views.DatastreamLatestView... | class Workbench.Views.DatastreamShowView extends Backbone.View
template: JST["workbench/workbench/templates/datastream"]
tagName: "li"
className: "datastream"
initialize: ->
@renderDeferred = $.Deferred()
@chartView = new Workbench.Views.DatastreamChartView
model: @model
@latestView = new ... |
Update test using set content-type | {assert} = require 'chai'
{Uploader} = require '../../src/uploader'
describe 'Small file upload @integration test', ->
source = undefined
uploader = undefined
before (done) ->
source = new Buffer "first\nsecond\nthird\n"
uploader = new Uploader
accessKey: process.env.AWS_S3_ACCESS_KEY
se... | {assert} = require 'chai'
{Uploader} = require '../../src/uploader'
describe 'Small file upload @integration test', ->
source = undefined
uploader = undefined
before (done) ->
source = new Buffer "key;value\ntest;1\nexample;2\n"
uploader = new Uploader
accessKey: process.env.AWS_S3_ACCESS_KEY
... |
Add missing ? to conditional | window.Backbone ||= {}
window.Backbone.Views ||= {}
class Backbone.Views.SectionView extends Backbone.Diorama.NestingView
template: Handlebars.templates['section.hbs']
tagName: 'section'
className: 'section-view'
events:
"click .add-narrative": "addNarrative"
"click .add-visualisation": "addVisualisat... | window.Backbone ||= {}
window.Backbone.Views ||= {}
class Backbone.Views.SectionView extends Backbone.Diorama.NestingView
template: Handlebars.templates['section.hbs']
tagName: 'section'
className: 'section-view'
events:
"click .add-narrative": "addNarrative"
"click .add-visualisation": "addVisualisat... |
Fix for rendering server errors in new Form mixin | _ = require 'underscore'
module.exports =
render: ->
# Prepare any submit buttons for Ladda
@$btn = @$('.ladda-button').ladda()
# Automatically focus the first visible input
_.defer =>
@$('.form-control:visible').eq(0).focus()
formParams: ->
# Uses jQuery formParams, but don't try to co... | _ = require 'underscore'
module.exports =
render: ->
# Prepare any submit buttons for Ladda
@$btn = @$('.ladda-button').ladda()
# Automatically focus the first visible input
_.defer =>
@$('.form-control:visible').eq(0).focus()
formParams: ->
# Uses jQuery formParams, but don't try to co... |
Allow overriding get/set from props | class Skr.Components.PrintFormChooser extends Lanes.React.Component
propTypes:
label: React.PropTypes.string
model: Lanes.PropTypes.Model.isRequired
mixins: [
Lanes.React.Mixins.ReadEditingState
]
onChange: ->
(f) => @invoice.form = f
renderEdit: (value) ->
... | class Skr.Components.PrintFormChooser extends Lanes.React.Component
propTypes:
label: React.PropTypes.string.isRequired
model: Lanes.PropTypes.Model.isRequired
choices: React.PropTypes.array
mixins: [
Lanes.React.Mixins.ReadEditingState
]
onChange: (val) ->
if ... |
Make sure to execute the next filter. | app = require('../config/app').app
io = require('socket.io').listen(app)
RepositorySchema = require('../models/repository').RepositorySchema
io.sockets.on 'connection', (socket) ->
RepositorySchema.pre 'save', (next) ->
console.log 'socket.io sending repository event'
socket.emit 'repository... | app = require('../config/app').app
io = require('socket.io').listen(app)
RepositorySchema = require('../models/repository').RepositorySchema
io.sockets.on 'connection', (socket) ->
RepositorySchema.pre 'save', (next) ->
console.log 'socket.io sending repository event'
socket.emit 'repository... |
Fix url normalization for Windows | mkdirp = require 'mkdirp'
fs = require 'fs'
#
# Convenient method for writing a file on
# a path that might not exist. This function
# will create all folders provided in the
# path to the file.
#
#
# writeToFile('/tmp/hi/folder/file.js', "console.log('hi')")
#
# will create a file at /tmp/hi/folder/file.js with... | mkdirp = require 'mkdirp'
fs = require 'fs'
#
# Convenient method for writing a file on
# a path that might not exist. This function
# will create all folders provided in the
# path to the file.
#
#
# writeToFile('/tmp/hi/folder/file.js', "console.log('hi')")
#
# will create a file at /tmp/hi/folder/file.js with... |
Add title to the chart | $ ->
data = [
name: 'Original'
participants: 100
conversions: 45
color: '#00aa00'
,
name: 'Variation'
participants: 100
conversions: 50
color: 'blue'
]
variations = []
variations.push new App.Variation item.name, item.color, item.participants, item.conversions for item in data
calculato... | $ ->
data =
title: 'Original vs Variation'
variations: [
name: 'Original'
participants: 100
conversions: 45
color: '#00aa00'
,
name: 'Variation'
participants: 100
conversions: 50
color: '#0000ff'
]
variations = []
variations.push new App.Variation item.name, item.color, item... |
Fix for new layout builder in Panel. | class IDE.Panel extends KDView
constructor: (options = {}, data) ->
options.cssClass = KD.utils.curry 'panel', options.cssClass
super options, data
@panesContainer = []
@panes = []
@panesByName = {}
@createLayout()
createLayout: ->
{layoutOptions} = @getOptions()
u... | class IDE.Panel extends KDView
constructor: (options = {}, data) ->
options.cssClass = KD.utils.curry 'panel', options.cssClass
super options, data
@panesContainer = []
@panes = []
@panesByName = {}
@createLayout()
createLayout: ->
{layoutOptions} = @getOptions()
... |
Make IR query reactive when smart event is edited | SmartEvents = require '/imports/collections/smartEvents'
Incidents = require '/imports/collections/incidentReports'
#Allow multiple modals or the suggested locations list won't show after the
#loading modal is hidden
Modal.allowMultiple = true
Template.smartEvent.onCreated ->
@editState = new ReactiveVar false
@ev... | SmartEvents = require '/imports/collections/smartEvents'
Incidents = require '/imports/collections/incidentReports'
#Allow multiple modals or the suggested locations list won't show after the
#loading modal is hidden
Modal.allowMultiple = true
Template.smartEvent.onCreated ->
@editState = new ReactiveVar false
@ev... |
Remove 'partials' from module name of student plagiarism list | angular.module('doubtfire.units.partials.unit-student-plagiarism-list',[])
#
# List of all possible plagiarism detected in student's work
#
.directive('unitStudentPlagiarismList', ->
replace: true
restrict: 'E'
templateUrl: 'units/unit-student-plagiarism-list/unit-student-plagiarism-list.tpl.html'
controller: ... | angular.module('doubtfire.units.unit-student-plagiarism-list',[])
#
# List of all possible plagiarism detected in student's work
#
.directive('unitStudentPlagiarismList', ->
replace: true
restrict: 'E'
templateUrl: 'units/unit-student-plagiarism-list/unit-student-plagiarism-list.tpl.html'
controller: ($scope, ... |
Comment why we have this method | {Emitter} = require 'event-kit'
{KeyboardLayoutObserver} = require '../build/Release/keyboard-layout-observer.node'
emitter = new Emitter
observer = new KeyboardLayoutObserver -> emitter.emit 'did-change-current-keyboard-layout', getCurrentKeyboardLayout()
getCurrentKeyboardLayout = ->
observer.getCurrentKeyboardLa... | {Emitter} = require 'event-kit'
{KeyboardLayoutObserver} = require '../build/Release/keyboard-layout-observer.node'
emitter = new Emitter
observer = new KeyboardLayoutObserver -> emitter.emit 'did-change-current-keyboard-layout', getCurrentKeyboardLayout()
getCurrentKeyboardLayout = ->
observer.getCurrentKeyboardLa... |
Make sure there is one conversation with same channel name in the conversation list | class ChatConversationListController extends CommonChatController
constructor:->
super
@getListView().on 'moveToIndexRequested', @bound 'moveItemToIndex'
# loadItems:(callback)->
# super
# @me.fetchFollowersWithRelationship {}, {}, (err, accounts)=>
# @instantiateListItems accounts unless e... | class ChatConversationListController extends CommonChatController
constructor:->
super
@getListView().on 'moveToIndexRequested', @bound 'moveItemToIndex'
addItem:(data)->
# Make sure there is one conversation with same channel name
{chatChannel} = data
for chat in @itemsOrdered
return i... |
Fix corgi bomb backend url | # Description:
# Corgime
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot corgi me - Receive a corgi
# hubot corgi bomb N - get N corgis
#
# Author:
# alexgodin
module.exports = (robot) ->
robot.respond /corgi me/i, (msg) ->
msg.http("http://corginator.herokuapp.com/random")
... | # Description:
# Corgime
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot corgi me - Receive a corgi
# hubot corgi bomb N - get N corgis
#
# Author:
# alexgodin
module.exports = (robot) ->
robot.respond /corgi me/i, (msg) ->
msg.http("http://corginator.herokuapp.com/random")
... |
Remove unnecessary do nesting; there are no private variables in this scope. | Backbone.Factlink ||= {}
do ->
#options:
# parentView: marionette view
# tooltipViewFactory: -> view
# selector: selector identifying what can be hovered over.
# $offsetParent: a dom node within which to position the
# tooltip with respect to the target (hovered) node. By
# default, uses parent... | Backbone.Factlink ||= {}
#options:
# parentView: marionette view
# tooltipViewFactory: -> view
# selector: selector identifying what can be hovered over.
# $offsetParent: a dom node within which to position the
# tooltip with respect to the target (hovered) node. By
# default, uses parentView.$el.
Backbone.... |
Fix bad spec: children is a function and it should actually assert the collection view not to be empty | describe 'Body', ->
Body = require '../lib/javascripts/body'
view = null
initView = ({ collection } = {}) ->
collection ?= new Backbone.Collection [
{ foo: 'foo', bar: 'bar' }
]
view = new Body { collection }
showView = ->
initView(arguments...).render()
afterEach ->
view?.destro... | describe 'Body', ->
Body = require '../lib/javascripts/body'
view = null
initView = ({ collection } = {}) ->
collection ?= new Backbone.Collection [
{ foo: 'foo', bar: 'bar' }
]
view = new Body { collection }
showView = ->
initView(arguments...).render()
afterEach ->
view?.destro... |
Remove slide animation for alerts | # This is a manifest file that'll be compiled into including all the files listed below.
# Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
# be included in the compiled file accessible from http://example.com/assets/application.js
# It's not advisable to add code directly he... | # This is a manifest file that'll be compiled into including all the files listed below.
# Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
# be included in the compiled file accessible from http://example.com/assets/application.js
# It's not advisable to add code directly he... |
Add default Librato source as "test" | Client = require 'librato'
module.exports = new Client \
process.env.LIBRATO_USER, \
process.env.LIBRATO_TOKEN, \
prefix: process.env.LIBRATO_PREFIX, source: process.env.DOTCLOUD_SERVICE_ID
| Client = require 'librato'
module.exports = new Client \
process.env.LIBRATO_USER, \
process.env.LIBRATO_TOKEN, \
prefix: process.env.LIBRATO_PREFIX, source: process.env.DOTCLOUD_SERVICE_ID or 'test'
|
Fix up the stress tester | # vim: ts=2:sw=2:sta
io = require('socket.io-client')
url = process.env.TEST_TARGET || 'https://snap-backend-dev.herokuapp.com' #'http://localhost:8080'
users = process.env.USERS || 50
randWord = (len) ->
Math.random().toString(36).substr(2, len)
startPlayer = (name) ->
socket = io(url, {multiplex: false})
s... | # vim: ts=2:sw=2:sta
io = require('socket.io-client')
url = process.env.TEST_TARGET || 'https://snap-backend-dev.herokuapp.com' #'http://localhost:8080'
users = process.env.USERS || 50
WORD_CHARS = "abcdefghijklmnopqrstuvwxyz"
randWord = (len) ->
word = ""
for c in [1..len]
index = Math.floor(Math.random() ... |
Add some things to Message | module.exports =
class Message
constructor: (@type, @message, @options={}) ->
getType: -> @type
getMessage: -> @message
isClosable: ->
!!@options.closable
getIcon: ->
return @options.icon if @options.icon?
switch @type
when 'fatal' then 'flame'
when 'error' then 'bug'
when 'w... |
# Experimental: This will likely change, do not use.
module.exports =
class Message
constructor: (@type, @message, @options={}) ->
getOptions: -> @options
getType: -> @type
getMessage: -> @message
getDetail: -> @optons.detail
isClosable: ->
!!@options.closable
getIcon: ->
return @options.ic... |
Add shift-modified keys to Shortcut script | # *************************************
#
# Shortcut
# -> Trigger clicking an element after keyup
#
# *************************************
#
# Dependencies
# - Orientation.keyCodes
#
# *************************************
#
# @param $element { jQuery object }
# @param dataAttribute { string }
# @param ke... | # *************************************
#
# Shortcut
# -> Trigger clicking an element after keyup
#
# *************************************
#
# Dependencies
# - Orientation.keyCodes
#
# *************************************
#
# @param $element { jQuery object }
# @param dataAttribute { string }
# @param ke... |
Update AssetGallery definition to be compatible with CS 1.3.3 | ###
Welcome to AssetGallery -- http://github.com/ewr/AssetGallery
###
# stub console.log() for IE
if !window.console
class window.console
@log: ->
AssetGallery ?= {}
| ###
Welcome to AssetGallery -- http://github.com/ewr/AssetGallery
###
# stub console.log() for IE
if !window.console
class window.console
@log: ->
window.AssetGallery ?= {}
|
Add indentation auto detection to Atom | packages: [
"autocomplete-python"
"fold-functions"
"language-ini"
"linter"
"linter-pep8"
"linter-python-pep8"
"markdown-preview-plus"
"package-sync"
"python-indent"
]
| packages: [
"auto-detect-indentation"
"autocomplete-python"
"fold-functions"
"language-ini"
"linter"
"linter-pep8"
"linter-python-pep8"
"markdown-preview-plus"
"package-sync"
"python-indent"
]
|
Add setting for proposed "Show Wrap Icon" option | "*":
editor:
tabLength: 4
fontFamily: "Menlo"
softTabs: false
autoIndentOnPaste: false
invisibles: {}
lineHeight: 1.3
fontSize: 11
core:
themes: [
"atom-light-ui"
"phoenix-syntax"
]
disabledPackages: [
"snippets"
"SFTP-deployment"
"spell-check"
... | "*":
editor:
tabLength: 4
fontFamily: "Menlo"
softTabs: false
autoIndentOnPaste: false
invisibles: {}
lineHeight: 1.3
fontSize: 11
core:
themes: [
"atom-light-ui"
"phoenix-syntax"
]
disabledPackages: [
"snippets"
"SFTP-deployment"
"spell-check"
... |
Use AWM tiles for small sensor map | class Workbench.Views.SensorMapView extends Backbone.Marionette.ItemView
template: false
initialize: ->
@zoom = 13
onDestroy: ->
@map.remove() if @map
onShow: ->
if @el.id is ""
console.warn "No Map Element"
else
@location = [@model.get("latitude"), @model.get("longitude")]
... | class Workbench.Views.SensorMapView extends Backbone.Marionette.ItemView
template: false
initialize: ->
@zoom = 13
onDestroy: ->
@map.remove() if @map
onShow: ->
if @el.id is ""
console.warn "No Map Element"
else
@location = [@model.get("latitude"), @model.get("longitude")]
... |
Support logging correctly when msg is mutated | window.Tahi ||= {}
Tahi.utils =
toCamel: (string) ->
string.replace /(\-[a-z])/g, ($1) ->
$1.toUpperCase().replace "-", ""
windowHistory: ->
window.history
bindColumnResize: ->
$(window).off('resize.columns').on 'resize.columns', =>
@resizeColumnHeaders()
resizeColumnHeaders: ->
$... | window.Tahi ||= {}
Tahi.utils =
toCamel: (string) ->
string.replace /(\-[a-z])/g, ($1) ->
$1.toUpperCase().replace "-", ""
windowHistory: ->
window.history
bindColumnResize: ->
$(window).off('resize.columns').on 'resize.columns', =>
@resizeColumnHeaders()
resizeColumnHeaders: ->
$... |
Add watch support + use grunt variable expansion | module.exports = (lineman) ->
config:
loadNpmTasks: lineman.config.application.loadNpmTasks.concat('grunt-coffeelint')
prependTasks:
common: lineman.config.application.prependTasks.common.concat('coffeelint')
coffeelint:
app: [
lineman.config.files.coffee.app
]
| module.exports = (lineman) ->
config:
loadNpmTasks: lineman.config.application.loadNpmTasks.concat('grunt-coffeelint')
prependTasks:
common: lineman.config.application.prependTasks.common.concat('coffeelint')
coffeelint:
app: ["<%= files.coffee.app %>", "<%= files.coffee.spec %>"]
watch... |
Fix redirects for cf problems | React = require('react')
import { withRouter, Redirect } from 'react-router'
import stripLabel from '../lib/stripLabel'
import withLang from '../lib/withLang'
correctUrl = (url, lang) ->
if not url.startsWith("/material/")
return url
url = stripLabel(url)
if lang == "ru"
return url.replac... | React = require('react')
import { withRouter, Redirect } from 'react-router'
import stripLabel from '../lib/stripLabel'
import withLang from '../lib/withLang'
correctUrl = (url, lang) ->
if not url.startsWith("/material/")
return url
url = stripLabel(url)
if lang == "ru"
return url #.repl... |
Hide menu items in non-latex environment. | 'context-menu':
'atom-text-editor': [
{
'label': 'Sync PDF'
'command': 'latex-friend:syncpdf'
}
{
'label': 'Show structure'
'command': 'latex-friend:showNavigation'
}
{
'label': 'Show structure pane'
'command': 'latex-friend:showNavigationPane'
}
{
... | 'context-menu':
'atom-text-editor[data-grammar*="text tex"]': [
{
'label': 'Sync PDF'
'command': 'latex-friend:syncpdf'
}
{
'label': 'Show structure'
'command': 'latex-friend:showNavigation'
}
{
'label': 'Show structure pane'
'command': 'latex-friend:showNavigat... |
Make build script work on Win32. | require 'coffee-script/register'
gulp = require 'gulp'
coffee = require 'gulp-coffee'
mocha = require 'gulp-mocha'
shell = require 'gulp-shell'
gulp.task 'coffee', ->
gulp.src(['retro.coffee', 'libretro_h.coffee'])
.pipe(coffee())
.pipe(gulp.dest '.')
gulp.task 'mocha', ['gyp', 'coffee'], ->
gulp.src(['test.co... | require 'coffee-script/register'
gulp = require 'gulp'
coffee = require 'gulp-coffee'
mocha = require 'gulp-mocha'
shell = require 'gulp-shell'
gulp.task 'coffee', ->
gulp.src(['retro.coffee', 'libretro_h.coffee'])
.pipe(coffee())
.pipe(gulp.dest '.')
gulp.task 'mocha', ['gyp', 'coffee'], ->
gulp.src(['test.co... |
Fix bug with off screen images | imagesLoaded = require 'imagesloaded'
module.exports = class Backdrop
constructor: ({ @$el, @$window, @$body }) ->
# Wait for images to load before scaling
@$el.imagesLoaded =>
@scale()
scale: ->
[width, height] = dimensions = @dimensions()
@$el
.addClass('is-ready')
.css
... | imagesLoaded = require 'imagesloaded'
module.exports = class Backdrop
constructor: ({ @$el, @$window, @$body }) ->
# Wait for images to load before scaling
@$el.imagesLoaded => @scale()
scale: ->
{ width, height } = dimensions = @dimensions()
@$el
.addClass('is-ready')
.css
tr... |
Configure webpack dev server to accept connections from mobile | 'use strict'
pkg = require './package.json'
node_modules = __dirname + '/node_modules'
ExtractTextPlugin = require('extract-text-webpack-plugin')
environment = process.env.NODE_ENV
module.exports =
cache : true
resolve : extensions: ['', '.cjsx', '.coffee', '.js', '.json', '... | 'use strict'
pkg = require './package.json'
node_modules = __dirname + '/node_modules'
ExtractTextPlugin = require('extract-text-webpack-plugin')
environment = process.env.NODE_ENV
module.exports =
cache : true
resolve : extensions: ['', '.cjsx', '.coffee', '.js', '.json', '... |
Allow links to still 'work' within tr[data-target] | # http://stackoverflow.com/questions/4214731/coffeescript-global-variables
root = exports ? this
root.decorate_minus_button = (e) ->
e.click ->
target_name = $(this).data('for')
target = $('input#'+target_name)
min = if target.attr('min') then target.attr('min') else 0
if target.val()
val = Math... | # http://stackoverflow.com/questions/4214731/coffeescript-global-variables
root = exports ? this
root.decorate_minus_button = (e) ->
e.click ->
target_name = $(this).data('for')
target = $('input#'+target_name)
min = if target.attr('min') then target.attr('min') else 0
if target.val()
val = Math... |
Fix broken editor link for new media | define [
'jquery'
'underscore'
'backbone'
'marionette'
'cs!collections/media-types'
'cs!helpers/enable-dnd'
'hbs!templates/workspace/content/search-results-item'
], ($, _, Backbone, Marionette, mediaTypes, enableContentDragging, searchResultsItemTemplate) ->
# Search Result Views (workspace)
# ------... | define [
'jquery'
'underscore'
'backbone'
'marionette'
'cs!collections/media-types'
'cs!helpers/enable-dnd'
'hbs!templates/workspace/content/search-results-item'
], ($, _, Backbone, Marionette, mediaTypes, enableContentDragging, searchResultsItemTemplate) ->
# Search Result Views (workspace)
# ------... |
Move gulp watch to top level task | gulp = require 'gulp'
webserver = require 'gulp-webserver'
coffee = require 'gulp-coffee'
concat = require 'gulp-concat'
filter = require 'gulp-filter'
uglify = require 'gulp-uglify'
main_bf = require 'main-bower-files'
gulp.task 'webserver', ->
gulp.src './'
.pipe webserver
livereload: ... | gulp = require 'gulp'
webserver = require 'gulp-webserver'
coffee = require 'gulp-coffee'
concat = require 'gulp-concat'
filter = require 'gulp-filter'
uglify = require 'gulp-uglify'
main_bf = require 'main-bower-files'
gulp.task 'webserver', ->
gulp.src './'
.pipe webserver
livereload: ... |
Add profile to server account create user | Meteor.startup ->
Accounts.urls.resetPassword = (token) ->
Meteor.absoluteUrl('reset-password/' + token)
AccountsEntry =
settings: {}
config: (appConfig) ->
@settings = _.extend(@settings, appConfig)
@AccountsEntry = AccountsEntry
Meteor.methods
entryValidateSignupCode: (signupCode) ->... | Meteor.startup ->
Accounts.urls.resetPassword = (token) ->
Meteor.absoluteUrl('reset-password/' + token)
AccountsEntry =
settings: {}
config: (appConfig) ->
@settings = _.extend(@settings, appConfig)
@AccountsEntry = AccountsEntry
Meteor.methods
entryValidateSignupCode: (signupCode) ->... |
Set various dotfile file types using the file-types package in atom. | "*":
"exception-reporting":
userId: "1e725750-c66d-33e4-9fce-f627ac32bde5"
"release-notes":
viewedVersion: "0.94.0"
welcome:
showOnStartup: false
metrics:
userId: "c2f08243ecb4a9bc44bd9e46d4f067086d9357e3"
editor:
fontSize: 11
showInvisibles: true
showIndentGuide: true
invisibl... | "*":
"exception-reporting":
userId: "1e725750-c66d-33e4-9fce-f627ac32bde5"
"release-notes":
viewedVersion: "0.94.0"
welcome:
showOnStartup: false
metrics:
userId: "c2f08243ecb4a9bc44bd9e46d4f067086d9357e3"
editor:
fontSize: 11
showInvisibles: true
showIndentGuide: true
invisibl... |
Add equalHeights to Startup cards | initialize = () ->
$markets = $("#startup_market_list")
$markets.tokenInput "http://api.angel.co/1/search?type=MarketTag",
crossDomain: true,
queryParam: "query",
prePopulate: $markets.data('pre'),
theme: "facebook",
tokenLimit: 3,
tokenValue: "name"
$ ->
$body = $('bod... | $ ->
$body = $('body')
bodyClass = $body.attr 'class'
routes = ['startups-new', 'startups-edit']
if bodyClass in ['startups-new', 'startups-edit']
$markets = $("#startup_market_list")
$markets.tokenInput "http://api.angel.co/1/search?type=MarketTag",
crossDomain: true,
... |
Use new status bar tile API | {$, View} = require 'atom-space-pen-views'
{CompositeDisposable} = require 'atom'
ImageEditor = require './image-editor'
module.exports =
class ImageEditorStatusView extends View
@content: ->
@div class: 'status-image inline-block', =>
@span class: 'image-size', outlet: 'imageSizeStatus'
initialize: (@s... | {$, View} = require 'atom-space-pen-views'
{CompositeDisposable} = require 'atom'
ImageEditor = require './image-editor'
module.exports =
class ImageEditorStatusView extends View
@content: ->
@div class: 'status-image inline-block', =>
@span class: 'image-size', outlet: 'imageSizeStatus'
initialize: (@s... |
Clarify wording in comment about routing deprecated event URLs | parse_pararms = (querystring) ->
params = {}
querystring = querystring.split('&')
for qs in querystring
continue if not qs
pair = qs.split('=')
params[decodeURIComponent pair[0]] = decodeURIComponent pair[1]
params
Meteor.Router.add
'/': ->
Session.set('params', parse_pararms @querystring)
... | parse_pararms = (querystring) ->
params = {}
querystring = querystring.split('&')
for qs in querystring
continue if not qs
pair = qs.split('=')
params[decodeURIComponent pair[0]] = decodeURIComponent pair[1]
params
Meteor.Router.add
'/': ->
Session.set('params', parse_pararms @querystring)
... |
Fix ptrotractor missing coffee files | config =
seleniumAddress: 'http://localhost:4444/wd/hub'
specs: [
'docs/app/src/**/.coffee'
]
module.exports = config | config =
seleniumAddress: 'http://localhost:4444/wd/hub'
specs: [
'docs/app/src/**/*.coffee'
]
module.exports = config |
Rename selector ivar to source | PEG = require 'pegjs'
fsUtils = require 'fs-utils'
module.exports =
class TextMateScopeSelector
@parser: null
@createParser: ->
unless TextMateScopeSelector.parser?
patternPath = require.resolve('text-mate-scope-selector-pattern.pegjs')
TextMateScopeSelector.parser = PEG.buildParser(fsUtils.read(p... | PEG = require 'pegjs'
fsUtils = require 'fs-utils'
module.exports =
class TextMateScopeSelector
@parser: null
@createParser: ->
unless TextMateScopeSelector.parser?
patternPath = require.resolve('text-mate-scope-selector-pattern.pegjs')
TextMateScopeSelector.parser = PEG.buildParser(fsUtils.read(p... |
Fix md editor on event creation | initYandexShare = (element) -> setTimeout (() -> Ya.share2(element)), 0
$ ->
simplemdeId = document.querySelectorAll('.edit_event')[0].id
if simplemdeId?
new SimpleMDE
element: document.getElementById("event_description")
indentWithTabs: false
promptURLs: true
spellChecker: false
... | initYandexShare = (element) -> setTimeout (() -> Ya.share2(element)), 0
$ ->
simplemdeId = document.querySelectorAll('.edit_event')[0]?.id
simplemdeId ||= document.getElementById('new_event')?.id
if simplemdeId?
new SimpleMDE
element: document.getElementById("event_description")
indentWithTabs: ... |
Replace jquery deprecated .live with .on | class CommitsList
@data =
ref: null
limit: 0
offset: 0
@disable = false
@showProgress: ->
$('.loading').show()
@hideProgress: ->
$('.loading').hide()
@init: (ref, limit) ->
$(".day-commits-table li.commit").live 'click', (event) ->
if event.target.nodeName != "A"
locat... | class CommitsList
@data =
ref: null
limit: 0
offset: 0
@disable = false
@showProgress: ->
$('.loading').show()
@hideProgress: ->
$('.loading').hide()
@init: (ref, limit) ->
$("body").on "click", ".day-commits-table li.commit", (event) ->
if event.target.nodeName != "A"
... |
Remove transition end for MS and Opera | #= require utensils/utensils
class utensils.Detect
# Describes browser detection for transition end events
# utensils.Detect.transition.end
# utensils.Detect.hasTransition
@transition = (=>
transitionEnd = (->
el = document.createElement("tranny")
transEndEventNames =
WebkitTransition:... | #= require utensils/utensils
class utensils.Detect
# Describes browser detection for transition end events
# utensils.Detect.transition.end
# utensils.Detect.hasTransition
@transition = (=>
transitionEnd = (->
el = document.createElement("tranny")
transEndEventNames =
WebkitTransition:... |
Fix reversed events hash for ConceptSearch, add autocomplete handler | define [
'../core'
'../search'
], (c, search)->
# Takes a collection of concepts to filter/get the concept model instances
# for rendering
class ConceptSearch extends search.Search
className: 'concept-search search'
events:
'input typeahead:selected': 'focusConcept'
... | define [
'../core'
'../search'
], (c, search)->
# Takes a collection of concepts to filter/get the concept model instances
# for rendering
class ConceptSearch extends search.Search
className: 'concept-search search'
events:
'typeahead:selected input': 'focusConcept'
... |
Fix header cells string cell className spec | describe 'HeaderCells StringCell', ->
HeaderCell = require '../../lib/javascripts/header-cells/string-cell'
initView = ({ model } = {}) ->
model ?= new Backbone.Model label: 'header cell label'
new HeaderCell { model }
showView = ->
initView(arguments...).render()
it 'renders the label', ->
e... | describe 'HeaderCells StringCell', ->
HeaderCell = require '../../lib/javascripts/header-cells/string-cell'
initView = ({ model } = {}) ->
model ?= new Backbone.Model label: 'header cell label'
new HeaderCell { model }
showView = ->
initView(arguments...).render()
it 'renders the label', ->
e... |
Add call to super in QueryModel parse() method | define [
'../core'
'./base'
], (c, base) ->
class QueryModel extends base.Model
parse: (attrs) ->
if attrs? and not attrs.shared_users?
attrs.shared_users = []
return attrs
class QueryCollection extends base.Collection
model: QueryModel
... | define [
'../core'
'./base'
], (c, base) ->
class QueryModel extends base.Model
parse: (attrs) ->
super
if attrs? and not attrs.shared_users?
attrs.shared_users = []
return attrs
class QueryCollection extends base.Collection
model: ... |
Use filePath instead of path as variable name | Git = require 'git-utils'
fsUtils = require 'fs-utils'
path = require 'path'
module.exports =
loadStatuses: (repoPath) ->
repo = Git.open(repoPath)
if repo?
workingDirectoryPath = repo.getWorkingDirectory()
statuses = {}
for path, status of repo.getStatus()
statuses[path.join(workin... | Git = require 'git-utils'
fsUtils = require 'fs-utils'
path = require 'path'
module.exports =
loadStatuses: (repoPath) ->
repo = Git.open(repoPath)
if repo?
workingDirectoryPath = repo.getWorkingDirectory()
statuses = {}
for filePath, status of repo.getStatus()
statuses[path.join(wo... |
Update parser to handle new search api response | define (require) ->
Backbone = require('backbone')
settings = require('cs!settings')
SEARCH_URI = "#{location.protocol}//#{settings.cnxarchive.host}:#{settings.cnxarchive.port}/search"
return class SearchResults extends Backbone.Model
url: () -> "#{SEARCH_URI}#{@query}"
defaults:
query:
... | define (require) ->
Backbone = require('backbone')
settings = require('cs!settings')
SEARCH_URI = "#{location.protocol}//#{settings.cnxarchive.host}:#{settings.cnxarchive.port}/search"
FILTER_NAMES = {
"authorID": "Author"
"keyword": "Keyword"
"type": "Type"
"pubYear": "Publication Date"
"... |
Fix diffing when using fallback spec | Walrus = require '../../bin/walrus'
fs = require 'fs'
path = require 'path'
exec = require( 'child_process' ).exec
TestHelpers =
read : ( filename ) -> fs.readFileSync filename, 'utf8' if path.existsSync filename
pass : ( specs, suffix='' ) ->
for file in fs.readdirSync specs when path.extname( file ) is... | Walrus = require '../../bin/walrus'
fs = require 'fs'
path = require 'path'
exec = require( 'child_process' ).exec
TestHelpers =
read : ( filename ) -> fs.readFileSync filename, 'utf8' if path.existsSync filename
pass : ( specs, suffix='' ) ->
for file in fs.readdirSync specs when path.extname( file ) is... |
Use classnames and add spin animation support | React = require 'react'
BS = require 'react-bootstrap'
module.exports = React.createClass
displayName: 'Icon'
propTypes:
type: React.PropTypes.string
className: React.PropTypes.string
tooltip: React.PropTypes.string
tooltipProps: React.PropTypes.object
getDefaultProps: ->
tooltipPro... | React = require 'react'
BS = require 'react-bootstrap'
classnames = require 'classnames'
module.exports = React.createClass
displayName: 'Icon'
propTypes:
type: React.PropTypes.string.isRequired
spin: React.PropTypes.bool
className: React.PropTypes.string
tooltip: React.PropTypes.string
... |
Use 'parse' function to set necessary properties on the page | class window.Evidence extends Backbone.Model
class window.OpinionatersEvidence extends Evidence
# TODO: eventually, fetching this model should populate
# the collection, not the other way around
initialize: (attributes, options) ->
@_fact_id = options.fact_id ? @collection.fact.id
@on 'change:use... | class window.Evidence extends Backbone.Model
class window.OpinionatersEvidence extends Evidence
# TODO: eventually, fetching this model should populate
# the collection, not the other way around
initialize: (attributes, options) ->
@_fact_id = options.fact_id ? @collection.fact.id
@on 'change', =... |
Add auth stats to librato | {argv} = require 'optimist'
koding = require './bongo'
koding.connect()
AuthWorker = require './authworker'
{authWorker} = require argv.c
authWorker = new AuthWorker koding, authWorker.authResourceName
authWorker.connect()
| {argv} = require 'optimist'
koding = require './bongo'
koding.connect()
AuthWorker = require './authworker'
{authWorker,librato} = require argv.c
processMonitor = (require 'processes-monitor').start
name : "Auth Worker #{process.pid}"
stats_id: "worker.auth." + process.pid
interval : 30000
librato: librato
... |
Replace jquery deprecated .live with .on | class CommitsList
@data =
ref: null
limit: 0
offset: 0
@disable = false
@showProgress: ->
$('.loading').show()
@hideProgress: ->
$('.loading').hide()
@init: (ref, limit) ->
$(".day-commits-table li.commit").live 'click', (event) ->
if event.target.nodeName != "A"
locat... | class CommitsList
@data =
ref: null
limit: 0
offset: 0
@disable = false
@showProgress: ->
$('.loading').show()
@hideProgress: ->
$('.loading').hide()
@init: (ref, limit) ->
$("body").on "click", ".day-commits-table li.commit", (event) ->
if event.target.nodeName != "A"
... |
Remove ivar only used in constructor | app = require 'app'
fs = require 'fs'
path = require 'path'
protocol = require 'protocol'
# Handles requests with 'atom' protocol.
#
# It's created by {AtomApplication} upon instantiation and is used to create a
# custom resource loader for 'atom://' URLs.
#
# The following directories are searched in order:
# * ~/.... | app = require 'app'
fs = require 'fs'
path = require 'path'
protocol = require 'protocol'
# Handles requests with 'atom' protocol.
#
# It's created by {AtomApplication} upon instantiation and is used to create a
# custom resource loader for 'atom://' URLs.
#
# The following directories are searched in order:
# * ~/.... |
Make feedback link work in service description. | define [
'i18next',
'app/views/base'
],
(
{t: t},
{SMItemView: SMItemView}
) ->
ServiceMapDisclaimersView: class ServiceMapDisclaimersView extends SMItemView
template: 'description-of-service'
className: 'content modal-dialog about'
serializeData: ->
lang: p13n.ge... | define [
'i18next',
'app/views/base'
],
(
{t: t},
{SMItemView: SMItemView}
) ->
ServiceMapDisclaimersView: class ServiceMapDisclaimersView extends SMItemView
template: 'description-of-service'
className: 'content modal-dialog about'
events:
'click .uservoice-link'... |
Remove subviews array from home view | ProjectMonitor.Views ||= {}
class ProjectMonitor.Views.HomeView extends Backbone.View
tagName: "ol"
className: "projects"
template: JST["backbone/templates/home"]
initialize: (options) ->
@subviews = []
@addTileView(tile) for tile in @collection.models
@collection.on 'reset', =>
for view in... | ProjectMonitor.Views ||= {}
class ProjectMonitor.Views.HomeView extends Backbone.View
tagName: "ol"
className: "projects"
template: JST["backbone/templates/home"]
initialize: (options) ->
@_addTileView(tile) for tile in @collection.models
@collection.on 'reset', =>
for cid,view of @subViews
... |
Fix embarassing typo in one of the popovers on the homepage | # 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://jashkenas.github.com/coffee-script/
$("document").ready ->
$(".point1").popover
placement: "right"
content: "We have... | # 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://jashkenas.github.com/coffee-script/
$("document").ready ->
$(".point1").popover
placement: "right"
content: "We have... |
Handle random sort on the client | Backbone = require 'backbone'
mediator = require '../../../lib/mediator.coffee'
template = -> require('../templates/partials/_channel_groups.jade') arguments...
{ QUERY } = require("sharify").data
class ProfileView extends Backbone.View
loading: false
disabled: false
threshold: -500
page: 2
initialize: ->
... | Backbone = require 'backbone'
{ QUERY, PROFILE_CHANNELS, SORT } = require("sharify").data
mediator = require '../../../lib/mediator.coffee'
ChannelGroupView = require '../../../components/channel_block_group/view.coffee'
template = -> require('../templates/partials/_channel_groups.jade') arguments...
class ProfileVie... |
Store invalid decimal values in state, apply later | class Lanes.Components.Input extends Lanes.React.Component
mixins: [
Lanes.Components.Form.FieldMixin
]
formGroupClass: 'input'
getDefaultProps: ->
type: 'text'
propTypes:
unlabled: React.PropTypes.bool
getValue: ->
@refs.input.getValue()
handleKeyDown: ... | class Lanes.Components.Input extends Lanes.React.Component
NUMBER_TEST: /^-?\d+(\.\d+)?$/
mixins: [
Lanes.Components.Form.FieldMixin
]
propTypes:
unlabled: React.PropTypes.bool
onlyNumeric: React.PropTypes.bool
getDefaultProps: ->
type: 'text'
getValue: ->
... |
Add capacity to inform a minHeight property | 'use strict'
angular.module("ngFillHeight.directives")
.directive 'ngFillHeight', ($parse) ->
ngFillHeightLink = (scope, element, attrs) ->
ngFillHeightOption = ($parse attrs.ngFillHeight)(scope)
if typeof ngFillHeightOption isnt 'object'
console.error 'The value of ngFillHeight has to be a... | 'use strict'
angular.module("ngFillHeight.directives")
.directive 'ngFillHeight', ($parse) ->
ngFillHeightLink = (scope, element, attrs) ->
ngFillHeightOption = ($parse attrs.ngFillHeight)(scope)
if typeof ngFillHeightOption isnt 'object'
console.error 'The value of ngFillHeight has to be a... |
Make sure to clear session explicitly when logging out | #
# Logout helpers.
#
request = require 'superagent'
opts = require '../options'
{ parse } = require 'url'
redirectBack = require './redirectback'
@denyBadLogoutLinks = (req, res, next) ->
if parse(req.get 'Referrer').hostname.match 'artsy.net'
next()
else
next new Error "Malicious logout link."
@logout ... | #
# Logout helpers.
#
request = require 'superagent'
opts = require '../options'
{ parse } = require 'url'
redirectBack = require './redirectback'
@denyBadLogoutLinks = (req, res, next) ->
if parse(req.get 'Referrer').hostname.match 'artsy.net'
next()
else
next new Error "Malicious logout link."
@logout ... |
Revert "Use options to observe phpExecutablePath config" | linterPath = atom.packages.getLoadedPackage("linter").path
Linter = require "#{linterPath}/lib/linter"
class LinterPhp extends Linter
# The syntax that the linter handles. May be a string or
# list/tuple of strings. Names should be all lowercase.
@syntax: ['text.html.php', 'source.php']
# A string, list, tupl... | linterPath = atom.packages.getLoadedPackage("linter").path
Linter = require "#{linterPath}/lib/linter"
{CompositeDisposable} = require 'atom'
class LinterPhp extends Linter
# The syntax that the linter handles. May be a string or
# list/tuple of strings. Names should be all lowercase.
@syntax: ['text.html.php', ... |
Sort by deprecated method calls | {$, $$, ScrollView} = require 'atom'
Grim = require 'grim'
module.exports =
class DeprecationCopView extends ScrollView
@content: ->
@div class: 'deprecation-cop pane-item', tabindex: -1, =>
@div class: 'panel', =>
@div class: 'panel-heading', "Deprecated calls"
@ul outlet: 'list', class: '... | {$, $$, ScrollView} = require 'atom'
Grim = require 'grim'
module.exports =
class DeprecationCopView extends ScrollView
@content: ->
@div class: 'deprecation-cop pane-item', tabindex: -1, =>
@div class: 'panel', =>
@div class: 'panel-heading', "Deprecated calls"
@ul outlet: 'list', class: '... |
Make empty pie chart appear on proposal page | angular.module('loomioApp').controller 'ProposalPieChartController', ($scope) ->
$scope.pieChartData = [
{ value : 0, color : "#90D490" },
{ value : 0, color : "#F0BB67" },
{ value : 0, color : "#D49090" },
{ value : 0, color : "#dd0000"}
]
$scope.pieChartOptions =
animation: false
segme... | angular.module('loomioApp').controller 'ProposalPieChartController', ($scope) ->
$scope.pieChartData = [
{ value : 0, color : "#90D490" },
{ value : 0, color : "#F0BB67" },
{ value : 0, color : "#D49090" },
{ value : 0, color : "#dd0000" },
{ value : 0, color : "#cccccc" }
]
$scope.pieChartO... |
Use forEach to iterate over package folders | path = require 'path'
async = require 'async'
Command = require './command'
config = require './config'
fs = require './fs'
module.exports =
class RebuildModuleCache extends Command
@commandNames: ['rebuild-module-cache']
constructor: ->
@atomPackagesDirectory = path.join(config.getAtomDirectory(), 'packages'... | path = require 'path'
async = require 'async'
Command = require './command'
config = require './config'
fs = require './fs'
module.exports =
class RebuildModuleCache extends Command
@commandNames: ['rebuild-module-cache']
constructor: ->
@atomPackagesDirectory = path.join(config.getAtomDirectory(), 'packages'... |
Change opacity of dots as lectures fade out and in | class Dashing.Lecturelist extends Dashing.Widget
ready: ->
@currentIndex = 0
@items = $(@node).find('li')
@items.hide()
@nextItem()
@startCarousel()
onData: (data) ->
@currentIndex = 0
i = 0
if data.items.length == 0
@set 'empty', true
startCarousel: ->
setInterval... | class Dashing.Lecturelist extends Dashing.Widget
ready: ->
@currentIndex = 0
@items = $(@node).find('li')
@items.hide()
@nextItem()
@startCarousel()
onData: (data) ->
@currentIndex = 0
i = 0
if data.items.length == 0
@set 'empty', true
startCarousel: ->
setInterval... |
Add option to not append the data on infinite scroll module | Neighborly.InfiniteScroll =
setupScroll: ->
_.bindAll(this, 'onScroll', 'onSuccess')
this.$window().scroll(this.onScroll)
fetchPage: ->
# the isLoaderDivVisible check if the div is already in the view pane to load more content
# the $loader.is(:visible) is here to avoid trigerring two concurrent fe... | Neighborly.InfiniteScroll =
setupScroll: ->
_.bindAll(this, 'onScroll', 'onSuccess')
this.$window().scroll(this.onScroll)
fetchPage: ->
# the isLoaderDivVisible check if the div is already in the view pane to load more content
# the $loader.is(:visible) is here to avoid trigerring two concurrent fe... |
Set token to 64 characters | App.Polls =
generateToken: ->
rand = Math.random().toString(36).substr(2) # remove `0.`
token = rand + rand # to make it longer
return token
replaceToken: ->
for link in $('.js-question-answer')
token_param = link.search.slice(-6)
if token_param == "token="
link.href = link.href... | App.Polls =
generateToken: ->
token = ''
for n in [0..5]
rand = Math.random().toString(36).substr(2) # remove `0.`
token = token + rand;
token = token.substring(0, 64)
return token
replaceToken: ->
for link in $('.js-question-answer')
token_param = link.search.slice(-6)
... |
Add a placeholder to rnss snippet | # Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#... | # Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#... |
Use x y positioning for controls | {my} = require '../my'
{draw} = require './draw'
exports.render = (root) ->
T = root.T()
get_style = (world) ->
{
border: "1px solid #{world.get('stroke')}"
background: world.get 'fill'
height: world.get 'height'
width: world.get 'width'
}
render_children = (world) ->
world.ma... | {my} = require '../my'
{draw} = require './draw'
exports.render = (root) ->
T = root.T()
get_style = (world) ->
{
border: "1px solid #{world.get('stroke')}"
background: world.get 'fill'
height: world.get 'height'
width: world.get 'width'
position: 'absolute'
left: world.get ... |
Add google analytics to model signup and login panels | AjaxPrefix.addAjaxPrefix(jQuery, -> Courseware.prefix)
$ ->
$.ajaxSetup
headers : { 'X-CSRFToken': $.cookie 'csrftoken' }
dataType: 'json'
window.onTouchBasedDevice = ->
navigator.userAgent.match /iPhone|iPod|iPad/i
$('body').addClass 'touch-based-device' if onTouchBasedDevice()
# $("a[rel*=lean... | AjaxPrefix.addAjaxPrefix(jQuery, -> Courseware.prefix)
$ ->
$.ajaxSetup
headers : { 'X-CSRFToken': $.cookie 'csrftoken' }
dataType: 'json'
window.onTouchBasedDevice = ->
navigator.userAgent.match /iPhone|iPod|iPad/i
$('body').addClass 'touch-based-device' if onTouchBasedDevice()
# $("a[rel*=lean... |
Drop support for legacy bracketed actions | noflo = require 'noflo'
debug = require('debug') 'noflo-ui:store'
exports.getComponent = ->
c = new noflo.Component
c.inPorts.add 'action',
datatype: 'all'
c.inPorts.add 'state',
datatype: 'object'
c.outPorts.add 'pass',
datatype: 'object'
scoped: false
c.state = {}
c.tearDown = (callback)... | noflo = require 'noflo'
debug = require('debug') 'noflo-ui:store'
exports.getComponent = ->
c = new noflo.Component
c.inPorts.add 'action',
datatype: 'all'
c.inPorts.add 'state',
datatype: 'object'
c.outPorts.add 'pass',
datatype: 'object'
scoped: false
c.state = {}
c.tearDown = (callback)... |
Fix error raised when typing in a mini editor | {View} = require 'atom'
module.exports = ->
highlightSelectedPackage = atom.packages.getLoadedPackage('highlight-selected')
highlightSelected = require (highlightSelectedPackage.path)
HighlightedAreaView = require (highlightSelectedPackage.path + '/lib/highlighted-area-view')
class FakeEditor
constructor... | {View} = require 'atom'
module.exports = ->
highlightSelectedPackage = atom.packages.getLoadedPackage('highlight-selected')
highlightSelected = require (highlightSelectedPackage.path)
HighlightedAreaView = require (highlightSelectedPackage.path + '/lib/highlighted-area-view')
class FakeEditor
constructor... |
Fix logic, task lacks correct keys forTaskHelper | React = require 'react'
BS = require 'react-bootstrap'
S = require '../../helpers/string'
{TimeStore} = require '../../flux/time'
moment = require 'moment'
TH = require '../../helpers/task'
module.exports = React.createClass
displayName: 'EventInfoIcon'
propTypes:
event: React.PropTypes.object.isRe... | React = require 'react'
BS = require 'react-bootstrap'
S = require '../../helpers/string'
{TimeStore} = require '../../flux/time'
moment = require 'moment'
module.exports = React.createClass
displayName: 'EventInfoIcon'
propTypes:
event: React.PropTypes.object.isRequired
render: ->
{event} =... |
Set timeago to current time if no time is given | Ember.Handlebars.helper 'formattedTime', (time) ->
new Handlebars.SafeString $.timeago(time)
| Ember.Handlebars.helper 'formattedTime', (time) ->
time ||= new Date()
new Handlebars.SafeString $.timeago(time)
|
Fix problem with numeric alt names. | class @UserList extends Backbone.Collection
model: User
comparator: (a, b) =>
aAuthority = a.get('authority')
bAuthority = b.get('authority')
aName = a.id.toLowerCase()
bName = b.id.toLowerCase()
if aAuthority < bAuthority then 1
else if aAuthority > bAuthority then -1
else if aNa... | class @UserList extends Backbone.Collection
model: User
comparator: (a, b) =>
aAuthority = a.get('authority')
bAuthority = b.get('authority')
aName = "#{a.id}".toLowerCase()
bName = "#{b.id}".toLowerCase()
if aAuthority < bAuthority then 1
else if aAuthority > bAuthority then -1
e... |
Remove trailing `.0` from variant unit scale | angular.module("admin.products").controller "editUnitsCtrl", ($scope, VariantUnitManager) ->
$scope.product =
variant_unit: angular.element('#variant_unit').val()
variant_unit_scale: angular.element('#variant_unit_scale').val()
$scope.variant_unit_options = VariantUnitManager.variantUnitOptions()
if $s... | angular.module("admin.products").controller "editUnitsCtrl", ($scope, VariantUnitManager) ->
$scope.product =
variant_unit: angular.element('#variant_unit').val()
variant_unit_scale: angular.element('#variant_unit_scale').val()
$scope.variant_unit_options = VariantUnitManager.variantUnitOptions()
if $s... |
Allow for discovery of users for DMs | _ = require "underscore"
Fuse = require "fuse.js"
class Utils
@robot: null
@findRoom: (msg) ->
room = msg.envelope.room
if _.isUndefined(room)
room = msg.envelope.user.reply_to
room
@getRoom: (context) ->
room = @robot.adapter.client.rtm.dataStore.getChannelOrGroupByName context.message.r... | _ = require "underscore"
Fuse = require "fuse.js"
class Utils
@robot: null
@findRoom: (msg) ->
room = msg.envelope.room
if _.isUndefined(room)
room = msg.envelope.user.reply_to
room
@getRoom: (context) ->
room = @robot.adapter.client.rtm.dataStore.getChannelOrGroupByName context.message.r... |
Mark all methods as private | #= require ../hash/hash
class Batman.Params extends Batman.Hash
constructor: (@hash, @navigator) ->
super(@hash)
@url = new Batman.UrlParams({}, @navigator, this)
@accessor 'url', -> @url
class Batman.UrlParams extends Batman.Hash
constructor: (@hash, @navigator, @params) ->
super(@hash)
@rep... | #= require ../hash/hash
class Batman.Params extends Batman.Hash
constructor: (@hash, @navigator) ->
super(@hash)
@url = new Batman.UrlParams({}, @navigator, this)
@accessor 'url', -> @url
class Batman.UrlParams extends Batman.Hash
constructor: (@hash, @navigator, @params) ->
super(@hash)
@rep... |
Fix selectors for enabled test | _ = require 'underscore'
Backbone = require 'backbone'
Artist = require '../../../models/artist.coffee'
CurrentUser = require '../../../models/current_user.coffee'
ArtistRouter = require './router.coffee'
analytics = require './analytics.coffee'
attachArtworkModal = require '../../../components/page_modal/index.coffee'... | _ = require 'underscore'
Backbone = require 'backbone'
Artist = require '../../../models/artist.coffee'
CurrentUser = require '../../../models/current_user.coffee'
ArtistRouter = require './router.coffee'
analytics = require './analytics.coffee'
attachArtworkModal = require '../../../components/page_modal/index.coffee'... |
Change atom seti theme colour to steel | "*":
core:
disabledPackages: [
"linter-pylint"
]
themes: [
"seti-ui"
"base16-tomorrow-dark-theme"
]
editor:
fontSize: 13
invisibles: {}
"exception-reporting":
userId: "da976a4b-6a5d-3f34-7d9b-6bfdb74474ed"
"git-diff":
showIconsInEditorGutter: true
"git-plus": ... | "*":
core:
disabledPackages: [
"linter-pylint"
]
themes: [
"seti-ui"
"base16-tomorrow-dark-theme"
]
editor:
fontSize: 13
invisibles: {}
"exception-reporting":
userId: "da976a4b-6a5d-3f34-7d9b-6bfdb74474ed"
"git-diff":
showIconsInEditorGutter: true
"git-plus": ... |
Change user fixture to be an admin | window.FIXTURES = {} if window.FIXTURES is undefined
FIXTURES.user = (id = 1)->
user:
id: id
bio: null
created_at: "2014-07-04T12:42:41+00:00"
email: "foo@bar.name"
facebook_url: null
linkedin_url: null
other_url: null
profile_type: "personal"
twitter_url: null
name: "Foo Bar"... | window.FIXTURES = {} if window.FIXTURES is undefined
FIXTURES.user = (id = 1)->
user:
id: id
bio: null
created_at: "2014-07-04T12:42:41+00:00"
email: "foo@bar.name"
facebook_url: null
linkedin_url: null
other_url: null
profile_type: "personal"
twitter_url: null
name: "Foo Bar"... |
Fix insertion bindings destroying their nodes rather than removing them | class Batman.DOM.InsertionBinding extends Batman.DOM.AbstractBinding
onlyObserve: Batman.BindingDefinitionOnlyObserve.Data
bindImmediately: false
constructor: (definition) ->
{@invert} = definition
super
@placeholderNode = document.createComment("batman-insertif=\"#{@keyPath}\"")
ready: ->
@b... | class Batman.DOM.InsertionBinding extends Batman.DOM.AbstractBinding
onlyObserve: Batman.BindingDefinitionOnlyObserve.Data
bindImmediately: false
constructor: (definition) ->
{@invert} = definition
super
@placeholderNode = document.createComment("batman-insertif=\"#{@keyPath}\"")
ready: ->
@b... |
Add UTC offset to the datetime format | class Tenon.features.DateTimePicker
constructor: ->
@$els = $("[data-behaviour~='datetime-picker']")
@format = "MMM. DD, YYYY [at] hh:mm A"
$.each(@$els, @_formatDate)
@_enableDateTimePicker()
@_setupUnfocus()
_formatDate: (i, el) =>
$el = $(el)
if $el.val() != '' && $el.val().match(/^\... | class Tenon.features.DateTimePicker
constructor: ->
@$els = $("[data-behaviour~='datetime-picker']")
@format = "MMM. DD, YYYY [at] hh:mm A Z"
$.each(@$els, @_formatDate)
@_enableDateTimePicker()
@_setupUnfocus()
_formatDate: (i, el) =>
$el = $(el)
if $el.val() != '' && $el.val().match(/... |
Test helpers for generic requests on tests |
# Export generic testhelpers
testhelpers = require '../../../../../testhelper'
{ expect
request
generateUrl
checkBongoConnectivity
generateRequestParamsEncodeBody } = testhelpers
utils = require './utils'
testhelpers.gitlabApiUrl = generateUrl { route : '-/api/gitlab' }
testhelpers.gitlabDefaultHeaders = {
... |
# Export generic testhelpers
testhelpers = require '../../../../../testhelper'
{ expect
request
generateUrl
checkBongoConnectivity
generateRequestParamsEncodeBody } = testhelpers
utils = require './utils'
testhelpers.gitlabApiUrl = generateUrl { route : '-/api/gitlab' }
testhelpers.gitlabDefaultHeaders = {
... |
Update source to latest in `coffeelint` | regexes =
nonEnglishOperators: /[&|\||\=]{2}|\!\=/
module.exports = class RuleProcessor
rule:
name: 'prefer_english_operator'
description: '''
This rule prohibits &&, ||, == and !=.
Use and, or, is, and isnt instead.
'''
level: 'warn'
message: 'Don\'t use &&, ||, == and !='
lin... | module.exports = class RuleProcessor
rule:
name: 'prefer_english_operator'
description: '''
This rule prohibits &&, ||, ==, != and !.
Use and, or, is, isnt, and not instead.
!! for converting to a boolean is ignored.
'''
level: 'ignore'
doubleNotLevel: 'ignore'
message: 'Don\'t use... |
Define search fields for projects | Dashboard.ProjectsTabController = Ember.Controller.extend Dashboard.SearchableBaseController,
baseRouteName: 'projects'
search:
pg_search: null
Dashboard.ProjectsSearchController = Dashboard.ProjectsTabController.extend Dashboard.SearchableController,
baseRouteName: 'projects'
| Dashboard.ProjectsTabController = Ember.Controller.extend Dashboard.SearchableBaseController,
baseRouteName: 'projects'
search:
query: null
between_created_at:
starts_at: null
ends_at: null
between_expires_at:
starts_at: null
ends_at: null
between_online_date:
starts_a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.