Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Set FETCH AT ONCE to 10000
exports.MSGBYPAGE = 30 # safeDestroy parameters (to be tweaked) # loads 200 ids in memory at once exports.LIMIT_DESTROY = 200 # loads 30 messages in memory at once exports.LIMIT_UPDATE = 30 # send 5 request to the DS in parallel exports.CONCURRENT_DESTROY = 1 # number of IMAP & cozy UID&flags in memory when comparing ...
exports.MSGBYPAGE = 30 # safeDestroy parameters (to be tweaked) # loads 200 ids in memory at once exports.LIMIT_DESTROY = 200 # loads 30 messages in memory at once exports.LIMIT_UPDATE = 30 # send 5 request to the DS in parallel exports.CONCURRENT_DESTROY = 1 # number of IMAP & cozy UID&flags in memory when comparing ...
Add package "language-rust" for Rust support
# Copyright (c) 2017-present Arctic Ice Studio <development@arcticicestudio.com> # Copyright (c) 2017-present Sven Greb <code@svengreb.de> # Project: igloo # Repository: https://github.com/arcticicestudio/igloo # License: MIT # References: # https://github.com/lee-dohm/package-sync packages: [ "atom-beautif...
# Copyright (c) 2017-present Arctic Ice Studio <development@arcticicestudio.com> # Copyright (c) 2017-present Sven Greb <code@svengreb.de> # Project: igloo # Repository: https://github.com/arcticicestudio/igloo # License: MIT # References: # https://github.com/lee-dohm/package-sync packages: [ "atom-beautif...
Use PulsarJob.output instead of PulsarJob.stdout for monitoring deploy.
class DeployMonitor deploy = null chat = null monitorInterval = null monitorPeriodMs = 10000 deployHangTimeMs = 0 lastDeployStdout = null setDeploy: (deployJob, chatArg)-> deploy = deployJob chat = chatArg deploy.on('create', ()=> @.startMonitoring() ) deploy.on('close', ()=> ...
class DeployMonitor deploy = null chat = null monitorInterval = null monitorPeriodMs = 10000 deployHangTimeMs = 0 lastDeployOutput = null setDeploy: (deployJob, chatArg)-> deploy = deployJob chat = chatArg deploy.on('create', ()=> @.startMonitoring() ) deploy.on('close', ()=> ...
Check if legacy url is defined before creating link
define (require) -> $ = require('jquery') settings = require('settings') BaseView = require('cs!helpers/backbone/views/base') template = require('hbs!./header-template') require('less!./header') return class HeaderView extends BaseView template: template templateHelpers: () -> { page: @page ...
define (require) -> $ = require('jquery') settings = require('settings') BaseView = require('cs!helpers/backbone/views/base') template = require('hbs!./header-template') require('less!./header') return class HeaderView extends BaseView template: template templateHelpers: () -> { page: @page ...
Reset query on interface or output change
share.Queries.before.update (userId, query, fieldNames, modifier, options) -> if _.intersection(fieldNames, ["interface", "output", "startRecNum", "sortField", "sortReverse", "fields", "fieldsOrder"]).length modifier.$set = modifier.$set or {} modifier.$set.isOutputStale = true
share.Queries.before.update (userId, query, fieldNames, modifier, options) -> if _.intersection(fieldNames, ["interface", "output", "startRecNum", "sortField", "sortReverse", "fields", "fieldsOrder"]).length modifier.$set = modifier.$set or {} modifier.$set.isOutputStale = true if _.intersection(fieldNames,...
Replace letters with diactritics (e.g., ä ö ü É é) during geoentity filtering, so geoentities can be filtered using only english alphabet
Species.GeoEntityAutoCompleteLookup = Ember.Mixin.create geoEntityQuery: null autoCompleteRegions: null autoCompleteCountries: null selectedGeoEntities: [] selectedGeoEntitiesIds: [] geoEntityQueryObserver: ( -> re = new RegExp("(^|\\(| )"+@get('geoEntityQuery'),"i") @set 'autoCompleteCountries', @...
Species.GeoEntityAutoCompleteLookup = Ember.Mixin.create geoEntityQuery: null autoCompleteRegions: null autoCompleteCountries: null selectedGeoEntities: [] selectedGeoEntitiesIds: [] geoEntityQueryObserver: ( -> removeDiactritics = (string) -> string.normalize('NFD').replace(/[\u0300-\u036f]/g, ''); ...
Use pendingState as state is not updated instantly
window.ReactSigninPopover = React.createClass getInitialState: -> opened: false componentDidMount: -> window.currentUser.on 'change:username', @_onSignedInChange, @ componentWillUnmount: -> window.currentUser.off null, null, @ _onButtonClicked: (e) -> @setState opened: true _onSignedInChan...
window.ReactSigninPopover = React.createClass getInitialState: -> opened: false componentDidMount: -> window.currentUser.on 'change:username', @_onSignedInChange, @ componentWillUnmount: -> window.currentUser.off null, null, @ _onButtonClicked: (e) -> @setState opened: true _onSignedInChan...
Remove view when package is deactivated
_ = require 'underscore' module.exports = projectPaths: null fuzzyFinderView: null loadPathsTask: null activate: (state) -> rootView.command 'fuzzy-finder:toggle-file-finder', => @createView().toggleFileFinder() rootView.command 'fuzzy-finder:toggle-buffer-finder', => @createView().toggleB...
_ = require 'underscore' module.exports = projectPaths: null fuzzyFinderView: null loadPathsTask: null activate: (state) -> rootView.command 'fuzzy-finder:toggle-file-finder', => @createView().toggleFileFinder() rootView.command 'fuzzy-finder:toggle-buffer-finder', => @createView().toggleB...
Load certs from dir 'certs'
Meteor.methods log: -> console.log.apply console, arguments Meteor.startup -> Push.debug = true Push.Configure apn: passphrase: '***' keyData: Assets.getText 'PushRocketChatKey.pem' certData: Assets.getText 'PushRocketChatCert_development.pem' gateway: 'gateway.sandbox.push.apple.com' 'apn-dev': ...
Meteor.methods log: -> console.log.apply console, arguments Meteor.startup -> Push.debug = true Push.Configure apn: passphrase: '***' keyData: Assets.getText 'certs/PushRocketChatKey.pem' certData: Assets.getText 'certs/PushRocketChatCert_development.pem' gateway: 'gateway.sandbox.push.apple.com' ...
Allow setting `allowClear` and `closeOnSelect`
Menglifang.Widgets.Select2 = Ember.Select.extend classNames: ['mlf-select2'] placeholder: '请选择...' allowClear: true minimumInputLength: 0 maximumSelectionSize: 3 didInsertElement: -> @$().select2 placeholder: @get('placeholder') allowClear: @get('allowClear') minimumInputLength: @get...
Menglifang.Widgets.Select2 = Ember.Select.extend classNames: ['mlf-select2'] placeholder: '请选择...' allowClear: true closeOnSelect: true minimumInputLength: 0 maximumSelectionSize: 0 selectedDidChange: (-> @$().select2('val', @$().val()) ).observes('selection.@each') didInsertElement: -> Emb...
Simplify adding rows to sortable tables
App.TableSortable = getCellValue: (row, index) -> $(row).children("td").eq(index).text() comparer: (index) -> (a, b) -> valA = App.TableSortable.getCellValue(a, index) valB = App.TableSortable.getCellValue(b, index) return if $.isNumeric(valA) and $.isNumeric(valB) then valA - valB else v...
App.TableSortable = getCellValue: (row, index) -> $(row).children("td").eq(index).text() comparer: (index) -> (a, b) -> valA = App.TableSortable.getCellValue(a, index) valB = App.TableSortable.getCellValue(b, index) return if $.isNumeric(valA) and $.isNumeric(valB) then valA - valB else v...
Set dashboard to use toolsets
Manager = require 'modules/manager' tools = require 'config/toolset_config' ToolLoader = (dashboard, cb) -> project = dashboard.get('project') unless project and tools.projects.hasOwnProperty project project = 'default' Manager.set 'project', project # Set valid tools for later retrieval. # If projec...
Manager = require 'modules/manager' tools = require 'config/toolset_config' ToolLoader = (dashboard, cb) -> project = dashboard.get('project') unless project and tools.projects.hasOwnProperty project project = 'default' Manager.set 'project', project # Set valid tools for later retrieval. # If projec...
Add initial outline view specs
RootView = require 'root-view' OutlineView = require 'outline-view' describe "OutlineView", -> [rootView, outlineView] = [] beforeEach -> rootView = new RootView(require.resolve('fixtures/coffee.coffee')) rootView.activateExtension(OutlineView) outlineView = OutlineView.instance rootView.attachToD...
Add unit test for adding collaborator
setupEventStream = -> store = ETahi.__container__.lookup "store:main" es = ETahi.EventStream.create store: store init: -> [es, store] createDashboardDataWithLitePaper = (paperCount, litePaper) -> ef = ETahi.Factory litePapers = [] for i in [1..paperCount] by 1 lp = ef.createLitePape...
Add test for preflighted cors
class PreflightCorsTest extends Test constructor: -> super @display_name = "Preflight CORS" run: -> [a, b] = super @$http( method: "POST" url: "http://corstest-api.coshx.com:4000/tests/preflight_cors" headers: {"x-a": a, "x-b": b} ).success((data, status, headers, config) => ...
Add tests for AWSRequest deferred object
AWS = require('../../lib/core') describe 'AWS.AWSRequest', -> request = null response = null beforeEach -> response = new AWS.AWSResponse(service: null, method: 'POST', params: {}) request = new AWS.AWSRequest(response) sharedBehaviour = (cbMethod, notifyMethod) -> it 'can register callback', -> ...
Add script to change the admin account password
chalk = require 'chalk' users = require './users' bcrypt = require 'bcrypt-nodejs' if process.argv.length <= 2 console.log chalk.blue 'Use this script to change the admin password:' console.log chalk.red ' node pwchange.js [new password]' return newpw = process.argv.slice(2).join(" ") for user in users.getUsers(...
Add runtime.getManifest() stub to Chrome mock
# # Mock the Chrome extension API. # root = exports ? window root.chrome = { extension: { connect: -> { onMessage: { addListener: -> } postMessage: -> } onMessage: { addListener: -> } sendMessage: -> } }
# # Mock the Chrome extension API. # root = exports ? window root.chrome = { extension: { connect: -> { onMessage: { addListener: -> } postMessage: -> } onMessage: { addListener: -> } sendMessage: -> } runtime: { getManifest: -> } }
Add specs for normalizeKeystrokes helper
{normalizeKeystrokes} = require '../src/helpers' describe ".normalizeKeystrokes(keystrokes)", -> it "parses and normalizes the keystrokes", -> expect(normalizeKeystrokes('ctrl--')).toBe 'ctrl--' expect(normalizeKeystrokes('ctrl-x')).toBe 'ctrl-x' expect(normalizeKeystrokes('a')).toBe 'a' expect(norma...
Add auto select input component
`import Ember from 'ember'` AutoSelectInput = Ember.TextField.extend attributeBindings: ['readonly'] readonly: true mouseUp: -> @$().select() `export default AutoSelectInput`
Use pageX instead of clientX
class app.views.Resizer extends app.View @className: '_resizer' @events: dragstart: 'onDragStart' dragend: 'onDragEnd' drag: 'onDrag' @isSupported: -> 'ondragstart' of document.createElement('div') and !app.isMobile() init: -> @el.setAttribute('draggable', 'true') @appendTo $('._app')...
class app.views.Resizer extends app.View @className: '_resizer' @events: dragstart: 'onDragStart' dragend: 'onDragEnd' drag: 'onDrag' @isSupported: -> 'ondragstart' of document.createElement('div') and !app.isMobile() init: -> @el.setAttribute('draggable', 'true') @appendTo $('._app')...
Add test for client request
client = require 'nack/client' process = require 'nack/process' config = __dirname + "/fixtures/echo.ru" exports.testClientRequest = (test) -> test.expect 5 p = process.createProcess config p.on 'ready', () -> c = client.createConnection p.sock test.ok c request = c.request 'GET', '/foo', {} ...
Add trailing wildcard route for filter
express = require 'express' app = module.exports = express() to = require './to' app.get '/filter/artworks', to '/browse' app.get '/genes', to '/categories' app.get '/partner-application', to '/apply' app.get '/fair-application', to '/apply/fair' app.get '/fairs', to 'art-fairs' app.get '/settings', to '/user/edit' # ...
express = require 'express' app = module.exports = express() to = require './to' app.get '/filter/artworks', to '/browse' app.get '/filter/artworks/*', to '/browse' app.get '/genes', to '/categories' app.get '/partner-application', to '/apply' app.get '/fair-application', to '/apply/fair' app.get '/fairs', to 'art-fai...
Revert "spec: ffi is crashing on OS X"
assert = require 'assert' fs = require 'fs' path = require 'path' temp = require 'temp' describe 'third-party module', -> fixtures = path.join __dirname, 'fixtures' temp.track() # If the test is executed with the debug build on Windows, we will skip it # because native modules don't work with the debu...
assert = require 'assert' fs = require 'fs' path = require 'path' temp = require 'temp' describe 'third-party module', -> fixtures = path.join __dirname, 'fixtures' temp.track() # If the test is executed with the debug build on Windows, we will skip it # because native modules don't work with the debu...
Add test for Mist Hunter title.
common = require './common' common.setup() casper.test.begin "Mist Hunter equips Tractor Beam", (test) -> common.waitForStartup('#rebel-builder') common.openScumBuilder() common.addShip('#scum-builder', 'G-1A Starfighter', 'Zuckuss') .then -> test.assertDoesntExist "#scum-builder #{common.se...
Use .subscribe and .observeConfig in WrapGuide
{View} = require 'space-pen' module.exports = class WrapGuide extends View @activate: (rootView, state, config) -> requireStylesheet 'wrap-guide.css' for editor in rootView.getEditors() if rootView.parents('html').length @appendToEditorPane(rootView, editor, config) rootView.on 'editor-op...
{View} = require 'space-pen' module.exports = class WrapGuide extends View @activate: (rootView, state, config) -> requireStylesheet 'wrap-guide.css' for editor in rootView.getEditors() if rootView.parents('html').length @appendToEditorPane(rootView, editor, config) rootView.on 'editor-op...
Add NoFlo component to SCD detector
noflo = require 'noflo' temporary = require 'temporary' fs = require 'fs' path = require 'path' exec = require('child_process').exec # @runtime noflo-nodejs # @name SCDDetect compute = (canvas, cascade, callback) -> # Get canvas ctx = canvas.getContext '2d' imageData = ctx.getImageData 0, 0, canvas.width, canva...
Fix following profile on fair and shows feed for logged out users
_ = require 'underscore' Backbone = require 'backbone' Profile = require '../../models/profile.coffee' { Following, FollowButton } = require '../../components/follow_button/index.coffee' CurrentUser = require '../../models/current_user.coffee' ShowInquiryModal = require '../contact/show_inquiry_modal.coffee' module.ex...
_ = require 'underscore' Backbone = require 'backbone' Profile = require '../../models/profile.coffee' { Following, FollowButton } = require '../../components/follow_button/index.coffee' CurrentUser = require '../../models/current_user.coffee' ShowInquiryModal = require '../contact/show_inquiry_modal.coffee' module.ex...
Print error when mkdir failed
assert = require 'assert' fs = require 'fs' path = require 'path' temp = require 'temp' describe 'third-party module', -> fixtures = path.join __dirname, 'fixtures' temp.track() describe 'runas', -> it 'can be required in renderer', -> require 'runas' it 'can be required in node binary', ...
assert = require 'assert' fs = require 'fs' path = require 'path' temp = require 'temp' describe 'third-party module', -> fixtures = path.join __dirname, 'fixtures' temp.track() describe 'runas', -> it 'can be required in renderer', -> require 'runas' it 'can be required in node binary', ...
Fix lint errors in MenuManager
ipc = require 'ipc' # Public: Provides a registry for menu items that you'd like to appear in the # application menu. # # Should be accessed via `atom.menu`. module.exports = class MenuManager # Private: constructor: () -> @template = {} # Public: Refreshes the currently visible menu. update: -> @send...
ipc = require 'ipc' # Public: Provides a registry for menu items that you'd like to appear in the # application menu. # # Should be accessed via `atom.menu`. module.exports = class MenuManager # Private: constructor: -> @template = {} # Public: Refreshes the currently visible menu. update: -> @sendToB...
Make font-size larger than the default
# Your init script # # Atom will evaluate this file each time a new window is opened. It is run # after packages are loaded/activated and after the previous editor state # has been restored. # # An example hack to make opened Markdown files have larger text: # # path = require 'path' # # atom.workspaceView.eachEditorVi...
# Your init script # # Atom will evaluate this file each time a new window is opened. It is run # after packages are loaded/activated and after the previous editor state # has been restored. # # An example hack to make opened Markdown files have larger text: # # path = require 'path' # # atom.workspaceView.eachEditorVi...
Set up split test for nav bar
# Centralizes configuration for currently running split tests # # eg. # header_design: # key: 'header_design' # outcomes: # old: 8 # new: 2 # # Or, `outcomes` can be an array, when you specify `weighting: 'equal'. # weighting: 'equal' # outcomes: [ # 'old' # 'new' # ] # edge: 'new' # dimen...
# Centralizes configuration for currently running split tests # # eg. # header_design: # key: 'header_design' # outcomes: # old: 8 # new: 2 # # Or, `outcomes` can be an array, when you specify `weighting: 'equal'. # weighting: 'equal' # outcomes: [ # 'old' # 'new' # ] # edge: 'new' # dimen...
Add tests to validate command structures.
require "./test_helper.js" {Commands} = require "../../background_scripts/commands.js" context "Key mappings", should "lowercase keys correctly", -> assert.equal (Commands.normalizeKey '<c-a>'), '<c-a>' assert.equal (Commands.normalizeKey '<C-a>'), '<c-a>' assert.equal (Commands.normalizeKey '<C-A>'), '<...
require "./test_helper.js" {Commands} = require "../../background_scripts/commands.js" context "Key mappings", should "lowercase keys correctly", -> assert.equal (Commands.normalizeKey '<c-a>'), '<c-a>' assert.equal (Commands.normalizeKey '<C-a>'), '<c-a>' assert.equal (Commands.normalizeKey '<C-A>'), '<...
Add some basic test of Languages methods
{ getLanguage } = require '../src/languages' exports["CSS comment types"] = (test) -> lang = getLanguage('foo.css') test.equal lang.checkType(' /* ** FOO bar -- **'), 'multistart' test.equal lang.checkType(' ** FOO bar -- **/ '), 'multiend' test.equal lang.checkType('/** FOO bar -- **/ '), 'single', "Multi li...
Add array merging code (to be used with offline sync and task sorting conflicts)
# Merge Array Order with Timestamps ArrayDiff = (a, b) -> a.filter (i) -> not (b.indexOf(i) > -1) merge = (client, server) -> # client and server are objects with time and order # Find diff serverDiff = ArrayDiff server.order, client.order clientDiff = ArrayDiff client.order, server.order # Check if...
Fix off by one issue in pagination
Backbone = require 'backbone' template = -> require('./index.jade') arguments... module.exports = class PaginatorView extends Backbone.View maxPage: 100 pagesInterval: 2 events: 'click li a' : 'setPage' initialize: ({ @params, @filter }) -> throw new Error 'Requires a params model' unless @params? ...
Backbone = require 'backbone' template = -> require('./index.jade') arguments... module.exports = class PaginatorView extends Backbone.View maxPage: 100 pagesInterval: 2 events: 'click li a' : 'setPage' initialize: ({ @params, @filter }) -> throw new Error 'Requires a params model' unless @params? ...
Create script to load the payments views from payment engines
Neighborly.Projects = {} if Neighborly.Projects is undefined Neighborly.Projects.Backers = {} if Neighborly.Projects.Backers is undefined Neighborly.Projects.Backers.Create = init: Backbone.View.extend el: '.create-backer-page' initialize: -> @payment_view = new this.Payment() Payment: Backbone.V...
Create directive for scaling by a factor and then formatting as currency
angular.module("admin.lineItems").directive "scaleAsCurrency", ($filter) -> restrict: "A" require: 'ngModel' scope: factor: "&scaleAsCurrency" link: (scope, element, attrs, ngModel) -> ngModel.$formatters.push (value) -> $filter("currency")(value * scope.factor())
Create migration to update message urls
Meteor.startup -> Migrations.add version: 7 up: -> console.log 'Populate urls in messages' query = ChatMessage.find({ 'urls.0': { $exists: true }, urls: { $type: 2 } }) count = query.count() query.forEach (message, index) -> console.log "#{index + 1} / #{count}" message.urls = message.urls.ma...
Fix the incorrect default url for new instances.
if not RocketChat.models.OAuthApps.findOne('zapier') RocketChat.models.OAuthApps.insert _id: 'zapier' name: 'Zapier' active: true clientId: 'zapier' clientSecret: 'RTK6TlndaCIolhQhZ7_KHIGOKj41RnlaOq_o-7JKwLr' redirectUri: 'https://zapier.com/dashboard/auth/oauth/return/AppAPI/' _createdAt: new Date _cr...
if not RocketChat.models.OAuthApps.findOne('zapier') RocketChat.models.OAuthApps.insert _id: 'zapier' name: 'Zapier' active: true clientId: 'zapier' clientSecret: 'RTK6TlndaCIolhQhZ7_KHIGOKj41RnlaOq_o-7JKwLr' redirectUri: 'https://zapier.com/dashboard/auth/oauth/return/App32270API/' _createdAt: new Date ...
Add status mixin for listening to user changes
User = require './model' UserStatusMixin = { componentDidMount: -> User.channel.on("change", @onUserChange) componentWillUnmount: -> User.channel.off("change", @onUserChange) onUserChange: -> @forceUpdate() getUser: -> User } module.exports = UserStatusMixin
Add mozilla sink, in addition to sink.js
class MozillaSink constructor: (@name) -> @buffers = [] @inputs = { audio: null } @audio = null @samplingFrequency = 48000 @channels = 2 @currentWritePosition = 0 @prebufferSize = null @t...
Add ember auth patch for testing
Em.onLoad 'Ember.Application', (application) -> application.initializer name: "adapter-auth-injection" before: "ember-auth-load" initialize: (container, app) -> app.inject 'adapter', 'auth', 'auth:main' Em.Auth.EmberDataAuthModule.reopen patch: -> DS.RESTAdapter.reopen ajax: (url, type...
Add a new custom script for Arnie quotes
# Description: # Listens for words and sometimes replies with an Arnie quote # # Dependencies: # None # # Commands: # None # # Author: # Casey Lawrence <cjlaw@users.noreply.github.com> # odds = [1...100] arnie_quotes = [ 'GET TO THE CHOPPA!', 'Your clothes, give them to me, now!', 'Hasta La Vista...
Test to validate expansion list.
common = require './common' common.setup() casper.test.begin "Validate Expansions", (test) -> valid_expansions = [ "A-Wing Expansion Pack" "B-Wing Expansion Pack" "Core" "E-Wing Expansion Pack" "HWK-290 Expansion Pack" "Imperial Aces Expansion Pack" "Lambda-...
Extend new modal from ComputePlansModalFree
kd = require 'kd' KDView = kd.View CustomLinkView = require 'app/customlinkview' ComputePlansModalFree = require 'app/providers/computeplansmodalfree' module.exports = class LimitedVideoCollaborationFree extends ComputePlansModalFree viewAppended: -> @addSubView new K...
Fix undefined method errors in overlay manager
module.exports = class OverlayManager constructor: (@container) -> @overlayNodesById = {} render: (props) -> {presenter} = props for decorationId, {pixelPosition, item} of presenter.state.content.overlays @renderOverlay(presenter, decorationId, item, pixelPosition) for id, overlayNode of @o...
module.exports = class OverlayManager constructor: (@container) -> @overlayNodesById = {} render: (props) -> {presenter} = props for decorationId, {pixelPosition, item} of presenter.state.content.overlays @renderOverlay(presenter, decorationId, item, pixelPosition) for id, overlayNode of @o...
Add dummy data creation script
"use strict" ObjectID = require('mongodb').ObjectID Moniker = require('moniker') rand = (min, max) -> Math.floor (Math.random() * (max - min + 1) + min) lisence = [ "CC BY-NC-ND 3.0 NO" "CC BY-NC 3.0 NO" "CC BY-ND 3.0 NO" "CC BY 3.0 NO" ] provider = [ "DNT" "NRK" "TURAPP" ] module.exports = (num) -> ...
Add multi tab/window support for sessionStorage
### Multiple tabs session storage sync @see http://blog.guya.net/2015/06/12/sharing-sessionstorage-between-tabs-for-secure-multi-tab-authentication/ ### module.exports = (Module, App, Backbone, Marionette, $, _) -> # transfers sessionStorage from one tab to another sessionStorage_transfer = (event) -> if !ev...
Add language settings to insert proper XQuery comments and default indents.
'.source.xq': 'editor': 'commentStart': '(: ' 'commentEnd': ' :)' 'increaseIndentPattern': '[\\({]\\s*$|<[^>]+>\\s*$|(then|return)\\s*$|let.*:=\\s*$' 'decreaseIndentPattern': '^\\s*</[^>]+>'
Add cam parser node work.
sys = require 'sys' fs = require 'fs' xml2js = require 'xml2js' _ = require 'underscore' parser = new xml2js.Parser() parser.addListener 'end', (result) -> cams = [] _(result.Document.Folder.Placemark).each (placemark) -> coords = placemark.Point.coordinates.split ',' url = placemark.descripti...
Add back accidentally removed spec-matcher
define toBeOneOf: -> if arguments.indexOf return arguments.indexOf @actual for arg in arguments when @actual is arguments[i] return true return false toHaveBeenCalledOnce: -> if arguments.length > 0 throw new Error 'toHaveBeenCalledOnce does not take arguments, use toHaveBeenCa...
Add generic process function in Q utils
Q = require 'q' _ = require 'underscore' ###* * Collection of Q utils ### module.exports = ###* * Process each element in the given list using the function fn (called on each iteration). * The function fn has to return a promise that should be resolved when all elements of the page are processed. * @param...
Add GTT download script template (Thx! @hanachin)
# 2014/12/15 # Created by @hanachin_ (@hanachin on GitHub) # Copyright (C) MIT License 2014 # disable web security to download files casper = require('casper').create pageSettings: webSecurityEnabled: false # Google Translator Toolkit endpoints GOOGLE_TRANSLATOR_TOOLKIT_URL = 'http://translate.google.com/toolki...
Add forgotten file: util for sorting by name.
define -> FINNISH_ALPHABET = 'abcdefghijklmnopqrstuvwxyzåäö' # Thank you # http://stackoverflow.com/questions/3630645/how-to-compare-utf-8-strings-in-javascript/3633725#3633725 alpha = (direction, caseSensitive, alphabetOrder = FINNISH_ALPHABET) -> compareLetters = (a, b) -> [ia, i...
Add script to expire existing DocOps lists
Settings = require "settings-sharelatex" rclient = require("redis-sharelatex").createClient(Settings.redis.documentupdater) keys = Settings.redis.documentupdater.key_schema async = require "async" RedisManager = require "./app/js/RedisManager" getKeysFromNode = (node, pattern, callback) -> cursor = 0 # redis iterato...
Add hide key to config
poi: theme: "paperdark" layout: "horizonal" window: x: 60 y: 60 width: 1274 height: 616 webview: width: 800 proxy: use: "none" socks5: host: "127.0.0.1" port: 1080 http: host: "127.0.0.1" port: 8099 shadowsocks: server: host: "106.185.25.115" port: 270...
poi: theme: "paperdark" layout: "horizonal" window: x: 60 y: 60 width: 1274 height: 616 webview: width: 800 shortcut: bosskey: 'CmdOrCtrl+h' proxy: use: "none" socks5: host: "127.0.0.1" port: 1080 http: host: "127.0.0.1" port: 8099 shadowsocks: server: ...
Make the scan task actually work
{PathSearcher, PathScanner, search} = require 'scandal' module.exports = (rootPath, regexSource, options) -> callback = @async() searcher = new PathSearcher() scanner = new PathScanner(rootPath, rootPath) searcher.on 'results-found', (result) -> emit('scan:result-found', result) flags = "g" flags +=...
{PathSearcher, PathScanner, search} = require 'scandal' module.exports = (rootPath, regexSource, options) -> callback = @async() searcher = new PathSearcher() scanner = new PathScanner(rootPath, options) searcher.on 'results-found', (result) -> emit('scan:result-found', result) flags = "g" flags += ...
Fix the youtube regex to be more flexible
class Kandan.Plugins.YouTubeEmbed @youtube_regex: /^http(s)?:\/\/www.youtube.com\/watch/i @youtube_id_regex: /\Wv=([\w|\-]*)/ @youtube_embed_template: _.template ''' <div class="youtube-preview"> <a target="_blank" class="youtube-preview-link" href="<%= video_url %>"> <img class="youtube-previ...
class Kandan.Plugins.YouTubeEmbed @youtube_regex: /^http(s)?.+www.youtube.com.+watch/i @youtube_id_regex: /\Wv=([\w|\-]*)/ @youtube_embed_template: _.template ''' <div class="youtube-preview"> <a target="_blank" class="youtube-preview-link" href="<%= video_url %>"> <img class="youtube-preview-...
Add tests for string interpolation.
suite 'String Interpolation', -> # ---------- test 'interpolate one string variable', -> b = 'b' eq 'abc', "a#{b}c" test 'interpolate two string variables', -> b = 'b' c = 'c' eq 'abcd', "a#{b}#{c}d" test 'interpolate one numeric variable in the middle of the string', -> b = 0 eq 'a...
Save CollectorProfile (including hack around API bug)
StepView = require './step.coffee' Form = require '../../form/index.coffee' LocationSearch = require '../../location_search/index.coffee' template = -> require('../templates/basic_info.jade') arguments... module.exports = class BasicInfo extends StepView template: -> template arguments... __events__: 'click b...
StepView = require './step.coffee' Form = require '../../form/index.coffee' LocationSearch = require '../../location_search/index.coffee' template = -> require('../templates/basic_info.jade') arguments... module.exports = class BasicInfo extends StepView template: -> template arguments... __events__: 'click b...
Add tool to generate a square polygon
# Teaspoon includes some support files, but you can use anything from your own support path too. # require support/jasmine-jquery-1.7.0 # require support/jasmine-jquery-2.0.0 # require support/jasmine-jquery-2.1.0 # require support/sinon # require support/your-support-file # # PhantomJS (Teaspoons default driver) doesn...
Revert "Moved requestAnimationFrame to browserlib"
window.requestAnimationFrame ||= window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || (callback, element) -> window.setTimeout( -> callback(+new Date()) , 1000 / 60)
Sort user list by admin first, then by username
class Kandan.Plugins.UserList @widget_title: "People" @widget_icon_url: "/assets/people_icon.png" @pluginNamespace: "Kandan.Plugins.UserList" @template: _.template ''' <li class="user" title="<%= name %>"> <img class="avatar" src="<%= avatarUrl %>"/> <%- name %><% if(admin){ %> <span class="ba...
class Kandan.Plugins.UserList @widget_title: "People" @widget_icon_url: "/assets/people_icon.png" @pluginNamespace: "Kandan.Plugins.UserList" @template: _.template ''' <li class="user" title="<%= name %>"> <img class="avatar" src="<%= avatarUrl %>"/> <%- name %><% if(admin){ %> <span class="ba...
Add a listen script to respond to pivotal stories seen in the room.
# Listen for a specific story from PivotalTracker # # You need to set the following variables: # HUBOT_PIVOTAL_TOKEN = <API token> # # paste a pivotal tracker link or type "sid-####" in the presence of hubot module.exports = (robot) -> robot.hear /(sid-|SID-|pivotaltracker.com\/story\/show)/i, (msg) -> Parser ...
Make strip whitespace a valid extension
module.exports = activate: (rootView) -> for buffer in rootView.project.getBuffers() @stripTrailingWhitespaceBeforeSave(buffer) rootView.project.on 'new-buffer', (buffer) => @stripTrailingWhitespaceBeforeSave(buffer) stripTrailingWhitespaceBeforeSave: (buffer) -> buffer.on 'before-save', -...
module.exports = name: "strip trailing whitespace" activate: (rootView) -> for buffer in rootView.project.getBuffers() @stripTrailingWhitespaceBeforeSave(buffer) rootView.project.on 'new-buffer', (buffer) => @stripTrailingWhitespaceBeforeSave(buffer) stripTrailingWhitespaceBeforeSave: (buff...
Implement component to get a frame of a GIF
noflo = require 'noflo' gm = require 'gm' fileType = require 'file-type' readChunk = require 'read-chunk' temporary = require 'temporary' # @runtime noflo-nodejs # @name GetGIFFrame exports.getComponent = -> c = new noflo.Component c.icon = 'image' c.description = 'Extract a frame of a given GIF filepath' c....
Add a simple JS tests file for the linear interpolator.
{expect} = require "chai" utils = require "../../utils" {Collections} = utils.require "base" describe "linear_interpolator_transform module", -> source = {start: 0, end: 10} target = {start: 20, end: 80} generate_interpolator_ColumnDataSource = -> Collections("LinearInterpolator").create x: 'var1' ...
Add comment and indent settings
".source.csound, .source.csound-score": editor: commentStart: "; " ".source.csound": editor: increaseIndentPattern: "\\b(?:do|else(?:if)?|i(?:f|nstr)|opcode)\\b" decreaseIndentPattern: "\\b(?:end(?:i[fn]|op|until)|fi|od)\\b"
Add -H option to fix broken symbolic links error
class FSFolder extends FSFile fetchContents:(callback)-> # @emit "fs.fetchContents.started" # @kiteController.run # toDo : "ls" # withArgs : # command : @path # , (err, response)=> # if err # warn err # @emit "fs.fetchContents.finished", err # else ...
class FSFolder extends FSFile fetchContents:(callback)-> # @emit "fs.fetchContents.started" # @kiteController.run # toDo : "ls" # withArgs : # command : @path # , (err, response)=> # if err # warn err # @emit "fs.fetchContents.finished", err # else ...
Add missing paging support classes
# Support classes for the paging feature. {vlog} = require 'verbosity' {decSymbol} = require 'symbols' {clone} = require 'tc_util' PAGE_DEFAULT_SIZE = decSymbol 'PAGE_DEFAULT_SIZE', 32 * 1024 # This is the worker implementation, ie the class that performs the actual # reading and writing for a page. # New ...
Use random sort instead of relative size for filtered partners on /galleries and /institutions.
module.exports = """ query partners_results($includeAggregations: Boolean!, $includeResults: Boolean!, $near: String, $category: [String], $type: [PartnerClassification], $page: Int, $term: String) { category: filter_partners(eligible_for_listing:true, aggregations:[CATEGORY, TOTAL] size:0, near: $near, type: $...
module.exports = """ query partners_results($includeAggregations: Boolean!, $includeResults: Boolean!, $near: String, $category: [String], $type: [PartnerClassification], $page: Int, $term: String) { category: filter_partners(eligible_for_listing:true, aggregations:[CATEGORY, TOTAL] size:0, near: $near, type: $...
Add simple integration test for categories (create, update, delete)
_ = require 'underscore' Q = require 'q' SphereClient = require '../../lib/client' Config = require('../../config').config uniqueId = (prefix) -> _.uniqueId "#{prefix}#{new Date().getTime()}_" newCategory = -> name: en: 'Category name' slug: en: uniqueId 'c' updateCategory = (version, parentId) -> ve...
Remove unneeded requires, variables, commas, and parens
path = require 'path' fs = require 'fs-plus' {_} = require 'atom' ## Platform specific helpers module.exports = # Public: Returns true if being run from within Windows isWindows: -> !!process.platform.match /^win/ # Public: Some files can not exist on Windows filesystems, so we have to # selectively gene...
path = require 'path' fs = require 'fs-plus' ## Platform specific helpers module.exports = # Public: Returns true if being run from within Windows isWindows: -> !!process.platform.match /^win/ # Public: Some files can not exist on Windows filesystems, so we have to # selectively generate our fixtures. #...
Add directive for smooth scrolling to anchor
Darkswarm.directive "ofnSmoothScrollTo", ($location, $document)-> # Onclick sets $location.hash to attrs.ofnScrollTo # Then triggers $document.scrollTo restrict: 'A' link: (scope, element, attrs)-> element.bind 'click', (ev)-> ev.stopPropagation() $location.hash attrs.ofnScrollTo target = ...
Add tool to copy event schemas into snowplow repository.
fs = require 'fs-extra' path = require 'path' if process.argv.length <= 2 console.log "Usage: #{__filename} snowplow-schema-dir" process.exit -1 source = path.join __dirname, '..', 'app', 'schemas', 'events' target = process.argv[2] fs.readdir source, (err, items) -> if err? console.log err process.e...
Add Range.fromObject, which takes a [start, end] array
Point = require 'point' _ = require 'underscore' module.exports = class Range constructor: (pointA = new Point(0, 0), pointB = new Point(0, 0)) -> pointA = Point.fromObject(pointA) pointB = Point.fromObject(pointB) if pointA.compare(pointB) <= 0 @start = pointA @end = pointB else ...
Point = require 'point' _ = require 'underscore' module.exports = class Range @fromObject: (object) -> if _.isArray(object) new Range(object...) else object constructor: (pointA = new Point(0, 0), pointB = new Point(0, 0)) -> pointA = Point.fromObject(pointA) pointB = Point.fromObjec...
Add script to subscribe email address to Mailchimp list
# Description: # Add email to Mailchimp list # # Dependencies: # "mailchimp": "0.9.5" # # Configuration: # MAILCHIMP_API_KEY # MAILCHIMP_LIST_ID # # Commands: # hubot subscribe <email> - Add email to list # # Author: # max, lmarburger MailChimpAPI = require('mailchimp').MailChimpAPI apiKey = process.env.M...
Add JS to request the content to the user about his bankaccount
Neighborly.Users ?= {} Neighborly.Users.Payments = modules: -> [] init: Backbone.View.extend el: '.user-payments-content' initialize: -> $accounts = $(".account-method") for account in $accounts $account = $(account) if $account.data('path') $account.html('loading......
Add unit test for vm-clean-reboot
{job} = require '../../jobs/vm-clean-reboot' Connector = require '../../src' debug = require('debug')('meshblu-connector-xenserver:test') simple = require('simple-mock') class MockConnector extends Connector mockXapi: (xapi) => debug "Mocking the xapi object" simple.mock(xapi, "connect").returnWith("OK") ...
Add mongodb and redis inspector utility
MongoClient = require('mongodb').MongoClient ObjectID = require('mongodb').ObjectID redisClient = require('redis') redis = redisClient.createClient() mongo = null exit = (msg, code) -> mongo.close -> redis.end() console.log msg if msg process.exit(code or 0) MongoClient.connect 'mongodb://localhost:27...
Add Atom package list file
packages: [ "editorconfig" "file-icons" "highlight-selected" "linter" "linter-coffeelint" "linter-csslint" "linter-flake8" "linter-htmlhint" "linter-js-yaml" "linter-jshint" "linter-jsonlint" "linter-less" "linter-php" "linter-scss-lint" "linter-shellcheck" "linter-xmllint" "minimap" ...
Add test example for Coffee options support.
# options_.coffee # An example of specifying file-level options in CoffeeScript. # # Usage: # coffee-streamline options_.coffee # # streamline.options = { "callback": "_wait" } _ = require 'underscore' assert = require 'assert' # simulate async step here: setTimeout _wait, 2000; # use underscore library here: assert...
Update CSON link to Atom Flight Manual
# Your snippets # # Atom snippets allow you to enter a simple prefix in the editor and hit tab to # expand the prefix into a larger code block with templated values. # # You can create a new snippet in this file by typing "snip" and then hitting # tab. # # An example CoffeeScript snippet to expand log to console.log: #...
# Your snippets # # Atom snippets allow you to enter a simple prefix in the editor and hit tab to # expand the prefix into a larger code block with templated values. # # You can create a new snippet in this file by typing "snip" and then hitting # tab. # # An example CoffeeScript snippet to expand log to console.log: #...
Add test for component metadata
noflo = require 'noflo' unless noflo.isBrowser() chai = require 'chai' unless chai GetMetadata = require '../components/GetMetadata.coffee' testutils = require './testutils' sharp = require 'sharp' else GetMetadata = require 'noflo-sharp/components/GetMetadata.js' testutils = require 'noflo-image/spec/testu...
Add utils for handling OTP GraphQL queries.
define -> PLAN_QUERY = """ query( $modes: String!, $from: InputCoordinates!, $to: InputCoordinates!, $locale: String!, $wheelchair: Boolean!) { plan( from: $from, to: $to, locale: $locale, wheelchair: $wheelchair, ...
Fix indexing of entries with "event" in the name
class app.models.Entry extends app.Model # Attributes: name, type, path SEPARATORS_REGEXP = /\:?\ |#|::|->/g PARANTHESES_REGEXP = /\(.*?\)$/ constructor: -> super @text = @searchValue() searchValue: -> @name .toLowerCase() .replace '...', ' ' .replace ' event', '' .repla...
class app.models.Entry extends app.Model # Attributes: name, type, path SEPARATORS_REGEXP = /\:?\ |#|::|->/g PARANTHESES_REGEXP = /\(.*?\)$/ constructor: -> super @text = @searchValue() searchValue: -> @name .toLowerCase() .replace '...', ' ' .replace /\ event$/, '' .rep...
Define projects for work computer on atom
[ { title: "Spyns" group: "Development" paths: [ "~/Development/spyns" ] } { title: "CSI-702: Homework02 Instructor Attempt" group: "Mason Fall 2017" paths: [ "~/Documents/work/teaching/2017_Spring_Semester/CSI-702_High_Performance_Computing/assignments/homework02-instructo...
Add renderer plugin spec document.
# nwdrome-renderer-plugin spec # Copyright 2014, Ragg(@_ragg_) ### # Nwdrome renderer plugin specification ## Register plugin Call `nwdrome.plugin.addRenderer` with `factory function` Factory function given plugin config object. Below Plugin config object properties. - appUrl :string Application(nwdrome) root pa...
Add "your wish is my command" watcher
# Description # Grabs the current forecast from Dark Sky # # Dependencies # None # # Configuration # HUBOT_DARK_SKY_API_KEY # HUBOT_DARK_SKY_DEFAULT_LOCATION # HUBOT_DARK_SKY_UNITS (optional - us, si, ca, or uk) # # Commands: # hubot weather - Get the weather for HUBOT_DARK_SKY_DEFAULT_LOCATION # hubot we...
Add Coffee source for initial Backbone/Heap integration.
_ = @_ View = Backbone.View::constructor Backbone.View::constructor = (args...) -> result = View.apply @, args events = _.result @, 'events' for key, method of events # Split event name from selector (lifted from backbone.js) [original, eventName, selector] = key.match /^(\S+)\s*(.*)$/ eventName...
Add pagination helpers to base collection.
#= require_self #= require_tree . Rahani.module 'Collections', -> class @Base extends Backbone.Collection
#= require_self #= require_tree . Rahani.module 'Collections', -> class @Base extends Backbone.Collection parse: (response, options)-> @_fetch_options_data = options.data || {}; @pagination = JSON.parse options.xhr.getResponseHeader('X-Pagination') response nextPage: -> if @paginatio...
Add coffee version of the shim.
# Airbrake shim that stores exceptions until Airbrake notifier is loaded. window.Airbrake = [] # Wraps passed function and returns new function that catches and # reports unhandled exceptions. Airbrake.wrap = (fn) -> airbrakeWrapper = -> try return fn.apply(this, arguments) catch exc args = Array...
Update current test instance AMI identifier
module.exports = current: 'ami-5dd50436' # Ordered by creation date list: [ 'ami-5dd50436' ]
module.exports = current: 'ami-bf235ad5' # Ordered by creation date list: [ 'ami-5dd50436' 'ami-bf235ad5' ]
Add the most important script in existence
# Robot Roll Call # # robot roll call - does what it says # robots = [ "http://i.imgur.com/6PcNC.jpg", # robot roll call "http://i.imgur.com/9UmSw.jpg", # cambot "http://i.imgur.com/1CrLw.jpg", # gypsy "http://i.imgur.com/SNpTp.jpg", # tom servo "http://i.imgur.com/HVXpw.jpg", # croooow! ] module.exports = ...
Add tests for show view helpers.
ViewHelpers = require '../../helpers/view_helpers' { fabricate } = require 'antigravity' describe 'ViewHelpers', -> describe 'sailthruTags', -> it 'formats sailthru tags properly', -> artist = fabricate 'artist', id: 'artist-id' partner = fabricate 'partner', id: 'partner-id' location = fabrica...
Clean up generating score values
### # Copyright 2015-2016 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 ver...
### # Copyright 2015-2016 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 ver...
Copy and paste youtube to steam
# Description # Grab the title of a youtube video # # Dependencies: # cheerio # request # # Configuration: # None # # Commands: # None # # Notes: # steam also sucks (but mostly I'm lazy) # # Author: # ~~justinwoo~~ sshirokov without copy and paste at all! url = require 'url' path = require 'path' request = requ...
Hide the mouse after 5 seconds of inactivity.
# dashing.js is located in the dashing framework # It includes jquery & batman for you. #= require dashing.js #= require_directory . #= require_tree ../../widgets console.log("Yeah! The dashboard has started!") Dashing.on 'ready', -> Dashing.widget_margins ||= [5, 5] Dashing.widget_base_dimensions ||= [300, 360]...
# dashing.js is located in the dashing framework # It includes jquery & batman for you. #= require dashing.js #= require_directory . #= require_tree ../../widgets console.log("Yeah! The dashboard has started!") Dashing.on 'ready', -> Dashing.widget_margins ||= [5, 5] Dashing.widget_base_dimensions ||= [300, 360]...
Change the artifact target directory to dist instead of lib.
module.exports = (grunt) -> grunt.initConfig pkg: grunt.file.readJSON('package.json') meta: banner: '// rivets.js\n' + '// version: <%= pkg.version %>\n' + '// author: <%= pkg.author %>\n' + '// license: <%= pkg.licenses[0].type %>\n' coffee: all: file...
module.exports = (grunt) -> grunt.initConfig pkg: grunt.file.readJSON('package.json') meta: banner: '// rivets.js\n' + '// version: <%= pkg.version %>\n' + '// author: <%= pkg.author %>\n' + '// license: <%= pkg.licenses[0].type %>\n' coffee: all: file...