Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Fix bad jquery selector for signup animation | $ ->
$('.devise-registrations-new .user_email input').blur ->
$input = $(@)
$sublogo = $input.parents('.login').find('.sub-logo')
email = $input.val()
if email.length > 0 and $input.data('last-email') != email
$sublogo.html ''
$.get "/company-from-email?email=#{email}", (data) ->
i... | $ ->
$('.registrations .user_email input').blur ->
$input = $(@)
$sublogo = $input.parents('.login').find('.sub-logo')
email = $input.val()
if email.length > 0 and $input.data('last-email') != email
$sublogo.html ''
$.get "/company-from-email?email=#{email}", (data) ->
if data.name... |
Fix bug in setting session variables | Router.map ->
@route "entrySignIn",
path: "/sign-in"
onBeforeRun: ->
Session.set('entryError', undefined)
Session.set('buttonText', 'in')
@route "entrySignUp",
path: "/sign-up"
onBeforeRun: ->
Session.set('entryError', undefined)
Session.set('buttonText', 'up')
@route "e... | Router.map ->
@route "entrySignIn",
path: "/sign-in"
before: ->
Session.set('entryError', undefined)
Session.set('buttonText', 'in')
@route "entrySignUp",
path: "/sign-up"
before: ->
Session.set('entryError', undefined)
Session.set('buttonText', 'up')
@route "entryForgot... |
Use root option to find config when using compiled JS | americano = require 'americano'
port = process.env.PORT || 9250
americano.start name: 'template', port: port | americano = require 'americano'
port = process.env.PORT || 9250
americano.start name: 'template', port: port, root: __dirname
|
Define verbs outside of method so that they're not initiliased for every request | _ = require('underscore')
module.exports = (req, res, next) ->
httpVerbWhitelist = ['GET']
return next() if process.env.NODE_ENV == 'test'
return next() if req.isAuthenticated() or _.contains(httpVerbWhitelist, req.method)
return res.send(401, 'Unauthorised')
| _ = require('underscore')
httpVerbWhitelist = ['GET']
module.exports = (req, res, next) ->
return next() if process.env.NODE_ENV == 'test'
return next() if req.isAuthenticated() or _.contains(httpVerbWhitelist, req.method)
return res.send(401, 'Unauthorised')
|
Remove .only from test suite | codio = require '../src/codio'
path = require 'path'
assert = require 'assert'
tmp = require 'tmp'
fs = require 'fs-extra'
describe.only 'versal codio', ->
cwd = null
before (done) ->
tmp.dir (err, tmp) ->
cwd = tmp
codio { cwd }, done
it 'creates .codio file', (done) ->
fs.exists path.join... | codio = require '../src/codio'
path = require 'path'
assert = require 'assert'
tmp = require 'tmp'
fs = require 'fs-extra'
describe 'versal codio', ->
cwd = null
before (done) ->
tmp.dir (err, tmp) ->
cwd = tmp
codio { cwd }, done
it 'creates .codio file', (done) ->
fs.exists path.join(cwd,... |
Initialize cache before activating first controller | ###
Top module for Rubic (for Chrome App)
###
# Compatibility modules
require("compat/es7compat")
require("compat/bbjscompat")
# UI helpers
require("ui/bootbox-promise")
# Load main controller
require("controller/windowcontroller") # Needed to solve circular dependency
$(->
# Controller must be initiated after ... | ###
Top module for Rubic (for Chrome App)
###
# Compatibility modules
require("compat/es7compat")
require("compat/bbjscompat")
# UI helpers
require("ui/bootbox-promise")
# Load main controller
require("controller/windowcontroller") # Needed to solve circular dependency
$(->
# Controller must be initiated after ... |
Call fs.list() without prior call to fs.exists() | Package = require 'package'
fs = require 'fs'
module.exports =
class AtomPackage extends Package
metadata: null
keymapsDirPath: null
constructor: (@name) ->
super
@keymapsDirPath = fs.join(@path, 'keymaps')
load: ->
try
if @requireModule
@module = require(@path)
@module.name... | Package = require 'package'
fs = require 'fs'
module.exports =
class AtomPackage extends Package
metadata: null
keymapsDirPath: null
constructor: (@name) ->
super
@keymapsDirPath = fs.join(@path, 'keymaps')
load: ->
try
if @requireModule
@module = require(@path)
@module.name... |
Move config defaults to top of exports | module.exports =
activate: ->
rootView.eachEditSession (editSession) => @whitespaceBeforeSave(editSession)
configDefaults:
ensureSingleTrailingNewline: true
whitespaceBeforeSave: (editSession) ->
buffer = editSession.buffer
buffer.on 'will-be-saved', ->
buffer.transact ->
buffer.sc... | module.exports =
configDefaults:
ensureSingleTrailingNewline: true
activate: ->
rootView.eachEditSession (editSession) => @whitespaceBeforeSave(editSession)
whitespaceBeforeSave: (editSession) ->
buffer = editSession.buffer
buffer.on 'will-be-saved', ->
buffer.transact ->
buffer.sc... |
Test de actualización de la barra del navegador. | require 'jquery.history.js'
require 'jquery.paginator.js'
describe "Paginator", ->
beforeEach ->
loadFixtures('paginator.html')
$('#list').ajaxPaginator()
describe 'clicking a link', ->
link = null
beforeEach ->
link = $('.pagination a:first')
link.click()
it "calls the link via ... | require 'jquery.history.js'
require 'jquery.paginator.js'
describe "Paginator", ->
beforeEach ->
loadFixtures('paginator.html')
$('#list').ajaxPaginator()
describe 'clicking a link', ->
link = null
beforeEach ->
link = $('.pagination a:first')
link.click()
it "calls the link via ... |
Clear listeners on process object when unloading. | EventEmitter = require('events').EventEmitter
ipc = process.atomBinding('ipc')
class Ipc extends EventEmitter
constructor: ->
process.on 'ATOM_INTERNAL_MESSAGE', (args...) =>
@emit(args...)
send: (args...) ->
ipc.send('ATOM_INTERNAL_MESSAGE', 'message', args...)
sendChannel: (args...) ->
ipc.... | EventEmitter = require('events').EventEmitter
ipc = process.atomBinding('ipc')
class Ipc extends EventEmitter
constructor: ->
process.on 'ATOM_INTERNAL_MESSAGE', (args...) =>
@emit(args...)
window.addEventListener 'unload', (event) ->
process.removeAllListeners 'ATOM_INTERNAL_MESSAGE'
send: (... |
Modify initializers to enable constructor parameters and add breadcrumbs | #= require_self
#= require_tree ./templates
#= require_tree ./models
#= require_tree ./views
#= require_tree ./routers
window.Water =
Models: {}
Collections: {}
Routers: {}
Views: {}
$ ->
window.tree_fetcher = new Water.TreeFetcher(repository_path: gon.repository_path, ref: gon.ref)
window.tcl = new Wat... | #= 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 ... |
Append to local html variable before scraping. | noflo = require "noflo"
jsdom = require "jsdom"
class ScrapeHtml extends noflo.Component
constructor: ->
@html = ""
@textSelector = ""
@crapSelectors = []
@inPorts =
in: new noflo.Port()
textSelector: new noflo.Port()
crapSelector: new noflo.Arra... | noflo = require "noflo"
jsdom = require "jsdom"
class ScrapeHtml extends noflo.Component
constructor: ->
@html = ""
@textSelector = ""
@crapSelectors = []
@inPorts =
in: new noflo.Port()
textSelector: new noflo.Port()
crapSelector: new noflo.Arra... |
Add python syntax highlighting to inline code chunks | 'name': 'Pweave markdown'
scopeName: 'source.pweave.md'
'fileTypes': [
'pmd'
'pmdw'
]
patterns: [
{
'include' : 'source.pweave.noweb'
}
{
'begin': '^([`~]{3,})(\\{|\\{\\.|)(python)(,|)\\s*(.*?)(\\}|)\\s*$'
'beginCaptures':
'1':
'name': 'markup.heading.weave.md'
'3':
... | 'name': 'Pweave markdown'
scopeName: 'source.pweave.md'
'fileTypes': [
'pmd'
'pmdw'
]
patterns: [
{
'include' : 'source.pweave.noweb'
}
{
'begin': '^([`~]{3,})(\\{|\\{\\.|)(python)(,|)\\s*(.*?)(\\}|)\\s*$'
'beginCaptures':
'1':
'name': 'markup.heading.weave.md'
'3':
... |
Fix Order-Of-Declaration Problems with Resolve Filter | angular.module 'qbn.engine', ['qbn.quality', 'qbn.storylet', 'qbn.choice']
.controller 'QbnEngine',
($scope, qualities, storylets, frontalChoices, choiceFactory, resolve) ->
$scope.qualities = qualities.getAll()
updateFrontalChoices = () ->
$scope.choices = frontalChoices.getAll()
re... | angular.module 'qbn.engine', ['qbn.quality', 'qbn.storylet', 'qbn.choice']
.filter 'resolve', ($injector, qualities) ->
(v) ->
while typeof v == 'function' || Array.isArray v
qualityNames = $injector.annotate v
qualityValues = qualityNames.map (name) -> qualities.lookup(name)?.value
... |
Fix enabling the input for the msg when inviting people to a space | $ ->
if isOnPage 'join_requests', 'invite'
# invite is selected by default
enableDisableMessage()
# enable/disable the message depending on the type selected
$('.type-options input[type=radio]').on 'change', ->
enableDisableMessage()
# input to search for users
id = '#candidates'
... | $ ->
if isOnPage 'join_requests', 'invite'
# invite is selected by default
enableDisableMessage()
# enable/disable the message depending on the type selected
$('.type-options input[type=radio]').on 'change', ->
enableDisableMessage()
# input to search for users
id = '#candidates'
... |
Use skinny arrows for command handlers | {CompositeDisposable, Disposable} = require 'atom'
_ = require 'underscore-plus'
AutocompleteView = require './autocomplete-view'
module.exports =
config:
includeCompletionsFromAllBuffers:
type: 'boolean'
default: false
autocompleteViewsByEditor: null
deactivationDisposables: null
activate: -... | {CompositeDisposable, Disposable} = require 'atom'
_ = require 'underscore-plus'
AutocompleteView = require './autocomplete-view'
module.exports =
config:
includeCompletionsFromAllBuffers:
type: 'boolean'
default: false
autocompleteViewsByEditor: null
deactivationDisposables: null
activate: -... |
Add dropup class in responsive toolbar. | Wheelmap.ToolbarView = Ember.View.extend
elementId: 'toolbar'
templateName: 'toolbar'
addToggleSearchbar: (()->
$searchbar = @$('.searchbar-form')
@$('.btn-toggle-searchbar').click ()->
$searchbar.toggleClass('active');
).on('didInsertElement')
categoryButton: (()->
activeCategories = @ge... | Wheelmap.ToolbarView = Ember.View.extend
elementId: 'toolbar'
templateName: 'toolbar'
init: ()->
@_super()
didInsertElement: ()->
$(window).on 'resize.toolbar', @adjustCategoryFilter
@adjustCategoryFilter()
didRemoveElement: ()->
$(window).off 'resize.toolbar'
adjustCategoryFilter: ()->
... |
Add missing key and refactor | ###
# Copyright 2015-2017 ppy Pty. Ltd.
#
# This file is part of osu!web. osu!web is distributed with the hope of
# attracting more community contributions to the core ecosystem of osu!.
#
# osu!web is free software: you can redistribute it and/or modify
# it under the terms of the Affero GNU General Pub... | ###
# Copyright 2015-2018 ppy Pty. Ltd.
#
# This file is part of osu!web. osu!web is distributed with the hope of
# attracting more community contributions to the core ecosystem of osu!.
#
# osu!web is free software: you can redistribute it and/or modify
# it under the terms of the Affero GNU General Pub... |
Expand args passed to 'trigger' in mock TitaniumView | class TitaniumView
constructor: (attributes) ->
for name, value of attributes
@[name] = value
@children = []
addEventListener: (name, event) ->
@on name, event
removeEventListener: (name, event) ->
@off name, event
fireEvent: (name, args...) ->
@trigger name, args
add: (view) ->... | class TitaniumView
constructor: (attributes) ->
for name, value of attributes
@[name] = value
@children = []
addEventListener: (name, event) ->
@on name, event
removeEventListener: (name, event) ->
@off name, event
fireEvent: (name, args...) ->
@trigger name, args...
add: (view)... |
Add custom console.log snippet to atom | # 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:
#... | # You can create a new snippet by typing "snip" and then hitting tab
'.source.js':
'console.log':
'prefix': 'log'
'body': 'console.log(${1:\'test\'})$2'
|
Use page up/down to navigate | api = require './slide-pack-api'
mousetrap = require 'mousetrap'
$ = require 'zeptojs'
# keyboard navigation
mousetrap.bind ['left', 'up', 'k', 'h'], api.prev
mousetrap.bind ['right', 'down', 'j', 'l'], api.next
# mouse/touch navigation
nav = $('<nav><a>←</a><a>→</a></nav>')
$('body').append nav
$(document).on 'cli... | api = require './slide-pack-api'
mousetrap = require 'mousetrap'
$ = require 'zeptojs'
# keyboard navigation
mousetrap.bind ['left', 'up', 'k', 'h', 'pageup'], api.prev
mousetrap.bind ['right', 'down', 'j', 'l', 'pagedown'], api.next
# mouse/touch navigation
nav = $('<nav><a>←</a><a>→</a></nav>')
$('body').append na... |
Add required User-Agent header to GitHub requests | request = require "request"
githubAuth = require "../../auth/github"
class GitHub
fetchGist: (gistID, callback) ->
request.get(
url: "https://api.github.com/gists/#{gistID}" +
"?client_id=#{githubAuth.clientID}" +
"&client_secret=#{githubAuth.clientSecret}"
json: true
, (e... | request = require "request"
githubAuth = require "../../auth/github"
class GitHub
fetchGist: (gistID, callback) ->
request.get(
url: "https://api.github.com/gists/#{gistID}" +
"?client_id=#{githubAuth.clientID}" +
"&client_secret=#{githubAuth.clientSecret}"
headers:
"U... |
Prepare for supporting MQTT, uncomment to enable | msgflo = require 'msgflo'
path = require 'path'
chai = require 'chai' unless chai
heterogenous = require '../node_modules/msgflo/spec/heterogenous.coffee'
python = process.env.PYTHON or 'python'
participants =
'PythonRepeat': [python, path.join __dirname, '..', 'examples', 'repeat.py']
describe 'Participants', ->
... | msgflo = require 'msgflo'
path = require 'path'
chai = require 'chai' unless chai
heterogenous = require '../node_modules/msgflo/spec/heterogenous.coffee'
python = process.env.PYTHON or 'python'
participants =
'PythonRepeat': [python, path.join __dirname, '..', 'examples', 'repeat.py']
# Note: most require running ... |
Allow options on start, and add quit | {readFile} = require 'fs'
{dirname} = require 'path'
{parseProcfile} = require './procfile'
{createFormation} = require './formation'
class Server
constructor: (@procfile) ->
@cwd = dirname @procfile
spawn: (callback) ->
parseProcfile @procfile, (err, details) =>
return callback?(err) if err
... | {readFile} = require 'fs'
{dirname} = require 'path'
{parseProcfile} = require './procfile'
{createFormation} = require './formation'
class Server
constructor: (@procfile) ->
@cwd = dirname @procfile
spawn: (options = {}, callback = ->) ->
options.cwd ?= @cwd
options.output ?= process.stdout
... |
Drop parent teams on team delete | express = require 'express'
router = express.Router()
database = require '../routes/database'
item = require '../routes/item'
db = null
router.post '/new', (req, res, next) ->
req.body._id = database.getId()
db.insertOne(req.body).then () ->
res.redirect 'back'
router.post '/getData', (req, res, next) ->
db... | express = require 'express'
router = express.Router()
database = require '../routes/database'
item = require '../routes/item'
db = null
router.post '/new', (req, res, next) ->
req.body._id = database.getId()
db.insertOne(req.body).then () ->
res.redirect 'back'
router.post '/getData', (req, res, next) ->
db... |
Use commmon Fira Mono while Atom has ligatures issue | '*':
'editor':
'fontFamily': 'Fira Code'
'showIndentGuide': true
'tabLength': 4
'softWrap': true
'invisibles': {}
'zoomFontWhenCtrlScrolling': false
'core':
'disabledPackages': [
'language-objective-c'
'archive-view'
'autosave'
'bookmarks'
'language-clojure'... | '*':
'editor':
'fontFamily': 'Fira Mono OT'
'showIndentGuide': true
'tabLength': 4
'softWrap': true
'invisibles': {}
'zoomFontWhenCtrlScrolling': false
'core':
'disabledPackages': [
'language-objective-c'
'archive-view'
'autosave'
'bookmarks'
'language-cloju... |
Fix tab toggle on activity | class @Activities
constructor: ->
Pager.init 20, true
$(".event-filter .btn").bind "click", (event) =>
event.preventDefault()
@toggleFilter($(event.currentTarget))
@reloadActivities()
reloadActivities: ->
$(".content_list").html ''
Pager.init 20, true
toggleFilter: (sender) ->... | class @Activities
constructor: ->
Pager.init 20, true
$(".event-filter .btn").bind "click", (event) =>
event.preventDefault()
@toggleFilter($(event.currentTarget))
@reloadActivities()
reloadActivities: ->
$(".content_list").html ''
Pager.init 20, true
toggleFilter: (sender) ->... |
Use the new workspace API. | {View} = require 'space-pen'
{GitNotFoundError} = require '../git-bridge'
class GitNotFoundErrorView extends View
@content: (err) ->
@div class: 'overlay from-top padded merge-conflict-error merge-conflicts-message', =>
@div class: 'panel', =>
@div class: "panel-heading", =>
@code 'git'
... | {View} = require 'space-pen'
{GitNotFoundError} = require '../git-bridge'
class GitNotFoundErrorView extends View
@content: (err) ->
@div class: 'overlay from-top padded merge-conflict-error merge-conflicts-message', =>
@div class: 'panel', =>
@div class: "panel-heading", =>
@code 'git'
... |
Make the JustifiedGallery script work with Turbolinks 5. | $ ->
$(".photos").justifiedGallery rowHeight: 200, margins: 8
| $(document).on 'turbolinks:load', ->
$(".photos").justifiedGallery rowHeight: 200, margins: 8
|
Add display name to default admin user | storage = require 'node-persist'
storage.initSync()
User = require './user'
users = (storage.getItem('users') or []).map (u) -> new User u
chalk = require 'chalk'
bcrypt = require 'bcrypt-nodejs'
_ = require 'lodash'
exp =
getUser: (username, password, cb) ->
if !cb and password
cb = password
passwor... | storage = require 'node-persist'
storage.initSync()
User = require './user'
users = (storage.getItem('users') or []).map (u) -> new User u
chalk = require 'chalk'
bcrypt = require 'bcrypt-nodejs'
_ = require 'lodash'
exp =
getUser: (username, password, cb) ->
if !cb and password
cb = password
passwor... |
Fix typo in confirm dialog title | Flow.ConfirmDialog = (_, _message, _opts={}, _go) ->
defaults _opts,
title: 'Alert'
acceptCaption: 'Yes'
declineCaption: 'No'
accept = -> _go yes
decline = -> _go no
title: _opts.title
acceptCaption: _opts.acceptCaption
declineCaption: _opts.declineCaption
message: Flow.Util.multilineTextTo... | Flow.ConfirmDialog = (_, _message, _opts={}, _go) ->
defaults _opts,
title: 'Confirm'
acceptCaption: 'Yes'
declineCaption: 'No'
accept = -> _go yes
decline = -> _go no
title: _opts.title
acceptCaption: _opts.acceptCaption
declineCaption: _opts.declineCaption
message: Flow.Util.multilineText... |
Implement base fetch and listing flow. | kd = require 'kd'
KDView = kd.View
KDListItemView = kd.ListItemView
KDCustomHTMLView = kd.CustomHTMLView
KDListViewController = kd.ListViewController
module.exports = class TeamMembersCommonView extends KDView
constructor: (options = {}, data) ->
options.noItemFoundWi... | kd = require 'kd'
KDView = kd.View
MemberItemView = require './memberitemview'
KDListItemView = kd.ListItemView
KDCustomHTMLView = kd.CustomHTMLView
KDListViewController = kd.ListViewController
module.exports = class TeamMembersCommonView extends KDView
constructor: ... |
Fix range of color from variable expression | ColorScanner = require '../color-scanner'
ColorContext = require '../color-context'
registry = require '../color-expressions'
{namePrefixes} = require '../regexes'
ColorsChunkSize = 100
class BufferColorsScanner
constructor: (config) ->
{@buffer, variables} = config
@context = new ColorContext(variables)
... | ColorScanner = require '../color-scanner'
ColorContext = require '../color-context'
registry = require '../color-expressions'
{namePrefixes} = require '../regexes'
ColorsChunkSize = 100
class BufferColorsScanner
constructor: (config) ->
{@buffer, variables} = config
@context = new ColorContext(variables)
... |
Use git-utils from status handler | Git = require 'git'
fs = require 'fs'
module.exports =
loadStatuses: (path) ->
repo = Git.open(path)
if repo?
workingDirectoryPath = repo.getWorkingDirectory()
statuses = {}
for path, status of repo.getRepo().getStatuses()
statuses[fs.join(workingDirectoryPath, path)] = status
... | Git = nodeRequire 'git-utils'
fs = require 'fs'
module.exports =
loadStatuses: (path) ->
repo = Git.open(path)
if repo?
workingDirectoryPath = repo.getWorkingDirectory()
statuses = {}
for path, status of repo.getStatuses()
statuses[fs.join(workingDirectoryPath, path)] = status
... |
Fix 'Invalid property value' for trix toolbar default CSS | {cloneFragment} = Trix
Trix.registerElement "trix-toolbar",
defaultCSS: """
%t {
white-space: collapse;
}
%t .dialog {
display: none;
}
%t .dialog.active {
display: block;
}
%t .dialog input.validate:invalid {
background-color: #ffdddd;
}
%t[native] {
... | {cloneFragment} = Trix
Trix.registerElement "trix-toolbar",
defaultCSS: """
%t {
white-space: nowrap;
}
%t .dialog {
display: none;
}
%t .dialog.active {
display: block;
}
%t .dialog input.validate:invalid {
background-color: #ffdddd;
}
%t[native] {
... |
Fix spec for ignoring numbers over 1000 | exports.Calculator = class Calculator
add: (input) ->
result = 0
[delimiter, trimmedInput] = this.getDelimiter input
numberStrings = trimmedInput.split delimiter
negatives = []
for numberString in numberStrings
num = parseInt numberString
negatives.push num if num && num < 0
resu... | exports.Calculator = class Calculator
add: (input) ->
result = 0
[delimiter, trimmedInput] = this.getDelimiter input
numberStrings = trimmedInput.split delimiter
negatives = []
for numberString in numberStrings
num = parseInt numberString
negatives.push num if num && num < 0
resu... |
Configure the BASE_PATH for WYMEditor globally | #= require wymeditor/jquery.wymeditor.js
#= require_self
$ ->
$(':input.wymeditor').wymeditor
basePath: '/assets/wymeditor/'
updateSelector: 'form:has(:input.wymeditor)'
updateEvent: 'submit'
| #= require wymeditor/jquery.wymeditor.js
#= require_self
WYMeditor.BASE_PATH = '/assets/wymeditor/'
$ ->
$(':input.wymeditor').wymeditor
updateSelector: 'form:has(:input.wymeditor)'
updateEvent: 'submit'
|
Add some comments for app.Storage. | goog.provide 'app.Storage'
goog.require 'este.labs.storage.Base'
class app.Storage extends este.labs.storage.Base
###*
@param {app.songs.Store} songsStore
@constructor
@extends {este.labs.storage.Base}
###
constructor: (@songsStore) ->
###*
@override
###
load: (route, routes) ->
swit... | goog.provide 'app.Storage'
goog.require 'este.labs.storage.Base'
class app.Storage extends este.labs.storage.Base
###*
@param {app.songs.Store} songsStore
@constructor
@extends {este.labs.storage.Base}
###
constructor: (@songsStore) ->
@stores = [@songsStore]
@fetchStores()
@listenStore... |
Fix star loading with turbolinks | # Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
$.fn.stars = ->
$(this).each ->
# Get the value
val = parseFloat($(this).html())
val = Math.rou... | # Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
$.fn.stars = ->
$(this).each ->
# Get the value
val = parseFloat($(this).html())
val = Math.rou... |
Attach an identifier to requests | noflo = require "noflo"
http = require "connect"
class Server extends noflo.Component
description: "This component receives a port and host, and initializes a HTTP server for that combination. It sends out a request/response pair for each HTTP request it receives"
constructor: ->
@server = null
... | noflo = require "noflo"
http = require "connect"
uuid = require "node-uuid"
class Server extends noflo.Component
description: "This component receives a port and host, and initializes a HTTP server for that combination. It sends out a request/response pair for each HTTP request it receives"
constructor: ->
... |
Fix "Accept" header test for Zepto 1.1.6 | each frameworks, (framework) ->
module "#{framework} - Accept",
setup: ->
setupFrame this, "/#{framework}.html"
asyncTest "default accept header prefers scripts", ->
@$.ajax
type: 'POST'
url: "/echo"
success: (env) =>
if typeof env is 'string'
env = JSON.parse env
... | each frameworks, (framework) ->
module "#{framework} - Accept",
setup: ->
setupFrame this, "/#{framework}.html"
asyncTest "default accept header prefers scripts", ->
@$.ajax
type: 'POST'
url: "/echo"
success: (env) =>
if typeof env is 'string'
env = JSON.parse env
... |
Fix a test failure caused by non-existing default directory in test environment | {WorkspaceView} = require 'atom'
NotationalVelocity = require '../lib/notational-velocity'
# Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
#
# To run a specific `it` or `describe` block add an `f` to the front (e.g. `fit`
# or `fdescribe`). Remove the `f` to unfocus the block.
describe "No... | {WorkspaceView} = require 'atom'
NotationalVelocity = require '../lib/notational-velocity'
# Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
#
# To run a specific `it` or `describe` block add an `f` to the front (e.g. `fit`
# or `fdescribe`). Remove the `f` to unfocus the block.
describe "No... |
Add autocomplete-emojis package to Atom | packages: [
"editorconfig"
"file-icons"
"highlight-selected"
"language-docker"
"language-typescript-grammars-only"
"linter"
"linter-coffeelint"
"linter-csslint"
"linter-docker"
"linter-flake8"
"linter-htmlhint"
"linter-js-yaml"
"linter-jshint"
"linter-jsonlint"
"linter-less"
"linter-php"... | packages: [
"autocomplete-emojis"
"editorconfig"
"file-icons"
"highlight-selected"
"language-docker"
"language-typescript-grammars-only"
"linter"
"linter-coffeelint"
"linter-csslint"
"linter-docker"
"linter-flake8"
"linter-htmlhint"
"linter-js-yaml"
"linter-jshint"
"linter-jsonlint"
"lin... |
Adjust limit to take max. | _ = require('underscore')._
CONS = require '../lib/constants'
Q = require 'q'
class Categories
constructor: ->
@id2index = {}
@name2id = {}
@fqName2id = {}
@duplicateNames = []
getAll: (rest) ->
deferred = Q.defer()
rest.GET "/categories?limit=1000", (error, response, body) ->
if er... | _ = require('underscore')._
CONS = require '../lib/constants'
Q = require 'q'
class Categories
constructor: ->
@id2index = {}
@name2id = {}
@fqName2id = {}
@duplicateNames = []
getAll: (rest) ->
deferred = Q.defer()
rest.GET "/categories?limit=0", (error, response, body) ->
if error... |
Update Csound message callback functions | {Emitter} = require 'atom'
module.exports =
class MessageManager
constructor: (csound, Csound) ->
@emitter = new Emitter
messageCallback = (Csound, attributes, string) =>
@emitter.emit 'did-receive-message', {string: string, attributes: attributes}
csound.SetDefaultMessageCallback messageCallback
... | {Emitter} = require 'atom'
module.exports =
class MessageManager
constructor: (csound, Csound) ->
@emitter = new Emitter
messageCallback = (attributes, string) =>
@emitter.emit 'did-receive-message', {string: string, attributes: attributes}
csound.SetDefaultMessageCallback messageCallback
csou... |
Implement Categories, clean up old code | Transformations["Checkmark"] = (object) -> Transformations.static(Checkmarks.Checkmark, object)
Checkmarks = Collections["Checkmark"] = new Mongo.Collection("Checkmarks", {transform: if Meteor.isClient then Transformations.Checkmark else null})
class Checkmarks.Checkmark
constructor: (doc) ->
_.extend(@, doc)
C... | Transformations["Checkmark"] = (object) -> Transformations.static(Checkmarks.Checkmark, object)
Checkmarks = Collections["Checkmark"] = new Mongo.Collection("Checkmarks", {transform: if Meteor.isClient then Transformations.Checkmark else null})
class Checkmarks.Checkmark
constructor: (doc) ->
_.extend(@, doc)
C... |
Use default label value if present | class Lanes.Components.Input extends Lanes.React.Component
mixins: [
Lanes.Components.Form.FieldMixin
]
formGroupClass: 'input'
getDefaultProps: ->
type: 'text'
propTypes:
unlabled: React.PropTypes.bool
getValue: ->
@refs.input.getValue()
handleKeyDown: ... | class Lanes.Components.Input extends Lanes.React.Component
mixins: [
Lanes.Components.Form.FieldMixin
]
formGroupClass: 'input'
getDefaultProps: ->
type: 'text'
propTypes:
unlabled: React.PropTypes.bool
getValue: ->
@refs.input.getValue()
handleKeyDown: ... |
Add project for OPCA docs and code | []
| [
{
title: "OPCUA-All"
paths: [
"/Users/randy/src/github/node-opcua"
"/Users/randy/Documents/Projects/OPCUA/WSDL-1.03"
]
}
]
|
Add index for phone numbers and byCount aggregation | mongoose = require '../connection'
Schema = mongoose.Schema
ObjectId = Schema.ObjectId
MessageSchema = new Schema(
Name: String
Subject: String
Message: String
Date: Date
Phone: String
Country: String
Attachments: String
)
Message = mongoose.model('Message', MessageSchema)
module.exports = Message
| mongoose = require '../connection'
Schema = mongoose.Schema
ObjectId = Schema.ObjectId
MessageSchema = new Schema(
Name: String
Subject: String
Message: String
Date: Date
Phone: String
Country: String
Attachments: String
)
MessageSchema.statics.byCount = (cb) ->
this.aggregate [
{
... |
Switch to explicit call instead of inside the loop | module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON "package.json"
sass:
dist:
files:
"{{ app_name }}/static/{{ app_name }}/css/app.css": "{{ app_name }}/static/{{ app_name }}/sass/app.sass"
options:
style: "compressed"
watch:
css:
... | module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON "package.json"
sass:
dist:
files:
"{{ app_name }}/static/{{ app_name }}/css/app.css": "{{ app_name }}/static/{{ app_name }}/sass/app.sass"
options:
style: "compressed"
watch:
css:
... |
Fix Grunt Jade task configuration | module.exports = (grunt, options) ->
return {
options:
client: true
files:
'<%= build %>/js/templates.js': ['views/templates/**/*.jade']
dev:
options:
data:
debug: true
dist:
options:
data:
debug: false
}
| module.exports = (grunt, options) ->
return {
options:
client: true
dev:
files:
'<%= build %>/js/templates.js': ['views/templates/**/*.jade']
options:
data:
debug: true
dist:
files:
'<%= build %>/js/templates.js': ['views/templates/**/*.jade']
... |
Increase timeout for thumbnail test | fs = require 'fs'
expect = require 'expect.js'
config = require '../../../test/test_config'
models = require('../lib/schema').load(config)
common = require '../../../test/common'
describe "Dotstorm Canvas to image from idea", ->
before (done) ->
@mahId = undefined
common.startUp (serv... | fs = require 'fs'
expect = require 'expect.js'
config = require '../../../test/test_config'
models = require('../lib/schema').load(config)
common = require '../../../test/common'
describe "Dotstorm Canvas to image from idea", ->
this.timeout(10000)
before (done) ->
@mahId = undefined
... |
Fix IE 9/10 host_ready event | setTimeout ->
if /^(interactive|complete)$/.test(document.readyState)
FactlinkJailRoot.host_ready_promise.resolve()
else
document.addEventListener('DOMContentLoaded', -> FactlinkJailRoot.host_ready_promise.resolve())
if 'complete' == document.readyState
FactlinkJailRoot.host_loaded_promise.resolve()... | setTimeout ->
ok =
loaded: true
interactive: !(document.documentMode < 11)
complete: true
if ok[document.readyState]
FactlinkJailRoot.host_ready_promise.resolve()
else
document.addEventListener('DOMContentLoaded', -> FactlinkJailRoot.host_ready_promise.resolve())
if 'complete' == document... |
Remove disabledPackages that no longer exist | 'global':
'core':
'themes': [
'inbox-light-ui'
]
'disabledPackages': [
"atom-dark-syntax",
"atom-dark-ui",
"atom-light-syntax",
"atom-light-ui",
"one-dark-syntax",
"one-dark-ui",
"one-light-syntax",
"one-light-ui",
"base16-tomorrow-dark-theme",
... | 'global':
'core':
'themes': [
'inbox-light-ui'
]
'disabledPackages': [
"sidebar-fullcontact",
"message-templates",
"calendar-bar",
"salesforce"
]
|
Remove advertize if data only enabled | init = ->
primary_lang = $("#catalog_primary_language")
other_lang_boxes = \
$("input[type=checkbox][name='catalog[other_languages][]']")
update_boxes = (evt)->
primary_value = primary_lang.val()
other_lang_boxes.attr("disabled", false)
match_box = $("input[type=checkbox][value=#{primary_value}]"... | init = ->
primary_lang = $("#catalog_primary_language")
other_lang_boxes = \
$("input[type=checkbox][name='catalog[other_languages][]']")
update_boxes = (evt)->
primary_value = primary_lang.val()
other_lang_boxes.attr("disabled", false)
match_box = $("input[type=checkbox][value=#{primary_value}]"... |
Enable keyboard interaction with 'More...' toggle | define (require) ->
$ = require('jquery')
linksHelper = require('cs!helpers/links')
BaseView = require('cs!helpers/backbone/views/base')
template = require('hbs!./filter-template')
require('less!./filter')
return class SearchResultsFilterView extends BaseView
template: template
templateHelpers:
... | define (require) ->
$ = require('jquery')
linksHelper = require('cs!helpers/links')
BaseView = require('cs!helpers/backbone/views/base')
template = require('hbs!./filter-template')
require('less!./filter')
return class SearchResultsFilterView extends BaseView
template: template
templateHelpers:
... |
Hide header and footer when song page is shown. | goog.provide 'app.react.Layout'
class app.react.Layout
###*
PATTERN(steida): Here we can choose mobile/tablet/desktop layout.
@param {app.Routes} routes
@param {app.react.Header} header
@param {app.react.Footer} footer
@constructor
###
constructor: (routes, header, footer) ->
{div} = Re... | goog.provide 'app.react.Layout'
class app.react.Layout
###*
PATTERN(steida): Layout is responsible for mobile/tablet/desktop look.
@param {app.Routes} routes
@param {app.react.Header} header
@param {app.react.Footer} footer
@param {app.react.pages.Song} song
@constructor
###
constructor:... |
Use buttons data-actions in NumberFieldUpdater component | class NumberFieldUpdater
@hideReadOnly: (id) ->
toggleReadOnly(id, false)
resetInput(id)
@showReadOnly: (id) ->
toggleReadOnly(id, true)
@showForm: (id) ->
toggleForm(id, true)
@hideForm: (id) ->
toggleForm(id, false)
@successHandler: (id, newNumber) ->
$("#number-update-#{id} span... | class NumberFieldUpdater
@hideReadOnly: (id) ->
toggleReadOnly(id, false)
resetInput(id)
@showReadOnly: (id) ->
toggleReadOnly(id, true)
@showForm: (id) ->
toggleForm(id, true)
@hideForm: (id) ->
toggleForm(id, false)
@successHandler: (id, newNumber) ->
$("#number-update-#{id} span... |
Allow routes to load without trailing slash | class Workbench.Routers.WorkbenchRouter extends Backbone.Router
initialize: (options) ->
@sensor = options.sensor
@navigate(@sensor.id)
routes:
'': 'index'
':id/': 'show'
index: ->
console.log "loading index route"
# render index view
show: (id) ->
console.log "loading show route"... | class Workbench.Routers.WorkbenchRouter extends Backbone.Router
initialize: (options) ->
@sensor = options.sensor
@navigate(@sensor.id)
routes:
'': 'index'
':id(/)': 'show'
index: ->
console.log "loading index route"
# render index view
show: (id) ->
console.log "loading show rout... |
Use region manager for sensors views | class Workbench.Controllers.SensorsController extends Backbone.Marionette.Controller
initialize: (options) ->
@$el = options.el
@getApiKey()
Workbench.source = new Geocens.DataService({ api_key: @apiKey })
# Ensure the API Key is displayed in the URL params.
addApiKeyParam: (base) ->
# if (locati... | class Workbench.Controllers.SensorsController extends Backbone.Marionette.Controller
initialize: (options) ->
@getApiKey()
Workbench.source = new Geocens.DataService({ api_key: @apiKey })
# Check params for API Key.
getApiKey: ->
if (location.search.length > 0)
params = deparam(location.search.... |
Validate compatible frames for all selected models prior to displaying frame selection dialog. PP-71 PP-82 | Steam.ModelSelectionView = (_) ->
_selections = nodes$ []
_hasSelection = lift$ _selections, (selections) -> selections.length > 0
_caption = lift$ _selections, (selections) ->
"#{describeCount selections.length, 'model'} selected."
scoreSelections = ->
_.promptForFrame (action, frameKey) ->
swit... | defaultScoringSelectionMessage = 'Score selected models.'
Steam.ModelSelectionView = (_) ->
_selections = nodes$ []
_hasSelection = lift$ _selections, (selections) -> selections.length > 0
_caption = lift$ _selections, (selections) ->
"#{describeCount selections.length, 'model'} selected."
_compatibleFrame... |
Fix for_value and for_ordinal in JS | #= require jiffy_enum
#= require_self
class window.JiffyEnums
constructor: (@hash) ->
# equavalent to [] in ruby
get: (key) =>
@hash[key]
each: (func) =>
_.each(@hash, func)
all: (func) =>
_.values(@hash)
for_value: (value) =>
_.each( all(), (_enum) ->
return _enum if value == _en... | #= require jiffy_enum
#= require_self
class window.JiffyEnums
constructor: (@hash) ->
# equavalent to [] in ruby
get: (key) =>
@hash[key]
each: (func) =>
_.each(@hash, func)
all: (func) =>
_.values(@hash)
for_value: (value) =>
_.find( all(), (_enum) ->
value == _enum.value
)
... |
Add licence and usage guide | class @StickyHeader
stickMarker: document.getElementsByClassName('js-sticky-header')
constructor: ->
$(window).on 'scroll', @stickOrUnstick
$(document).on 'ready page:load osu:page:change', @stickOrUnstick
stickOrUnstick: =>
return if @stickMarker.length == 0
for marker in @stickMarker by -1
... | ###
# Copyright 2015 ppy Pty. Ltd.
#
# This file is part of osu!web. osu!web is distributed with the hope of
# attracting more community contributions to the core ecosystem of osu!.
#
# osu!web is free software: you can redistribute it and/or modify
# it under the terms of the Affero GNU General Public License as publi... |
Define error reponses for unimplemented endpoints | _ = require 'underscore'
pkg = require '../package.json'
module.exports = (app) ->
# homepage
app.get '/', (req, res, next) ->
res.json _.omit pkg, 'devDependencies'
# retrieve a link to the generated pdf
app.post '/api/pdf/url', (req, res, next) ->
# - generate pdf
# - respond with JSON containi... | _ = require 'underscore'
pkg = require '../package.json'
module.exports = (app) ->
# homepage
app.get '/', (req, res, next) ->
res.json _.omit pkg, 'devDependencies'
# generate and render pdf in the browser
app.get '/api/pdf/:token', (req, res, next) ->
res.send 501,
message: 'Endpoint not impl... |
Change from Yahoo to DuckDuckGo | $ ->
DIC_URL_PREFIX = 'http://alldic.daum.net/search.do?dic=eng&q='
IMAGES_URL_PREFIX = 'http://images.search.yahoo.com/search/images?p='
$input = $('input')
$button = $('button')
$dicIframe = $('iframe.dic')
$imagesIframe = $('iframe.images')
search = ->
query = $input.val()
return if query is ''... | $ ->
DIC_URL_PREFIX = 'http://alldic.daum.net/search.do?dic=eng&q='
IMAGES_URL_PREFIX = 'https://duckduckgo.com/?%3Fiax=1&iax=1&ia=images&q='
$input = $('input')
$button = $('button')
$dicIframe = $('iframe.dic')
$imagesIframe = $('iframe.images')
search = ->
query = $input.val()
return if query i... |
Fix InStateMenu not positioning correctly. | define [
'phaser'
'underscore'
'app/helpers'
], (Phaser, _, Helpers) ->
'use strict'
{Keyboard} = Phaser
class InStateMenu
constructor: (@textItems, game, options = {}) ->
{@pauseHandler, @layout, @toggleKeyCode} = _.defaults options,
layout: { y: 120, baseline: 40 }
pauseHandl... | define [
'phaser'
'underscore'
'app/helpers'
], (Phaser, _, Helpers) ->
'use strict'
{Keyboard} = Phaser
class InStateMenu
constructor: (@textItems, game, options = {}) ->
{@pauseHandler, @layout, @toggleKeyCode} = _.defaults options,
layout: { y: 120, baseline: 40 }
pauseHandl... |
Add default message if none defined in config | Slack = require('slack-client')
require('events').EventEmitter
config = require('../../../config.json').slack;
class SlackIntegration
constructor: (opts)->
{
@token
} = opts
@slack = new Slack(@token, true, true)
@slack.login()
@slack_channels = []
@config_channels = config.channels
... | Slack = require('slack-client')
require('events').EventEmitter
config = require('../../../config.json').slack;
class SlackIntegration
DEFAULT_MESSAGE = "#{player} is playing #{game}. Go join them!"
constructor: (opts)->
{
@token
} = opts
@slack = new Slack(@token, true, true)
@slack.login()... |
Add `tiles` array and `newTile` function | # tael.js
# Copyright (c) 2015 Carter Hinsley
# MIT License
module.exports = ->
($ document).ready ->
($ '.tael-container')
.append(
($ '<div>')
.addClass 'tael-node-leaf'
.text 'Hello, world!'
)
| # tael.js
# Copyright (c) 2015 Carter Hinsley
# MIT License
tiles = [{
type: 'container'
}]
newTile = (parent) ->
# Add a new tile to the `tiles` array.
pushTile = ->
# Push a new tile to the `tiles` array and return its index.
(
tiles.push
type: 'leaf'
... |
Make test projects diff more | helper =
settingsPath: "#{__dirname}/projects.test.cson"
savedProjects: null
readFile: (callback) ->
callback(helper.projects)
writeFile: (projects, callback) ->
helper.projects = projects
callback?()
projects:
testproject1:
title: "Test project 1"
group: "Test"
paths: [
... | helper =
settingsPath: "#{__dirname}/projects.test.cson"
savedProjects: null
readFile: (callback) ->
callback(helper.projects)
writeFile: (projects, callback) ->
helper.projects = projects
callback?()
projects:
testproject1:
title: "Test project 1"
group: "Test"
paths: [
... |
Add "build:once" task without webserver and watcher | gulp = require 'gulp'
sequence = require 'gulp-run-sequence'
require('./clean') gulp
require('./coffee') gulp
require('./jade') gulp
require('./scss') gulp
require('./vendor') gulp
require('./watch') gulp
require('./webserver') gulp
require('./specs') gulp
module.exports = (gulp) ->
gulp.task 'build', ->
... | gulp = require 'gulp'
sequence = require 'gulp-run-sequence'
require('./clean') gulp
require('./coffee') gulp
require('./jade') gulp
require('./scss') gulp
require('./vendor') gulp
require('./watch') gulp
require('./webserver') gulp
require('./specs') gulp
module.exports = (gulp) ->
gulp.task 'build', ->
... |
Add getQuestions method to Form class | if Meteor.isServer
Parse = require 'parse/node'
else
Parse = require 'parse'
exports.Survey = Parse.Object.extend 'Survey',
getForms: (returnMeteorCollection, collection) ->
query = @relation('forms').query()
query.find().then (forms) ->
if returnMeteorCollection and forms
formCollection = ... | if Meteor.isServer
Parse = require 'parse/node'
else
Parse = require 'parse'
exports.Survey = Parse.Object.extend 'Survey',
getForms: (returnMeteorCollection, collection) ->
query = @relation('forms').query()
query.find().then (forms) ->
if returnMeteorCollection and forms
formCollection = ... |
Use the slack way of sending message | # Description:
# Find the build status of an open-source project on Travis
# Can also notify about builds, just enable the webhook notification on travis http://about.travis-ci.org/docs/user/build-configuration/ -> 'Webhook notification'
#
# Dependencies:
#
# Configuration:
# None
#
# Commands:
# hubot travis m... | # Description:
# Find the build status of an open-source project on Travis
# Can also notify about builds, just enable the webhook notification on travis http://about.travis-ci.org/docs/user/build-configuration/ -> 'Webhook notification'
#
# Dependencies:
#
# Configuration:
# None
#
# Commands:
# hubot travis m... |
Test that updateWindowSheetOffset can be called | TitleBar = require '../src/title-bar'
describe "TitleBar", ->
it 'updates the title based on document.title when the active pane item changes', ->
titleBar = new TitleBar({
workspace: atom.workspace,
themes: atom.themes,
applicationDelegate: atom.applicationDelegate,
})
expect(titleBar... | TitleBar = require '../src/title-bar'
describe "TitleBar", ->
it "updates the title based on document.title when the active pane item changes", ->
titleBar = new TitleBar({
workspace: atom.workspace,
themes: atom.themes,
applicationDelegate: atom.applicationDelegate,
})
expect(titleBar... |
Use a string to specify adapter | App.Store = DS.Store.extend
revision: 11
adapter: App.Adapter.create()
| App.Store = DS.Store.extend
revision: 11
adapter: 'App.Adapter'
|
Hide if there is no machine. | SidebarMachineList = require './sidebarmachinelist'
module.exports = class SidebarSharedMachinesList extends SidebarMachineList
constructor: (options = {}, data) ->
options.title = 'Shared VMs'
options.hasPlusIcon = no
options.cssClass = 'shared-machines'
{ shared, collaboration } = data... | SidebarMachineList = require './sidebarmachinelist'
kd = require 'kd'
module.exports = class SidebarSharedMachinesList extends SidebarMachineList
constructor: (options = {}, data) ->
options.title = 'Shared VMs'
options.hasPlusIcon = no
options.cssClass = 'shared-machines'
{ shared, coll... |
Fix plugin broken by latest 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... |
Remove chai-as-promised; it isn’t working properly. | module.exports = ->
chai = require 'chai'
chai.use require 'chai-as-promised'
@World.prototype.expect = chai.expect
| module.exports = ->
chai = require 'chai'
@World.prototype.expect = chai.expect
|
Fix for slow loading images | $(document).ready ->
# Photo grid
photoGrid = $(".photo-grid")
photoGrid.imagesLoaded ->
photoGrid.trigger "reload:grid"
$(window).resize ->
photoGrid.trigger "reload:grid"
photoGrid.on "reload:grid", ->
opts = wookmarkOptions(calculateGridWidth())
photoGrid.find(".photo, .user-block").wookm... | $(document).ready ->
# Photo grid
photoGrid = $(".photo-grid")
photoGrid.imagesLoaded ->
photoGrid.trigger "reload:grid"
$(window).resize ->
photoGrid.trigger "reload:grid"
photoGrid.on "reload:grid", ->
opts = wookmarkOptions(calculateGridWidth())
photoGrid.find(".photo, .user-block").wookm... |
Convert to and from underlying query in CwbSimpleInput | ###* @jsx React.DOM ###
window.CwbSimpleInput = React.createClass
getInitialState: ->
searchText: ''
displayedQuery: ->
''
handleTextChange: (e) ->
console.log('text')
@setState(searchText: e.target.value)
handleSearch: (e) ->
console.log('search')
render: ->
`<div className="row-... | ###* @jsx React.DOM ###
window.CwbSimpleInput = React.createClass
propTypes:
query: React.PropTypes.string.isRequired
handleQueryChanged: React.PropTypes.func.isRequired
displayedQuery: ->
# Take the CQP expression and just remove quotes
@props.query.replace(/"/g, '')
handleTextChange: (e) ->
... |
Use BufferedProcess instead of BufferedNodeProcess | {$$, BufferedNodeProcess} = require 'atom'
module.exports =
activate: ->
atom.workspaceView.command 'update-package-dependencies:update', => @update()
update: ->
view = @createProgressView()
atom.workspaceView.append(view)
command = atom.packages.getApmPath()
args = ['install']
options = ... | {$$, BufferedProcess} = require 'atom'
module.exports =
activate: ->
atom.workspaceView.command 'update-package-dependencies:update', => @update()
update: ->
view = @createProgressView()
atom.workspaceView.append(view)
command = atom.packages.getApmPath()
args = ['install']
options = {cwd... |
Connect to broker before registering | program = require 'commander'
msgflo_nodejs = require 'msgflo-nodejs'
fs = require 'fs'
path = require 'path'
foreigner = require '../foreign-participant'
yaml = require 'js-yaml'
onError = (err) ->
console.log err
process.exit 1
onComplete = ->
process.exit 0
main = ->
program
.option('--broker <uri>', ... | program = require 'commander'
msgflo_nodejs = require 'msgflo-nodejs'
fs = require 'fs'
path = require 'path'
foreigner = require '../foreign-participant'
yaml = require 'js-yaml'
onError = (err) ->
console.log err
process.exit 1
onComplete = ->
process.exit 0
main = ->
program
.option('--broker <uri>', ... |
Make constructors for all HTML5 elements. | make_element = (name, v) ->
e = $ "<#{name}>"
e.append v
for n in ["label", "div", "span", "button", "img", "figure", "figcaption",
"h1", "h2", "h3",
"table", "thead", "tfoot", "tbody", "tr", "th", "td",
"form", "select", "option"]
@[n] = do (n) -> (v) -> make_element n, v
| make_element = (name, v) ->
e = $ "<#{name}>"
e.append v
# Make HTML element constructors of the same names as the elements.
for n in [# Root element
"html",
# Document metadata
"head", "title", "base", "link", "meta", "style",
# Scripting
"script", "noscript", "te... |
Update Google Analytics script to reflect location of the user | $(document).on 'page:change', ->
if window._gaq?
_gaq.push ['_trackPageview']
else if window.pageTracker?
pageTracker._trackPageview() | if window.history?.pushState and window.history.replaceState
document.addEventListener 'page:change', (event) =>
# Google Analytics
if window.ga != undefined
ga('set', 'location', location.href.split('#')[0])
ga('send', 'pageview', {"title": document.title})
else if window._gaq != undefined
... |
Add javascript Ising Model as project | [
{
title: "CDS-411 Instructors"
group: "CDS-411"
paths: [
"~/Courses/CDS-411/instructors"
]
}
{
title: "Spyns"
group: "Development"
paths: [
"~/Development/spyns"
]
}
{
title: "CSI-702 Spr17: Homework02 Instructor Attempt"
group: "CSI-702"
paths: [
... | [
{
title: "CDS-411 Instructors"
group: "CDS-411"
paths: [
"~/Courses/CDS-411/instructors"
]
}
{
title: "Spyns"
group: "Development"
paths: [
"~/Development/spyns"
]
}
{
title: "CSI-702 Spr17: Homework02 Instructor Attempt"
group: "CSI-702"
paths: [
... |
Break logic out into a CheckBox component | class Lanes.Components.Grid.Selections
id: 'selected'
query: false
textAlign: 'center'
fixedWidth: 90
defaultClicked: true
constructor: (options) ->
@onChange = options.onChange
@choices = {}
_.bindAll(@, 'onColumnClick')
@render = _.partial(@render, _, @)
on... | class CheckBox extends Lanes.React.BaseComponent
d: -> @props.query.results.xtraData(@props.row)
onChange: (ev) -> #, me, results, index) ->
@d().selected = ev.target.checked
@props.selections.onChange?(@props)
@forceUpdate()
render: ->
selected = @d().selected
sele... |
Add update method using PUT to resource factory | 'use strict'
apiResource = ($resource, resource, args) ->
$resource "/api/#{resource}/:id"
, # Default arguments
args
, # Override methods
query:
method: 'GET'
isArray: false
angular.module('taarifaWaterpointsApp')
.factory 'Waterpoint', ($resource) ->
apiResource $resource, 'waterpoin... | 'use strict'
apiResource = ($resource, resource, args) ->
$resource "/api/#{resource}/:id"
, # Default arguments
args
, # Override methods
query:
method: 'GET'
isArray: false
update:
method: 'PUT'
angular.module('taarifaWaterpointsApp')
.factory 'Waterpoint', ($resource) ->
a... |
Update fields that are shown | class Skr.Components.CustomerProjectFinder extends Lanes.React.Component
propTypes:
onModelSet: React.PropTypes.func
commands: React.PropTypes.object
autoFocus: React.PropTypes.bool
name: React.PropTypes.string
selectField: React.PropTypes.bool
getDefaultProp... | class Skr.Components.CustomerProjectFinder extends Lanes.React.Component
propTypes:
onModelSet: React.PropTypes.func
commands: React.PropTypes.object
autoFocus: React.PropTypes.bool
name: React.PropTypes.string
selectField: React.PropTypes.bool
getDefaultProp... |
Put introduction text into editor when ready. | BaseStackEditorView = require './basestackeditorview'
module.exports = class StackTemplateEditorView extends BaseStackEditorView
constructor: (options = {}, data) ->
unless options.content
options.content = require '../defaulttemplate'
super options, data
| BaseStackEditorView = require './basestackeditorview'
module.exports = class StackTemplateEditorView extends BaseStackEditorView
constructor: (options = {}, data) ->
unless options.content
options.content = require '../defaulttemplate'
super options, data
@on 'EditorReady', =>
return i... |
Fix issue where not all arguments would be pushed to GA | define (require) ->
Backbone = require('backbone')
settings = require('settings')
# Class to handle loading analytics scripts and wrapping
# handlers around them so that modules don't have to
# interact with global variables directly
return new class AnalyticsHandler
constructor: () ->
# Setup te... | define (require) ->
Backbone = require('backbone')
settings = require('settings')
# Class to handle loading analytics scripts and wrapping
# handlers around them so that modules don't have to
# interact with global variables directly
return new class AnalyticsHandler
constructor: () ->
# Setup te... |
Update base controller to use new beforeLoad api | class Controller
_redirecting: false
constructor: (@request, @response, view, layout) ->
View = Import 'class.View$cs'
@view = new View view, @response
@view.setLayout layout
beforeLoad: ->
beforeRender: ->
redirect: (args...) ->
if args.length is 2
@response.redirect args[0], args[1]
else
@re... | class Controller
_redirecting: false
constructor: (@request, @response, view, layout) ->
View = Import 'class.View$cs'
@view = new View view, @response
@view.setLayout layout
beforeAction: ->
beforeRender: ->
redirect: (args...) ->
if args.length is 2
@response.redirect args[0], args[1]
else
@... |
Handle toggling quoted invalid regions | toggleQuotes = (editor) ->
editor.transact ->
for cursor in editor.getCursors()
position = cursor.getBufferPosition()
toggleQuoteAtPosition(editor, position)
cursor.setBufferPosition(position)
toggleQuoteAtPosition = (editor, position) ->
range = editor.displayBuffer.bufferRangeForScopeAtPosi... | toggleQuotes = (editor) ->
editor.transact ->
for cursor in editor.getCursors()
position = cursor.getBufferPosition()
toggleQuoteAtPosition(editor, position)
cursor.setBufferPosition(position)
toggleQuoteAtPosition = (editor, position) ->
range = editor.displayBuffer.bufferRangeForScopeAtPosi... |
Delete only files which are generated at least 60 seconds ago. | {File} = require 'file-utils'
fs = require 'fs'
class LocaleTempFileRepository
items : null
constructor : (@items = {}) ->
setInterval (=> @gc()), 60000
gc : ->
console.log 'LocaleTempFileRepository.gc'
now = new Date()
validUntil = now - 60
for id, item of @items #when item.created < vali... | {File} = require 'file-utils'
fs = require 'fs'
class LocaleTempFileRepository
items : null
constructor : (@items = {}) ->
setInterval (=> @gc()), 60000
gc : ->
console.log 'LocaleTempFileRepository.gc'
now = new Date()
validUntil = now - 60
for id, item of @items when item.created.getTime... |
Use default empty message when items exist | {$$, SelectListView} = require 'atom'
module.exports =
class DiffListView extends SelectListView
initialize: ->
super
@addClass('diff-list-view overlay from-top')
getEmptyMessage: ->
'No diffs'
getFilterKey: ->
'lineText'
attach: ->
@storeFocusedElement()
atom.workspaceView.appendToT... | {$$, SelectListView} = require 'atom'
module.exports =
class DiffListView extends SelectListView
initialize: ->
super
@addClass('diff-list-view overlay from-top')
getEmptyMessage: (itemCount) ->
if itemCount is 0
'No diffs in file'
else
super
getFilterKey: ->
'lineText'
attac... |
Fix render error of contest voting page | # 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 core from 'osu-core-singleton'
import { createElement } from 'react'
import { ArtEntryList } from './contest-voting/art-entry-list'
import... | # 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 core from 'osu-core-singleton'
import { createElement } from 'react'
import { ArtEntryList } from './contest-voting/art-entry-list'
import... |
Remove dangling references to conv IDs and bot name env options | module.exports = class Util
@log: console.log.bind console
@logError: console.error.bind console
@debug: (object) ->
if @isDebug()
@log object
@isDebug: -> process.env.HUBOT_FLEEP_DEBUG is 'true' or false
@parseOptions: ->
email : process.env.HUBOT_FLEEP_EMAIL
password : proce... | module.exports = class Util
@log: console.log.bind console
@logError: console.error.bind console
@debug: (object) ->
if @isDebug()
@log object
@isDebug: -> process.env.HUBOT_FLEEP_DEBUG is 'true'
@parseOptions: ->
email : process.env.HUBOT_FLEEP_EMAIL
password : process.env.HU... |
Add 0 load time for no-op ThemePackage::load | Q = require 'q'
Package = require './package'
module.exports =
class ThemePackage extends Package
getType: -> 'theme'
getStyleSheetPriority: -> 1
enable: ->
atom.config.unshiftAtKeyPath('core.themes', @name)
disable: ->
atom.config.removeAtKeyPath('core.themes', @name)
load: ->
this
activa... | Q = require 'q'
Package = require './package'
module.exports =
class ThemePackage extends Package
getType: -> 'theme'
getStyleSheetPriority: -> 1
enable: ->
atom.config.unshiftAtKeyPath('core.themes', @name)
disable: ->
atom.config.removeAtKeyPath('core.themes', @name)
load: ->
@loadTime = 0
... |
Fix open links for Android | Meteor.startup ->
return unless Meteor.isCordova
# Handle click events for all external URLs
$(document).on 'deviceready', ->
platform = device.platform.toLowerCase()
$(document).on 'click', (e) ->
$link = $(e.target).closest('a[href]')
return unless $link.length > 0
url = $link.attr('href')
if /^h... | Meteor.startup ->
return unless Meteor.isCordova
# Handle click events for all external URLs
$(document).on 'deviceready', ->
platform = device.platform.toLowerCase()
$(document).on 'click', (e) ->
$link = $(e.target).closest('a[href]')
return unless $link.length > 0
url = $link.attr('href')
if /^h... |
Revert "Prevent tour wizard button from disappearing" | define [
'app/views/base',
'app/tour'
],
(
base,
tour,
) ->
class TourStartButton extends base.SMItemView
className: 'feature-tour-start'
template: 'feature-tour-start'
events:
'click .close-button' : 'hideTour'
'click .prompt-button' : 'showTour'
... | define [
'app/views/base',
'app/tour'
],
(
base,
tour,
) ->
class TourStartButton extends base.SMItemView
className: 'feature-tour-start'
template: 'feature-tour-start'
events:
'click .close-button' : 'hideTour'
'click .prompt-button' : 'showTour'
... |
Remove the marker views when hideResults | _ = require 'underscore'
{View} = require 'space-pen'
Selection = require 'selection'
MarkerView = require './marker-view'
SearchResultsModel = require './search-results-model'
# Will be one of these created per editor.
module.exports =
class SearchResultsView extends View
@content: ->
@div class: 'search-resul... | _ = require 'underscore'
{View} = require 'space-pen'
Selection = require 'selection'
MarkerView = require './marker-view'
SearchResultsModel = require './search-results-model'
# Will be one of these created per editor.
module.exports =
class SearchResultsView extends View
@content: ->
@div class: 'search-resul... |
Update flag selection on value input | ---
---
pow2 = (exp) ->
base = 1
base *= 2 while exp-- > 0
base
recalculate = ->
val = 0
for el in document.querySelectorAll '.flag-list input'
val += pow2 el.getAttribute 'value' if el.checked
document.getElementById('flag').value = val
return
document.addEventListener 'DOMContentLoaded', ->
for el in d... | ---
---
pow2 = (exp) ->
base = 1
base *= 2 while exp-- > 0
base
parse = ->
flags = document.querySelectorAll('.flag-list input')
max = pow2 flags.length + 1
newValue = parseInt document.getElementById('flag').value, 10
if !newValue
return
for flag in [flags.length - 1..0]
pow = pow2 flag
if newValue >=... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.