Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Revert "remove respimg plugin and add unload plugin" | #= require lazysizes/plugins/rias/ls.rias
#= require lazysizes/plugins/bgset/ls.bgset
#= require lazysizes/plugins/unload/ls.unload
#= require lazysizes
| #= require lazysizes/plugins/rias/ls.rias
#= require lazysizes/plugins/bgset/ls.bgset
#= require lazysizes/plugins/respimg/ls.respimg
# require lazysizes/plugins/custommedia/ls.custommedia
#= require lazysizes |
Change sort to use > and not >= | mid = new Date('02/25/14 00:00:00')
Template.agenda.day1 = ->
@items.filter((i) -> i.time < mid).sort((a, b) -> a.time >= b.time)
Template.agenda.day2 = ->
@items.filter((i) -> i.time > mid).sort((a, b) -> a.time >= b.time)
Template.agenda.canSee = ->
u = User.current()
u and (u.admin() or u.moderator())
Tem... | mid = new Date('02/25/14 00:00:00')
Template.agenda.day1 = ->
@items.filter((i) -> i.time < mid).sort((a, b) -> a.time > b.time)
Template.agenda.day2 = ->
@items.filter((i) -> i.time > mid).sort((a, b) -> a.time > b.time)
Template.agenda.canSee = ->
u = User.current()
u and (u.admin() or u.moderator())
Templ... |
Refactor loading of order in Orders.find() | Sprangular.service "Orders", ($http) ->
service =
find: (number) ->
$http.get("/api/orders/#{number}")
.then (response) ->
order = new Sprangular.Order
order.load(response.data)
service
| Sprangular.service "Orders", ($http) ->
service =
find: (number) ->
$http.get("/api/orders/#{number}")
.then (response) ->
Sprangular.extend(response.data, Sprangular.Order)
service
|
Fix Biskoto to be compatible with PhantomJS's escaping of cookies | define ->
class Biskoto
encode = encodeURIComponent
decode = decodeURIComponent
@get: (name) ->
if document.cookie
cookies = decode(document.cookie).split(/;\s/g)
for cookie in cookies
if cookie.indexOf(name) is 0
try
return JSON.parse(cookie.spl... | define ->
class Biskoto
encode = encodeURIComponent
decode = decodeURIComponent
@get: (name) ->
if document.cookie
cookies = document.cookie.split(/;\s/g)
for cookie in cookies
if cookie.indexOf(name) is 0
value = decode(cookie.split('=')[1])
try
... |
Allow street lights to be not connected | noflo = require 'noflo'
class ConvertStreetLight extends noflo.Component
icon: 'filter'
description: 'Convert street light RGB values so we can send them to PWM'
constructor: ->
@inPorts = new noflo.InPorts
colors:
datatype: 'array'
description: 'Street light values'
@outPorts = ne... | noflo = require 'noflo'
class ConvertStreetLight extends noflo.Component
icon: 'filter'
description: 'Convert street light RGB values so we can send them to PWM'
constructor: ->
@inPorts = new noflo.InPorts
colors:
datatype: 'array'
description: 'Street light values'
@outPorts = ne... |
Fix warnings caused by invalid nesting of p elems | React = require 'react'
EnrollButton = require '../students/enroll_button'
InlineUsers = React.createClass(
displayName: 'InlineUsers'
render: ->
key = @props.title + '_' + @props.role
last_user_index = @props.users.length - 1
user_list = @props.users.map (user, index) ->
link = ... | React = require 'react'
EnrollButton = require '../students/enroll_button'
InlineUsers = React.createClass(
displayName: 'InlineUsers'
render: ->
key = @props.title + '_' + @props.role
last_user_index = @props.users.length - 1
user_list = @props.users.map (user, index) ->
link = ... |
Set the branch to '', that makes it use the default. | define [], () ->
defaultRepo:
repoUser: 'oerpub'
repoName: 'textbook-demo'
branch: 'master'
| define [], () ->
defaultRepo:
repoUser: 'oerpub'
repoName: 'textbook-demo'
branch: ''
|
Fix param posting in chrome | BaseView = require 'views/base_view'
class Dialog extends BaseView
className: 'dialog'
tag: 'div'
dialogTemplate: require './templates/dialog'
initialize: (options) ->
@parent = options.parent
close: =>
@remove()
confirm: (e) =>
unless e.type is 'keypress' and e.which isnt 13
@confir... | BaseView = require 'views/base_view'
class Dialog extends BaseView
className: 'dialog'
tag: 'div'
dialogTemplate: require './templates/dialog'
initialize: (options) ->
@parent = options.parent
close: =>
@remove()
confirm: (e) =>
unless e.type is 'keypress' and e.which isnt 13
e.preve... |
Add Allen's information to team | root = exports ? this
root.team =
paul:
name: "Paul Bigger"
role: "Founder"
photo: "paul.jpg"
github: "pbiggar"
email: "paul@circleci.com"
bio: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam at eros non dui sollicitudin mattis. Pellentesque habitant morbi tristique senectus e... | root = exports ? this
root.team =
paul:
name: "Paul Bigger"
role: "Founder"
github: "pbiggar"
email: "paul@circleci.com"
bio: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam at eros non dui sollicitudin mattis. Pellentesque habitant morbi tristique senectus et netus et malesuada f... |
Use suggested_topics passed as parameter, and fall back to collection with the single model | #= require ./add_channel_to_channels_modal_view
class window.AddChannelToChannelsButtonView extends Backbone.Marionette.Layout
template: 'channels/add_channel_to_channels_button'
events:
"click .js-add-to-channel-button": "openAddToChannelModal"
initialize: ->
@collection = @model.getOwnContainingChann... | #= require ./add_channel_to_channels_modal_view
class window.AddChannelToChannelsButtonView extends Backbone.Marionette.Layout
template: 'channels/add_channel_to_channels_button'
events:
"click .js-add-to-channel-button": "openAddToChannelModal"
initialize: ->
@collection = @model.getOwnContainingChann... |
Update 'outerPages' so that features/integrations pages don't redirect to themselves | checkOuterPages = (url) =>
outerPages = ["docs", "about", "privacy", "pricing"]
for page in outerPages
if (url.match "^/#{page}.*")
return "/"
return url
CI.github =
# we encode each parameter separately (one of them twice!) to get the right format
authUrl: (scope=["user:email", "repo"]) =>
de... | checkOuterPages = (url) =>
outerPages = ["docs", "about", "privacy", "pricing", "integrations", "features"]
for page in outerPages
if (url.match "^/#{page}.*")
return "/"
return url
CI.github =
# we encode each parameter separately (one of them twice!) to get the right format
authUrl: (scope=["use... |
Fix landing page behavior when transitioning using the enter key | this.edsc.util.url = do(window,
document,
History,
extend = jQuery.extend,
param = jQuery.param) ->
pushPath = (path, title=document.title, data=null) ->
History.pushState(data, title, path + window.location.search)
... | this.edsc.util.url = do(window,
document,
History,
extend = jQuery.extend,
param = jQuery.param) ->
cleanPath = ->
# Remove everything up to the third slash
History.getState().cleanUrl.replace(/^[^\/]*\/\/[^\/]*/,... |
Add pprint utility function for JSON-based structures | define [
'jquery'
'./utils/numbers'
'./utils/url'
'./utils/version'
], ($, mods...) ->
# Convenience method for getting a value using the dot-notion for
# accessing nested structures.
getDotProp = (obj, key) ->
toks = key.split('.')
for tok in toks
if not (obj = ... | define [
'jquery'
'./utils/numbers'
'./utils/url'
'./utils/version'
], ($, mods...) ->
# Convenience method for getting a value using the dot-notion for
# accessing nested structures.
getDotProp = (obj, key) ->
toks = key.split('.')
for tok in toks
if not (obj = ... |
Revert "Replace validation to node built-in functions" | util = require 'util'
exports.is =
fun: util.isFunction
str: util.isString
arr: util.isArray
obj: util.isObject
exports.normalize = (params, options, fn) ->
if util.isFunction params
fn = params
params = null
options = null
else if util.isFunction options
fn = options
options = null
... | fun = (f) -> typeof f is 'function'
str = (s) -> typeof s is 'string'
arr = (a) -> a instanceof Array
obj = (o) -> o instanceof Object and not fun(o) and not arr(o)
exports.is =
fun: fun
str: str
arr: arr
obj: obj
exports.normalize = (params, options, fn) ->
if fun params
fn = params
params = null
... |
Include past shows in related shows on gallery pages | _ = require 'underscore'
{ Cities, FeaturedCities } = require 'places'
PartnerShows = require '../../../../collections/partner_shows.coffee'
RelatedShowsView = require './view.coffee'
module.exports = (type, show) ->
el = $('.js-related-shows')
city = _.findWhere(Cities, name: show.formatCity())
criteria =
... | _ = require 'underscore'
{ Cities, FeaturedCities } = require 'places'
PartnerShows = require '../../../../collections/partner_shows.coffee'
RelatedShowsView = require './view.coffee'
module.exports = (type, show) ->
el = $('.js-related-shows')
city = _.findWhere(Cities, name: show.formatCity())
criteria =
... |
Fix go-to-declaration for various cursor position within Ruby identifier | {Task} = require 'atom'
ctags = require 'ctags'
async = require 'async'
getTagsFile = require "./get-tags-file"
handlerPath = require.resolve './load-tags-handler'
module.exports =
find: (editor, callback) ->
symbol = editor.getSelectedText()
unless symbol
cursor = editor.getLastCursor()
scopes... | {Task} = require 'atom'
ctags = require 'ctags'
async = require 'async'
getTagsFile = require "./get-tags-file"
handlerPath = require.resolve './load-tags-handler'
module.exports =
find: (editor, callback) ->
symbol = editor.getSelectedText()
unless symbol
cursor = editor.getLastCursor()
scopes... |
Enable click support on mobile devices. | window.bsat.utils.readyOrPageChange ->
#
# Setup sidebar open/close state when the user
# clicks on sidebar toggle button. The sidebar
# gets closed on small devices using media queries,
# so we need to take this into account.
#
$('#sidebar-toggle-button').click (e) ->
e.preventDefault()
if $(wind... | window.bsat.utils.readyOrPageChange ->
#
# Setup sidebar open/close state when the user
# clicks on sidebar toggle button. The sidebar
# gets closed on small devices using media queries,
# so we need to take this into account.
#
$('#sidebar-toggle-button').click (e) ->
e.preventDefault()
if $(wind... |
Remove deprecated swig file type | # Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# e... | # Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# e... |
Add optional server and port | commander = require 'commander'
meshblu = require 'meshblu'
class KeygenCommand
parseOptions: =>
commander
.parse process.argv
run: =>
@parseOptions()
@config = {server: 'meshblu.octoblu.com', port: 80, uuid: 'wrong'}
@conn = meshblu.createConnection @config
@conn.on 'notReady', @onRe... | commander = require 'commander'
_ = require 'lodash'
meshblu = require 'meshblu'
url = require 'url'
DEFAULT_HOST = 'meshblu.octoblu.com'
DEFAULT_PORT = 80
class KeygenCommand
parseOptions: =>
commander
.option '-s, --server <host[:port]>', 'Meshblu host'
.parse process.argv
parse... |
Add description for config setting | GitHubFile = require './github-file'
module.exports =
config:
includeLineNumbersInUrls:
default: true
type: 'boolean'
activate: ->
atom.commands.add 'atom-pane',
'open-on-github:file': ->
if itemPath = getActivePath()
GitHubFile.fromPath(itemPath).open(getSelectedRange... | GitHubFile = require './github-file'
module.exports =
config:
includeLineNumbersInUrls:
default: true
type: 'boolean'
description: 'Include the line range selected in the editor when opening or copying URLs to the clipboard. When opened in the browser, the GitHub page will automatically scroll... |
Remove try without a catch | fs = require('fs')
isFile= (name,foundCB)->
try
fs.stat name, (err,stats)->
foundCB(!err && stats.isFile())
isFileSync= (name)->
try
fs.statSync(name).isFile()
catch e
throw e unless e.code == 'ENOENT'
false
moduleExtensions= ['.js','.coffee','.json']
hasAnExtension= (name,extensions,fou... | fs = require('fs')
isFile= (name,foundCB)->
fs.stat name, (err,stats)->
foundCB(!err && stats.isFile())
isFileSync= (name)->
try
fs.statSync(name).isFile()
catch e
throw e unless e.code == 'ENOENT'
false
moduleExtensions= ['.js','.coffee','.json']
hasAnExtension= (name,extensions,foundCB)->
... |
Include query strings in backbone history | define (require) ->
$ = require('jquery')
Backbone = require('backbone')
router = require('cs!router')
analytics = require('cs!helpers/handlers/analytics') # Setup Analytics Handler
# The root URI prefixed on all non-external AJAX and Backbone URIs
root = '/'
init = (options = {}) ->
# Append /test ... | define (require) ->
$ = require('jquery')
Backbone = require('backbone')
router = require('cs!router')
analytics = require('cs!helpers/handlers/analytics') # Setup Analytics Handler
# The root URI prefixed on all non-external AJAX and Backbone URIs
root = '/'
init = (options = {}) ->
# Append /test ... |
Use a regex to capture the base64 encoded string | ###
PDFImage - embeds images in PDF documents
By Devon Govett
###
fs = require 'fs'
Data = require './data'
JPEG = require './image/jpeg'
PNG = require './image/png'
class PDFImage
@open: (src, label) ->
if Buffer.isBuffer(src)
data = src
else
if src[0..4] is 'data:' and src.indexOf(';base64,') ... | ###
PDFImage - embeds images in PDF documents
By Devon Govett
###
fs = require 'fs'
Data = require './data'
JPEG = require './image/jpeg'
PNG = require './image/png'
class PDFImage
@open: (src, label) ->
if Buffer.isBuffer(src)
data = src
else
if match = /^data:.+;base64,(.*)$/.exec(src)
... |
Check accounts length since its the data | class ChatConversationListItemTitle extends JView
constructor:(options = {}, data)->
options.cssClass = 'chat-item'
# data = [nick for nick in data when nick isnt KD.nick()].first
super
viewAppended:->
invitees = @getData()
@accounts = []
for invitee in invitees
KD.remote.cacheable... | class ChatConversationListItemTitle extends JView
constructor:(options = {}, data)->
options.cssClass = 'chat-item'
# data = [nick for nick in data when nick isnt KD.nick()].first
super
viewAppended:->
invitees = @getData()
@accounts = []
for invitee in invitees
KD.remote.cacheable... |
Fix for windows template paths. | fs = require 'graceful-fs'
AssetWatcher = require './Asset'
class TemplateWatcher extends AssetWatcher
constructor: (@config)->
super()
pattern: -> super ["**/template.jade"]
getPaths: -> ['/templates.js', "/templates-#{@hash()}.js"]
getShortPath: (path)->
@pathpart(path)
.sub... | fs = require 'graceful-fs'
AssetWatcher = require './Asset'
class TemplateWatcher extends AssetWatcher
constructor: (@config)->
super()
pattern: -> super ["**/template.jade"]
getPaths: -> ['/templates.js', "/templates-#{@hash()}.js"]
getShortPath: (path)->
@pathpart(path)
.sub... |
Fix width on PDF viewer | 'use strict'
app.directive 'pdfViewer', [
() ->
restrict: 'E'
scope:
asset: '=asset'
link: ($scope, $elem) ->
pdfElement = $($elem)[0]
objectTag = document.createElement('object')
objectTag.setAttribute('data', $scope.asset.downloadRoute(true))
pdfElement.appendChild(object... | 'use strict'
app.directive 'pdfViewer', [
() ->
restrict: 'E'
scope:
asset: '=asset'
link: ($scope, $elem) ->
pdfElement = $($elem)[0]
objectTag = document.createElement('object')
objectTag.setAttribute('data', $scope.asset.downloadRoute(true))
objectTag.setAttribute('width... |
Change isDev util function to use re.test() instead of search() | moment = require('lib/moment')
exports.isDev = (req) ->
# We are on DEV when Host has string like
# '/dev.' or '/staging.' or '.local' or '.dev' or 'localhost'
found = req.headers.Host.search(/(\/dev\.|\/staging\.|\.local$|\.dev$|localhost)/) > -1
return found
exports.prettyDate = (date) ->
moment.utc(da... | moment = require('lib/moment')
exports.isDev = (req) ->
# We are on DEV when Host has string like
# '/dev.' or '/staging.' or '.local' or '.dev' or 'localhost'
re = /(\/dev\.|\/staging\.|\.local$|\.dev$|localhost)/
return re.test(req.headers.Host)
exports.prettyDate = (date) ->
moment.utc(date).local().f... |
Remove debug message from save method. | program = require "commander"
fs = require "fs"
path = require "path"
bang = process.env.HOME + "/.bang"
data = {}
if path.existsSync bang
data = JSON.parse(fs.readFileSync bang)
save = ->
console.log "save called"
fs.writeFileSync bang, JSON.stringify(data)
get = (key) ->
console.log data[key] if d... | program = require "commander"
fs = require "fs"
path = require "path"
bang = process.env.HOME + "/.bang"
data = {}
if path.existsSync bang
data = JSON.parse(fs.readFileSync bang)
save = ->
fs.writeFileSync bang, JSON.stringify(data)
get = (key) ->
console.log data[key] if data[key]
set = (key, value)... |
Use updated endpoint and fix for legacy endpoint | _ = require 'underscore'
Backbone = require 'backbone'
{ API_URL } = require('sharify').data
UserInterest = require '../models/user_interest.coffee'
module.exports = class UserInterests extends Backbone.Collection
model: UserInterest
url: ->
if (id = @collectorProfile?.id)?
"#{API_URL}/api/v1/collector_... | _ = require 'underscore'
Backbone = require 'backbone'
{ API_URL } = require('sharify').data
UserInterest = require '../models/user_interest.coffee'
module.exports = class UserInterests extends Backbone.Collection
model: UserInterest
interestType: 'Artist' # Should/will be configurable
url: ->
if @collecto... |
Fix checkbox to slide correctly only when ticked | window.UsersComponent = class UsersComponent
@initialize: ->
@addEventListeners()
@addEventListeners: ->
@userDetailsTooltip()
@respondentsTable()
#Enables search through users table
enableSearch()
@userDetailsTooltip: ->
tooltipClass = '.information-tooltip'
$(document).on('click', ... | window.UsersComponent = class UsersComponent
@initialize: ->
@addEventListeners()
@addEventListeners: ->
@userDetailsTooltip()
@respondentsTable()
#Enables search through users table
enableSearch()
@userDetailsTooltip: ->
tooltipClass = '.information-tooltip'
$(document).on('click', ... |
Add support for document status in data gen | "use strict"
ObjectID = require('mongodb').ObjectID
Moniker = require('moniker')
rand = (min, max) -> Math.floor (Math.random() * (max - min + 1) + min)
lisence = [
"CC BY-NC-ND 3.0 NO"
"CC BY-NC 3.0 NO"
"CC BY-ND 3.0 NO"
"CC BY 3.0 NO"
]
provider = [
"DNT"
"NRK"
"TURAPP"
]
tags = [
'Sted'
'Hytte... | "use strict"
ObjectID = require('mongodb').ObjectID
Moniker = require('moniker')
rand = (min, max) -> Math.floor (Math.random() * (max - min + 1) + min)
lisence = [
"CC BY-NC-ND 3.0 NO"
"CC BY-NC 3.0 NO"
"CC BY-ND 3.0 NO"
"CC BY 3.0 NO"
]
provider = [
"DNT"
"NRK"
"TURAPP"
]
statuses = [
"Offentlig"... |
Revert "Added url for NDPEvidenceCollection" | class window.NDPEvidenceCollection extends Backbone.Collection
initialize: (models, options) ->
@on 'change', @sort, @
@fact = options.fact
constructor: (models, options) ->
super
unless models and models.length > 0
@reset [
new OpinionatersEvidence {type: 'believe'}, collection: t... | class window.NDPEvidenceCollection extends Backbone.Collection
initialize: (models, options) ->
@on 'change', @sort, @
@fact = options.fact
constructor: (models, options) ->
super
unless models and models.length > 0
@reset [
new OpinionatersEvidence {type: 'believe'}, collection: t... |
Use _.escape to escape tooltip titles | {$, View} = require 'atom'
path = require 'path'
module.exports =
class TabView extends View
@content: ->
@li class: 'tab sortable', =>
@div class: 'title', outlet: 'title'
@div class: 'close-icon'
initialize: (@item, @pane) ->
@item.on? 'title-changed', =>
@updateTitle()
@updateTo... | {$, View} = require 'atom'
_ = require 'underscore-plus'
path = require 'path'
module.exports =
class TabView extends View
@content: ->
@li class: 'tab sortable', =>
@div class: 'title', outlet: 'title'
@div class: 'close-icon'
initialize: (@item, @pane) ->
@item.on? 'title-changed', =>
... |
Enable soft wrap in Atom for text files. | "*":
"activate-power-mode":
autoToggle: false
comboMode:
enabled: false
plugins:
playAudio: true
screenShake: true
"autocomplete-plus":
confirmCompletion: "enter"
useCoreMovementCommands: false
"autocomplete-python-jedi":
fuzzyMatcher: false
useSnippets: "required"
... | "*":
"activate-power-mode":
autoToggle: false
comboMode:
enabled: false
plugins:
playAudio: true
screenShake: true
"autocomplete-plus":
confirmCompletion: "enter"
useCoreMovementCommands: false
"autocomplete-python-jedi":
fuzzyMatcher: false
useSnippets: "required"
... |
Revert "Revert "CHECKPOINT re-implemented binarySearch using slices"" |
{ isListAscending } = require './is-list-ascending.coffee'
_binarySearch = (sortedList, needle, start, end)->
return -1 if end < start
mid = Math.floor (start + ((end - start) / 2))
return mid if sortedList[mid] is needle
if sortedList[mid] > needle
return _binarySearch sortedList, needle, start, mid... |
{ isListAscending } = require './is-list-ascending.coffee'
_binarySearch = (sortedList, needle)->
return -1 if sortedList.length is 0
mid = Math.floor (sortedList.length / 2)
return mid if sortedList[mid] is needle
if sortedList[mid] > needle
return _binarySearch sortedList[0..mid - 1], needle
else
... |
Support ESC key for closing modalize modals | _ = require 'underscore'
Backbone = require 'backbone'
template = require './templates/index.coffee'
Scrollbar = require '../scrollbar/index.coffee'
module.exports = class Modalize extends Backbone.View
className: 'modalize'
defaults: dimensions: width: '400px'
events:
'click .js-modalize-backdrop': 'maybe... | _ = require 'underscore'
Backbone = require 'backbone'
template = require './templates/index.coffee'
Scrollbar = require '../scrollbar/index.coffee'
module.exports = class Modalize extends Backbone.View
className: 'modalize'
defaults: dimensions: width: '400px'
events:
'click .js-modalize-backdrop': 'maybe... |
Remove _ and fs from exports | {Point, Range} = require 'text-buffer'
module.exports =
_: require 'underscore-plus'
BufferedNodeProcess: require '../src/buffered-node-process'
BufferedProcess: require '../src/buffered-process'
fs: require 'fs-plus'
Git: require '../src/git'
Point: Point
Range: Range
# The following classes can't be u... | {Point, Range} = require 'text-buffer'
module.exports =
BufferedNodeProcess: require '../src/buffered-node-process'
BufferedProcess: require '../src/buffered-process'
Git: require '../src/git'
Point: Point
Range: Range
# The following classes can't be used from a Task handler and should therefore
# only be ... |
Include query strings in backbone history | define (require) ->
$ = require('jquery')
Backbone = require('backbone')
router = require('cs!router')
analytics = require('cs!helpers/handlers/analytics') # Setup Analytics Handler
# The root URI prefixed on all non-external AJAX and Backbone URIs
root = '/'
init = (options = {}) ->
# Append /test ... | define (require) ->
$ = require('jquery')
Backbone = require('backbone')
router = require('cs!router')
analytics = require('cs!helpers/handlers/analytics') # Setup Analytics Handler
# The root URI prefixed on all non-external AJAX and Backbone URIs
root = '/'
init = (options = {}) ->
# Append /test ... |
Update notification store to handle notification action | # Requirements
#----------------------------------------
McFly = require 'mcfly'
Flux = new McFly()
# Data
#----------------------------------------
_notifications = []
# Private Methods
#----------------------------------------
addNotification = (notification) ->
_notifications.push(notification)
Notificatio... | # Requirements
#----------------------------------------
McFly = require 'mcfly'
Flux = new McFly()
# Data
#----------------------------------------
_notifications = []
# Private Methods
#----------------------------------------
addNotification = (notification) ->
_notifications.push(notification)
Notificatio... |
Make the pre-formatted code regular expression a lot more permissive | ###
# Highlight is a named function that will highlight ``` messages
# @param {Object} message - The message object
###
class Highlight
# If message starts with ```, replace it for text formatting
constructor: (message) ->
if _.trim message.html
# Separate text in code blocks and non code blocks
msgParts =... | ###
# Highlight is a named function that will highlight ``` messages
# @param {Object} message - The message object
###
class Highlight
constructor: (message) ->
if _.trim message.html
# Count occurencies of ```
count = (message.html.match(/```/g) || []).length
if count
# Check if we need to add a... |
Update for the new theme | {$$} = require 'space-pen'
SelectList = require 'select-list'
$ = require 'jquery'
_ = require 'underscore'
module.exports =
class CommandPaletteView extends SelectList
@activate: ->
new CommandPaletteView
@viewClass: ->
"#{super} command-palette overlay from-top"
filterKey: 'eventDescription'
keyBi... | {$$} = require 'space-pen'
SelectList = require 'select-list'
$ = require 'jquery'
_ = require 'underscore'
module.exports =
class CommandPaletteView extends SelectList
@activate: ->
new CommandPaletteView
@viewClass: ->
"#{super} command-palette overlay from-top"
filterKey: 'eventDescription'
keyBi... |
Update entity search service to use latest Marbles.HTTP.Client | class EntitySearchService
constructor: (@options = {}) ->
@client = new Marbles.HTTP.Client(middleware: [Marbles.HTTP.Middleware.SerializeJSON])
# options:
# - success: fn
# - error: fn
# - complete: fn
search: (query, options = {}) =>
@client.get @options.api_root, { q: query }, options
_.e... | class EntitySearchService
constructor: (@options = {}) ->
@client = new Marbles.HTTP.Client(middleware: [Marbles.HTTP.Middleware.SerializeJSON])
# callback can either be a function or an object:
# - success: fn
# - error: fn
# - complete: fn
search: (query, callback) =>
@client.get(url: @opti... |
Test that UOM setting propogates | describe "Skr.Models.SoLine", ->
it "can be instantiated", ->
model = new Skr.Models.SoLine()
expect(model).toEqual(jasmine.any(Skr.Models.SoLine))
| describe "Skr.Models.SoLine", ->
it "can sets properties from the uom", ->
model = new Skr.Models.SoLine()
model.uom = new Skr.Models.Uom(size: 10, code: 'CS')
expect(model.uom_size).toEqual(10)
expect(model.uom_code).toEqual('CS')
|
Add `self` URL to `Content` | config = require '../config'
crypto = require 'crypto'
redis = require 'redis'
# Redis
client = redis.createClient()
# Keys
HASH_ALGORITHM = 'sha256'
HASH_ENCODING = 'hex'
NEXT_ID_KEY = 'content:next.id'
getIdKey = (id) ->
"content:id:#{id}"
getURLKey = (url) ->
hash = crypto.createHash HASH_ALGORITHM
hash.... | config = require '../config'
crypto = require 'crypto'
redis = require 'redis'
# Redis
client = redis.createClient()
# Keys
HASH_ALGORITHM = 'sha256'
HASH_ENCODING = 'hex'
NEXT_ID_KEY = 'content:next.id'
getIdKey = (id) ->
"content:id:#{id}"
getURLKey = (url) ->
hash = crypto.createHash HASH_ALGORITHM
hash.... |
Remove unused fetchers, getDomains does it all | 'use strict'
class DomainsFactory
constructor: (@restangular) ->
getDomains: ->
@restangular.all('domains-details').getList()
getDomainPageCount: (domain) ->
@restangular.one('domains', domain.name).one('page-count').get()
getDomainReviewCount: (domain) ->
@restangular.one('domains', domain.name... | 'use strict'
class DomainsFactory
constructor: (@restangular) ->
getDomains: ->
@restangular.all('domains-details').getList()
getDomainReviews: (domainName, params) ->
@restangular.one('domains', domainName).one('reviews').get(params)
getDomainGroupedViolations: (domainName) ->
@restangular.one(... |
Set and fit Yandex Map bounds | class @Gmaps4Rails.Yandex.Map extends Gmaps4Rails.Common
@include Gmaps4Rails.Interfaces.Map
@include Gmaps4Rails.Map
@include Gmaps4Rails.Yandex.Shared
@include Gmaps4Rails.Configuration
CONF:
disableDefaultUI: false
disableDoubleClickZoom: false
type: "ROADMAP" # HY... | class @Gmaps4Rails.Yandex.Map extends Gmaps4Rails.Common
@include Gmaps4Rails.Interfaces.Map
@include Gmaps4Rails.Map
@include Gmaps4Rails.Yandex.Shared
@include Gmaps4Rails.Configuration
CONF:
disableDefaultUI: false
disableDoubleClickZoom: false
type: "ROADMAP" # HY... |
Fix XSS error in OEmbed | getTitle = (self) ->
if not self.meta?
return
return self.meta.ogTitle or self.meta.twitterTitle or self.meta.title or self.meta.pageTitle
getDescription = (self) ->
if not self.meta?
return
description = self.meta.ogDescription or self.meta.twitterDescription or self.meta.description
if not description?
... | getTitle = (self) ->
if not self.meta?
return
return self.meta.ogTitle or self.meta.twitterTitle or self.meta.title or self.meta.pageTitle
getDescription = (self) ->
if not self.meta?
return
description = self.meta.ogDescription or self.meta.twitterDescription or self.meta.description
if not description?
... |
Support for JSON reponse in browser impl added | 'use strict'
[utils, Model] = ['utils', 'model'].map require
exports.Request = require('./request.coffee')()
exports.Response = require('./response.coffee')()
exports.init = ->
# Send internal request to change the page based on the URI
changePage = (uri) =>
# change browser URI in the history
history.pushSt... | 'use strict'
[utils, Model] = ['utils', 'model'].map require
exports.Request = require('./request.coffee')()
exports.Response = require('./response.coffee')()
exports.init = ->
# Send internal request to change the page based on the URI
changePage = (uri) =>
# change browser URI in the history
history.pushSt... |
Add findTask method to store. | # http://emberjs.com/guides/models/using-the-store/
ETahi.Store = DS.Store.extend
# Override the default adapter with the `DS.ActiveModelAdapter` which
# is built to work nicely with the ActiveModel::Serializers gem.
adapter: '-active-model'
push: (type, data, _partial) ->
oldType = type
dataType = da... | # http://emberjs.com/guides/models/using-the-store/
ETahi.Store = DS.Store.extend
# Override the default adapter with the `DS.ActiveModelAdapter` which
# is built to work nicely with the ActiveModel::Serializers gem.
adapter: '-active-model'
push: (type, data, _partial) ->
oldType = type
dataType = da... |
Add mandatory transaction date to spec data | describe 'LedgerWeb.Models.Transactions.Month', ->
it 'populates transactions attribute as transactions collection', ->
month = new LedgerWeb.Models.Transactions.Month
month: '2013/12'
transactions: [payee: 'my payee']
(expect month.get('transactions') instanceof LedgerWeb.Collections.Transactions... | describe 'LedgerWeb.Models.Transactions.Month', ->
it 'populates transactions attribute as transactions collection', ->
month = new LedgerWeb.Models.Transactions.Month
month: '2013/12'
transactions: [payee: 'my payee', date: '2013/12/01']
(expect month.get('transactions') instanceof LedgerWeb.Coll... |
Fix dumb break in script | # build task for tsc
task 'build', 'build:typescript', (done)->
count = 0
typescriptProjects()
.pipe foreach (each,next) ->
count++
execute "#{basefolder}/node_modules/.bin/tsc --project #{folder each.path}", (code,stdout,stderr) ->
echo stdout.replace("src/next-gen","#{basefolder}/src/ne... | # build task for tsc
task 'build', 'build:typescript', (done)->
count = 0
typescriptProjects()
.pipe foreach (each,next) ->
count++
execute "#{basefolder}/node_modules/.bin/tsc --project #{folder each.path}", (code,stdout,stderr) ->
echo stdout.replace("src/next-gen","#{basefolder}/src/ne... |
Fix escaping in test system. | Qjs = require '../../lib/qjs'
TestSystem = Qjs.parse """
# Nil & others
Any = .
Nil = .( v | v === null )
# Booleans
True = .( b | b === true )
False = .( b | b === false )
Boolean = .Boolean
# Numerics
Numeric = .Number
Integer = .Number( i | noDot: i.toString().indexOf('.') == -1 )
# St... | Qjs = require '../../lib/qjs'
TestSystem = Qjs.parse """
# Nil & others
Any = .
Nil = .( v | v === null )
# Booleans
True = .( b | b === true )
False = .( b | b === false )
Boolean = .Boolean
# Numerics
Numeric = .Number
Integer = .Number( i | noDot: i.toString().indexOf('.') == -1 )
# St... |
Set current cwd folder for download by default | fs = require 'fs'
exports.initialize = (args) ->
configName = if args.length isnt 0 then args[0] else 'main'
configPath = "#{__dirname}/users/#{configName}.json"
fs.exists configPath, (exists) ->
if not exists
console.log "Config #{configName} doesn't exists."
return
params = require config... | fs = require 'fs'
exports.initialize = (args) ->
configName = if args.length isnt 0 then args[0] else 'main'
configPath = "#{__dirname}/users/#{configName}.json"
fs.exists configPath, (exists) ->
if not exists
console.log "Config #{configName} doesn't exists."
return
params = require config... |
Set user's realname to alias if not set already | Meteor.methods
sendMessage: (message) ->
if message.msg?.length > RocketChat.settings.get('Message_MaxAllowedSize')
throw new Meteor.Error('error-message-size-exceeded', 'Message size exceeds Message_MaxAllowedSize', { method: 'sendMessage' })
if not Meteor.userId()
throw new Meteor.Error('error-invalid-use... | Meteor.methods
sendMessage: (message) ->
if message.msg?.length > RocketChat.settings.get('Message_MaxAllowedSize')
throw new Meteor.Error('error-message-size-exceeded', 'Message size exceeds Message_MaxAllowedSize', { method: 'sendMessage' })
if not Meteor.userId()
throw new Meteor.Error('error-invalid-use... |
Move flattening title links for todo_lists in to own function; register updated handler | # 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/
OUT.registerCreatedHandler "todo_list", (selector) ->
$(selector).find("a.new").click()
... | # 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/
OUT.registerCreatedHandler "todo_list", (selector) ->
$(selector).find("a.new").click()
... |
Make sure links aren't caught by Phabot Rabbit | # Description:
# Shows a link to phabricator tasks and issues mentioned in comments
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# D#### - show a link to phabricator review
# T#### - show a link to phabricator task
#
# Author:
# tzjames
module.exports = (robot) ->
robot.hear /\b((D|T)... | # Description:
# Shows a link to phabricator tasks and issues mentioned in comments
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# D#### - show a link to phabricator review
# T#### - show a link to phabricator task
#
# Author:
# tzjames
module.exports = (robot) ->
# We check for white... |
Append after at end of initialize | _ = require 'underscore-plus'
{View} = require 'atom'
module.exports =
class PackageUpdatesStatusView extends View
@content: ->
@div class: 'inline-block text text-info', =>
@span class: 'icon icon-package'
@span outlet: 'countLabel', class: 'available-updates-status'
initialize: (statusBar, p... | _ = require 'underscore-plus'
{View} = require 'atom'
module.exports =
class PackageUpdatesStatusView extends View
@content: ->
@div class: 'inline-block text text-info', =>
@span class: 'icon icon-package'
@span outlet: 'countLabel', class: 'available-updates-status'
initialize: (statusBar, p... |
Add ctrl-. keybinding on Linux | '.workspace .platform-darwin':
'cmd-.': 'key-binding-resolver:toggle'
'.workspace .platform-win32':
'ctrl-.': 'key-binding-resolver:toggle'
| '.workspace .platform-darwin':
'cmd-.': 'key-binding-resolver:toggle'
'.workspace .platform-win32':
'ctrl-.': 'key-binding-resolver:toggle'
'.workspace .platform-linux':
'ctrl-.': 'key-binding-resolver:toggle'
|
Set this method to public | # Public: Here's a class.
class Foo
# Here's a method, baz.
baz: () -> 'baz'
# Here is a method on Foo, called bar.
Foo::bar = () -> 'bar'
| # Public: Here's a class.
class Foo
# Here's a method, baz.
baz: () -> 'baz'
# Public: Here is a method on Foo, called bar.
Foo::bar = () -> 'bar'
|
Revert "trying history mode for gh-pages" | # Setup router
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use VueRouter
###
Routing paths
`/` - (home) app index
`/:location` - (location) weather detail for a specific location
###
routes = [
{
name: 'home'
path: '/'
component: require '../components/home'
children: [
... | # Setup router
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use VueRouter
###
Routing paths
`/` - (home) app index
`/:location` - (location) weather detail for a specific location
###
routes = [
{
name: 'home'
path: '/'
component: require '../components/home'
children: [
... |
Add keybindings for windows and linux | # Keybindings require three things to be fully defined: A selector that is
# matched against the focused element, the keystroke and the command to
# execute.
#
# Below is a basic keybinding which registers on all platforms by applying to
# the root workspace element.
# For more detailed documentation see
# https://ato... | '.platform-darwin':
'ctrl-cmd-p': 'project-manager:toggle'
'.platform-win32':
'ctrl-alt-p': 'project-manager:toggle'
'.platform-linux':
'ctrl-alt-p': 'project-manager:toggle' |
Add preliminary sorting functionality to transactions controller | App.TransactionsController = Em.ArrayController.extend App.PagingMixin,
needs: ['categories']
perPage: 100
itemController: 'transaction'
init: ->
@_super()
dropped: ->
category = @get('controllers.categories.dragSource')
selections = @get('model').filterProperty 'selected'
promise = App.Matche... | App.TransactionsController = Em.ArrayController.extend App.PagingMixin,
needs: ['categories']
perPage: 100
itemController: 'transaction'
sortProperties: ['posted_at']
sortAscending: false
init: ->
@_super()
actions:
sort: (field) ->
@setProperties
sortProperties: [field]
dropped: -... |
Refactor the if conditional on show password JS | Neighborly.Devise ?= {}
Neighborly.Devise.Registrations ?= {}
Neighborly.Devise.Registrations.New =
init: ->
$('#show_password').change ->
$input = $('#show_password')
$password = $('#user_password')
if $input.is(':checked')
$password.prop 'type', 'text'
else
$password.pr... | Neighborly.Devise ?= {}
Neighborly.Devise.Registrations ?= {}
Neighborly.Devise.Registrations.New =
init: ->
$('#show_password').change ->
$password = $('#user_password')
if $('#show_password').is(':checked')
$password.prop 'type', 'text'
else
$password.prop 'type', 'password'
|
Allow non-unique media to have their title changed globally | define [
'underscore'
'backbone'
], (_, Backbone) ->
return Backbone.Model.extend
url: () -> return "/api/content/#{ @id }"
mediaType: 'application/vnd.org.cnx.module'
toJSON: () ->
json = Backbone.Model::toJSON.apply(@, arguments)
json.mediaType = @mediaType
json.id = @id or @cid
... | define [
'underscore'
'backbone'
], (_, Backbone) ->
return Backbone.Model.extend
url: () -> return "/api/content/#{ @id }"
mediaType: 'application/vnd.org.cnx.module'
toJSON: () ->
json = Backbone.Model::toJSON.apply(@, arguments)
json.mediaType = @mediaType
json.id = @id or @cid
... |
Add "permanent-delete" package to Atom | packages: [
"autocomplete-emojis"
"busy-signal"
"editorconfig"
"file-icons"
"highlight-selected"
"intentions"
"linter"
"linter-coffeelint"
"linter-csslint"
"linter-eslint"
"linter-flake8"
"linter-htmlhint"
"linter-js-yaml"
"linter-jsonlint"
"linter-less"
"linter-php"
"linter-scss-lint"... | packages: [
"autocomplete-emojis"
"busy-signal"
"editorconfig"
"file-icons"
"highlight-selected"
"intentions"
"linter"
"linter-coffeelint"
"linter-csslint"
"linter-eslint"
"linter-flake8"
"linter-htmlhint"
"linter-js-yaml"
"linter-jsonlint"
"linter-less"
"linter-php"
"linter-scss-lint"... |
Fix _.string to _.str on recent server trim check | sendwithus = require '../sendwithus'
utils = require '../lib/utils'
errors = require '../commons/errors'
wrap = require 'co-express'
database = require '../commons/database'
parse = require '../commons/parse'
module.exports =
sendParentSignupInstructions: wrap (req, res, next) ->
context =
email_id: sendwi... | sendwithus = require '../sendwithus'
utils = require '../lib/utils'
errors = require '../commons/errors'
wrap = require 'co-express'
database = require '../commons/database'
parse = require '../commons/parse'
module.exports =
sendParentSignupInstructions: wrap (req, res, next) ->
context =
email_id: sendwi... |
Make draft mode regex global | fs = require "fs"
logger = require "logger-sharelatex"
module.exports = DraftModeManager =
injectDraftMode: (filename, callback = (error) ->) ->
fs.readFile filename, "utf8", (error, content) ->
return callback(error) if error?
modified_content = DraftModeManager._injectDraftOption content
logger.log {
... | fs = require "fs"
logger = require "logger-sharelatex"
module.exports = DraftModeManager =
injectDraftMode: (filename, callback = (error) ->) ->
fs.readFile filename, "utf8", (error, content) ->
return callback(error) if error?
modified_content = DraftModeManager._injectDraftOption content
logger.log {
... |
Enable pretty HTML on development | express = require 'express'
mongoose = require 'mongoose'
ext_type = require 'connect-ext-type'
{ createServer } = require 'http'
{ join } = require 'path'
module.exports = express().configure ->
@set 'port', process.env.PORT or 8070
@set 'view engine', 'jade'
@set 'views', join __dirname, 'views'
@locals
... | express = require 'express'
mongoose = require 'mongoose'
ext_type = require 'connect-ext-type'
{ createServer } = require 'http'
{ join } = require 'path'
module.exports = express().configure ->
@set 'port', process.env.PORT or 8070
@set 'view engine', 'jade'
@set 'views', join __dirname, 'views'
@locals
... |
Use class instead of element | {Testing, expect, sinon, _, ReactTestUtils} = require 'shared/specs/helpers'
{ChangeStudentIdForm} = require 'shared'
describe 'ChangeStudentIdForm Component', ->
beforeEach ->
@props =
onCancel: sinon.spy()
onSubmit: sinon.spy()
label: 'a test label'
saveButtonLabel: 'this is save btn'
... | {Testing, expect, sinon, _, ReactTestUtils} = require 'shared/specs/helpers'
{ChangeStudentIdForm} = require 'shared'
describe 'ChangeStudentIdForm Component', ->
beforeEach ->
@props =
onCancel: sinon.spy()
onSubmit: sinon.spy()
label: 'a test label'
saveButtonLabel: 'this is save btn'
... |
Update project lab to use new pages resource | React = require 'react'
AutoSave = require '../../components/auto-save'
handleInputChange = require '../../lib/handle-input-change'
module.exports = React.createClass
displayName: 'EditProjectScienceCase'
getDefaultProps: ->
project: {}
render: ->
<div>
<p className="form-help">This page is for y... | React = require 'react'
AutoSave = require '../../components/auto-save'
handleInputChange = require '../../lib/handle-input-change'
PromiseRenderer = require '../../components/promise-renderer'
apiClient = require '../../api/client'
module.exports = React.createClass
displayName: 'EditProjectScienceCase'
getDefau... |
Allow backbone navigation from conversation index to user profile, in stead of letting the click be handled by the wholeElementClick | class window.ConversationItemView extends Backbone.Marionette.ItemView
tagName: 'li'
className: 'clearfix'
template: 'conversations/item'
events:
'click' : 'wholeElementClick'
templateHelpers: =>
url: @model.url()
wholeElementClick: (e) ->
url = @model.url()
e.preventDefault()
e.stopIm... | class window.ConversationItemView extends Backbone.Marionette.ItemView
tagName: 'li'
className: 'clearfix'
template: 'conversations/item'
events:
'click' : 'wholeElementClick'
'click .user-profile-link' : 'userProfileLinkClick'
templateHelpers: =>
url: @model.url()
wholeElementClick: (e) ->
... |
Reorder expectations in trinary test suite | Trinary = require './example'
describe 'Trinary', ->
it '1 is decimal 1', ->
expect(1).toEqual new Trinary('1').toDecimal()
xit '2 is decimal 2', ->
expect(2).toEqual new Trinary('2').toDecimal()
xit '10 is decimal 3', ->
expect(3).toEqual new Trinary('10').toDecimal()
xit '11 is decimal 4', ->... | Trinary = require './example'
describe 'Trinary', ->
it '1 is decimal 1', ->
expect(new Trinary('1').toDecimal()).toEqual 1
xit '2 is decimal 2', ->
expect(new Trinary('2').toDecimal()).toEqual 2
xit '10 is decimal 3', ->
expect(new Trinary('10').toDecimal()).toEqual 3
xit '11 is decimal 4', ->... |
Correct coffeescript syntax for events | $ ->
if isOnPage 'eventplug-events', 'edit' or isOnPage 'eventplug-events', 'new'
$("#event_date").datepicker()
opts =
button: false
editor = new EpicEditor(opts).load()
editor.on 'save', ->
$('#event_description').val(editor.exportFile())
| $ ->
if isOnPage('eventplug-events', 'new') or isOnPage('eventplug-events', 'edit')
$("#event_date").datepicker()
opts =
button: false
editor = new EpicEditor(opts).load()
editor.on 'save', ->
$('#event_description').val(editor.exportFile())
|
Change name of function isObject to isObejctOrArray |
isObject = require 'is-object'
isFunction = require 'is-function'
###
when passed an object, returns an array of its keys.
when passed an array, returns an array of its indexes.
arrayify({a: 'aa', b: 'bb', c: 'cc'})
-> ['a', 'b', 'c']
arrayify(['one', 'two', 'three'])
-> [1, 2, 3]
###
arrayify = (obj) ->
(key f... |
isFunction = require 'is-function'
isObjectOrArray = require 'is-object'
isArray = require 'is-array'
###
when passed an object, returns an array of its keys.
when passed an array, returns an array of its indexes.
arrayify({a: 'aa', b: 'bb', c: 'cc'})
-> ['a', 'b', 'c']
arrayify(['one', 'two', 'three'])... |
Integrate grid clearing and add random background image. | button = require '../../button'
grid = require '../../grid'
parser = require 'stout-client/parser'
window.onload = ->
parser.parse().then ->
grid = $stout.get('#basic-grid')
$stout.get('#btn-add').click = ->
randomSize = -> Math.max 5, Math.ceil(Math.random() * 8)
i = 2
while i--
... | button = require '../../button'
grid = require '../../grid'
parser = require 'stout-client/parser'
window.onload = ->
parser.parse().then ->
grid = $stout.get('#basic-grid')
$stout.get('#btn-add').click = ->
randomSize = -> Math.max 1, Math.ceil(Math.random() * 3)
i = 2
while i--
... |
Use long opts for readability | _ = require 'underscore'
BufferedProcess = require 'buffered-process'
$ = require 'jquery'
module.exports =
class LoadPathsTask
constructor: (@callback) ->
start: ->
rootPath = project.getPath()
ignoredNames = config.get('fuzzyFinder.ignoredNames') ? []
ignoredNames = ignoredNames.concat(config.get('c... | _ = require 'underscore'
BufferedProcess = require 'buffered-process'
$ = require 'jquery'
module.exports =
class LoadPathsTask
constructor: (@callback) ->
start: ->
rootPath = project.getPath()
ignoredNames = config.get('fuzzyFinder.ignoredNames') ? []
ignoredNames = ignoredNames.concat(config.get('c... |
Change keymap according to upstream command changes | 'atom-text-editor':
'alt-cmd-r': 'debugger:start-locally'
'alt-cmd-e': 'debugger:stop'
'alt-cmd-c': 'debugger:resume'
'alt-cmd-y': 'debugger:pause'
'f6': 'debugger:step-over'
'f7': 'debugger:step-into'
| 'atom-text-editor':
'alt-cmd-r': 'debugger:start'
'alt-cmd-e': 'debugger:stop'
'alt-cmd-c': 'debugger:resume'
'alt-cmd-y': 'debugger:pause'
'alt-cmd-7': 'debugger:toggle-breakpoint-at-current-line'
'f6': 'debugger:step-over'
'f7': 'debugger:step-into'
|
Use poi-plugin-translator to translate ships and items | require 'coffee-react/register'
require "#{ROOT}/views/env"
i18n = require './node_modules/i18n'
{join} = require 'path-extra'
i18n.configure
locales: ['en-US', 'ja-JP', 'zh-CN', 'zh-TW']
defaultLocale: 'zh-CN'
directory: join(__dirname, 'assets', 'i18n')
updateFiles: false
indent: '\t'
extension: '.json'... | require 'coffee-react/register'
require "#{ROOT}/views/env"
try
require 'poi-plugin-translator'
catch error
console.error error
i18n = require './node_modules/i18n'
{join} = require 'path-extra'
i18n.configure
locales: ['en-US', 'ja-JP', 'zh-CN', 'zh-TW']
defaultLocale: 'zh-CN'
directory: join(__dirname, 'a... |
Make it possible to not recurse through dir. | fs = require 'fs'
path = require 'path'
vm = require './vm'
walk = require './walk'
{parseArgs} = require './utils'
module.exports = parseArgs (basePath, opts, cb) ->
{relative, excluded} = opts
opts.patch ?= true
modules = {}
watching = {}
watch = (dir, isModule) ->
... | fs = require 'fs'
path = require 'path'
vm = require './vm'
walk = require './walk'
{parseArgs} = require './utils'
module.exports = parseArgs (basePath, opts, cb) ->
{relative, excluded} = opts
opts.patch ?= true
opts.recurse ?= true
modules = {}
watching = {}
... |
Fix dateFormat directive to accept string model values. | angular
.module('angular-w')
.directive('dateFormat', ['dateFilter', (dateFilter)->
restrict: 'A'
require: 'ngModel'
link: (scope, element, attrs, ngModel)->
ngModel.$formatters.push (value)->
console.log(value)
dateFilter(value, attrs.dateFormat)
ngModel.$parsers.push (value)->
new Dat... | angular
.module('angular-w')
.directive('dateFormat', ['dateFilter', (dateFilter)->
restrict: 'A'
require: 'ngModel'
link: (scope, element, attrs, ngModel)->
ngModel.$formatters.push (value)->
date = if angular.isString(value)
milis = Date.parse(value)
new Date(milis) unles... |
Fix test, no more menu on header. |
describe 'Laere Module', ->
# load the controller's module
beforeEach module 'laere'
HeaderController = scope = null
# Initialize the controller and a mock scope
beforeEach inject ($controller, $rootScope) ->
scope = $rootScope.$new()
HeaderController = $controller 'HeaderController',
$scope... |
describe 'Laere Module', ->
# load the controller's module
beforeEach module 'laere'
HeaderController = scope = null
# Initialize the controller and a mock scope
beforeEach inject ($controller, $rootScope) ->
scope = $rootScope.$new()
HeaderController = $controller 'HeaderController',
$scope... |
Change all attributes of current unit when another unit is selected | class Langtrainer.LangtrainerApp.Views.UnitSelector extends Backbone.View
_.extend(@prototype, Langtrainer.LangtrainerApp.Views.Extensions.Localized)
template: JST['langtrainer_frontend_backbone/templates/unit_selector']
id: 'unit-selector'
events:
'change select': 'onChange'
initialize: ->
@listen... | class Langtrainer.LangtrainerApp.Views.UnitSelector extends Backbone.View
_.extend(@prototype, Langtrainer.LangtrainerApp.Views.Extensions.Localized)
template: JST['langtrainer_frontend_backbone/templates/unit_selector']
id: 'unit-selector'
events:
'change select': 'onChange'
initialize: ->
@listen... |
Make sure new/edit exists before calling them on create/update. | window.App ||= {}
class App.Base
constructor: ->
return this
create: ->
$this.new()
return
update: ->
$this.edit()
return | window.App ||= {}
class App.Base
constructor: ->
return this
create: ->
if typeof $this.new == 'function'
return $this.new()
update: ->
if typeof $this.edit == 'function'
return $this.edit() |
Use isFileSync instead of existsSync | url = require 'url'
fs = require 'fs-plus'
MarkdownPreviewView = require './markdown-preview-view'
module.exports =
activate: ->
atom.workspaceView.command 'markdown-preview:show', =>
@show()
atom.workspace.registerOpener (uriToOpen) ->
{protocol, pathname} = url.parse(uriToOpen)
return u... | url = require 'url'
fs = require 'fs-plus'
MarkdownPreviewView = require './markdown-preview-view'
module.exports =
activate: ->
atom.workspaceView.command 'markdown-preview:show', =>
@show()
atom.workspace.registerOpener (uriToOpen) ->
{protocol, pathname} = url.parse(uriToOpen)
return u... |
Add use strict atom 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:
#... |
Read total number of messages instead of those in queue |
AMQPStats = require 'amqp-stats'
debug = require('debug')('guv:rabbitmq')
url = require 'url'
amqpOptions = (str) ->
o = {}
u = url.parse str
[ user, password ] = u.auth.split ':'
o.hostname = u.host # includes port
o.username = user
o.password = password
o.protocol = 'https'
return o
exports.getStat... |
AMQPStats = require 'amqp-stats'
debug = require('debug')('guv:rabbitmq')
url = require 'url'
amqpOptions = (str) ->
o = {}
u = url.parse str
[ user, password ] = u.auth.split ':'
o.hostname = u.host # includes port
o.username = user
o.password = password
o.protocol = 'https'
return o
exports.getStat... |
Use treeController's delegate as FinderController since there is no more FinderController singleton | class FSFolder extends FSFile
fetchContents:(callback, dontWatch=yes)->
{ treeController } = @getOptions()
@emit "fs.job.started"
@vmController.run
method : 'fs.readDirectory'
vmName : @vmName
withArgs :
onChange : if dontWatch then null else (change)=>
FSHe... | class FSFolder extends FSFile
fetchContents:(callback, dontWatch=yes)->
{ treeController } = @getOptions()
@emit "fs.job.started"
@vmController.run
method : 'fs.readDirectory'
vmName : @vmName
withArgs :
onChange : if dontWatch then null else (change)=>
FSHe... |
Add event parameter to popover click event | $(document).on 'ready page:load', ->
$("a.popover").click ->
event.preventDefault()
popover_src = $(this).children("img").attr("data-src")
popover_caption = $(this).children("img").attr("alt")
popover_width = $(this).children("img").attr("data-width")
popover_height = $(this).children("img").at... | $(document).on 'ready page:load', ->
$("a.popover").click (event) ->
event.preventDefault()
popover_src = $(this).children("img").attr("data-src")
popover_caption = $(this).children("img").attr("alt")
popover_width = $(this).children("img").attr("data-width")
popover_height = $(this).children("... |
Stop execution on rebuild if one command fails | gyp = require('node-gyp')()
# The first two arguments are apparently necessary as else nopt won’t include
# loglevel as an option.
defaultArgv = ['node', '.', '--loglevel=silent']
# It is necessary to execute rebuild manually as calling node-gyp’s rebuild
# programmatically fires the callback function too early.
manu... | gyp = require('node-gyp')()
# The first two arguments are apparently necessary as else nopt won’t include
# loglevel as an option.
defaultArgv = ['node', '.', '--loglevel=silent']
# It is necessary to execute rebuild manually as calling node-gyp’s rebuild
# programmatically fires the callback function too early.
manu... |
Revert back to production posts | #
# Using ["The Twelve-Factor App"](http://12factor.net/) as a reference all
# environment configuration will live in environment variables. This file
# simply lays out all of those environment variables with sensible defaults
# for development.
#
module.exports =
NODE_ENV: "development"
PORT: 4000
APP_URL: "htt... | #
# Using ["The Twelve-Factor App"](http://12factor.net/) as a reference all
# environment configuration will live in environment variables. This file
# simply lays out all of those environment variables with sensible defaults
# for development.
#
module.exports =
NODE_ENV: "development"
PORT: 4000
APP_URL: "htt... |
Add more phrases to ping hubot | # Hubot is very attentive
module.exports = (robot) ->
name_regex = new RegExp("#{robot.name}\\?$", "i")
robot.hear name_regex, (msg) ->
msg.reply "Yes, master?"
| # Hubot is very attentive (ping hubot)
phrases = [
"Yes, master?"
"At your service"
"Unleash my strength"
"I'm here. As always"
"By your command"
"Ready to work!"
"Yes, milord?"
"More work?"
"Ready for action"
"Orders?"
"What do you need?"
"Say the word"
"Aye, my lord"
"Locked and loaded"
... |
Fix dirty tracking after save | ETahi.ManuscriptManagerTemplateEditController = Ember.ObjectController.extend
dirty: false
paperTypes: (->
@get('journal.paperTypes')
).property('journal.paperTypes.@each')
sortedPhases: Ember.computed.alias 'phases'
actions:
changeTaskPhase: (task, targetPhase) ->
task.get('phase').removeTas... | ETahi.ManuscriptManagerTemplateEditController = Ember.ObjectController.extend
dirty: false
paperTypes: (->
@get('journal.paperTypes')
).property('journal.paperTypes.@each')
sortedPhases: Ember.computed.alias 'phases'
actions:
changeTaskPhase: (task, targetPhase) ->
task.get('phase').removeTas... |
Fix permalink reformat to wait for link to load if its the first time the page opened | $ ->
$("*[data-umlaut-toggle-permalink]").click (event) ->
originalLink = $(this)
valueContainer = $("#umlaut-permalink-container")
loadedLink = $(".umlaut-permalink-content a")
url = loadedLink.attr("href")
if url == undefined
loadedLink = $("#umlaut-permalink-content")
url = loadedLink.attr("href")... | $ ->
$("*[data-umlaut-toggle-permalink]").click (event) ->
if $(".umlaut-permalink-container input").is(":visible")
$(".umlaut-permalink-container input").select()
permalinkLoaded = setInterval ->
if $(".umlaut-permalink-container a").is(":visible")
reformatPermalink(event)
clearInterval(permalinkLoa... |
Hide detailed observation fields by default. | $ = jQuery
$ ->
current_jd = +$("#current-jd").text()
$("#id_jd").val(current_jd)
| $ = jQuery
$ ->
current_jd = +$("#current-jd").text()
$("#id_jd").val(current_jd)
detail_fields = $("#div_id_comp1, #div_id_comp2, #div_id_comment_code, #div_id_chart, #div_id_notes")
detail_fields.hide()
|
Support providing a defaultLevel when in logger factory | class LoggerFactory
instance = null
@get: ->
instance ?= new LoggerFactory
createLogger: (namespace)->
log.debug 'LoggerFactory.createLogger()', arguments
if namespace?
expect(namespace).to.be.a('string').that.has.length.above(0)
prefix = namespace + ':'
expect(Loglevel).t... | class LoggerFactory
instance = null
@get: ->
instance ?= new LoggerFactory
createLogger: (namespace, defaultLevel)->
log.debug 'LoggerFactory.createLogger()', arguments
if namespace?
expect(namespace).to.be.a('string').that.has.length.above(0)
prefix = namespace + ':'
expe... |
Check for new slides after every cycle | storage = require 'node-persist'
storage.initSync()
config = storage.getItemSync 'config'
module.exports =
getConfig: ->
defaultDelay: 3
defaultDuration: 0.5
defaultTransition: "none"
checkCycles: 2 | storage = require 'node-persist'
storage.initSync()
config = storage.getItemSync 'config'
module.exports =
getConfig: ->
defaultDelay: 3
defaultDuration: 0.5
defaultTransition: "none"
checkCycles: 1 |
Add config for badge, sound, alert and vibrate for Push Notifications | if Meteor.isCordova
Tracker.autorun ->
if RocketChat.settings.get('Push_enable') is true
Push.Configure {}
Push.addListener 'token', (token) ->
Meteor.call 'log', 'token', arguments
Push.addListener 'error', (err) ->
Meteor.call 'log', 'error', arguments
if error.type == 'apn.cordova'
Met... | if Meteor.isCordova
Tracker.autorun ->
if RocketChat.settings.get('Push_enable') is true
Push.Configure
badge: true
sound: true
alert: true
vibrate: true
Push.addListener 'token', (token) ->
Meteor.call 'log', 'token', arguments
Push.addListener 'error', (err) ->
Meteor.call 'log',... |
Load / run scripts synchronously | fs = require 'fs'
path = require 'path'
module.exports = (robot, scripts) ->
scriptsPath = path.resolve(__dirname, 'src')
fs.exists scriptsPath, (exists) ->
if exists
for script in fs.readdirSync(scriptsPath)
if scripts? and '*' not in scripts
robot.loadF... | fs = require 'fs'
path = require 'path'
module.exports = (robot, scripts) ->
scriptsPath = path.resolve(__dirname, 'src')
if fs.existsSync scriptsPath
for script in fs.readdirSync(scriptsPath).sort()
if scripts? and '*' not in scripts
robot.loadFile(scriptsPath, script) if s... |
Change set markdown type shortcuts to start with 'm' | 'ft-outline-editor':
'ctrl-cmd-c': 'foldingtext-markdown:copy-markdown'
'ctrl-cmd-v': 'foldingtext-markdown:paste-markdown'
'ft-outline-editor.outlineMode':
't p': 'foldingtext-markdown:make-paragraph'
't h': 'foldingtext-markdown:make-header'
't c': 'foldingtext-markdown:make-code-block'
't q': 'foldingte... | 'ft-outline-editor':
'ctrl-cmd-c': 'foldingtext-markdown:copy-markdown'
'ctrl-cmd-v': 'foldingtext-markdown:paste-markdown'
'ft-outline-editor.outlineMode':
'm p': 'foldingtext-markdown:make-paragraph'
'm h': 'foldingtext-markdown:make-header'
'm c': 'foldingtext-markdown:make-code-block'
'm q': 'foldingte... |
Change mocha options: tap -> spec, colors = false | module.exports = (grunt)->
_ = grunt.util._
init_config = grunt.config()
# mocha
mocha_requires = [
"coffee-script"
"should"
"requirejs"
"underscore"
"backbone"
"jquery"
]
mocha_requires.push "./spec/spec_helper.coffee" if require("fs").existsSync("./spec/spec_helper.coffee")
_(in... | module.exports = (grunt)->
_ = grunt.util._
init_config = grunt.config()
# mocha
mocha_requires = [
"coffee-script"
"should"
"requirejs"
"underscore"
"backbone"
"jquery"
]
mocha_requires.push "./spec/spec_helper.coffee" if require("fs").existsSync("./spec/spec_helper.coffee")
_(in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.