Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Expand charset for stress test words again | # vim: ts=2:sw=2:sta
io = require('socket.io-client')
url = process.env.TEST_TARGET || 'https://snap-backend-dev.herokuapp.com' #'http://localhost:8080'
users = process.env.USERS || 50
WORD_CHARS = "abcdefghijklmnopqrstuvwxyz"
randWord = (len) ->
word = ""
for c in [1..len]
index = Math.floor(Math.random() ... | # vim: ts=2:sw=2:sta
io = require('socket.io-client')
url = process.env.TEST_TARGET || 'https://snap-backend-dev.herokuapp.com' #'http://localhost:8080'
users = process.env.USERS || 50
WORD_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789 "
randWord = (len) ->
word = ""
for c in [1..len]
index = Math.floor(Mat... |
Add global commit request object | #= require_self
#= require_tree ./templates
#= require_tree ./models
#= require_tree ./views
#= require_tree ./routers
window.Water =
Models: {}
Collections: {}
Routers: {}
Views: {}
$ ->
fetcher = window.tree_fetcher = new Water.TreeFetcher(repository_path: gon.repository_path, ref: gon.ref)
tree_view ... | #= require_self
#= require_tree ./templates
#= require_tree ./models
#= require_tree ./views
#= require_tree ./routers
window.Water =
Models: {}
Collections: {}
Routers: {}
Views: {}
$ ->
fetcher = window.tree_fetcher = new Water.TreeFetcher(repository_path: gon.repository_path, ref: gon.ref)
tree_view ... |
Switch to density for initialization. It's all relative anyway. | window.go = ->
window.world = new World "display"
window.rect = new Rectangle 5, 0.5,
position: [0, 0]
inverseMass: 1/10
color: "#F00"
window.rect2 = new Rectangle 1, 1,
position: [0, 1]
inverseMass: 1/1
velocity: [1, -2]
color: "#08F"
window.rect3 = new Rectangle 1, 1,
posit... | window.go = ->
window.world = new World "display"
window.rect = new Rectangle 5, 0.5,
position: [0, 0]
density: 4
color: "#F00"
window.rect2 = new Rectangle 1, 1,
position: [0, 1]
velocity: [1, -2]
density: 1
color: "#08F"
window.rect3 = new Rectangle 1, 1,
position: [0,-1]
... |
Add linter-eslint for projects that use ESLint | packages: [
"advanced-open-file"
"atom-alignment"
"auto-update-packages"
"docblockr"
"editorconfig"
"emmet"
"expand-region"
"language-apache"
"language-applescript"
"language-awk"
"language-env"
"language-gitattributes"
"language-gitignore"
"language-hosts"
"language-ini"
"language-latex... | packages: [
"advanced-open-file"
"atom-alignment"
"auto-update-packages"
"docblockr"
"editorconfig"
"emmet"
"expand-region"
"language-apache"
"language-applescript"
"language-awk"
"language-env"
"language-gitattributes"
"language-gitignore"
"language-hosts"
"language-ini"
"language-latex... |
Split coffee spec and build tasks | module.exports = ->
@initConfig
pkg: @file.readJSON "package.json"
meta:
file: "request"
package: "."
temp: "temp"
resources:
src: [
"src/module.coffee"
"src/emitter.coffee"
"src/helpers.coffee"
"src/request.coffee"
]
spec: ["spec/*.co... | module.exports = ->
@initConfig
pkg: @file.readJSON "package.json"
meta:
file: "request"
package: "."
temp: "temp"
build: "build"
resources:
src: [
"src/module.coffee"
"src/emitter.coffee"
"src/helpers.coffee"
"src/request.coffee"
]
... |
Fix build script adding content files to the build result | module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON "package.json"
clean:
main:
["dist/**/*"]
fast:
["dist/{/,routes/,bin/,sourcemap/}*{.js,.js.map}"]
coffee:
main:
files: [
expand: true,
src: ["{bin,routes,app}/*.coffee"],
... | module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON "package.json"
clean:
main:
["dist/**/*"]
fast:
["dist/{/,routes/,bin/,sourcemap/}*{.js,.js.map}"]
coffee:
main:
files: [
expand: true,
src: ["{bin,routes,app}/*.coffee"],
... |
Fix bug when shipping address fields are not getting not required when they are hidden | hideShippingAddressFields = (shipping_address) ->
shipping_address.hide().find('input,select').removeProp('required')
showShippingAddressFields = (shipping_address) ->
shipping_address.show().find("input:not([name$='[address2]']),select:not([name$='[state_code]'])").prop('required', true)
initShippingAddressField... | hideShippingAddressFields = (shipping_address) ->
shipping_address.hide().find('input, select').prop('required', false)
showShippingAddressFields = (shipping_address) ->
shipping_address.show().find("input:not([name$='[address2]']),select:not([name$='[state_code]'])").prop('required', true)
initShippingAddressFie... |
Create role when adding a user to a non-existing role | RocketChat.authz.addUsersToRoles = (userIds, roleNames, scope ) ->
console.log '[methods] addUserToRoles -> '.green, 'arguments:', arguments
if not userIds or not roleNames
return false
unless _.isArray(userIds)
userIds = [userIds]
users = Meteor.users.find({_id: {$in : userIds}}).fetch()
unless userIds.leng... | RocketChat.authz.addUsersToRoles = (userIds, roleNames, scope ) ->
console.log '[methods] addUserToRoles -> '.green, 'arguments:', arguments
if not userIds or not roleNames
return false
unless _.isArray(userIds)
userIds = [userIds]
users = Meteor.users.find({_id: {$in : userIds}}).fetch()
unless userIds.leng... |
Disable annotation if there's a factlink button | rightClick = (event=window.event) ->
if event.which
event.which == 3
else if event.button
event.button == 2
else
false
Factlink.textSelected = (e) ->
Factlink.getSelectionInfo().text?.length > 1
timeout = null
annotating = false
Factlink.startAnnotating = ->
return if annotating
annotating =... | rightClick = (event=window.event) ->
if event.which
event.which == 3
else if event.button
event.button == 2
else
false
Factlink.textSelected = (e) ->
Factlink.getSelectionInfo().text?.length > 1
timeout = null
annotating = false
Factlink.startAnnotating = ->
return if annotating
annotating =... |
Remove File and Directory exports | {Point, Range} = require 'text-buffer'
{File, Directory} = require 'pathwatcher'
module.exports =
_: require 'underscore-plus'
BufferedNodeProcess: require '../src/buffered-node-process'
BufferedProcess: require '../src/buffered-process'
Directory: Directory
File: File
fs: require 'fs-plus'
Git: require ... | {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... |
Fix alert dialog to use raw html like confirm dialog | {div, button} = React.DOM
ModalDialog = React.createFactory require './modal-dialog-view'
tr = require '../utils/translate'
module.exports = React.createClass
displayName: 'AlertDialogView'
close: ->
@props.close?()
@props.callback?()
render: ->
(ModalDialog {title: @props.title or (tr '~ALERT_D... | {div, button} = React.DOM
ModalDialog = React.createFactory require './modal-dialog-view'
tr = require '../utils/translate'
module.exports = React.createClass
displayName: 'AlertDialogView'
close: ->
@props.close?()
@props.callback?()
render: ->
(ModalDialog {title: @props.title or (tr '~ALERT_D... |
Fix the width of the performance graph on the dashboard. | $(document).ready ->
chart = new Highcharts.Chart
chart:
renderTo: 'weeks-performance-graph',
defaultSeriesType: 'spline',
backgroundColor: '#f7f7f7',
width: 600,
animation: false
title: [
text: 'Weekly Performance'
],
series: [
{
name: 'views',
... | $(document).ready ->
chart = new Highcharts.Chart
chart:
renderTo: 'weeks-performance-graph',
defaultSeriesType: 'spline',
backgroundColor: '#f7f7f7',
width: 700,
animation: false
title: [
text: 'Weekly Performance'
],
series: [
{
name: 'views',
... |
Revert "fix for show/hide pagination" | `import Ember from 'ember'`
ProjectCommitsController = Ember.ArrayController.extend
hideAccepted: true
searchResults: Ember.computed 'page', 'hideAccepted', 'model', ->
searchInput = null
@get("model").then (model) =>
searchInput = model
if !searchInput or !(@get('hideAccepted'))
@get("ar... | `import Ember from 'ember'`
ProjectCommitsController = Ember.ArrayController.extend
sortProperties: ['authoredAt']
hideAccepted: true
searchResults: Ember.computed.oneWay('arrangedContent')
filteredContent: Ember.observer('model', 'hideAccepted', 'page', ->
searchInput = @get('model')
if !searchInpu... |
Make list sortable on page load/turbolinks event | $ ->
$(".js-bucket-list").sortable({
connectWith: ".js-bucket-list"
update: (event, ui) ->
if this == ui.item.parent()[0]
window.target = $(event.target)
bucket_id = target.data("bucket-id")
position = ui.item.index()
$.ajax
type: "POST"
url: ui.i... | makeBucketsSortable = ->
$(".js-bucket-list").sortable({
connectWith: ".js-bucket-list"
update: (event, ui) ->
if this == ui.item.parent()[0]
window.target = $(event.target)
bucket_id = target.data("bucket-id")
position = ui.item.index()
$.ajax
type: "POST"... |
Implement not sending updates when gamepad hasn't changed. | angular.module('ansible')
# reports the gamepad states
.service 'gamepadReporter', [
'$interval'
'ansible'
'AMessage'
($interval, ansible, AMessage) ->
update = ->
g = navigator.getGamepads()[0]
if not g?
return # we don't have anything to send
content =
axes: g.axes
... | angular.module('ansible')
# reports the gamepad states
.service 'gamepadReporter', [
'$interval'
'ansible'
'AMessage'
($interval, ansible, AMessage) ->
# used for not sending redundant gamepad state
previousTimestamp = 0
update = ->
g = navigator.getGamepads()[0]
if not g? or g.timesta... |
Check whether there are currently any scrollbars | scrollbarWidth = 0
FactlinkJailRoot.loaded_promise.then ->
# Create the measurement nod; see http://davidwalsh.name/detect-scrollbar-width
scrollDiv = document.createElement("div");
$(scrollDiv).css(
width: "100px"
height: "100px"
overflow: "scroll"
position: "absolute"
top: "-9999px"
)
do... | scrollbarWidth = 0
FactlinkJailRoot.loaded_promise.then ->
# Create the measurement nod; see http://davidwalsh.name/detect-scrollbar-width
scrollDiv = document.createElement("div");
$(scrollDiv).css(
width: "100px"
height: "100px"
overflow: "scroll"
position: "absolute"
top: "-9999px"
)
do... |
Revert "fix typing info getting stuck" | {scrollToBottom} = require './messages'
{nameof} = require '../util'
module.exports = view (models) ->
{viewstate, conv, entity} = models
conv_id = viewstate?.selectedConv
c = conv[conv_id]
return unless c
typing = (t for t in (c.typing or []) when t.status != 'STOPPED')
if typing.length
... | {scrollToBottom} = require './messages'
{nameof} = require '../util'
module.exports = view (models) ->
{viewstate, conv, entity} = models
conv_id = viewstate?.selectedConv
c = conv[conv_id]
return unless c
if c.typing?.length
div class:'typing', ->
for t, i in c.typing
... |
Fix posts count on profile | class TentStatus.Views.ProfileStats extends TentStatus.View
templateName: '_profile_stats'
initialize: (options) ->
super
@resources = ['posts', 'followers', 'followings']
for r in @resources
do (r) =>
@on "change:#{r}Count", @render
new HTTP 'GET', "#{TentStatus.config.current_... | class TentStatus.Views.ProfileStats extends TentStatus.View
templateName: '_profile_stats'
initialize: (options) ->
super
@resources = ['posts', 'followers', 'followings']
for r in @resources
do (r) =>
@on "change:#{r}Count", @render
if r == 'posts'
params = {
... |
Return a boolean in `_loadMore` for if there are more items to load (5m) | class window.Neat.Renderer.InfiniteReveal extends window.Neat.Renderer.Basic
constructor: (@view, @collection, @options) ->
super
@scrollHandler = new Neat.ScrollHandler()
@scrollHandler.on "scroll", _.bind(@_windowHasBeenScrolled, @)
@sensitivity = @options.sensitivity ? 5
@pageSize = @options.... | class window.Neat.Renderer.InfiniteReveal extends window.Neat.Renderer.Basic
constructor: (@view, @collection, @options) ->
super
@scrollHandler = new Neat.ScrollHandler()
@scrollHandler.on "scroll", _.bind(@_windowHasBeenScrolled, @)
@sensitivity = @options.sensitivity ? 5
@pageSize = @options.... |
Add option for automatic pub get. | AnalysisComponent = require './analysis_component'
AnalysisView = require './views/analysis_view'
Utils = require './utils'
Formatter = require './formatter'
PubComponent = require './pub_component'
module.exports =
# spooky ( ͡° ͜ʖ ͡°)
analysisComponent: null
analysisStatusView: null
pubComponent: null
ac... | AnalysisComponent = require './analysis_component'
AnalysisView = require './views/analysis_view'
Utils = require './utils'
Formatter = require './formatter'
PubComponent = require './pub_component'
module.exports =
# spooky ( ͡° ͜ʖ ͡°)
analysisComponent: null
analysisStatusView: null
pubComponent: null
#... |
Fix the double callback call on docker timeout. | 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... |
Refactor Reporter to be thenable and to use promises | define [
'settings'
'promise'
'helpers/browser_helper'
'helpers/url_helper'
], (Settings, Promise, BrowserHelper, URLHelper)->
unique_id = 1
class Reporter
constructor: (options)->
@base = Settings.url.base
@queue = []
@transport = 'img'
@_determineTransport().then @_enableProp... | define [
'settings'
'promise'
'helpers/browser_helper'
'helpers/url_helper'
], (Settings, Promise, BrowserHelper, URLHelper)->
unique_id = 1
class Reporter
constructor: (options)->
@base = Settings.url.base
@queue = []
@transport = 'img'
@transport_ready = @_determineTransport(... |
Document drag and drop behaviors | # Handles HTML5 File API jQuery Drag and Drop interface transmorgifier plugin
# stereotypical aphormational gimme the loot putting all the holes in the
# sweata biggie smalls.
$(document).ready () ->
$('#fileupload').fileupload({
dropZone: $('body'),
dataType: 'json',
sequentialUploads: true,
url: '/... | # Handles HTML5 File API jQuery Drag and Drop interface transmorgifier plugin
# stereotypical aphormational gimme the loot putting all the holes in the
# sweata biggie smalls.
$(document).ready () ->
# Set up the file upload behavior on the invisa #fileupload box.
$('#fileupload').fileupload({
dropZone: $('bod... |
Add Google public API key to urlshorthener request | $ = require 'jquery'
kd = require 'kd'
module.exports = shortenUrl = (longUrl, callback) ->
apiUrl = 'https://www.googleapis.com/urlshortener/v1/url'
request = $.ajax
url : apiUrl
type : 'POST'
contentType : 'application/json'
data : JSON.stringify {longUrl}
dataType ... | $ = require 'jquery'
kd = require 'kd'
globals = require 'globals'
module.exports = shortenUrl = (longUrl, callback) ->
{apiKey} = globals.config.google
apiUrl = "https://www.googleapis.com/urlshortener/v1/url?key=#{apiKey}"
request = $.ajax
url : apiUrl
type : 'POST'
contentType : ... |
Fix bug with the warning visibility condition | (($) ->
'use strict'
$(document).ready ->
$('input[data-warn-if-checked]').behave 'load', ->
$('input[data-warn-if-checked]').each ->
input = $(this)
container = input.parent()
if container.find('.warn-message').length is 0
container.append($('<span class="warn-message">... | (($) ->
'use strict'
$(document).ready ->
$('input[data-warn-if-checked]').behave 'load', ->
$('input[data-warn-if-checked]').each ->
input = $(this)
container = input.parent()
if container.find('.warn-message').length is 0
container.append($('<span class="warn-message">... |
Move consumerLinter's logic to _consumeLinter it'll help us work with disposables while still working. | module.exports =
instance: null
config:
lintOnFly:
title: 'Lint on fly'
description: 'Lint files while typing, without the need to save them'
type: 'boolean'
default: true
showErrorInline:
title: "Show Inline Tooltips"
descriptions: "Show inline tooltips for errors"
... | module.exports =
instance: null
config:
lintOnFly:
title: 'Lint on fly'
description: 'Lint files while typing, without the need to save them'
type: 'boolean'
default: true
showErrorInline:
title: "Show Inline Tooltips"
descriptions: "Show inline tooltips for errors"
... |
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... |
Change adjustFontSizeTo function to fontSizeToPX and add fontSizeToMS | React = require 'react'
objectAssign = require('react/lib/Object.assign')
VerticalRhythm = require 'compass-vertical-rhythm'
ms = require 'modularscale'
module.exports = (options) ->
defaults =
baseFontSize: '16px'
baseLineHeight: '24px'
modularScale: [
'diminished fourth'
{ 768: 'minor third... | React = require 'react'
objectAssign = require('react/lib/Object.assign')
VerticalRhythm = require 'compass-vertical-rhythm'
ms = require 'modularscale'
module.exports = (options) ->
defaults =
baseFontSize: '16px'
baseLineHeight: '24px'
modularScale: [
'diminished fourth'
{ 768: 'minor third... |
Fix bug of using mixpanel module as the mixpanel client | Promise = require 'bluebird'
_ = require 'lodash'
fs = Promise.promisifyAll require 'fs'
config = require './config'
mixpanel = require 'mixpanel'
# Parses package.json and returns resin-supervisor's version
exports.getSupervisorVersion = ->
fs.readFileAsync(__dirname + '/../package.json', 'utf-8')
.then (data) ->
... | Promise = require 'bluebird'
_ = require 'lodash'
fs = Promise.promisifyAll require 'fs'
config = require './config'
mixpanel = require 'mixpanel'
# Parses package.json and returns resin-supervisor's version
exports.getSupervisorVersion = ->
fs.readFileAsync(__dirname + '/../package.json', 'utf-8')
.then (data) ->
... |
Make ctrl-k work first time | # 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... |
Make active only if 'os-teacher' class is present | React = require 'react'
BS = require 'react-bootstrap'
TeacherContentToggle = React.createClass
propTypes:
onChange: React.PropTypes.func.isRequired
isShowing: React.PropTypes.bool.isRequired
onClick: ->
@props.onChange(not @props.isShowing)
render: ->
teacherLinkText = if @props.isShowing
... | React = require 'react'
BS = require 'react-bootstrap'
TEACHER_CONTENT_SELECTOR = '.os-teacher'
TeacherContentToggle = React.createClass
propTypes:
onChange: React.PropTypes.func.isRequired
isShowing: React.PropTypes.bool
section: React.PropTypes.string
windowImpl: React.PropTypes.object
g... |
Add Grunt Fatal Error on Fail | fs = require 'fs'
# global module: false
module.exports = (grunt) ->
# Modules
grunt.loadNpmTasks 'grunt-init'
grunt.loadNpmTasks 'grunt-contrib-sass'
grunt.loadNpmTasks 'grunt-contrib-watch'
# Grunt Tasks
grunt.initConfig
meta: version: '0.0.1'
# Sass
sass: test:
options:
styl... | fs = require 'fs'
# global module: false
module.exports = (grunt) ->
# Modules
grunt.loadNpmTasks 'grunt-init'
grunt.loadNpmTasks 'grunt-contrib-sass'
grunt.loadNpmTasks 'grunt-contrib-watch'
# Grunt Tasks
grunt.initConfig
meta: version: '0.0.1'
# Sass
sass: test:
options:
styl... |
Change linter settings to be less distractive | 'global':
'core':
'ignoredNames': [
'.git'
'.svn'
'.DS_Store'
]
'disabledPackages': [
'open-on-github'
'linter-scss-lint'
]
'welcome':
'showOnStartup': false
'exception-reporting':
'userId': '93eefc96-d01a-1960-59e4-71ddef94eb74'
'metrics':
'userId': '9e... | 'global':
'core':
'ignoredNames': [
'.git'
'.svn'
'.DS_Store'
]
'disabledPackages': [
'open-on-github'
'linter-scss-lint'
]
'welcome':
'showOnStartup': false
'exception-reporting':
'userId': '93eefc96-d01a-1960-59e4-71ddef94eb74'
'metrics':
'userId': '9e... |
Move constant variable outside of class definition | # Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
# See the LICENCE file in the repository root for full licence text.
import * as React from 'react'
import { div, dd, dl, dt } from 'react-dom-factories'
el = React.createElement
export class Stats extends React.... | # Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
# See the LICENCE file in the repository root for full licence text.
import * as React from 'react'
import { div, dd, dl, dt } from 'react-dom-factories'
entries = [
'ranked_beatmapset_count'
'loved_beatmapset... |
Refactor - set port variable before configuration | express = require 'express'
io = require 'socket.io'
http = require 'http'
fs = require 'fs'
path = require 'path'
logger = require 'winston'
routes = require './routes'
fs.mkdir './log' unless fs.existsSync './log'
logger.add logger.transports.File,
filename: './log/flumen.log'
handleExceptions: true
socketIoApp... | express = require 'express'
io = require 'socket.io'
http = require 'http'
fs = require 'fs'
path = require 'path'
logger = require 'winston'
routes = require './routes'
fs.mkdir './log' unless fs.existsSync './log'
logger.add logger.transports.File,
filename: './log/flumen.log'
handleExceptions: true
socketIoApp... |
Add a few languages for the language drop-down | window.translations ||= {}
window.translations['en'] =
languages:
"":
lang: "en"
"en": [null, "English"]
"no": [null, "Norwegian"]
"nb": [null, "Norwegian bokmål"]
"nn": [null, "Norwegian nynorsk"]
"ru": [null, "Russian"] | window.translations ||= {}
window.translations['en'] =
languages:
"":
lang: "en"
"en": [null, "English"]
"no": [null, "Norwegian"]
"nb": [null, "Norwegian bokmål"]
"nn": [null, "Norwegian nynorsk"]
"ru": [null, "Russian"]
"fr": [null, "French"]
"it": [null, "Italian"]
"se": ... |
Extend from `Ember.Service` instead of `Ember.Object` in service blueprint | `import Ember from 'ember'`
<%= classifiedModuleName %>Service = Ember.Object.extend()
`export default <%= classifiedModuleName %>Service`
| `import Ember from 'ember'`
<%= classifiedModuleName %>Service = Ember.Service.extend()
`export default <%= classifiedModuleName %>Service`
|
Fix onDidChangeKernel in plugin API | module.exports =
class HydrogenProvider
constructor: (@_hydrogen) ->
@_happy = true
onDidChangeKernel: (callback) ->
@_hydrogen.emitter.on 'did-change-kernel', (kernel) ->
return kernel.getPluginWrapper()
getActiveKernel: ->
unless @_hydrogen.kernel
return n... | module.exports =
class HydrogenProvider
constructor: (@_hydrogen) ->
@_happy = true
onDidChangeKernel: (callback) ->
@_hydrogen.emitter.on 'did-change-kernel', (kernel) ->
if kernel?
callback kernel.getPluginWrapper()
else
callback null
... |
Move validation part to a separate function | module.exports =
instance: null
config:
lintOnFly:
title: 'Lint on fly'
description: 'Lint files while typing, without the need to save them'
type: 'boolean'
default: true
showErrorInline:
title: "Show Inline Tooltips"
descriptions: "Show inline tooltips for errors"
... | module.exports =
instance: null
config:
lintOnFly:
title: 'Lint on fly'
description: 'Lint files while typing, without the need to save them'
type: 'boolean'
default: true
showErrorInline:
title: "Show Inline Tooltips"
descriptions: "Show inline tooltips for errors"
... |
Fix issue of invalid order of task's actions. | Q = require 'q'
{Base} = require "#{__dirname}/base"
{Wrappers} = require "#{__dirname}/helpers/wrappers"
{BeanBuilder} = require "#{__dirname}/helpers/bean_builder"
class BaseTask extends Base
app: null
actions: null
actionBuilder: null
constructor: ->
@actions = []
@actionBuilder = new BeanBuild... | Q = require 'q'
{Base} = require "#{__dirname}/base"
{Wrappers} = require "#{__dirname}/helpers/wrappers"
{BeanBuilder} = require "#{__dirname}/helpers/bean_builder"
class BaseTask extends Base
app: null
actions: null
actionBuilder: null
constructor: ->
@actions = []
@actionBuilder = new BeanBuild... |
Remove some left-over view code | {CompositeDisposable} = require 'atom'
module.exports = ListEdit =
listEditView: null
modalPanel: null
subscriptions: null
activate: (state) ->
# Events subscribed to in atom's system can be easily cleaned up with a CompositeDisposable
@subscriptions = new CompositeDisposable
# Register command t... | {CompositeDisposable} = require 'atom'
module.exports =
subscriptions: null
activate: (state) ->
# Events subscribed to in atom's system can be easily cleaned up with a CompositeDisposable
@subscriptions = new CompositeDisposable
# Register command that toggles this view
@subscriptions.add atom.c... |
Add coupon check for Taiwan | CocoCollection = require './CocoCollection'
Product = require 'models/Product'
utils = require 'core/utils'
module.exports = class Products extends CocoCollection
model: Product
url: '/db/products'
getByName: (name) -> @findWhere { name: name }
getBasicSubscriptionForUser: (user) ->
coupon = user?.get(... | CocoCollection = require './CocoCollection'
Product = require 'models/Product'
utils = require 'core/utils'
module.exports = class Products extends CocoCollection
model: Product
url: '/db/products'
getByName: (name) -> @findWhere { name: name }
getBasicSubscriptionForUser: (user) ->
coupon = user?.get('s... |
Set up travis for Topic Map [rev: Alex Scown] | module.exports = (grunt) ->
documentation = 'doc'
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
clean: [
'bin'
'.grunt'
documentation
]
jsdoc:
dist:
src: ['topicmap.js', 'README.md']
options:
destination: documentation
template: ... | module.exports = (grunt) ->
documentation = 'doc'
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
clean: [
'bin'
'.grunt'
documentation
]
jsdoc:
dist:
src: ['src/js/topicmap.js', 'README.md']
options:
destination: documentation
tem... |
Add server route for serving up images. | mkdirp = Meteor.npmRequire 'mkdirp'
Busboy = Meteor.npmRequire "busboy"
fs = Npm.require 'fs'
os = Npm.require 'os'
path = Npm.require 'path'
Router.route '/image/:id',
name: 'image'
where: 'server'
onBeforeAction: (req, res, next) ->
{id} = @params
filenames = []
if req.method is 'POST'
busboy... | mkdirp = Meteor.npmRequire 'mkdirp'
Busboy = Meteor.npmRequire "busboy"
fs = Npm.require 'fs'
os = Npm.require 'os'
path = Npm.require 'path'
Router.route '/image/:id',
name: 'image'
where: 'server'
onBeforeAction: (req, res, next) ->
{id} = @params
filenames = []
if req.method is 'POST'
busboy... |
Remove unused vars from Directory | _ = require 'underscore'
fs = require 'fs'
File = require 'file'
EventEmitter = require 'event-emitter'
module.exports =
class Directory
@idCounter = 0
path: null
constructor: (@path) ->
@id = ++Directory.idCounter
getName: ->
fs.base(@path) + '/'
getEntries: ->
directories = []
files = [... | _ = require 'underscore'
fs = require 'fs'
File = require 'file'
EventEmitter = require 'event-emitter'
module.exports =
class Directory
path: null
constructor: (@path) ->
getName: ->
fs.base(@path) + '/'
getEntries: ->
directories = []
files = []
for path in fs.list(@path)
if fs.isDir... |
Update tooltip when title changes | {$, fs, 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()
@item.on? 'mo... | {$, fs, 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()
@upda... |
Trim `(edited)` from the ends of lines. | # Strict quote parser for the format entered into the clipboard by the Slack thick client.
moment = require 'moment'
_ = require 'underscore'
# RegExp snippets for reuse
TS = '\\[(\d{1,2}:\d{2}(?: [aApP][mM])?)\\]' # [11:22 AM] *or* [16:00]
# RegExps
rxWs = /^\s*$/
rxNickLine = new RegExp("^\s*(\S+)\s+#{TS}\s*$")
rx... | # Strict quote parser for the format entered into the clipboard by the Slack thick client.
moment = require 'moment'
_ = require 'underscore'
# RegExp snippets for reuse
TS = '\\[(\d{1,2}:\d{2}(?: [aApP][mM])?)\\]' # [11:22 AM] *or* [16:00]
# RegExps
rxWs = /^\s*$/
rxNickLine = new RegExp("^\s*(\S+)\s+#{TS}\s*$")
rx... |
Add headless Chrome parameters to work on ResinCi | karmaConfig = require('resin-config-karma')
packageJSON = require('./package.json')
module.exports = (config) ->
karmaConfig.plugins.push(require('karma-chrome-launcher'))
karmaConfig.browsers = ['ChromeHeadless']
karmaConfig.logLevel = config.LOG_INFO
karmaConfig.sauceLabs =
testName: "#{packageJSON.name} v#{... | karmaConfig = require('resin-config-karma')
packageJSON = require('./package.json')
module.exports = (config) ->
karmaConfig.plugins.push(require('karma-chrome-launcher'))
karmaConfig.browsers = ['ChromeHeadlessCustom']
karmaConfig.customLaunchers =
ChromeHeadlessCustom:
base: 'ChromeHeadless'
flags: [
... |
Use four spaces for shell script files | # 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.
#
# Settings to assign based on grammar name.
grammarSettings =
'GitHub Markdown':
showInvisibles: false
softWrap: tru... | # 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.
#
# Settings to assign based on grammar name.
grammarSettings =
'GitHub Markdown':
showInvisibles: false
softWrap: tru... |
Revert "add support for new homepage rails and update rails order" | module.exports = """
query($showHeroUnits: Boolean!) {
home_page {
artwork_modules(
max_rails: -1,
max_followed_gene_rails: -1,
order: [
ACTIVE_BIDS,
RECENTLY_VIEWED_WORKS,
SIMILAR_TO_RECENTLY_VIEWED,
SAVED_WORKS,
SIMILAR_TO_SAVED_WOR... | module.exports = """
query($showHeroUnits: Boolean!) {
home_page {
artwork_modules(
max_rails: -1,
max_followed_gene_rails: -1,
order: [
ACTIVE_BIDS,
RECENTLY_VIEWED_WORKS
RECOMMENDED_WORKS,
FOLLOWED_ARTISTS,
RELATED_ARTISTS,
... |
Add Google Analytics tracking code |
# Positionning funny elements
$RndmElmts = $('span.funnythings')
PositionElmts = ->
$RndmElmts.each ->
left = Math.floor((Math.random() * 90))
top = Math.floor((Math.random() * 90))
$(this).css('top': top + '%', 'left': left + '%')
# Stellar js
Stellar = ->
if window.matchMedia('(min-width: 860px)').m... |
# Positionning funny elements
$RndmElmts = $('span.funnythings')
PositionElmts = ->
$RndmElmts.each ->
left = Math.floor((Math.random() * 90))
top = Math.floor((Math.random() * 90))
$(this).css('top': top + '%', 'left': left + '%')
# Stellar js
Stellar = ->
if window.matchMedia('(min-width: 860px)').m... |
Make sure 'info' and 'debug' logging levels have different colors |
winston = require('winston')
module.exports = new (winston.Logger)({
transports: [
new (winston.transports.Console)({colorize: true})
]
levels:
silly: 14
debug: 13
verbose: 12
info: 11
test: 10
pass: 9
fail: 8
complete: 7
actual: 6
expected: 5
hook: 4
request... |
winston = require('winston')
module.exports = new (winston.Logger)({
transports: [
new (winston.transports.Console)({colorize: true})
]
levels:
silly: 14
debug: 13
verbose: 12
info: 11
test: 10
pass: 9
fail: 8
complete: 7
actual: 6
expected: 5
hook: 4
request... |
Check for existence before copying | fs = require 'fs'
path = require 'path'
walkdir = require 'walkdir'
module.exports = (grunt) ->
cp: (source, destination, {filter}={}) ->
try
walkdir.sync source, (sourcePath, stats) ->
return if filter?.test(sourcePath)
destinationPath = path.join(destination, path.relative(source, source... | fs = require 'fs'
path = require 'path'
walkdir = require 'walkdir'
module.exports = (grunt) ->
cp: (source, destination, {filter}={}) ->
unless grunt.file.exists(source)
grunt.fatal("Cannot copy non-existent #{source.cyan} to #{destination.cyan}")
try
walkdir.sync source, (sourcePath, stats) ->... |
Disable logging in test again (oops) | Front = require('../lib/front/front')
WebSocket = require('ws')
WebSocketServer = require('ws').Server
logger.set_levels 'development'
describe 'Front', ->
beforeEach ->
@front = new Front
it 'should initialize', ->
@front.start
it 'should start a WSS', ->
stub = new WebSocketServer({port: 3021, ho... | Front = require('../lib/front/front')
WebSocket = require('ws')
WebSocketServer = require('ws').Server
describe 'Front', ->
beforeEach ->
@front = new Front
it 'should initialize', ->
@front.start
it 'should start a WSS', ->
stub = new WebSocketServer({port: 3021, host: "0.0.0.0"});
stub.on 'co... |
Store archive edit session state in a telepath document | fsUtils = require 'fs-utils'
path = require 'path'
_ = require 'underscore'
archive = require 'ls-archive'
File = require 'file'
module.exports=
class ArchiveEditSession
registerDeserializer(this)
@version: 1
@activate: ->
Project = require 'project'
Project.registerOpener (filePath) ->
new Archiv... | path = require 'path'
_ = require 'underscore'
archive = require 'ls-archive'
telepath = require 'telepath'
fsUtils = require 'fs-utils'
File = require 'file'
module.exports=
class ArchiveEditSession
@acceptsDocuments: true
registerDeserializer(this)
@version: 1
@activate: ->
Project = require 'project'... |
Use ActivityLogger in stash pop | git = require '../git'
notifier = require '../notifier'
OutputViewManager = require '../output-view-manager'
module.exports = (repo) ->
cwd = repo.getWorkingDirectory()
git.cmd(['stash', 'pop'], {cwd}, color: true)
.then (msg) ->
OutputViewManager.getView().showContent(msg) if msg isnt ''
.catch (msg) ->
... | git = require('../git-es').default
ActivityLogger = require('../activity-logger').default
module.exports = (repo) ->
cwd = repo.getWorkingDirectory()
git(['stash', 'pop'], {cwd, color: true})
.then (result) ->
ActivityLogger.record(Object.assign({message: 'Pop from stash'}, result))
|
Use "instance" as scope reference | Parse = require 'parse'
Template.survey_admin.onCreated ->
@fetched = new ReactiveVar false
surveyId = @data.id
self = @
query = new Parse.Query Survey
query.get(surveyId).then (survey) ->
self.fetched.set true
self.survey = survey
,
(obj, error) ->
throw new Meteor.Error 'server',... | Parse = require 'parse'
{Survey} = require '../../imports/models'
Template.survey_admin.onCreated ->
@fetched = new ReactiveVar false
surveyId = @data.id
instance = @
query = new Parse.Query Survey
query.get(surveyId).then (survey) ->
instance.fetched.set true
instance.survey = survey
,
... |
Allow hiding if operating as single location | class Skr.Components.LocationChooser extends Lanes.React.Component
propTypes:
onModelSet: React.PropTypes.func
name: React.PropTypes.string
getDefaultProps: ->
label: 'Location', name: 'location'
dataObjects:
query: ->
new Lanes.Models.Query({
... | class Skr.Components.LocationChooser extends Lanes.React.Component
propTypes:
onModelSet: React.PropTypes.func
name: React.PropTypes.string
hideSingle: React.PropTypes.bool
getDefaultProps: ->
label: 'Location', name: 'location'
dataObjects:
query: ->
... |
Fix stupid bug with jQuery reference | @Infeedl ||= {}
@Infeedl.init = ->
Infeedl.$("[data-infeedl-placement]").each ->
placement = new Infeedl.Placement($(this).attr("data-infeedl-placement"), this)
placement.fetch()
Infeedl.$ = jQuery.noConflict()
@Infeedl.init()
| @Infeedl ||= {}
@Infeedl.init = ->
Infeedl.$("[data-infeedl-placement]").each ->
placement = new Infeedl.Placement(Infeedl.$(this).attr("data-infeedl-placement"), this)
placement.fetch()
Infeedl.$ = jQuery.noConflict()
@Infeedl.init()
|
Update Grunt pages task. | grunt = require 'grunt'
module.exports =
'gh-pages':
options:
base: 'gh-pages'
add: yes
src: ['**']
clean: [
'gh-pages/*'
'!gh-pages/.gitignore'
'!gh-pages/template.html'
]
copy:
expand: yes
src: [
'dist/**/*'
'docs/**/*'
'lib/**/*'
'tests/**/... | grunt = require 'grunt'
module.exports =
'gh-pages':
options:
base: 'gh-pages'
add: yes
src: ['**']
clean: [
'gh-pages/*'
'!gh-pages/.gitignore'
'!gh-pages/template.html'
]
copy:
expand: yes
src: [
'dist/**/*'
'docs/**/*'
'lib/**/*'
'tests/**/... |
Add language-pip to Atom package list | packages: [
"advanced-open-file"
"atom-alignment"
"atom-beautify"
"atom-transpose"
"color-picker"
"docblockr"
"editorconfig"
"emmet"
"expand-region"
"language-apache"
"language-applescript"
"language-awk"
"language-babel"
"language-diff"
"language-env"
"language-gitattributes"
"languag... | packages: [
"advanced-open-file"
"atom-alignment"
"atom-beautify"
"atom-transpose"
"color-picker"
"docblockr"
"editorconfig"
"emmet"
"expand-region"
"language-apache"
"language-applescript"
"language-awk"
"language-babel"
"language-diff"
"language-env"
"language-gitattributes"
"languag... |
Include the auditor gui in the build | module.exports = (grunt)->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
jshint:
options:
jshintrc: '.jshintrc'
all: [
'Standards/**/*.js'
'PhantomJS/*.js'
]
uglify:
options:
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - <%= ... | module.exports = (grunt)->
grunt.initConfig
pkg: grunt.file.readJSON('package.json')
jshint:
options:
jshintrc: '.jshintrc'
all: [
'Standards/**/*.js'
'PhantomJS/*.js'
]
uglify:
options:
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - <%= ... |
Mark ::get as private and tweak comments | {Document} = require 'telepath'
# Public: Manages the deserializers used for serialized state
module.exports =
class DeserializerManager
constructor: ->
@deserializers = {}
@deferredDeserializers = {}
# Public: Add a deserializer.
add: (klasses...) ->
@deserializers[klass.name] = klass for klass in ... | {Document} = require 'telepath'
# Public: Manages the deserializers used for serialized state
module.exports =
class DeserializerManager
constructor: ->
@deserializers = {}
@deferredDeserializers = {}
# Public: Register the given class(es) as deserializers.
add: (klasses...) ->
@deserializers[klass.... |
Change out Ember.run.later for Ember.run.schedule | ETahi.PhaseHeaderView = Em.View.extend
templateName: 'phase_header'
classNames: ['column-header']
classNameBindings: ['active']
active: false
focusIn: (e)->
@set('active', true)
phaseNameDidChange: (->
# race condition with binding and cancel action? :(
Em.run.later (->
Tahi.utils.resize... | ETahi.PhaseHeaderView = Em.View.extend
templateName: 'phase_header'
classNames: ['column-header']
classNameBindings: ['active']
active: false
focusIn: (e)->
@set('active', true)
phaseNameDidChange: (->
Ember.run.schedule('afterRender' , this, ->
Tahi.utils.resizeColumnHeaders()
)
).obs... |
Fix requirejs errors for googles map in QA | require [
"jquery"
"underscore"
"backbone"
"foundation"
"foundation.topbar"
"raven"
"AppRouter"
"signet"
], ($, _, Backbone, foundation, topbar, Raven, Router) ->
$ ->
# Config Sentry Raven Client
if jailbreak.sentry.enabled
Raven.config(jailbreak.sentry.dsn, {
whitelistUrls: ... | require [
"jquery"
"underscore"
"backbone"
"foundation"
"foundation.topbar"
"raven"
"AppRouter"
"signet"
"async"
], ($, _, Backbone, foundation, topbar, Raven, Router) ->
$ ->
# Config Sentry Raven Client
if jailbreak.sentry.enabled
Raven.config(jailbreak.sentry.dsn, {
white... |
Fix bug where creating a dashboard didn't direct you to its url | BaseView = require 'views/base_view'
Manager = require 'modules/manager'
class DashboardDialog extends BaseView
className: 'dialog'
tag: 'div'
projects: require 'config/projects_config'
template: require './templates/dashboard_dialog'
initialize: (options) ->
@parent = options.parent
@selected = M... | BaseView = require 'views/base_view'
Manager = require 'modules/manager'
class DashboardDialog extends BaseView
className: 'dialog'
tag: 'div'
projects: require 'config/projects_config'
template: require './templates/dashboard_dialog'
initialize: (options) ->
@parent = options.parent
@selected = M... |
Move the poller into the lib and mix it with the other classmixer stuffs. Update the test. | #= require dashboard
#= require mock-ajax
describe "Dashboard - getData()", ->
beforeEach ->
jasmine.Ajax.useMock()
@dashboard = Dashboard
describe "when the report is ready on the first iteration", ->
it "should return the dashboard data", ->
that = this
@dashboard.getData 'lesson_leader... | #= require lib/dashboard_poller
#= require mock-ajax
describe "Dashboard - getData()", ->
beforeEach ->
jasmine.Ajax.useMock()
@dashboard = ttm.lib.DashboardPoller.build()
describe "when the report is ready on the first iteration", ->
it "should return the dashboard data", ->
that = this
... |
Move enumNames out of class | class Enumeration
#Registered enums
@types:[]
#Static function that creates an enum object value. Uniqueness guarantied by object reference.
#This objects's unique own field is the Enumeration name. It's read only.
#string value shall be uppercase
@value:(value,enumName="Enumeration")->
prototype= id: -... | #Registered enums
enumNames=[]
class Enumeration
#Static function that creates an enum object value. Uniqueness guarantied by object reference.
#This objects's unique own field is the Enumeration name. It's read only.
#string value shall be uppercase
@value:(value,enumName="Enumeration")->
prototype= id: ->... |
Remove filename debugging info from the subject viewer | React = require 'react'
module.exports = React.createClass
displayName: 'SubjectViewer'
mediaSrcs: {}
getInitialState: ->
text: 'Loading'
componentDidMount: ->
@loadText @props.subject?.locations
componentWillReceiveProps: (newProps) ->
@loadText newProps.subject?.locations
rende... | React = require 'react'
module.exports = React.createClass
displayName: 'SubjectViewer'
mediaSrcs: {}
getInitialState: ->
text: 'Loading'
componentDidMount: ->
@loadText @props.subject?.locations
componentWillReceiveProps: (newProps) ->
@loadText newProps.subject?.locations
rende... |
Add Object.values & Object.entries snippets | ".source.js":
"Object.assign":
prefix: "assign"
body: "Object.assign(${1:dest}, ${2:source})"
"Object.assign +":
prefix: "Object.assign"
body: "Object.assign(${1:dest}, ${2:source})"
"Object.create":
prefix: "create"
body: "Object.create(${1:object})"
"Object.create +":
prefix: "Obj... | ".source.js":
"Object.assign":
prefix: "assign"
body: "Object.assign(${1:dest}, ${2:source})"
"Object.assign +":
prefix: "Object.assign"
body: "Object.assign(${1:dest}, ${2:source})"
"Object.create":
prefix: "create"
body: "Object.create(${1:object})"
"Object.create +":
prefix: "Obj... |
Revert custom finder related logic. | class FinderPane extends Pane
constructor: (options = {}, data) ->
super options, data
@createFinderController()
@bindListeners()
createFinderController: ->
finderApp = new FinderController
@finderController = finderApp.create()
@addSubView @finderController.getView()
@finde... | class FinderPane extends Pane
constructor: (options = {}, data) ->
super options, data
vmController = KD.getSingleton 'vmController'
vmController.fetchDefaultVmName (vmName) =>
@finder = new NFinderController
nodeIdPath : 'path'
nodeParentIdPath : 'parentPath'
contextMen... |
Fix in app date display for meeting tiems | angular.module('loomioApp').factory 'TimeService', (AppConfig) ->
new class TimeService
displayDate: (m, zone) =>
if moment._f == 'YYYY-MM-DD'
m.format("D MMMM#{@sameYear(m)}")
else
@inTimeZone(m, zone).format("D MMMM#{@sameYear(m)} - h:mma")
isoDate: (m, zone) =>
@inTimeZo... | angular.module('loomioApp').factory 'TimeService', (AppConfig) ->
new class TimeService
displayDate: (m, zone) =>
if m._f == 'YYYY-MM-DD'
m.format("D MMMM#{@sameYear(m)}")
else
@inTimeZone(m, zone).format("D MMMM#{@sameYear(m)} - h:mma")
isoDate: (m, zone) =>
@inTimeZone(m,... |
Remove .coffee extension from require path | BodyParser = require '../lib/snippet-body-parser.coffee'
describe "Snippet Body Parser", ->
it "breaks a snippet body into lines, with each line containing tab stops at the appropriate position", ->
bodyTree = BodyParser.parse """
the quick brown $1fox ${2:jumped ${3:over}
}the ${4:lazy} dog
"""
... | BodyParser = require '../lib/snippet-body-parser'
describe "Snippet Body Parser", ->
it "breaks a snippet body into lines, with each line containing tab stops at the appropriate position", ->
bodyTree = BodyParser.parse """
the quick brown $1fox ${2:jumped ${3:over}
}the ${4:lazy} dog
"""
ex... |
Check existence of gulpfile in landing site directory | fs = require 'fs'
gulp = require 'gulp'
shell = require 'gulp-shell'
module.exports = (version) ->
folders = (folder for folder in fs.readdirSync('./') when fs.statSync(folder).isDirectory())
sites = folders.filter (folder) -> folder.search(/^site\./) is 0 and folder isnt 'site.boilerplate'
comman... | fs = require 'fs'
gulp = require 'gulp'
shell = require 'gulp-shell'
module.exports = (version) ->
folders = (folder for folder in fs.readdirSync('./') when fs.statSync(folder).isDirectory())
sites = folders.filter (folder) ->
siteDir = folder.search(/^site\./) is 0 and folder isnt 'site.boilerp... |
Add command for opening todo list | # 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.
#
path = require 'path'
oldWindowDimensions = {}
oldThemes = []
atom.commands.add 'atom-workspace',
'custom:open-todo-list':... | # 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.
#
path = require 'path'
oldWindowDimensions = {}
atom.commands.add 'atom-workspace',
'custom:open-todo-list': ->
todoLis... |
Fix login problems on firefox | checkOuterPages = (url) =>
outerPages = ["docs", "about", "privacy", "pricing"]
for page in outerPages
if (url.match "^/#{page}.*")
return "/"
return url
CI.github =
# we encore each parammeter separately (one of them twice!) to get the right format
authUrl: (scope=["user", "repo"]) =>
destina... | checkOuterPages = (url) =>
outerPages = ["docs", "about", "privacy", "pricing"]
for page in outerPages
if (url.match "^/#{page}.*")
return "/"
return url
CI.github =
# we encore each parammeter separately (one of them twice!) to get the right format
authUrl: (scope=["user", "repo"]) =>
destina... |
Remove pushed/unpushed status for now. | LocalBranch = require './local-branch'
{git} = require '../../git'
module.exports =
class CurrentBranch extends LocalBranch
initialize: ->
@reload()
reload: ->
git.branch (head) =>
@set head
git.gitNoChange "log @{u}..", (output) =>
@set unpushed: (output != "")
head: ->
"HEAD"
... | LocalBranch = require './local-branch'
{git} = require '../../git'
module.exports =
class CurrentBranch extends LocalBranch
initialize: ->
@reload()
reload: ->
git.branch (head) =>
@set head
# git.gitNoChange "log @{u}..", (output) =>
# @set unpushed: (output != "")
head: ->
"HEAD... |
Fix wrong redirect after logging in | express = require 'express'
passport = require 'passport'
router = express.Router()
router.post '/login', passport.authenticate 'local',
successRedirect: '/app'
failureRedirect: '/'
failureFlash: 'Invalid username or password!'
module.exports = router
| express = require 'express'
passport = require 'passport'
router = express.Router()
router.post '/login', passport.authenticate 'local',
successRedirect: '/admin'
failureRedirect: '/'
failureFlash: 'Invalid username or password!'
module.exports = router
|
Set `target: _blank` on submit feedback | React = require 'react'
Nav = React.createFactory require 'antwar-default-theme/Nav'
Paths = require('antwar-core/PathsMixin')
require 'antwar-default-theme/scss/main.scss'
require 'react-ghfork/gh-fork-ribbon.ie.css' # ie support
require 'react-ghfork/gh-fork-ribbon.css'
Fork = React.createFactory(require 'react-ghfo... | React = require 'react'
Nav = React.createFactory require 'antwar-default-theme/Nav'
Paths = require('antwar-core/PathsMixin')
require 'antwar-default-theme/scss/main.scss'
require 'react-ghfork/gh-fork-ribbon.ie.css' # ie support
require 'react-ghfork/gh-fork-ribbon.css'
Fork = React.createFactory(require 'react-ghfo... |
Disable particles in mobile login | Template.loginLayout.rendered = ->
$('html').addClass("scroll").removeClass "noscroll"
window.pJSDom = []
particlesJS.load 'particles-js', '/scripts/particles.json', -> | Template.loginLayout.rendered = ->
$('html').addClass("scroll").removeClass "noscroll"
if not Meteor.isCordova
window.pJSDom = []
particlesJS.load 'particles-js', '/scripts/particles.json', -> |
Set image properties when inserting an image. | #= require cmsimple/panels/images/panel
class CMSimple.Panels.ImageLibrary.List extends Spine.Controller
events:
'click .media-actions > .info' : 'toggleInfo'
'click .media-info > .close' : 'toggleInfo'
'click [data-full-url]' : 'triggerImage'
'click .delete' : 'deleteImage'
constructor: (el)->
... | #= require cmsimple/panels/images/panel
class CMSimple.Panels.ImageLibrary.List extends Spine.Controller
events:
'click .media-actions > .info' : 'toggleInfo'
'click .media-info > .close' : 'toggleInfo'
'click [data-full-url]' : 'triggerImage'
'click .delete' : 'deleteImage'
constructor: (el)->
... |
Fix typo, tray => Tray | # Import common modules.
module.exports = require '../../../../common/api/lib/exports/electron'
v8Util = process.atomBinding 'v8_util'
v8Util.setHiddenValue module.exports, 'electronModule', true
Object.defineProperties module.exports,
# Browser side modules, please sort with alphabet order.
app:
enumerable: ... | # Import common modules.
module.exports = require '../../../../common/api/lib/exports/electron'
v8Util = process.atomBinding 'v8_util'
v8Util.setHiddenValue module.exports, 'electronModule', true
Object.defineProperties module.exports,
# Browser side modules, please sort with alphabet order.
app:
enumerable: ... |
Sort subject sets by borough and file id | React = require 'react'
module.exports = React.createClass
displayName: 'ChooseSubjectSet'
getInitialState: ->
subject_sets: []
componentWillMount: ->
@props.workflow?.get 'subject_sets', page_size: 40
.then (subject_sets) =>
@setState {subject_sets}
render: ->
<div classNa... | React = require 'react'
module.exports = React.createClass
displayName: 'ChooseSubjectSet'
getInitialState: ->
subject_sets: []
componentWillMount: ->
@props.workflow?.get 'subject_sets', page_size: 40
.then (subject_sets) =>
subject_sets.sort (a, b) ->
return 1 if a.metad... |
Add specs for normal scope. | describe 'PodsList', ->
subject = null
beforeEach (done) ->
subject = new SeedsStore('test')
expect(subject.clear()).eventually.notify(done)
it 'counts 0', (done) ->
expect(subject.countForAll()).eventually.equal(0).notify(done)
it 'counts n', (done) ->
subject.update([{name: 1},{name: 2},{name:... | describe 'PodsList', ->
subject = null
beforeEach (done) ->
subject = new SeedsStore('test')
expect(subject.clear()).eventually.notify(done)
it 'counts 0', (done) ->
expect(subject.countForAll()).eventually.equal(0).notify(done)
it 'counts n', (done) ->
subject.update([{name: 1},{name: 2},{name:... |
Fix Attachment not correctly cleaning up listener | #
Tether = require 'tether/tether'
assign = require 'object-assign'
React = require 'react'
$ = React.createElement
class Attachment extends React.Component
componentDidMount: =>
@root = document.createElement 'DIV'
document.body.appendChild @root
document.addEventListener 'mousedown', @handleEvent
... | #
Tether = require 'tether/tether'
assign = require 'object-assign'
React = require 'react'
$ = React.createElement
class Attachment extends React.Component
componentDidMount: =>
@root = document.createElement 'DIV'
document.body.appendChild @root
document.addEventListener 'mousedown', @handleEvent
... |
Remove ref to status bar | StatusBarView = require './status-bar-view'
FileInfoView = require './file-info-view'
CursorPositionView = require './cursor-position-view'
GrammarView = require './grammar-view'
GitView = require './git-view'
module.exports =
activate: ->
@statusBar = new StatusBarView()
@statusBar.attach()
@fileInfo =... | StatusBarView = require './status-bar-view'
FileInfoView = require './file-info-view'
CursorPositionView = require './cursor-position-view'
GitView = require './git-view'
module.exports =
activate: ->
@statusBar = new StatusBarView()
@statusBar.attach()
@fileInfo = new FileInfoView(@statusBar)
@stat... |
Remove Fetch from PushableCollection Create Event | class Backbone.PushableCollection extends Backbone.Collection
initialize: () ->
window.FayeClient.subscribe "/sync/#{@channel()}", _.bind(@receive, @)
receive: (message) ->
@[message.event] message.object
create: (attributes) ->
model = new @model attributes
model.fetch()
@add model
updat... | class Backbone.PushableCollection extends Backbone.Collection
initialize: () ->
window.FayeClient.subscribe "/sync/#{@channel()}", _.bind(@receive, @)
receive: (message) ->
@[message.event] message.object
create: (attributes) ->
model = new @model attributes
@add model
update: (attributes) ->... |
Add button interactive event proxying. | ###*
# @overview Registers the custom button tag.
#
# @module stout-ui/button
###
defaults = require 'lodash/defaults'
Button = require './Button'
ButtonView = require './ButtonView'
parser = require 'stout-client/parser'
# Read the button custom HTML tag.
TAG_NAME = vars.readPrefixed 'button/button-tag'
# ... | ###*
# @overview Registers the custom button tag.
#
# @module stout-ui/button
###
defaults = require 'lodash/defaults'
Button = require './Button'
ButtonView = require './ButtonView'
parser = require 'stout-client/parser'
# Read the button custom HTML tag.
TAG_NAME = vars.readPrefixed 'button/button-tag'
# ... |
Remove unneeded param defaults from activate methods | module.exports =
treeView: null
activate: (@state={}) ->
@createView() if @state.attached
rootView.command 'tree-view:toggle', => @createView().toggle()
rootView.command 'tree-view:reveal-active-file', => @createView().revealActiveFile()
deactivate: ->
@treeView?.deactivate()
@treeView = nul... | module.exports =
treeView: null
activate: (@state) ->
@createView() if @state.attached
rootView.command 'tree-view:toggle', => @createView().toggle()
rootView.command 'tree-view:reveal-active-file', => @createView().revealActiveFile()
deactivate: ->
@treeView?.deactivate()
@treeView = null
... |
Add method for optionally-fatal deprecation warnings | # NoFlo - Flow-Based Programming for JavaScript
# (c) 2014-2015 TheGrid (Rituwall Inc.)
# NoFlo may be freely distributed under the MIT license
#
# Platform detection method
exports.isBrowser = ->
if typeof process isnt 'undefined' and process.execPath and process.execPath.match /node|iojs/
return fal... | # NoFlo - Flow-Based Programming for JavaScript
# (c) 2014-2015 TheGrid (Rituwall Inc.)
# NoFlo may be freely distributed under the MIT license
#
# Platform detection method
exports.isBrowser = ->
if typeof process isnt 'undefined' and process.execPath and process.execPath.match /node|iojs/
return fal... |
Use relative path for leaflet-override | #= require jquery/dist/jquery
#= require jquery-deparam/jquery-deparam
#= require jquery.transit/jquery.transit
#= require slow-ajax
#= require bootstrap/dist/js/bootstrap
#= require highstock-release/highstock
#= require highstock-release/modules/exporting
#= require leaflet/dist/leaflet
#= require leaflet-override
#=... | #= require jquery/dist/jquery
#= require jquery-deparam/jquery-deparam
#= require jquery.transit/jquery.transit
#= require slow-ajax
#= require bootstrap/dist/js/bootstrap
#= require highstock-release/highstock
#= require highstock-release/modules/exporting
#= require leaflet/dist/leaflet
#= require ./leaflet-override
... |
Expand on hack for valid hash fields | _ = require 'underscore'
Q = require 'q'
Backbone = require 'backbone'
{ API_URL } = require('sharify').data
Relations = require './mixins/relations/collector_profile.coffee'
module.exports = class CollectorProfile extends Backbone.Model
_.extend @prototype, Relations
url: "#{API_URL}/api/v1/me/collector_profile"... | _ = require 'underscore'
Q = require 'q'
Backbone = require 'backbone'
{ API_URL } = require('sharify').data
Relations = require './mixins/relations/collector_profile.coffee'
module.exports = class CollectorProfile extends Backbone.Model
_.extend @prototype, Relations
url: "#{API_URL}/api/v1/me/collector_profile"... |
Change parameters by which shows are selected | _ = require 'underscore'
{ Cities, FeaturedCities } = require 'places'
PartnerShows = require '../../../../collections/partner_shows.coffee'
RelatedShowsView = require './view.coffee'
module.exports = (type, show) ->
city = _.findWhere(Cities, name: show.formatCity())
el = $('.js-related-shows')
criteria =
... | _ = require 'underscore'
{ Cities, FeaturedCities } = require 'places'
PartnerShows = require '../../../../collections/partner_shows.coffee'
RelatedShowsView = require './view.coffee'
module.exports = (type, show) ->
city = _.findWhere(Cities, name: show.formatCity())
el = $('.js-related-shows')
criteria =
... |
Change height and width calculations to just use Viewport Width and Height | {div} = React.DOM
module.exports = React.createClass
displayName: 'Modal'
watchForEscape: (e) ->
if e.keyCode is 27
@props.close?()
# shadow the entire viewport behind the dialog
getDimensions: ->
width: $(window).width() + 'px'
height: $(window).height() + 'px'
getInitialState: ->
... | {div} = React.DOM
module.exports = React.createClass
displayName: 'Modal'
watchForEscape: (e) ->
if e.keyCode is 27
@props.close?()
# shadow the entire viewport behind the dialog
getDimensions: ->
width: '100vw'
height: '100vh'
getInitialState: ->
dimensions = @getDimensions()
i... |
Make the indicator selector only show indicators with data | window.Backbone ||= {}
window.Backbone.Views ||= {}
class Backbone.Views.IndicatorSelectorView extends Backbone.Diorama.NestingView
template: Handlebars.templates['indicator_selector.hbs']
className: 'modal indicator-selector'
events:
"click .close": "close"
initialize: (options = {}) ->
@currentIndi... | window.Backbone ||= {}
window.Backbone.Views ||= {}
class Backbone.Views.IndicatorSelectorView extends Backbone.Diorama.NestingView
template: Handlebars.templates['indicator_selector.hbs']
className: 'modal indicator-selector'
events:
"click .close": "close"
initialize: (options = {}) ->
@currentIndi... |
Fix response loading twice on fill_out start | {div} = React.DOM
@FeedView = React.createClass
displayName: 'FeedView'
componentWillMount: ->
Screensmart.store.dispatch Screensmart.Actions.updateResponse()
render: ->
div
className: 'feed'
@props.children.map (child) ->
div
key: child.key
className: 'item'
... | {div} = React.DOM
@FeedView = React.createClass
displayName: 'FeedView'
render: ->
div
className: 'feed'
@props.children.map (child) ->
div
key: child.key
className: 'item'
child
|
Use Collapse component vs own logic | class Lanes.Components.FieldSet extends Lanes.React.Component
getDefaultProps: ->
speed: 0.4
propTypes:
title: React.PropTypes.string.isRequired
speed: React.PropTypes.number
collapsed: React.PropTypes.bool
getInitialState: ->
state = {
expanded: !@prop... | class Lanes.Components.FieldSet extends Lanes.React.Component
getDefaultProps: ->
expanded: true
propTypes:
title: React.PropTypes.string.isRequired
expanded: React.PropTypes.bool
getInitialState: ->
expanded: @props.expanded
componentWillReceiveProps: (nextProps) ->
... |
Fix broken plugin since highlight-selected update | module.exports = ->
highlightSelectedPackage = atom.packages.getLoadedPackage('highlight-selected')
highlightSelected = require (highlightSelectedPackage.path)
HighlightedAreaView = require (highlightSelectedPackage.path + '/lib/highlighted-area-view')
class FakeEditor
constructor: (@minimap) ->
getA... | module.exports = ->
highlightSelectedPackage = atom.packages.getLoadedPackage('highlight-selected')
highlightSelected = require (highlightSelectedPackage.path)
HighlightedAreaView = require (highlightSelectedPackage.path + '/lib/highlighted-area-view')
class FakeEditor
constructor: (@minimap) ->
getA... |
Allow cmd and ctrl clicks to open links in new tabs | _ = require 'underscore'
Backbone = require 'backbone'
router = new Backbone.Router
href = null
module.exports = ($el) ->
$el.on 'click', 'a[href]', onClick
# Make sure history is started to use our internal router
Backbone.history.start(pushState: true) unless Backbone.History.started
onClick = (e) ->
e.pre... | _ = require 'underscore'
Backbone = require 'backbone'
router = new Backbone.Router
href = null
module.exports = ($el) ->
$el.on 'click', 'a[href]', onClick
# Make sure history is started to use our internal router
Backbone.history.start(pushState: true) unless Backbone.History.started
onClick = (e) ->
retur... |
Implement minimap creation observer method for v4 | {CompositeDisposable} = require 'event-kit'
[Minimap, MinimapElement] = []
module.exports =
class V4Main
@includeInto: (base) ->
for k,v of @prototype
base::[k] = v
activateV4: ->
@editorsMinimaps = {}
@subscriptions = new CompositeDisposable
MinimapElement ?= require './minimap-element'
... | {CompositeDisposable} = require 'event-kit'
[Minimap, MinimapElement] = []
module.exports =
class V4Main
@includeInto: (base) ->
for k,v of @prototype
base::[k] = v
activateV4: ->
@editorsMinimaps = {}
@subscriptions = new CompositeDisposable
MinimapElement ?= require './minimap-element'
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.