Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Add routes for requests list and triage views | 'use strict'
app = angular
.module('taarifaWaterpointsApp', [
'ngResource',
'ngRoute',
'leaflet-directive',
'dynform',
'angular-flash.service',
'angular-flash.flash-alert-directive',
'gettext',
'ui.bootstrap'
])
.config ($routeProvider, $httpProvider, flashProvider) ->
$routeP... | 'use strict'
app = angular
.module('taarifaWaterpointsApp', [
'ngResource',
'ngRoute',
'leaflet-directive',
'dynform',
'angular-flash.service',
'angular-flash.flash-alert-directive',
'gettext',
'ui.bootstrap'
])
.config ($routeProvider, $httpProvider, flashProvider) ->
$routeP... |
Add usage. Fix command. encode uri |
module.exports = (robot) ->
robot.respond /educast (.*)/i, (res) ->
res.send "https://beta.educast.pro/search/?q=#{res.match[1]}"
| # Description:
# Search from to educast
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot educast <keyword> - Search from educast
module.exports = (robot) ->
robot.respond /educast\s+(.*)/i, (res) ->
keyword = encodeURIComponent(res.match[1])
res.s... |
Add max lengths to Device names as per spec | xml = require 'xml'
# generate device type string
makeDeviceType = (config) ->
type = [
config.specs.upnp.prefix
config.device.type
config.device.version
]
type.join ':'
# build device description element
buildDescription = (config, callback) ->
# generate namespace string
... | xml = require 'xml'
# generate device type string
makeDeviceType = (config) ->
type = [
config.specs.upnp.prefix
config.device.type
config.device.version
]
type.join ':'
# build device description element
buildDescription = (config, callback) ->
# generate namespace string
... |
Return Undefined if There is No Save to Load | angular.module 'qbn.save', ['qbn.quality']
.factory 'savedGame', (qualities) ->
storageName = 'qbnSave'
api =
load: () ->
save = JSON.parse localStorage.getItem storageName
if save?
for savedQuality in save.qualities
quality = qualities.lookup savedQuality.id
... | angular.module 'qbn.save', ['qbn.quality']
.factory 'savedGame', (qualities) ->
storageName = 'qbnSave'
api =
load: () ->
save = JSON.parse localStorage.getItem storageName
return undefined if not save?
for savedQuality in save.qualities
quality = qualities.lookup saved... |
Clean up some promise snippets | ".source.js":
"Promise":
prefix: "promise",
body: """
new Promise((resolve, reject) => {
\t${0}
});
"""
"Promise.prototype.then":
prefix: "then"
body: """
then(${1:(${2:value}) => {
\t${0}
\\}})
"""
"Promise.prototype.catch":
prefix: "catch"
body: """
ca... | ".source.js":
"new Promise":
prefix: "Promise",
body: """
new Promise((resolve, reject) => {
\t${0}
});
"""
"new Promise +":
prefix: "new Promise",
body: """
new Promise((resolve, reject) => {
\t${0}
});
"""
"Promise.prototype.then":
prefix: "then"
body: ""... |
Make the gem compatible with Turbolinks and Turbolinks Classic | 'use strict';
initSelect2 = (inputs, extra = {}) ->
inputs.each ->
item = $(this)
# reading from data allows <input data-select2='{"tags": ['some']}'> to be passed to select2
options = $.extend(allowClear: true, extra, item.data('select2'))
# because select2 reads from input.data to check if it is se... | 'use strict';
initSelect2 = (inputs, extra = {}) ->
inputs.each ->
item = $(this)
# reading from data allows <input data-select2='{"tags": ['some']}'> to be passed to select2
options = $.extend(allowClear: true, extra, item.data('select2'))
# because select2 reads from input.data to check if it is se... |
Allow event filtering by check name | namespace 'SensuDashboard.Views.Events', (exports) ->
class exports.List extends SensuDashboard.Views.List
name: 'events/list'
initialize: ->
@autocomplete_view = @options.autocomplete_view
@autocomplete_view.delegate = this
super
itemClass: ->
exports.ListItem
resolvedCol... | namespace 'SensuDashboard.Views.Events', (exports) ->
class exports.List extends SensuDashboard.Views.List
name: 'events/list'
initialize: ->
@autocomplete_view = @options.autocomplete_view
@autocomplete_view.delegate = this
super
itemClass: ->
exports.ListItem
resolvedCol... |
Set XML for attribute nodes. | @ignore = []
@record_is_ignored = (name) ->
($.inArray name, ignore) isnt -1
render_field = ->
if field.attr
v = xml.attr name
else
x = xml.children field.name
v = x.text()
with_mixin {xml: x, value: v}, fieldview
@render_record = ->
for f in schema
if not record_is_ignored f.name
wit... | @ignore = []
@record_is_ignored = (name) ->
($.inArray name, ignore) isnt -1
render_field = ->
if field.attr
x = xml
v = xml.attr name
else
x = xml.children field.name
v = x.text()
with_mixin {parent: xml, xml: x, value: v}, fieldview
@render_record = ->
for f in schema
if not record_is... |
Fix a crash when cmd+shift+m failed to load files | {SelectListView} = require 'atom-space-pen-views'
path = require 'path'
fs = require 'fs'
module.exports =
class PodFilePane extends SelectListView
initialize: ->
super
@addClass('overlay from-top')
@setItems([])
@panel ?= atom.workspace.addModalPanel(item: this)
@panel.hide()
viewForItem: (item) ->... | {SelectListView} = require 'atom-space-pen-views'
path = require 'path'
fs = require 'fs'
module.exports =
class PodFilePane extends SelectListView
initialize: ->
super
@addClass('overlay from-top')
@setItems([])
@panel ?= atom.workspace.addModalPanel(item: this)
@panel.hide()
viewForItem: (item) ->... |
Add params to other methods | uuid = require 'node-uuid'
WebSocket = require 'ws'
class DeviceManagerSocketClient
constructor: (@options={}) ->
@messageCallbacks = {}
connect: (callback=->) =>
@connection = new WebSocket "ws://#{@options.host}:#{@options.port}"
if @connection.on?
@connection.on 'open', callback
@... | uuid = require 'node-uuid'
WebSocket = require 'ws'
class DeviceManagerSocketClient
constructor: (@options={}) ->
@messageCallbacks = {}
connect: (callback=->) =>
@connection = new WebSocket "ws://#{@options.host}:#{@options.port}"
if @connection.on?
@connection.on 'open', callback
@... |
Add JavaScript Redirect for 401 (Unauth) | jQuery ->
$(".best_in_place").best_in_place().bind "ajax:success", ->
$(this).closest(".video-container").find("iframe").attr "src", $(this).html() if $(this).hasClass("video-related")
# handle updating the new file for upload display
$("label.file-upload-label input").livequery ->
$(this).on "change", -... | jQuery ->
$(".best_in_place").best_in_place().bind "ajax:success", ->
$(this).closest(".video-container").find("iframe").attr "src", $(this).html() if $(this).hasClass("video-related")
# handle updating the new file for upload display
$("label.file-upload-label input").livequery ->
$(this).on "change", -... |
Remove unused student prop from mixin | React = require 'react'
Router = require 'react-router'
LateIcon = require '../late-icon'
TaskHelper = require '../../helpers/task'
module.exports = {
propTypes:
courseId: React.PropTypes.string.isRequired
task: React.PropTypes.shape(
status: React.PropTypes.string
due_at: Rea... | React = require 'react'
Router = require 'react-router'
LateIcon = require '../late-icon'
TaskHelper = require '../../helpers/task'
module.exports = {
propTypes:
courseId: React.PropTypes.string.isRequired
task: React.PropTypes.shape(
status: React.PropTypes.string
due_at: Rea... |
Move class to the outer `div` | {View} = require 'atom'
# Status bar view for the indentation indicator.
module.exports =
class IndentationIndicatorView extends View
@content: ->
@div class: 'inline-block', =>
@span 'foo:42', class: 'indentation-indicator', outlet: 'text'
# Public: Initializes the view by subscribing to various events... | {View} = require 'atom'
# Status bar view for the indentation indicator.
module.exports =
class IndentationIndicatorView extends View
@content: ->
@div class: 'indentation-indicator inline-block', =>
@span 'foo:42', outlet: 'text'
# Public: Initializes the view by subscribing to various events.
#
# ... |
Rename variable to pattern to shadow config key path | {View} = require 'space-pen'
$ = require 'jquery'
_ = require 'underscore'
module.exports =
class WrapGuide extends View
@activate: (rootView, state) ->
rootView.eachEditor (editor) =>
@appendToEditorPane(rootView, editor) if editor.attached
@appendToEditorPane: (rootView, editor) ->
if underlayer =... | {View} = require 'space-pen'
$ = require 'jquery'
_ = require 'underscore'
module.exports =
class WrapGuide extends View
@activate: (rootView, state) ->
rootView.eachEditor (editor) =>
@appendToEditorPane(rootView, editor) if editor.attached
@appendToEditorPane: (rootView, editor) ->
if underlayer =... |
Hide Send Feedback from status bar | path = require 'path'
fs = require 'fs-extra'
request = require 'request'
Decompress = require 'decompress'
injectPackage = null
workDir = null
installPackage = (owner, name, version, callback) ->
tarballUrl = 'https://github.com/' + owner + '/' + name + '/archive/master.tar.gz'
tarballPath = path.join(workDir, 'n... | path = require 'path'
fs = require 'fs-extra'
request = require 'request'
Decompress = require 'decompress'
injectPackage = null
workDir = null
installPackage = (owner, name, version, callback) ->
tarballUrl = 'https://github.com/' + owner + '/' + name + '/archive/master.tar.gz'
tarballPath = path.join(workDir, 'n... |
Set image path for leaflet map js |
$(document).ready( ->
root = exports ? this
mapDiv = $("#map")
if mapDiv?
lat = mapDiv.data("lat")
lon = mapDiv.data("lon")
host = mapDiv.data('host')
key = mapDiv.data('key')
attribution = mapDiv.data("attribution")
zoom = 15
map = L.map("map",
center: [
lat
l... |
$(document).ready( ->
root = exports ? this
mapDiv = $("#map")
if mapDiv?
lat = mapDiv.data("lat")
lon = mapDiv.data("lon")
host = mapDiv.data('host')
key = mapDiv.data('key')
attribution = mapDiv.data("attribution")
zoom = 15
L.Icon.Default.imagePath = '../images'
map = L.map(... |
Clean up collections manager react-select | React = require 'react'
Select = require 'react-select'
apiClient = require '../api/client'
debounce = require 'debounce'
module.exports = React.createClass
displayName: 'CollectionSearch'
getDefaultProps: ->
multi: false
project: null
getInitialState: ->
collections: []
searchCollections: (valu... | React = require 'react'
Select = require 'react-select'
apiClient = require '../api/client'
debounce = require 'debounce'
module.exports = React.createClass
displayName: 'CollectionSearch'
getDefaultProps: ->
multi: false
project: null
searchCollections: (value, callback) ->
query =
page_size... |
Update Google Analytics tracking script. | ###
Typekit
###
try
Typekit.load()
###
Google Analytics
###
GOOGLE_ANALYTICS =
account: 'UA-12933299-1'
domain: 'stdout.be'
_gaq = _gaq or []
_gaq.push ['_setAccount', GOOGLE_ANALYTICS.account]
_gaq.push ['_trackPageview']
_gaq.push ['_setDomainName', GOOGLE_ANALYTICS.domain]
do ->
https = 'https:'... | ###
Typekit
###
try
Typekit.load()
###
Google Analytics
###
GOOGLE_ANALYTICS =
account: 'UA-12933299-1'
domain: 'stdout.be'
_gaq = window._gaq ?= []
_gaq.push ['_setAccount', GOOGLE_ANALYTICS.account]
_gaq.push ['_trackPageview']
_gaq.push ['_setDomainName', GOOGLE_ANALYTICS.domain]
do ->
https = '... |
Add 'slug_title' as idAttribute to Topic | class window.Topic extends Backbone.Model
newChannelForUser: (user) ->
new Channel
title: this.get 'title'
slug_title: this.get 'slug_title'
username: user.get 'username'
withCurrentOrCreatedChannelFor: (user, options)->
if ch = @existingChannelFor(user)
options.success?(ch)
els... | class window.Topic extends Backbone.Model
idAttribute: 'slug_title'
newChannelForUser: (user) ->
new Channel
title: this.get 'title'
slug_title: this.get 'slug_title'
username: user.get 'username'
withCurrentOrCreatedChannelFor: (user, options)->
if ch = @existingChannelFor(user)
... |
Call callback in event handlers with event | class Game.State extends Game.TwoWay
constructor: () ->
@objects = {}
@eventCounters = {}
@eventHandlers = {}
super
onEvent: (e) ->
# Add timestamped instance to the event counters object
if e.type not of @eventCounters
@eventCounters[e.type] = []
@eventCounters[e.type].push new Da... | class Game.State extends Game.TwoWay
constructor: () ->
@objects = {}
@eventCounters = {}
@eventHandlers = {}
super
onEvent: (e) ->
# Add timestamped instance to the event counters object
if e.type not of @eventCounters
@eventCounters[e.type] = []
@eventCounters[e.type].push new Da... |
Add ignoreAllRequests() to ajax spec helpers | # =require modules
TIMEOUT = 500 # ms - Used to be 300, but FF was too slow
extendClass 'specs.jasmine.AjaxHelpers', (self)->
ajaxServer = null
initialize: (fakeAjaxServer, options={})->
ajaxServer = fakeAjaxServer
TIMEOUT = options.timeout if options.timeout
ajaxSettings: -> ajaxServer.ajaxSettings()
... | # =require modules
TIMEOUT = 500 # ms - Used to be 300, but FF was too slow
extendClass 'specs.jasmine.AjaxHelpers', (self)->
ajaxServer = null
initialize: (fakeAjaxServer, options={})->
ajaxServer = fakeAjaxServer
TIMEOUT = options.timeout if options.timeout
ajaxSettings: -> ajaxServer.ajaxSettings()
... |
Change the default compiler for the lazy demo | 'use strict'
{
setupEditors
setupSamples
setupCompilers
setupRunButton
saveProgram
loadProgram
} = window.viz
grid = null
run = (editors, compiler) ->
saveProgram editors
playfield = new bef.Playfield()
playfield.fromString editors.source.getValue(), 16, 10
lazyRuntime = new bef.LazyRuntime()
lazyRunt... | 'use strict'
{
setupEditors
setupSamples
setupCompilers
setupRunButton
saveProgram
loadProgram
} = window.viz
grid = null
run = (editors, compiler) ->
saveProgram editors
playfield = new bef.Playfield()
playfield.fromString editors.source.getValue(), 16, 10
lazyRuntime = new bef.LazyRuntime()
lazyRunt... |
Add gone with the wind | # Movie quotes
#
# It'll happen
#
module.exports = (robot) ->
robot.hear /.*one (in|out of) a million*/, (msg) ->
msg.send "so you're telling me there's a chance: http://www.youtube.com/watch?v=yCFB2akLh4s"
| # Movie quotes
#
# It'll happen
#
module.exports = (robot) ->
robot.hear /.*one (in|out of) a million*/i, (msg) ->
msg.send "so you're telling me there's a chance: http://www.youtube.com/watch?v=yCFB2akLh4s"
robot.hear /.*I don't give.*/i, (msg) ->
msg.send "relevant: http://www.youtube.com/watch?v=-6Pbc8... |
Set encoding after reboot, and misc fixes | gbk_paths = [
]
gbk_exclude_path = [
]
atom.workspace.onDidOpen (event) ->
editor = event.item
path = event.uri
gbk_paths.forEach (regex) ->
if regex.test(path)
gbk_exclude_path.forEach (exclude_regex) ->
unless exclude_regex.test(path)
console.log "#{path} matches #{regex}, set enco... | gbk_paths = [
]
gbk_exclude_path = [
]
# console.debug(atom.workspace.getTextEditors())
set_encoding_for = (editor, path) ->
gbk_paths.forEach (regex) ->
if regex.test(path)
console.debug "#{path} matches #{regex}, examining gbk_exclude_path..."
is_excluded = false
gbk_exclude_path.forEach (e... |
Check an error when we fail to find an appropriate file by default (WNdb doesn't contain exceptions) | should = require('chai').should()
Wordnet = require('../lib/wordnet')
describe 'wordnet', () ->
wordnet = undefined
beforeEach (done) ->
wordnet = new Wordnet()
done()
it 'should pass unfiltered lookup method', (done) ->
wordnet.lookup 'node', (results) ->
should.exist(results)
result... | should = require('chai').should()
Wordnet = require('../lib/wordnet')
describe 'wordnet', () ->
wordnet = undefined
beforeEach (done) ->
wordnet = new Wordnet()
done()
it 'should pass unfiltered lookup method', (done) ->
wordnet.lookup 'node', (results) ->
should.exist(results)
result... |
Add TODO regarding quieting progress bar | async = require('async')
fs = require('fs')
widgets = require('../widgets/widgets')
server = require('../../server/server')
ProgressBar = require('progress')
exports.remove = (name, confirmAttribute, deleteFunction, outerCallback) ->
async.waterfall([
(callback) ->
if confirmAttribute
return callback(null, ... | async = require('async')
fs = require('fs')
widgets = require('../widgets/widgets')
server = require('../../server/server')
ProgressBar = require('progress')
exports.remove = (name, confirmAttribute, deleteFunction, outerCallback) ->
async.waterfall([
(callback) ->
if confirmAttribute
return callback(null, ... |
Reduce polling period on front-end | class LogFeed
POLL_PERIOD: 500
constructor: ->
@currentLine = -1
@lines = $('#lines')
getLines: =>
$.get(window.location.href + '/changes.json',
{currentLine: @currentLine},
this.getLinesSuccess
)
.fail(this.getLinesError)
.always(this.getLinesComplete)
getLinesSuccess: (d... | class LogFeed
POLL_PERIOD: 1500
constructor: ->
@currentLine = -1
@lines = $('#lines')
getLines: =>
$.get(window.location.href + '/changes.json',
{currentLine: @currentLine},
this.getLinesSuccess
)
.fail(this.getLinesError)
.always(this.getLinesComplete)
getLinesSuccess: (... |
Add disable a html preview shortcut | # Your keymap
#
# Atom keymaps work similarly to stylesheets. Just as stylesheets use selectors
# to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts.
#
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
#
# Here's an exa... | # Your keymap
#
# Atom keymaps work similarly to stylesheets. Just as stylesheets use selectors
# to apply styles to elements, Atom keymaps use selectors to associate
# keystrokes with events in specific contexts.
#
# You can create a new keybinding in this file by typing "key" and then hitting
# tab.
#
# Here's an exa... |
Check for empty post results in bootstrap | async = require("async")
mongoose = require("mongoose")
ObjectId = mongoose.Types.ObjectId
User = mongoose.model("User")
Post = mongoose.model("Post")
Message = mongoose.model("Message")
exports.index = (req, res) ->
res.render "index"
exports.timeline = (req, res) ->
res.render "timeline"
exports.app = (req, re... | async = require("async")
mongoose = require("mongoose")
ObjectId = mongoose.Types.ObjectId
User = mongoose.model("User")
Post = mongoose.model("Post")
Message = mongoose.model("Message")
exports.index = (req, res) ->
res.render "index"
exports.timeline = (req, res) ->
res.render "timeline"
exports.app = (req, re... |
Remove stray Google Auth JavaScript code. | # 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/
$ ->
$tagLine = $ '.tag-line'
$signButton = $ '.sign-up'
# Ideally this array would come from so... | # 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/
$ ->
$tagLine = $ '.tag-line'
$signButton = $ '.sign-up'
# Ideally this array would come from so... |
Add IE a bit more time | describe 'NoFlo UI initialization', ->
win = null
doc = null
db = null
before (done) ->
@timeout 20000
iframe = document.getElementById 'app'
iframe.src = '../app.html'
iframe.onload = ->
win = iframe.contentWindow
doc = iframe.contentDocument
setTimeout ->
done()
... | describe 'NoFlo UI initialization', ->
win = null
doc = null
db = null
before (done) ->
@timeout 20000
iframe = document.getElementById 'app'
iframe.src = '../app.html'
iframe.onload = ->
win = iframe.contentWindow
doc = iframe.contentDocument
setTimeout ->
done()
... |
Make poll search case insensitive | angular.module('loomioApp').controller 'PreviousPollsPageController', ($scope, $rootScope, $routeParams, Records, AbilityService, TranslationService, LoadingService) ->
$rootScope.$broadcast('currentComponent', { page: 'previousPollsPage'})
Records.groups.findOrFetchById($routeParams.key).then (group) =>
@grou... | angular.module('loomioApp').controller 'PreviousPollsPageController', ($scope, $rootScope, $routeParams, Records, AbilityService, TranslationService, LoadingService) ->
$rootScope.$broadcast('currentComponent', { page: 'previousPollsPage'})
Records.groups.findOrFetchById($routeParams.key).then (group) =>
@grou... |
Fix permalink url for /g replacing of space | Schema = mongoose.Schema
ObjectId = Schema.ObjectId
Comment = new Schema {
body : String,
author_id : ObjectId,
date : Date
}
File = new Schema {
path : String,
size : Number
}
Torrent = new Schema {
uploader : String,
title : String,
size : Number,
dateUploaded : {ty... | Schema = mongoose.Schema
ObjectId = Schema.ObjectId
Comment = new Schema {
body : String,
author_id : ObjectId,
date : Date
}
File = new Schema {
path : String,
size : Number
}
Torrent = new Schema {
uploader : String,
title : String,
size : Number,
dateUploaded : {ty... |
Clear layout set in button group component as it seems not to be needed anymore. | ###
Button Group.
In its simple form, each item in the button group is a Bootstrap.Button component,
In case this is a Radio, each item is rendered as a label.
###
Bootstrap.BsBtnGroup = Bootstrap.ItemsView.extend(Bootstrap.SizeSupport, Bootstrap.ItemsSelection,
classTypePrefix: ['btn-group']
classNames: ['btn... | ###
Button Group.
In its simple form, each item in the button group is a Bootstrap.Button component,
In case this is a Radio, each item is rendered as a label.
###
Bootstrap.BsBtnGroup = Bootstrap.ItemsView.extend(Bootstrap.SizeSupport, Bootstrap.ItemsSelection,
classTypePrefix: ['btn-group']
classNames: ['btn... |
Fix require to new path | #= require lib/format_as_short_number
describe 'window.format_as_short_number', ->
tests = [
[`undefined`, "?"]
[null, "?"]
[0, "0"]
[3, "3"]
[3.52555, "3"]
[10, "10" ]
[127.8392, "127"]
[1000, "1k" ]
[3600, "3k" ]
]
for test in tests
do (test) ->... | #= require utils/format_as_short_number
describe 'window.format_as_short_number', ->
tests = [
[`undefined`, "?"]
[null, "?"]
[0, "0"]
[3, "3"]
[3.52555, "3"]
[10, "10" ]
[127.8392, "127"]
[1000, "1k" ]
[3600, "3k" ]
]
for test in tests
do (test) ... |
Add JS toggle to show cards fields when has previously | window.NeighborlyBalancedCreditcard = Backbone.View.extend
el: '.neighborly-balanced-creditcard-form'
initialize: ->
_.bindAll(this, 'validate', 'submit')
$(document).foundation('forms')
this.$button = this.$('input[type=submit]')
this.$form = this.$('form')
this.$form.bind('submit', this.subm... | window.NeighborlyBalancedCreditcard = Backbone.View.extend
el: '.neighborly-balanced-creditcard-form'
initialize: ->
_.bindAll(this, 'validate', 'submit')
$(document).foundation('forms')
this.$button = this.$('input[type=submit]')
this.$form = this.$('form')
this.$form.bind('submit', this.subm... |
Add marker to satellite image | {Model} = require 'spine'
class Subject extends Model
@configure 'Subject', 'zooniverseId', 'location', 'coords', 'metadata'
@toClassify = []
select: ->
@trigger 'select'
satelliteImage: -> """
//maps.googleapis.com/maps/api/staticmap
?center=#{@coords.join ','}
&zoom=17
&size=565x380
... | {Model} = require 'spine'
class Subject extends Model
@configure 'Subject', 'zooniverseId', 'location', 'coords', 'metadata'
@toClassify = []
select: ->
@trigger 'select'
satelliteImage: -> """
//maps.googleapis.com/maps/api/staticmap
?center=#{@coords.join ','}
&zoom=17
&size=565x380
... |
Revert the timeout change in the docker runner | spawn = require("child_process").spawn
logger = require "logger-sharelatex"
Settings = require "settings-sharelatex"
module.exports = DockerRunner =
_docker: Settings.clsi?.docker?.binary or 'docker'
_baseCommand: ['run', '--rm=true', '-t', '-v', '$COMPILE_DIR:/source', '--name=texlive-$PROJECT_ID']
run: (proj... | spawn = require("child_process").spawn
logger = require "logger-sharelatex"
Settings = require "settings-sharelatex"
module.exports = DockerRunner =
_docker: Settings.clsi?.docker?.binary or 'docker'
_baseCommand: ['run', '--rm=true', '-t', '-v', '$COMPILE_DIR:/source', '--name=texlive-$PROJECT_ID']
run: (proj... |
Create button for creating challenges from feed | window.ReactFeedSelection = React.createClass
displayName: 'ReactFeedSelection'
mixins: [UpdateOnSignInOrOutMixin]
getInitialState: ->
feedChoice: 'global'
feeds:
global: new GlobalFeedActivities
personal: new PersonalFeedActivities
_handleFeedChoiceChange: (e) ->
if(e.target.checked)... | window.ReactFeedSelection = React.createClass
displayName: 'ReactFeedSelection'
mixins: [UpdateOnSignInOrOutMixin]
getInitialState: ->
feedChoice: 'global'
feeds:
global: new GlobalFeedActivities
personal: new PersonalFeedActivities
_handleFeedChoiceChange: (e) ->
if(e.target.checked)... |
Use parseFloat() instead of Number() in numeric range control | define [
'./range'
], (range) ->
# A control for entering an inclusive or exclusive numeric range
class NumberControl extends range.RangeControl
# Cast the lower bound to a number for use in the getValue() method
getLowerBoundValue: ->
return Number(@ui.lowerBound.val())
... | define [
'./range'
], (range) ->
# A control for entering an inclusive or exclusive numeric range
class NumberControl extends range.RangeControl
# Cast the lower bound to a number for use in the getValue() method
getLowerBoundValue: ->
return parseFloat(@ui.lowerBound.val())
... |
Use face an pop for model animation | #= require_self
#= require_tree .
window.Neighborly =
configs:
turbolinks: true
pjax: false
modules: -> []
initPage: ->
that = this
unless window.Turbolinks is undefined
$(document).bind "page:fetch", ->
that.Loading.show()
$(document).bind "page:restore", ->
that.L... | #= require_self
#= require_tree .
window.Neighborly =
configs:
turbolinks: true
pjax: false
modules: -> []
initPage: ->
that = this
unless window.Turbolinks is undefined
$(document).bind "page:fetch", ->
that.Loading.show()
$(document).bind "page:restore", ->
that.L... |
Replace player clones in tunnel | Game = @Game
Game.Scripts ||= {}
class Game.Scripts.TrainAssaulter extends Game.EntityScript
spawn: (options) ->
dir = options.from ? 'top'
switch dir
when 'top'
startY = .3
@endY = .6
when 'middle'
startY = .5
@endY = .5
else
startY = .6
@end... | Game = @Game
Game.Scripts ||= {}
class Game.Scripts.TrainAssaulter extends Game.EntityScript
assets: ->
@loadAssets('playerShip')
spawn: (options) ->
dir = options.from ? 'top'
switch dir
when 'top'
startY = .3
@endY = .6
when 'middle'
startY = .5
@endY = .5... |
Update preferred line length to 100 | "*":
editor:
invisibles: {}
showInvisibles: true
fontFamily: "Source Code Pro"
core:
ignoredNames: [
".bundle"
".git"
"log"
"repositories"
"tmp"
"vendor"
]
disabledPackages: [
"background-tips"
"exception-reporting"
"metrics"
]
"spe... | "*":
editor:
invisibles: {}
showInvisibles: true
fontFamily: "Source Code Pro"
preferredLineLength: 100
core:
ignoredNames: [
".bundle"
".git"
"log"
"repositories"
"tmp"
"vendor"
]
disabledPackages: [
"background-tips"
"exception-reporting"... |
Fix to work Remove/Add Fields under turbolinks | # 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/
# For dynamic appending test cases.
$ ->
$('form').on 'click', '.remove_fields', (event) ->
$(this).pr... | # 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/
# For dynamic appending test cases.
$(document).on 'turbolinks:load', -> # for turbolinks
$ -> # Remove F... |
Fix getting port from env | express = require 'express'
app = express()
# Serve static files
app.use express.static(__dirname + '/public')
# Set cache manifext content-type
app.use (req, res, next)->
if req.originalUrl == '/cache.manifest'
res.setHeader('Content-Type', 'text/cache-manifest')
next()
app.get '/', (req, res, next)->
res... | express = require 'express'
app = express()
# Serve static files
app.use express.static(__dirname + '/public')
# Set cache manifext content-type
app.use (req, res, next)->
if req.originalUrl == '/cache.manifest'
res.setHeader('Content-Type', 'text/cache-manifest')
next()
app.get '/', (req, res, next)->
res... |
Fix rendering failure in RDDs-output | H2O.RDDsOutput = (_, _rDDs) ->
_rDDViews = signal []
createRDDView = (rDD) ->
id: rDD.id
name: rDD.name
partitions: rDD.partitions
_rDDViews map _rDDs, createRDDView
rDDViews: _rDDViews
hasRDDs: _rDDs.length > 0
template: 'flow-rdds-output'
| H2O.RDDsOutput = (_, _go, _rDDs) ->
_rDDViews = signal []
createRDDView = (rDD) ->
id: rDD.id
name: rDD.name
partitions: rDD.partitions
_rDDViews map _rDDs, createRDDView
defer _go
rDDViews: _rDDViews
hasRDDs: _rDDs.length > 0
template: 'flow-rdds-output'
|
Fix bug introduced by coffee migration |
fs = require 'fs'
path = require 'path'
module.exports = (settings) ->
# Validation
throw new Error 'No shell provided' if not settings.shell
shell = settings.shell
# Plug completer to interface
shell.interface.completer = (text) ->
suggestions = []
routes = shell.routes
fo... |
module.exports = (settings) ->
# Validation
throw new Error 'No shell provided' if not settings.shell
shell = settings.shell
# Plug completer to interface
shell.interface.completer = (text) ->
suggestions = []
routes = shell.routes
for route in routes
command = r... |
Remove class instead of animation | Cookies = require 'cookies-js'
module.exports = ->
$el = $('.lo-cta')
unless Cookies.get('lo-cta')
$el.addClass 'lo-cta--visible'
$el.on 'click', '.lo-cta__close', (e) ->
$el.slideToggle "fast"
# Cookie expires in 1 day
Cookies.set 'lo-cta', true, { expires: 86400000 } | Cookies = require 'cookies-js'
module.exports = ->
$el = $('.lo-cta')
unless Cookies.get('lo-cta')
$el.addClass 'lo-cta--visible'
$el.on 'click', '.lo-cta__close', (e) ->
$el.removeClass 'lo-cta--visible'
# Cookie expires in 1 day
Cookies.set 'lo-cta', true, { expires: 86400000 } |
Add new convention method for performing channel actions | class @Cable.Channel
constructor: (params = {}) ->
@channelName ?= @underscore @constructor.name
params['channel'] = @channelName
@channelIdentifier = JSON.stringify params
cable.subscribe(@channelIdentifier, {
onConnect: @connected
onDisconnect: @disconnected
onReceiveData: @recei... | class @Cable.Channel
constructor: (params = {}) ->
@channelName ?= @underscore @constructor.name
params['channel'] = @channelName
@channelIdentifier = JSON.stringify params
cable.subscribe(@channelIdentifier, {
onConnect: @connected
onDisconnect: @disconnected
onReceiveData: @recei... |
Delete password in an afterEach function | keytar = require '../lib/keytar'
describe "keytar", ->
service = 'keytar tests'
account = 'buster'
password = 'secret'
beforeEach ->
keytar.deletePassword(service, account)
describe "addPassword(service, account, password)", ->
it "returns true when the service, account, and password are specified"... | keytar = require '../lib/keytar'
describe "keytar", ->
service = 'keytar tests'
account = 'buster'
password = 'secret'
beforeEach ->
keytar.deletePassword(service, account)
afterEach ->
keytar.deletePassword(service, account)
describe "addPassword(service, account, password)", ->
it "returns... |
Write a test. It passed! | # Use chai assertation library
expect = chai.expect
before ->
@client = new Postie.Client('http://example.org/background.html')
describe 'ready', ->
it 'should create an iframe', ->
@client.ready()
expect(@client._frame).to.be.an.instanceof(Window)
| describe 'ready', ->
it 'should create an iframe', ->
@client = new Postie.Client('http://example.org/background.html')
@client.ready()
expect(@client._frame).not.toBeNull()
|
Update api to match cnx-archive | # Representation of individual nodes in a book's tree (table of contents).
# A Node can represent both a tree (subcollection), or leaf (page).
# Page Nodes also are used to cache a page's content once loaded.
define (require) ->
Backbone = require('backbone')
settings = require('cs!settings')
require('backbone-a... | # Representation of individual nodes in a book's tree (table of contents).
# A Node can represent both a tree (subcollection), or leaf (page).
# Page Nodes also are used to cache a page's content once loaded.
define (require) ->
Backbone = require('backbone')
settings = require('cs!settings')
require('backbone-a... |
Use to inject mock service | 'use strict'
describe 'Controller: ContactCtrl', ->
# load the controller's module
beforeEach module 'expressoApp'
ContactCtrl = {}
scope = {}
# Initialize the controller and a mock scope
beforeEach inject ($controller, $rootScope, $injector) ->
scope = $rootScope.$new()
AuthService = $injector... | 'use strict'
describe 'Controller: ContactCtrl', ->
# load the controller's module
beforeEach module 'expressoApp'
beforeEach ->
AuthServiceMock = {
isAuthenticated: ->
,
isAuthorized: ->
}
module ($provide) ->
$provide.value 'AuthService', AuthServiceMock
null
... |
Use a different serverAddress so it works over apache proxied connection | define [
'models/server'
'vendor/underscore'
'vendor/jquery'
], ( Server ) ->
# Application base class
#
class App
id: null
serverAddress: ''
# Constructs a new app.
#
constructor: ( ) ->
@_initTime = performance.now()
@server = new Server(@serverAddress)
@initialize()
# Is called... | define [
'models/server'
'vendor/underscore'
'vendor/jquery'
], ( Server ) ->
# Application base class
#
class App
id: null
serverAddress: ':8080/'
# Constructs a new app.
#
constructor: ( ) ->
@_initTime = performance.now()
@server = new Server(@serverAddress)
@initialize()
# Is ... |
Move require inside method to fix hot module reloading | {NotificationActions} = require 'shared'
Router = require './router'
module.exports =
start: (bootstrapData) ->
NotificationActions.startPolling()
for level, message of (bootstrapData.flash or {})
NotificationActions.display({message, level})
buildCallbackHandlers: (comp) ->
router = comp.cont... | {NotificationActions} = require 'shared'
module.exports =
start: (bootstrapData) ->
NotificationActions.startPolling()
for level, message of (bootstrapData.flash or {})
NotificationActions.display({message, level})
buildCallbackHandlers: (comp) ->
# Require router here because requiring it in g... |
Fix 'create new' in private group list opening 'create channel' flex | Template.listPrivateGroupsFlex.helpers
groups: ->
return ChatSubscription.find { t: { $in: ['p']}, f: { $ne: true } }, { sort: 't': 1, 'name': 1 }
Template.listPrivateGroupsFlex.events
'click header': ->
SideNav.closeFlex()
'click .channel-link': ->
SideNav.closeFlex()
'click footer .create': ->
SideNa... | Template.listPrivateGroupsFlex.helpers
groups: ->
return ChatSubscription.find { t: { $in: ['p']}, f: { $ne: true } }, { sort: 't': 1, 'name': 1 }
Template.listPrivateGroupsFlex.events
'click header': ->
SideNav.closeFlex()
'click .channel-link': ->
SideNav.closeFlex()
'click footer .create': ->
SideNa... |
Address duplicate definition from merge and load order issue | #= require models/data/query
#= require models/data/project
#= require models/data/user
#= require models/ui/temporal
#= require models/ui/project_list
data = @edsc.models.data
ui = @edsc.models.ui
ns = @edsc.models.page
ui = @edsc.models.ui
ns.AccessPage = do (ko,
setCurrent = ns.setCurrent
... | #= require models/data/query
#= require models/data/project
#= require models/data/user
#= require models/ui/temporal
#= require models/ui/project_list
data = @edsc.models.data
ui = @edsc.models.ui
ns = @edsc.models.page
ns.AccessPage = do (ko,
setCurrent = ns.setCurrent
access... |
Fix accidentally created closure inside of a loop | $ ->
initializeButtons = () ->
for metric in gon.metrics
repository = gon.repository.name
$(".compute-metric.#{metric}").on 'click', (event) =>
parameter = { "repository": repository, "metric": metric }
$.post("/metrics/compute", parameter, (data, status) =>
console.log dat... | $ ->
createRequestCallback = (repository, metric) ->
return () ->
parameter = {"repository": repository, "metric": metric}
$.post("/metrics/compute", parameter)
initializeButtons = () ->
for metric in gon.metrics
repository = gon.repository.name
$(".compute-metric.#{metric}").bind... |
Return new scopes array for each line tokenized | {Emitter} = require 'emissary'
module.exports =
class NullGrammar
Emitter.includeInto(this)
name: 'Null Grammar'
scopeName: 'text.plain.null-grammar'
constructor: ->
@scopes = ['null-grammar.text.plain']
getScore: -> 0
tokenizeLine: (line) ->
tokens: [{value: line, @scopes}]
tokenizeLines: (... | {Emitter} = require 'emissary'
module.exports =
class NullGrammar
Emitter.includeInto(this)
name: 'Null Grammar'
scopeName: 'text.plain.null-grammar'
getScore: -> 0
tokenizeLine: (line) ->
tokens: [{value: line, scopes: ['null-grammar.text.plain']}]
tokenizeLines: (text) ->
lines = text.split('... |
Use the document for the listener target for turbolinks | #= require glimpse/vendor/jquery.tipsy
updatePerformanceBar = ->
glimpseResults = $('#glimpse-results')
$('#glimpse [data-defer-to]').each ->
deferKey = $(this).data 'defer-to'
data = glimpseResults.data deferKey
$(this).text data
initializeTipsy = ->
$('#glimpse .tooltip').each ->
el = $(this)
... | #= require glimpse/vendor/jquery.tipsy
updatePerformanceBar = ->
glimpseResults = $('#glimpse-results')
$('#glimpse [data-defer-to]').each ->
deferKey = $(this).data 'defer-to'
data = glimpseResults.data deferKey
$(this).text data
initializeTipsy = ->
$('#glimpse .tooltip').each ->
el = $(this)
... |
Fix bug that unrelated builds are updated | $ ->
$('.jobs_controller.index_action').each ->
new Altria.ServerEvent()
.on 'build.started build.finished', (attributes) ->
$.ajax "/jobs/#{attributes.job_id}", success: (data) ->
$("#job#{attributes.job_id}").replaceWith(data)
$('.jobs_controller.show_action').each ->
event = new ... | $ ->
$('.jobs_controller.index_action').each ->
new Altria.ServerEvent()
.on 'build.started build.finished', (attributes) ->
$.ajax "/jobs/#{attributes.job_id}", success: (data) ->
$("#job#{attributes.job_id}").replaceWith(data)
$('.jobs_controller.show_action').each ->
event = new ... |
Make Router context not a hash | #= require app
App.Router = Ember.Router.extend
enableLogging: true
location: 'hash'
root: Ember.Route.extend
index: Ember.Route.extend
route: '/'
redirectsTo: 'whatwouldisee.index'
whatwouldisee: Ember.Route.extend
route: '/whatwouldisee'
doLookUp: (router, e) ->
if sc... | #= require app
App.Router = Ember.Router.extend
enableLogging: true
location: 'hash'
root: Ember.Route.extend
index: Ember.Route.extend
route: '/'
redirectsTo: 'whatwouldisee.index'
whatwouldisee: Ember.Route.extend
route: '/whatwouldisee'
doLookUp: (router, e) ->
if sc... |
Update opinionaters when model changes | class window.OpinionatersEvidence extends Backbone.Model
opinionaters: ->
@_opinionaters ?= new Users @get('users')
| class window.OpinionatersEvidence extends Backbone.Model
opinionaters: ->
unless @_opinionaters?
@_opinionaters = new Users @get('users')
@on 'change', => @_opinionaters.reset @get('users')
@_opinionaters
|
Add ctrl+h -> ctrl+f to atom keybindings | '.platform-win32, .platform-linux':
'alt-\\': 'unset!' # tree-view:toggle-focus default
'ctrl-|': 'unset!' # tree-view:reveal-active-file default
'ctrl-0': 'tree-view:reveal-active-file'
'atom-workspace atom-text-editor:not([mini])':
'ctrl-up': 'unset!' # editor:move-line-up default
'ctrl-shift-up': 'editor:... | '.platform-win32, .platform-linux':
'alt-\\': 'unset!' # tree-view:toggle-focus default
'ctrl-|': 'unset!' # tree-view:reveal-active-file default
'ctrl-0': 'tree-view:reveal-active-file'
'ctrl-h': 'find-and-replace:show'
'atom-workspace atom-text-editor:not([mini])':
'ctrl-up': 'unset!' # editor:move-line-up... |
Add check for maximum data length of 900 characters | # Description:
# Generate QR codes as PNG with size 128x128 pixels
# Using service from [QR Code Generator](http://goqr.me/api/doc/create-qr-code/)
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot qr gen <data>
#
# Author:
# eelcokoelewijn
# http(s)://api.qrserver.com/v1/create-qr-... | # Description:
# Generate QR codes as PNG with size 128x128 pixels
# Using service from [QR Code Generator](http://goqr.me/api/doc/create-qr-code/)
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot qr gen <data>
#
# Author:
# eelcokoelewijn
# http(s)://api.qrserver.com/v1/create-qr-... |
Implement methods to handle indexes in Models | RocketChat.models._Base = class
find: ->
return @model.find.apply @model, arguments
findOne: ->
return @model.findOne.apply @model, arguments
insert: ->
return @model.insert.apply @model, arguments
update: ->
return @model.update.apply @model, arguments
upsert: ->
return @model.upsert.apply @model, a... | RocketChat.models._Base = class
find: ->
return @model.find.apply @model, arguments
findOne: ->
return @model.findOne.apply @model, arguments
insert: ->
return @model.insert.apply @model, arguments
update: ->
return @model.update.apply @model, arguments
upsert: ->
return @model.upsert.apply @model, a... |
Save cell edits if user clicks outside of the cell. | $ ->
enableEditables()
enableEditables = ->
$('span.editable').editable (value, settings) ->
$span = $(this)
data = {_method: 'PUT'}
data[$span.data('attribute')] = value
# TODO: We should handle failures and timeouts in POSTing, and make our own "Saving..." indicator.
$.post($span.data('url'),... | $ ->
enableEditables()
enableEditables = ->
$('span.editable').editable (value, settings) ->
$span = $(this)
data = {_method: 'PUT'}
data[$span.data('attribute')] = value
# TODO: We should handle failures and timeouts in POSTing, and make our own "Saving..." indicator.
$.post($span.data('url'),... |
Print msg to stderr in case of problem. | Config = require '../config'
argv = require('optimist')
.usage('Usage: $0 --projectKey key --clientId id --clientSecret secret')
.demand(['projectKey','clientId', 'clientSecret'])
.argv
OrderDistribution = require('../main').OrderDistribution
options =
master: Config.config
retailer:
project_key: argv.pr... | Config = require '../config'
argv = require('optimist')
.usage('Usage: $0 --projectKey key --clientId id --clientSecret secret')
.demand(['projectKey','clientId', 'clientSecret'])
.argv
OrderDistribution = require('../main').OrderDistribution
options =
master: Config.config
retailer:
project_key: argv.pr... |
Add record querying to FixtureAdapter. | Syrup.ApplicationAdapter = DS.FixtureAdapter
| Syrup.ApplicationAdapter = DS.FixtureAdapter.extend
queryFixtures: (records, query, type)->
console.log('in queryFixtures')
records.filter (record)->
for own key, value of query
if record[key] != value
return false
return true
|
Use correct property name for Facebook OG tags. | React = require 'react'
module.exports = (tags) ->
_tags = []
for name, content of tags
if content
_tags.push <meta name=name content=content key=name />
return _tags | React = require 'react'
module.exports = (meta) ->
tags = []
for k,v of meta
if k.split(':')[0] is 'og'
tags.push(<meta property=k content=v key=k />)
else
tags.push(<meta name=k content=v key=k />)
return tags |
Add a blank option when selecting the location option | jQuery ->
$('form').on 'click', '.add_fields', (event) ->
time = new Date().getTime()
regexp = new RegExp($(this).data('id'), 'g')
$(this).before($(this).data('fields').replace(regexp, time))
event.preventDefault()
jQuery ->
$('#items').dataTable
columnDefs: [
## https://datat... | jQuery ->
$('form').on 'click', '.add_fields', (event) ->
time = new Date().getTime()
regexp = new RegExp($(this).data('id'), 'g')
$(this).before($(this).data('fields').replace(regexp, time))
event.preventDefault()
jQuery ->
$('#items').dataTable
columnDefs: [
## https://datat... |
Create game with proper from param | twilio = require 'twilio'
reset = '+16466816260'
module.exports = (app) ->
Game = app.get 'game'
hook = twilio.webhook
validate: false
app.get '/twilio/voice', hook, (req, res) ->
twiml = new twilio.TwimlResponse
if req.param('To') == reset
return Game.create req.param('To'), (err, game) ->
... | twilio = require 'twilio'
reset = '+16466816260'
module.exports = (app) ->
Game = app.get 'game'
hook = twilio.webhook
validate: false
app.get '/twilio/voice', hook, (req, res) ->
twiml = new twilio.TwimlResponse
if req.param('To') == reset
return Game.create req.param('From'), (err, game) -... |
Remove themes and disable telemetry | "*":
"atom-autocomplete-php": {}
"atom-beautify":
css:
beautify_on_save: true
end_with_newline: true
indent_size: 2
no_lead_zero: true
general:
analytics: false
beautifyEntireFileOnSave: false
html:
end_with_newline: true
indent_size: 2
js:
end_w... | "*":
"atom-autocomplete-php": {}
"atom-beautify":
css:
beautify_on_save: true
end_with_newline: true
indent_size: 2
no_lead_zero: true
general:
analytics: false
beautifyEntireFileOnSave: false
html:
end_with_newline: true
indent_size: 2
js:
end_w... |
Create computed properties checking storage of text | `import DS from 'ember-data'`
BlogyPost = DS.Model.extend {
published: DS.attr()
draft: DS.attr()
ilustration: DS.attr()
title: DS.attr()
locale: DS.attr()
slug: DS.attr()
storage: DS.attr()
format: DS.attr()
document: DS.attr()
remote: DS.attr()
text: DS.attr()
content: DS.attr()
plain: DS.a... | `import DS from 'ember-data'`
BlogyPost = DS.Model.extend {
published: DS.attr()
draft: DS.attr()
ilustration: DS.attr()
title: DS.attr()
locale: DS.attr()
slug: DS.attr()
storage: DS.attr()
format: DS.attr()
document: DS.attr()
remote: DS.attr()
text: DS.attr()
content: DS.attr()
createdAt: ... |
Call exit on process global |
module.exports = (grunt) ->
grunt.registerTask 'check-licenses', 'Report the licenses of all dependencies', ->
legalEagle = require 'legal-eagle'
{size, keys} = require 'underscore-plus'
done = @async()
options =
path: process.cwd()
omitPermissive: true
overrides: require './licens... | module.exports = (grunt) ->
grunt.registerTask 'check-licenses', 'Report the licenses of all dependencies', ->
legalEagle = require 'legal-eagle'
{size, keys} = require 'underscore-plus'
done = @async()
options =
path: process.cwd()
omitPermissive: true
overrides: require './license... |
Fix view reize based on keyboard | if Meteor.isCordova
window.addEventListener 'deviceready', ->
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
window.addEventListener 'native.keyboardshow', ->
$('.main-content').css 'height', window.innerHeight
window.addEventListener 'native.keyboardhi... | if Meteor.isCordova
document.addEventListener 'deviceready', ->
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
window.addEventListener 'native.keyboardshow', ->
$('.main-content').css 'height', window.innerHeight
window.addEventListener 'native.keyboard... |
Throw error on line not found | class @Locale
constructor: ->
# @param dialoguesFilename [String] path of the JSON file containing all the localized dialogue lines
loadDialogueLines: (dialoguesFilename) =>
$.getJSON(dialoguesFilename, @buildDialogueLines)
.done(-> console.log "[LOAD] Loaded localized dialogue lines")
.fail(-> ... | class @Locale
constructor: ->
# @param dialoguesFilename [String] path of the JSON file containing all the localized dialogue lines
loadDialogueLines: (dialoguesFilename) =>
$.getJSON(dialoguesFilename, @buildDialogueLines)
.done(-> console.log "[LOAD] Loaded localized dialogue lines")
.fail(-> ... |
Fix path to my more typical username - aross | "*":
core:
disabledPackages: [
"background-tips"
"exception-reporting"
"metrics"
]
followSymlinks: false
hideGitIgnoredFiles: true
ignoredNames: [
".bundle"
".git"
"log"
"repositories"
"tmp"
"vendor"
]
themes: [
"unity-ui"
"... | "*":
core:
disabledPackages: [
"background-tips"
"exception-reporting"
"metrics"
]
followSymlinks: false
hideGitIgnoredFiles: true
ignoredNames: [
".bundle"
".git"
"log"
"repositories"
"tmp"
"vendor"
]
themes: [
"unity-ui"
"... |
Make sure application_serializer is always required first | #= require ./element_animations
#= require ./store
#= require ./event_stream_actions
#= require_tree ./mixins
#= require_tree ./models
#
#= require ./controllers/task_controller
#= require_tree ./controllers
#
#= require ./views/overlays/overlay
#= require_tree ./views/forms
#= require_tree ./views
#
#= require_tree ./... | #= require ./element_animations
#= require ./store
#= require ./event_stream_actions
#= require_tree ./mixins
#= require ./serializers/application_serializer
#= require_tree ./serializers
#= require_tree ./models
#
#= require ./controllers/task_controller
#= require_tree ./controllers
#
#= require ./views/overlays/over... |
Refactor with destructuring and expand InStateMenu. | define [
'phaser'
'underscore'
'app/helpers'
], (Phaser, _, Helpers) ->
'use strict'
{Keyboard} = Phaser
class InStateMenu
constructor: (@textItems, @game, @options) ->
@_initialize()
_initialize: ->
@group = @game.add.group()
@overlay = @game.add.graphics 0, 0, @group
... | define [
'phaser'
'underscore'
'app/helpers'
], (Phaser, _, Helpers) ->
'use strict'
{Keyboard} = Phaser
class InStateMenu
constructor: (@textItems, game, options = {}) ->
{@pauseHandler, @layout, @toggleKeyCode} = _.defaults options,
layout: { y: 120, baseline: 40 }
pauseHandl... |
Remove console logging to not spam output | if not Meteor.server
console.log("spacejamio:cli - Meteor.server is not defined, creating noop implementations for all meteor ddp methods")
_.each(['publish', 'methods', 'call', 'apply', 'onConnection'],
(name) ->
Meteor[name] = ->
);
| if not Meteor.server
# Meteor.server is not defined, creating noop implementations for all meteor ddp methods
_.each(['publish', 'methods', 'call', 'apply', 'onConnection'],
(name) ->
Meteor[name] = ->
);
|
Use trim of jquery (trim does not exist in IE8) | #= require partystreusel/base
class Readmore extends Partystreusel.Base
@className = 'Readmore'
constructor: (el) ->
super
@contentDiv = $('<div/>')
.append(@$el.contents())
.addClass('hide')
@$el.append(@contentDiv)
return if @contentDiv.text().trim() == ''
@button = @renderBut... | #= require partystreusel/base
class Readmore extends Partystreusel.Base
@className = 'Readmore'
constructor: (el) ->
super
@contentDiv = $('<div/>')
.append(@$el.contents())
.addClass('hide')
@$el.append(@contentDiv)
return if $.trim(@contentDiv.text()) == ''
@button = @renderBu... |
Fix typo in route name | angular.module('app.modules.tabs', [
'app.modules.tabs.items'
'app.modules.tabs.review'
'app.modules.tabs.menus'
'app.modules.tabs.settings'
# 'app.components.tabs.share'
# 'app.components.tabs.notify'
])
.config ($stateProvider, $urlRouterProvider) ->
$stateProvider
.state "tab",
url: "/tab"
... | angular.module('app.modules.tabs', [
'app.modules.tabs.items'
'app.modules.tabs.review'
'app.modules.tabs.menus'
'app.modules.tabs.settings'
# 'app.components.tabs.share'
# 'app.components.tabs.notify'
])
.config ($stateProvider, $urlRouterProvider) ->
$stateProvider
.state "tab",
url: "/tab"
... |
Change default value of toFixed|toExponential|toPrecision methods | Handlebars.registerHelper 'toFixed', (number, digits) ->
number.toFixed if Utils.isUndefined(digits) then digits
Handlebars.registerHelper 'toPrecision', (number, precision) ->
number.toPrecision if Utils.isUndefined(precision) then precision
Handlebars.registerHelper 'toExponential', (number, fractions) ->
... | Handlebars.registerHelper 'toFixed', (number, digits) ->
digits = 0 if Utils.isUndefined(digits)
number.toFixed digits
Handlebars.registerHelper 'toPrecision', (number, precision) ->
precision = 1 if Utils.isUndefined(precision)
number.toPrecision precision
Handlebars.registerHelper 'toExponential', (... |
Remove unnecessary context information in CoffeeLint's message | {Range, Point} = require 'atom'
CheckstyleBase = require './checkstyle-base'
Violation = require '../violation'
module.exports =
class CoffeeLint extends CheckstyleBase
buildCommand: ->
command = []
userCoffeeLintPath = atom.config.get('atom-lint.coffeelint.path')
if userCoffeeLintPath?
command.p... | {Range, Point} = require 'atom'
CheckstyleBase = require './checkstyle-base'
Violation = require '../violation'
module.exports =
class CoffeeLint extends CheckstyleBase
buildCommand: ->
command = []
userCoffeeLintPath = atom.config.get('atom-lint.coffeelint.path')
if userCoffeeLintPath?
command.p... |
Add context section so well-formed test | should = require 'should'
{wd40, browser, base_url, login_url, home_url, prepIntegration} = require './helper'
describe 'Free Trial', ->
prepIntegration()
before (done) ->
wd40.fill '#username', 'free-trial-user', ->
wd40.fill '#password', 'testing', ->
wd40.click '#login', done
before (done)... | should = require 'should'
{wd40, browser, base_url, login_url, home_url, prepIntegration} = require './helper'
describe 'Free Trial', ->
prepIntegration()
context 'when I log in as a free trial user', ->
before (done) ->
wd40.fill '#username', 'free-trial-user', ->
wd40.fill '#password', 'testin... |
Migrate projects from single doing column to array of doing columns | angular.module 'Scrumble.common'
.config ($stateProvider) ->
$stateProvider
.state 'tab',
abstract: true
templateUrl: 'common/states/base.html'
controller: 'BaseCtrl'
resolve:
sprint: ($state, Sprint) ->
Sprint.getActiveSprint().catch (err) -> return
project: ($state, Project) ->... | angular.module 'Scrumble.common'
.config ($stateProvider) ->
$stateProvider
.state 'tab',
abstract: true
templateUrl: 'common/states/base.html'
controller: 'BaseCtrl'
resolve:
sprint: ($state, Sprint) ->
Sprint.getActiveSprint().catch (err) -> return
project: ($state, Project) ->... |
Configure moment().calender() to be used as an alternative to moment().from() | window.env = require 'env'
window.utils = require 'utils'
window.constants = require 'constants'
window.app = require 'application'
# Make all string methods available on _
_.mixin _.string.exports()
# Set Vex default className
vex.defaultOptions.className = 'vex-theme-default'
# Patch jQuery ajax to always use xhrF... | window.env = require 'env'
window.utils = require 'utils'
window.constants = require 'constants'
window.app = require 'application'
# Make all string methods available on _
_.mixin _.string.exports()
# Set Vex default className
vex.defaultOptions.className = 'vex-theme-default'
# Patch jQuery ajax to always use xhrF... |
Use `git pull` instead of fetch + merge. | git = require '../git'
OutputView = require './output-view'
BranchListView = require './branch-list-view'
module.exports =
# Extension of BranchListView
# Takes the name of the remote to pull from
class PullBranchListView extends BranchListView
initialize: (@repo, @data, @remote) ->
super
confirme... | git = require '../git'
OutputView = require './output-view'
BranchListView = require './branch-list-view'
module.exports =
# Extension of BranchListView
# Takes the name of the remote to pull from
class PullBranchListView extends BranchListView
initialize: (@repo, @data, @remote) ->
super
confirme... |
Add before sharing callback for facebook | class @SharingTags.BaseShare
url: null
title: null
description: null
constructor: ({@url, @title, @description})->
@_assert_vars 'url'
_open_popup: (api_url, params)->
share_url = if params then "#{api_url}?#{$.param(params)}" else api_url
share_window = window.open share_url, 'Share Dialog', '... | class @SharingTags.BaseShare
url: null
title: null
description: null
constructor: ({@url, @title, @description})->
@_assert_vars 'url'
_open_popup: (api_url, params)->
share_url = if params then "#{api_url}?#{$.param(params)}" else api_url
share_window = window.open share_url, 'Share Dialog', '... |
Stop blinking after each test | noflo = require 'noflo'
chai = require 'chai' unless chai
StateToColor = require '../components/StateToColor.coffee'
fs = require 'fs'
path = require 'path'
describe 'StateToColor component', ->
c = null
state = null
color = null
portalConfig = null
beforeEach ->
c = StateToColor.getComponent()
porta... | noflo = require 'noflo'
chai = require 'chai' unless chai
StateToColor = require '../components/StateToColor.coffee'
fs = require 'fs'
path = require 'path'
describe 'StateToColor component', ->
c = null
state = null
color = null
portalConfig = null
beforeEach ->
c = StateToColor.getComponent()
porta... |
Transform specs to something useful | MarkdownPreviewView = require 'markdown-preview/lib/markdown-preview-view'
$ = require 'jquery'
{$$$} = require 'space-pen'
describe "MarkdownPreviewView", ->
[buffer, preview] = []
beforeEach ->
project.setPath(project.resolve('markdown'))
buffer = project.bufferForPath('file.markdown')
preview = new... | MarkdownPreviewView = require 'markdown-preview/lib/markdown-preview-view'
$ = require 'jquery'
{$$$} = require 'space-pen'
describe "MarkdownPreviewView", ->
[buffer, preview] = []
beforeEach ->
project.setPath(project.resolve('markdown'))
buffer = project.bufferForPath('file.markdown')
preview = new... |
Add test for removing a specific responder | module "PubSub"
require ["core/pubsub"], (pubsub) ->
test "export aliases", ->
ok pubsub.on is pubsub.respondTo, "on and respondTo"
ok pubsub.off is pubsub.stopResponding, "off and stopResponding"
test "simple on/fire", ->
memoValue = null
expectedMemo = "expected"
pubsub.on "stim", (memo)... | module "PubSub"
require ["core/pubsub"], (pubsub) ->
test "export aliases", ->
ok pubsub.on is pubsub.respondTo, "on and respondTo"
ok pubsub.off is pubsub.stopResponding, "off and stopResponding"
test "simple on/fire", ->
memoValue = null
expectedMemo = "expected"
pubsub.on "stim", (memo)... |
Add atom ctags for Ruby. | "*":
editor:
fontFamily: "Menlo"
showIndentGuide: true
tabLength: 2
invisibles: {}
preferredLineLength: 120
softWrap: true
fontSize: 14
core:
ignoredNames: [
".bundle"
".git"
"log"
"repositories"
"tmp"
"vendor"
]
disabledPackages: [
"... | "*":
editor:
fontFamily: "Menlo"
showIndentGuide: true
tabLength: 2
invisibles: {}
preferredLineLength: 120
softWrap: true
core:
ignoredNames: [
".bundle"
".git"
"log"
"repositories"
"tmp"
"vendor"
]
disabledPackages: [
"background-tips"
... |
Fix retrieval of `error` field, used for endpoint updates | # This file contains custom Nylas error classes.
#
# In general I think these should be created as sparingly as possible.
# Only add one if you really can't use native `new Error("my msg")`
# A wrapper around the three arguments we get back from node's `request`
# method. We wrap it in an error object because Promise... | # This file contains custom Nylas error classes.
#
# In general I think these should be created as sparingly as possible.
# Only add one if you really can't use native `new Error("my msg")`
# A wrapper around the three arguments we get back from node's `request`
# method. We wrap it in an error object because Promise... |
Add test for multiple bufferModifying linters | describe 'buffer modifying linters', ->
getModuleMain = -> atom.packages.getActivePackage('linter').mainModule.instance
beforeEach ->
waitsForPromise ->
atom.packages.activatePackage('linter')
waitsForPromise ->
atom.workspace.open('test.txt')
it 'is triggered before other linters', ->
lin... | describe 'buffer modifying linters', ->
getModuleMain = -> atom.packages.getActivePackage('linter').mainModule.instance
beforeEach ->
waitsForPromise ->
atom.packages.activatePackage('linter')
waitsForPromise ->
atom.workspace.open('test.txt')
it 'is triggered before other linters', ->
lin... |
Copy bill address to shipping address when the checkout address page loads | window.MultiShippingAddress ||= {}
$.extend(MultiShippingAddress, { SameAsBilling: {} })
class MultiShippingAddress.SameAsBilling.CopyBillToShip
constructor: (@$form) ->
@findShippingAddresses()
@bindForm()
@bindCountrySelects()
billAddress: null
shippingAddresses: []
getName: ($input) ->
$in... | window.MultiShippingAddress ||= {}
$.extend(MultiShippingAddress, { SameAsBilling: {} })
class MultiShippingAddress.SameAsBilling.CopyBillToShip
constructor: (@$form) ->
@findShippingAddresses()
@bindCountrySelects()
@getBillAddress()
@copyBillAddress()
@bindForm()
billAddress: null
shipping... |
Set input value to default rails date | window.DatePickerView = class DatePickerView extends Uniform
@::counter = 0
elements: (add) ->
add('select', 'select')
events: (add) ->
add('.input-date', 'changeDate', (el, e) -> @update_select_values(el))
init: ->
super
@select.hide()
@insert_date_input()
date_input = ->
$ """
... | window.DatePickerView = class DatePickerView extends Uniform
@::counter = 0
elements: (add) ->
add('select', 'select')
events: (add) ->
add('.input-date', 'changeDate', (el, e) -> @update_select_values(el))
init: ->
super
@select.hide()
@insert_date_input()
date_input = ->
$ """
... |
Refactor NodeCanvasElement: use brackets for clarity. | define [
'viewmodels/drawings/canvas_element'
'viewmodels/drawings/stencils/stencil_factory'
'models/commands/delete_node'
'models/commands/composite_command'
'models/commands/move_node'
], (CanvasElement, StencilFactory, DeleteNode, CompositeCommand, MoveNode) ->
class NodeCanvasElement extends CanvasElem... | define [
'viewmodels/drawings/canvas_element'
'viewmodels/drawings/stencils/stencil_factory'
'models/commands/delete_node'
'models/commands/composite_command'
'models/commands/move_node'
], (CanvasElement, StencilFactory, DeleteNode, CompositeCommand, MoveNode) ->
class NodeCanvasElement extends CanvasElem... |
Add a mixing to offer the same API for decorations as editors | Mixin = require 'mixto'
module.exports =
class DecorationManagement extends Mixin
decorateMarker: (marker, options={}) ->
| Mixin = require 'mixto'
Decoration = require atom.config.resourcePath + '/src/decoration'
module.exports =
class DecorationManagement extends Mixin
initializeDecorations: ->
@decorationsById = {}
@decorationsByMarkerId = {}
@decorationMarkerChangedSubscriptions = {}
@decorationMarkerDestroyedSubscrip... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.