Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Return avatarUrl directly if it's a string | angular.module('loomioApp').directive 'userAvatar', ($window) ->
scope: {user: '=', coordinator: '=?', size: '@?'}
restrict: 'E'
templateUrl: 'generated/components/user_avatar/user_avatar.html'
replace: true
controller: ($scope) ->
unless _.contains(['small', 'medium', 'medium-circular', 'large', 'large-c... | angular.module('loomioApp').directive 'userAvatar', ($window) ->
scope: {user: '=', coordinator: '=?', size: '@?'}
restrict: 'E'
templateUrl: 'generated/components/user_avatar/user_avatar.html'
replace: true
controller: ($scope) ->
unless _.contains(['small', 'medium', 'medium-circular', 'large', 'large-c... |
Use not instead of ! for consistency | setGlobalFocusPriority = (priority) ->
env = jasmine.getEnv()
env.focusPriority = 1 unless env.focusPriority
env.focusPriority = priority if priority > env.focusPriority
focusMethods =
fdescribe: (description, specDefinitions, priority=1) ->
setGlobalFocusPriority(priority)
suite = describe(description... | setGlobalFocusPriority = (priority) ->
env = jasmine.getEnv()
env.focusPriority = 1 unless env.focusPriority
env.focusPriority = priority if priority > env.focusPriority
focusMethods =
fdescribe: (description, specDefinitions, priority=1) ->
setGlobalFocusPriority(priority)
suite = describe(description... |
Call addOpener instead of registerOpener | path = require 'path'
{allowUnsafeNewFunction} = require 'loophole'
archive = allowUnsafeNewFunction -> require 'ls-archive'
{File} = require 'pathwatcher'
fs = require 'fs-plus'
Serializable = require 'serializable'
module.exports=
class ArchiveEditor extends Serializable
atom.deserializers.add(this)
@activate:... | path = require 'path'
{allowUnsafeNewFunction} = require 'loophole'
archive = allowUnsafeNewFunction -> require 'ls-archive'
{File} = require 'pathwatcher'
fs = require 'fs-plus'
Serializable = require 'serializable'
module.exports=
class ArchiveEditor extends Serializable
atom.deserializers.add(this)
@activate:... |
Comment out line that breaks app | if Meteor.isClient
if Package.ui
Handlebars = Package.ui.Handlebars
Handlebars.registerHelper 't9n', (x, prefix='') ->
T9n.get(x, prefix)
class T9n
@get: (x, prefix='') ->
_get(x, prefix)
@map: (language, map) ->
if not i18n._maps[language]
i18n._maps[language] = {}
_extend(i18n._m... | if Meteor.isClient
if Package.ui
Handlebars = Package.ui.Handlebars
Handlebars.registerHelper 't9n', (x, prefix='') ->
T9n.get(x, prefix)
class T9n
@get: (x, prefix='') ->
_get(x, prefix)
@map: (language, map) ->
if not i18n._maps[language]
i18n._maps[language] = {}
_extend(i18n._m... |
Remove the ? from the URL params, as this was preventing reload of a page. | Species.SearchRoute = Ember.Route.extend
serialize: (model) ->
{params: '?' + $.param(model)}
model: (params) ->
geoEntitiesController = @controllerFor('geoEntities')
geoEntitiesController.set('content', Species.GeoEntity.find())
# what follows here is the deserialisation of params
# this hook... | Species.SearchRoute = Ember.Route.extend
serialize: (model) ->
{params: $.param(model)}
model: (params) ->
geoEntitiesController = @controllerFor('geoEntities')
geoEntitiesController.set('content', Species.GeoEntity.find())
# what follows here is the deserialisation of params
# this hook is ex... |
Add context menu in FilePatchView for opening file in editor | 'menu': [
{
'label': 'View'
'submenu': [
{
'label': 'Toggle Git Panel'
'command': 'github:toggle-git-panel'
}
]
}
{
'label': 'Packages'
'submenu': [
{
'label': 'GitHub',
'submenu': [
{
'label': 'Toggle'
'comman... | 'menu': [
{
'label': 'View'
'submenu': [
{
'label': 'Toggle Git Panel'
'command': 'github:toggle-git-panel'
}
]
}
{
'label': 'Packages'
'submenu': [
{
'label': 'GitHub',
'submenu': [
{
'label': 'Toggle'
'comman... |
Set isNew to illustrate possible attribute assignments | ETahi.InlineEditTextComponent = Em.Component.extend
editing: false
hasNoContent: (->
Em.isEmpty(@get('bodyPart.value'))
).property('bodyPart.value')
focusOnEdit: (->
if @get('editing')
Em.run.schedule 'afterRender', @, ->
@$('textarea').focus()
).observes('editing')
actions:
togg... | ETahi.InlineEditTextComponent = Em.Component.extend
editing: false
isNew: false
hasNoContent: (->
Em.isEmpty(@get('bodyPart.value'))
).property('bodyPart.value')
focusOnEdit: (->
if @get('editing')
Em.run.schedule 'afterRender', @, ->
@$('textarea').focus()
).observes('editing')
a... |
Make Geo.distanceBetween take either a LatLng or a locatable at either parameter | Darkswarm.service "Geo", ->
new class Geo
OK: google.maps.GeocoderStatus.OK
# Usage:
# Geo.geocode address, (results, status) ->
# if status == Geo.OK
# console.log results[0].geometry.location
# else
# console.log "Error: #{status}"
geocode: (address, callback) ->
g... | Darkswarm.service "Geo", ->
new class Geo
OK: google.maps.GeocoderStatus.OK
# Usage:
# Geo.geocode address, (results, status) ->
# if status == Geo.OK
# console.log results[0].geometry.location
# else
# console.log "Error: #{status}"
geocode: (address, callback) ->
g... |
Add Markdown keymaps for webdoc | '.platform-darwin atom-text-editor[data-grammar="source dyndoc md stata"]':
'cmd-shift-x': 'markdown:toggle-task'
'.platform-win32 atom-text-editor[data-grammar="source dyndoc md stata"]':
'ctrl-shift-x': 'markdown:toggle-task'
'.platform-linux atom-text-editor[data-grammar="source dyndoc md stata"]':
'ctrl-shift... | '.platform-darwin atom-text-editor[data-grammar="source dyndoc md stata"]':
'cmd-shift-x': 'markdown:toggle-task'
'.platform-win32 atom-text-editor[data-grammar="source dyndoc md stata"]':
'ctrl-shift-x': 'markdown:toggle-task'
'.platform-linux atom-text-editor[data-grammar="source dyndoc md stata"]':
'ctrl-shift... |
Hide suggestions dropdown if the keyUp is Enter | Species.TaxonConceptSearchTextField = Em.TextField.extend
value: ''
currentTimeout: null
attributeBindings: ['autocomplete']
focusOut: (event) ->
@.$().attr('placeholder', @get('placeholder'))
@hideDropdown() if !@get('parentView.mousedOver')
keyUp: (event) ->
Ember.run.cancel(@currentTimeout)
... | Species.TaxonConceptSearchTextField = Em.TextField.extend
value: ''
currentTimeout: null
attributeBindings: ['autocomplete']
focusOut: (event) ->
@.$().attr('placeholder', @get('placeholder'))
@hideDropdown() if !@get('parentView.mousedOver')
keyUp: (event) ->
Ember.run.cancel(@currentTimeout)
... |
Hide all the items on `ready` | class Dashing.Lecturelist extends Dashing.Widget
ready: ->
@currentIndex = 0
@items = $(@node).find('li')
@nextItem()
@startCarousel()
onData: (data) ->
@currentIndex = 0
i = 0
if data.items.length == 0
@set 'empty', true
while i < data.items.length
capacity = data.it... | class Dashing.Lecturelist extends Dashing.Widget
ready: ->
@currentIndex = 0
@items = $(@node).find('li')
@items.hide()
@nextItem()
@startCarousel()
onData: (data) ->
@currentIndex = 0
i = 0
if data.items.length == 0
@set 'empty', true
startCarousel: ->
setInterval... |
Handle custom commands with strategies | shell = require 'shell'
module.exports = customCommand = (virtualFileSystem, {payload}) ->
payload = JSON.parse(payload)
switch payload.command
when 'browser_open'
shell.openExternal(payload.url)
when 'learn_submit'
# open atom browser window
else
console.log 'Unhandled custom comman... | shell = require 'shell'
commandStrategies = {
browser_open: ({url}) ->
shell.openExternal(url)
atom_open: ({path}, virtualFileSystem) ->
# node = virtualFileSystem.getNode(path)
# open node.localPath()
learn_submit: ({url}) ->
# open BrowserWindow to url
}
module.exports = customCommand = (vir... |
Update minified_event structure to match frontend | dotenv = require 'dotenv'
amqp = require 'amqp'
MongoClient = require('mongodb').MongoClient
dotenv.load()
if !process.env.AMQP_URL or process.env.AMQP_URL.length < 1
console.error "Missing required environment variable AMQP_URL!"
process.exit 1
if !process.env.AMQP_QUEUE_NAME or process.env.AMQP_QUEUE_NAME.length... | dotenv = require 'dotenv'
amqp = require 'amqp'
MongoClient = require('mongodb').MongoClient
dotenv.load()
if !process.env.AMQP_URL or process.env.AMQP_URL.length < 1
console.error "Missing required environment variable AMQP_URL!"
process.exit 1
if !process.env.AMQP_QUEUE_NAME or process.env.AMQP_QUEUE_NAME.length... |
Update drawing tools to match readymade | Pinpoint = require './pinpoint'
t7e = require 't7e'
enUs = require './en-us'
t7e.load enUs
translate = t7e
module.exports =
id: 'penguin'
producer: translate 'div', 'producer'
title: translate 'div', 'title'
summary: translate 'div', 'summary'
description: translate 'div', 'description'
background: 'pen... | Pinpoint = require './pinpoint'
t7e = require 't7e'
enUs = require './en-us'
t7e.load enUs
translate = t7e
module.exports =
id: 'penguin'
producer: translate 'div', 'producer'
title: translate 'div', 'title'
summary: translate 'div', 'summary'
description: translate 'div', 'description'
background: 'pen... |
Reset progress bar before start. | #= require nanobar.js
class @PodsProgressBar
update: (factor) ->
progress = factor * 100
@nanobar.go(progress)
start: ->
@nanobar = new Nanobar
target: $('.progress-container').get(0)
id: 'pods-progress'
| #= require nanobar.js
class @PodsProgressBar
update: (factor) ->
progress = factor * 100
@nanobar.go(progress)
start: ->
$container = $('.progress-container').empty()
@nanobar = new Nanobar
target: $container.get(0)
id: 'pods-progress'
|
Remove unnecessary beforeEach from tests | _ = require 'underscore'
Collector = require '../lib/collector'
describe "Collector", ->
subject = null
beforeEach ->
subject = new Collector
describe "getData", ->
beforeEach ->
it "creates a request with the proper options", ->
keys = _.keys(subject.getData())
expect(keys).toContain '... | _ = require 'underscore'
Collector = require '../lib/collector'
describe "Collector", ->
subject = null
beforeEach ->
subject = new Collector
describe "getData", ->
it "creates a request with the proper options", ->
keys = _.keys(subject.getData())
expect(keys).toContain 'user_agent'
e... |
Fix problem with template path | 'use strict'
$(document).foundation()
angular
.module('app', [
'ngAnimate',
# 'ngAria',
'ngCookies',
'ngMessages',
'ngResource',
'ngRoute',
'ngSanitize',
# 'ngTouch',
'angular-growl',
'angularSpinner',
])
.config [
'$routeProvider',
'$httpProvider',
'$logProvi... | 'use strict'
$(document).foundation()
angular
.module('app', [
'ngAnimate',
# 'ngAria',
'ngCookies',
'ngMessages',
'ngResource',
'ngRoute',
'ngSanitize',
# 'ngTouch',
'angular-growl',
'angularSpinner',
])
.config [
'$routeProvider',
'$httpProvider',
'$logProvi... |
Use dismisser instead of cookies lib for onboarding tips | Backbone = require 'backbone'
Cookies = require 'cookies-js'
analytics = require '../../lib/analytics.coffee'
Promise = require 'bluebird-q'
module.exports = class TipView extends Backbone.View
events:
'click': 'onClick'
'click .js-close' : 'close'
initialize: ({ @user }) -> #
onClick: (e) ->
e.pre... | Backbone = require 'backbone'
Dismisser = require '../has_seen/dismisser.coffee'
analytics = require '../../lib/analytics.coffee'
Promise = require 'bluebird-q'
module.exports = class TipView extends Backbone.View
events:
'click': 'onClick'
'click .js-close' : 'close'
initialize: ({ @user }) ->
@dismi... |
Change URL of mesh server again | socket = io.connect 'ws://45.55.200.178'
angular.module("FarmBot").factory 'socket', ($rootScope) ->
on: (eventName, callback) ->
socket.on eventName, ->
args = arguments
$rootScope.$apply -> callback.apply socket, args
emit: (eventName, data, callback) ->
socket.emit eventName, data, ->
... | socket = io.connect 'ws://mesh.farmbot.it'
angular.module("FarmBot").factory 'socket', ($rootScope) ->
on: (eventName, callback) ->
socket.on eventName, ->
args = arguments
$rootScope.$apply -> callback.apply socket, args
emit: (eventName, data, callback) ->
socket.emit eventName, data, ->
... |
Add some basic error handling when creating devices | devices =
MediaServer: require "./devices/MediaServer"
upnp =
createDevice: (name, type) -> new devices[type](name)
module.exports = upnp
| # Currently implemented devices
deviceList = [ 'MediaServer' ]
devices = {}
for deviceType in deviceList
# device classes are in devices/<DeviceType>.coffee
devices[deviceType] = require "./devices/#{deviceType}"
exports.createDevice = (name, type) ->
if not type in deviceList
return new Error "UP... |
Add a workaround for a race condition between chosen and floatThead | $(document).on 'uic:domchange', ->
margin_top = $('.navbar-fixed-top, .navbar-static-top').height()
$('table[data-toggle=sticky-header]').floatThead
useAbsolutePositioning: false
scrollingTop: margin_top
| setFloatThead = ->
margin_top = $('.navbar-fixed-top, .navbar-static-top').height()
$('table[data-toggle=sticky-header]').floatThead
useAbsolutePositioning: false
scrollingTop: margin_top
# workaround for race condition between chosen and floatThead
$(document).on 'uic:domchange', ->
window.setTimeout se... |
Set Atom Dark as the default theme | "*":
Zen:
softWrap: false
width: 160
core:
disabledPackages: [
"notebook"
"language-gfm"
"wrap-guide"
]
telemetryConsent: "limited"
themes: [
"one-dark-ui"
"zenburn-theme"
]
"default-language":
defaultLanguage: "Pandoc markdown"
editor:
fontSize:... | "*":
Zen:
softWrap: false
width: 160
core:
disabledPackages: [
"notebook"
"language-gfm"
"wrap-guide"
]
telemetryConsent: "limited"
themes: [
"atom-dark-ui"
"atom-dark-syntax"
]
"default-language":
defaultLanguage: "Pandoc markdown"
editor:
fontS... |
Fix issues expanding notifications' table rows | Augury.Views.Notifications.Index = Backbone.View.extend(
initialize: ->
_.bindAll @, 'renderTable'
Augury.notifications.bind 'reset', @renderTable
events:
'click button[type=submit]': 'search'
render: ->
@$el.html JST["admin/templates/notifications/index"]()
@$el.find('#filter-reference-type... | Augury.Views.Notifications.Index = Backbone.View.extend(
initialize: ->
_.bindAll @, 'renderTable'
Augury.notifications.bind 'reset', @renderTable
events:
'click button[type=submit]': 'search'
render: ->
@$el.html JST["admin/templates/notifications/index"]()
@$el.find('#filter-reference-type... |
Revert "Express server creating in 2.x.x fixed" | coffee = require("coffee-script")
less = require("less")
jade = require("jade")
express = require("express")
gzippo = require("gzippo")
assets = require("connect-assets")
nconf = require("nconf")
request = require("request")
module.exports = app = express.createServer()
apiUrl = nconf.get("url:api")
#... | coffee = require("coffee-script")
less = require("less")
jade = require("jade")
express = require("express")
gzippo = require("gzippo")
assets = require("connect-assets")
nconf = require("nconf")
request = require("request")
module.exports = app = express()
apiUrl = nconf.get("url:api")
###s
# Config... |
Load teaching periods in root controller | angular.module('doubtfire.config.root-controller', [])
#
# The Doubtfire root application controller
#
.controller("AppCtrl", ($rootScope, $state, $document, $filter, ExternalName) ->
# Automatically localise page titles
# TODO: (@alexcu) consider putting this in a directive?
suffix = $document.prop "title"
s... | angular.module('doubtfire.config.root-controller', [])
#
# The Doubtfire root application controller
#
.controller("AppCtrl", ($rootScope, $state, $document, $filter, ExternalName, TeachingPeriod) ->
# Automatically localise page titles
# TODO: (@alexcu) consider putting this in a directive?
suffix = $document.... |
Change watch task to default | gulp = require 'gulp'
coffee = require 'gulp-coffee'
browserify = require 'browserify'
runSequence = require 'run-sequence'
source = require 'vinyl-source-stream'
del = require 'del'
closureCompiler = require 'gulp-closure-compiler'
gulp.task 'coffee', ->
gulp.src('*.coffee')
.pipe(coffee())
.pipe(gulp.dest(... | gulp = require 'gulp'
coffee = require 'gulp-coffee'
browserify = require 'browserify'
runSequence = require 'run-sequence'
source = require 'vinyl-source-stream'
del = require 'del'
closureCompiler = require 'gulp-closure-compiler'
gulp.task 'coffee', ->
gulp.src('*.coffee')
.pipe(coffee())
.pipe(gulp.dest(... |
Add command to each item. | fs = require 'fs'
child_process = require 'child_process'
module.exports = Indexer =
getCondaPackages: () ->
output = child_process.execSync ' conda search ".*" --names-only '
names = output.toString().split('\n').slice(1)
names.map (name) ->
{name: name, description: null}
getPipPackages: () ->
output ... | fs = require 'fs'
child_process = require 'child_process'
module.exports = Indexer =
getCondaPackages: () ->
output = child_process.execSync ' conda search ".*" --names-only '
names = output.toString().split('\n').slice(1)
names.map (name) ->
{name: name, description: null, command: "conda install #{name}"}... |
Update address state when countryId changes | Sprangular.directive 'addressForm', ->
restrict: 'E'
templateUrl: 'addresses/form.html'
scope:
address: '='
countries: '='
controller: ($scope) ->
$scope.selectedCountry = null
$scope.$watch (-> $scope.address.countryId), (newCountryId) ->
return unless newCountryId
$scope.selectedC... | Sprangular.directive 'addressForm', ->
restrict: 'E'
templateUrl: 'addresses/form.html'
scope:
address: '='
countries: '='
controller: ($scope) ->
$scope.selectedCountry = null
$scope.$watch (-> $scope.address.countryId), (newCountryId) ->
return unless newCountryId
address = $scop... |
Revert "woot, now supporting attribute injection" | camelCase = (s) ->
(->
console.log 'foo'
)()
isString = (obj) ->
obj.constructor == String
isjQuery = (obj) ->
obj.constructor == jQuery
createTemplate = (tmpl) ->
tmpl = tmpl.html() if isjQuery tmpl
div = document.createElement 'div'
div.innerHTML = tmpl
jQuery div
findData... | isString = (obj) ->
obj.constructor == String
isjQuery = (obj) ->
obj.constructor == jQuery
createTemplate = (tmpl) ->
tmpl = tmpl.html() if isjQuery tmpl
div = document.createElement 'div'
div.innerHTML = tmpl
jQuery div
findDataAttr = (field, key) ->
dataAttr = ''
if field.dataset... |
Add select next menu item | 'menu': [
'label': 'Find'
'submenu': [
{ 'label': 'Find in Buffer', 'command': 'find-and-replace:show'}
{ 'label': 'Replace in Buffer', 'command': 'find-and-replace:show-replace'}
{ 'type': 'separator' }
{ 'label': 'Find in Project', 'command': 'project-find:show'}
{ 'type': 'separator' }
{ ... | 'menu': [
'label': 'Find'
'submenu': [
{ 'label': 'Find in Buffer', 'command': 'find-and-replace:show'}
{ 'label': 'Replace in Buffer', 'command': 'find-and-replace:show-replace'}
{ 'label': 'Select Next', 'command': 'find-and-replace:select-next'}
{ 'type': 'separator' }
{ 'label': 'Find in Pro... |
Update Orders.find to take optional token | Sprangular.service "Orders", ($http) ->
service =
find: (number) ->
$http.get("/api/orders/#{number}")
.then (response) ->
service._loadOrder(response.data)
all: ->
$http.get("/api/orders")
.then (response) ->
_.map response.data, (record) ->
servi... | Sprangular.service "Orders", ($http) ->
service =
find: (number, token) ->
config =
headers:
'X-Spree-Order-Token': token
$http.get("/api/orders/#{number}", config)
.then (response) ->
service._loadOrder(response.data)
all: ->
$http.get("/api/orders")
... |
Remove empty lines in user model. | class App.Models.User extends App.Model
urlRoot: 'users',
defaults:
user_settings: {
avatar: 'http://i.imgur.com/i31E9hh.jpg',
username: '',
website: '',
email: '',
interests: '',
name: '',
skills: '',
github_handle: '',
twitter_handle: '',
linkedin_ha... | class App.Models.User extends App.Model
urlRoot: 'users',
defaults:
user_settings: {
avatar: 'http://i.imgur.com/i31E9hh.jpg',
username: '',
website: '',
email: '',
interests: '',
name: '',
skills: '',
github_handle: '',
twitter_handle: '',
linkedin_ha... |
Change name of breadcrumb_template in backbone index | #= require_self
#= require_tree ./templates
#= require_tree ./models
#= require_tree ./views
#= require_tree ./routers
window.Water =
Models: {}
Collections: {}
Routers: {}
Views: {}
$ ->
fetcher = window.tree_fetcher = new Water.TreeFetcher(repository_path: gon.repository_path, ref: gon.ref)
tree_view ... | #= require_self
#= require_tree ./templates
#= require_tree ./models
#= require_tree ./views
#= require_tree ./routers
window.Water =
Models: {}
Collections: {}
Routers: {}
Views: {}
$ ->
fetcher = window.tree_fetcher = new Water.TreeFetcher(repository_path: gon.repository_path, ref: gon.ref)
tree_view ... |
Append ProjectView subviews in 1 operation | ProjectMonitor.Views ||= {}
class ProjectMonitor.Views.ProjectView extends Backbone.View
tagName: "li"
className: "project"
initialize: (options) ->
@subviews = []
@subviews.push(new ProjectMonitor.Views.BuildView(model: @model.get("build"))) if @model.get("build")
@subviews.push(new ProjectMonitor.... | ProjectMonitor.Views ||= {}
class ProjectMonitor.Views.ProjectView extends Backbone.View
tagName: "li"
className: "project"
initialize: (options) ->
@subviews = []
@subviews.push(new ProjectMonitor.Views.BuildView(model: @model.get("build"))) if @model.get("build")
@subviews.push(new ProjectMonitor.... |
Remove livereload functionality for now. | module.exports = (grunt) ->
# Configuration.
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
coffee:
dist:
expand: true,
cwd: './avalonstar/assets/javascripts',
src: ['*.coffee'],
dest: './avalonstar/static/javascripts/application',
ext: '.js'
sas... | module.exports = (grunt) ->
# Configuration.
grunt.initConfig
pkg: grunt.file.readJSON 'package.json'
coffee:
dist:
expand: true,
cwd: './avalonstar/assets/javascripts',
src: ['*.coffee'],
dest: './avalonstar/static/javascripts/application',
ext: '.js'
sas... |
Use coffeescript instead of coffee-script | import cluster from 'cluster'
import fs from 'fs'
import path from 'path'
import {tmpFile} from './utils'
import watch from './watch'
_watch = (dir) ->
require('vigil').watch dir, (filename, stats, isModule) ->
console.log "#{filename} changed, reloading"
process.exit 0
export default run = (fn... | import cluster from 'cluster'
import fs from 'fs'
import path from 'path'
import {tmpFile} from './utils'
import watch from './watch'
_watch = (dir) ->
require('vigil').watch dir, (filename, stats, isModule) ->
console.log "#{filename} changed, reloading"
process.exit 0
export default run = (fn... |
Apply selected value as label | class @TemplateSelector
constructor: (opts = {}) ->
{
@dropdown,
@data,
@pattern,
@wrapper,
@editor,
@fileEndpoint,
@$input = $('#file_name')
} = opts
@buildDropdown()
@bindEvents()
@onFilenameUpdate()
buildDropdown: ->
@dropdown.glDropdown(
... | class @TemplateSelector
constructor: (opts = {}) ->
{
@dropdown,
@data,
@pattern,
@wrapper,
@editor,
@fileEndpoint,
@$input = $('#file_name')
} = opts
@buildDropdown()
@bindEvents()
@onFilenameUpdate()
buildDropdown: ->
@dropdown.glDropdown(
... |
Implement content-setter for the control iframe |
class ControlIframe
constructor: ->
@el = document.createElement('iframe')
#need to append to outer document before we can access frame document.
FactlinkJailRoot.$factlinkCoreContainer.append(@el)
@$el = $(@el)
@doc = @el.contentWindow.document;
@doc.open()
#need doctype to avoid quirks ... |
class ControlIframe
constructor: ->
@el = document.createElement('iframe')
#need to append to outer document before we can access frame document.
FactlinkJailRoot.$factlinkCoreContainer.append(@el)
@$el = $(@el)
@doc = @el.contentWindow.document;
@doc.open()
#need doctype to avoid quirks ... |
Add .node extension to require path | {Behavior} = require 'emissary'
{ScrollbarStyleObserver} = require('../build/Release/scrollbar-style-observer')
observer = new ScrollbarStyleObserver -> behavior.emitValue(observer.getPreferredScrollbarStyle())
behavior = new Behavior(observer.getPreferredScrollbarStyle())
module.exports = behavior
| {Behavior} = require 'emissary'
{ScrollbarStyleObserver} = require('../build/Release/scrollbar-style-observer.node')
observer = new ScrollbarStyleObserver -> behavior.emitValue(observer.getPreferredScrollbarStyle())
behavior = new Behavior(observer.getPreferredScrollbarStyle())
module.exports = behavior
|
Fix for scrolling on pages | define (require) ->
_ = require('underscore')
BaseView = require('cs!helpers/backbone/views/base')
PublishListPageView = require('cs!./page')
template = require('hbs!./section-template')
require('less!./section')
# TODO: Write a simple inheritable for displaying the toc as a tree
# and use that inh... | define (require) ->
_ = require('underscore')
BaseView = require('cs!helpers/backbone/views/base')
PublishListPageView = require('cs!./page')
template = require('hbs!./section-template')
require('less!./section')
# TODO: Write a simple inheritable for displaying the toc as a tree
# and use that inh... |
Allow insert into "Find" tool panel | {View} = require 'atom'
module.exports =
class CompatibleView extends View
@content: ->
@div class: 'test overlay from-top', =>
@div "The Test package is Alive! It's ALIVE!", class: "message"
initialize: (serializeState) ->
atom.workspaceView.command "compatible:at", => @at()
atom.workspaceView.... | {View} = require 'atom'
module.exports =
class CompatibleView extends View
@content: ->
@div class: 'test overlay from-top', =>
@div "The Test package is Alive! It's ALIVE!", class: "message"
initialize: (serializeState) ->
atom.workspaceView.command "compatible:at", => @at()
atom.workspaceView.... |
Add test for asserting chaining delegates works | QUnit.module "Batman.Object delegation",
setup: ->
class @MyObject extends Batman.Object
@accessor 'address', -> Batman(number: '123', zip: '90210', country: Batman(country_code: 'CA'))
test 'delegate without to option raises developer warning', ->
spy = spyOn(Batman.developer, 'warn')
@MyObject.delega... | QUnit.module "Batman.Object delegation",
setup: ->
class @MyObject extends Batman.Object
@accessor 'address', -> Batman(number: '123', zip: '90210', country: Batman(country_code: 'CA'))
test 'delegate without to option raises developer warning', ->
spy = spyOn(Batman.developer, 'warn')
@MyObject.delega... |
Move outside of component scope | noflo = require 'noflo'
# @runtime noflo-browser
exports.getComponent = ->
c = new noflo.Component
c.inPorts.add 'graphstore',
datatype: 'object'
getGraphs = ->
graphIds = localStorage.getItem 'noflo-ui-graphs'
graphs = []
return graphs unless graphIds
ids = graphIds.split ','
for id in... | noflo = require 'noflo'
# @runtime noflo-browser
getGraphs = ->
graphIds = localStorage.getItem 'noflo-ui-graphs'
graphs = []
return graphs unless graphIds
ids = graphIds.split ','
for id in ids
graph = getGraph id
continue unless graph
graphs.push graph
return graphs
getGraph = (id) ->
jso... |
Disable Google Plus, native bindings are adequate. |
configs = []
configs.push
name: "Google Plus"
comment:
"""
This uses Google Plus' native j/k bindings (which work well), but adds the ability to activate the primary
link on <code>Enter</code>. By using the native bindings for j/k, we're able to also use Google's other
bindings, such as o, n and ... |
configs = []
configs.push
name: "Google Plus"
comment:
"""
This uses Google Plus' native j/k bindings (which work well), but adds the ability to activate the primary
link on <code>Enter</code>. By using the native bindings for j/k, we're able to also use Google's other
bindings, such as o, n and ... |
Add allow_single_deselect to chosen init | $ ->
$('[data-toggle="chosen"]').each ->
$this = $(this)
data = $this.data()
data.search_contains = true
$this.chosen data
| $ ->
$('[data-toggle="chosen"]').each ->
$this = $(this)
data = $this.data()
data.search_contains = true
data.allow_single_deselect = true
$this.chosen data
|
Enable tracing in example app | module.exports = do (Marionette, $) ->
{ UIRouterMarionette } = require('../router')
App = new Marionette.Application
Marionette.Behaviors.behaviorsLookup = ->
# Import Marionette behaviors for state lookup/active state
UISref: require('../router/marionette/behaviors').UISref
App.addRegions
rootReg... | module.exports = do (Marionette, $) ->
{ UIRouterMarionette } = require('../router')
App = new Marionette.Application
Marionette.Behaviors.behaviorsLookup = ->
# Import Marionette behaviors for state lookup/active state
UISref: require('../router/marionette/behaviors').UISref
App.addRegions
rootReg... |
Clone options to not pollute other .data properties | class OpinionatersCollection extends Backbone.Factlink.Collection
model: OpinionatersEvidence
default_fetch_data:
take: 7
initialize: (models, options) ->
@fact = options.fact
@_wheel = @fact.getFactWheel()
@_wheel.on 'sync', =>
@fetch()
url: ->
"/facts/#{@fact.id}/interactors"
... | class OpinionatersCollection extends Backbone.Factlink.Collection
model: OpinionatersEvidence
default_fetch_data:
take: 7
initialize: (models, options) ->
@fact = options.fact
@_wheel = @fact.getFactWheel()
@_wheel.on 'sync', =>
@fetch()
url: ->
"/facts/#{@fact.id}/interactors"
... |
Use SVG as the label | # Preamble
_.mixin(_.str.exports())
rx = require('../../reactive-coffee/src/reactive')
bind = rx.bind
T = rx.rxt.tags
S = rx.rxt.svg_tags
# Dependencies
# {items} = require('./model')
# {editor} = require('./editor')
{draw_grid} = require('./draw_grid')
grid_size = 640
grid_split = 8
main = ->
$('body').append(... | # Preamble
_.mixin(_.str.exports())
rx = require('../../reactive-coffee/src/reactive')
bind = rx.bind
T = rx.rxt.tags
SVG = rx.rxt.svg_tags
# Dependencies
# {items} = require('./model')
# {editor} = require('./editor')
{draw_grid} = require('./draw_grid')
grid_size = 640
grid_split = 8
main = ->
$('body').appen... |
Change method name to be more accurate | # Placeholder Polyfill
# https://github.com/mathiasbynens/jquery-placeholder
$(window).load ->
$("input, textarea").placeholder()
# Sammy
(($) ->
circle = $.sammy("body", ->
# Page
class Page
constructor: (@name, @title) ->
render: ->
document.title = "Circle - " + @title
$("b... | # Placeholder Polyfill
# https://github.com/mathiasbynens/jquery-placeholder
$(window).load ->
$("input, textarea").placeholder()
# Sammy
(($) ->
circle = $.sammy("body", ->
# Page
class Page
constructor: (@name, @title) ->
render: ->
document.title = "Circle - " + @title
$("b... |
Add atom-jinja2 to package list | packages: [
"package-sync",
"term2",
"merge-conflicts",
"git-log",
"git-history",
"browser-plus"
]
| packages: [
"package-sync",
"term2",
"merge-conflicts",
"git-log",
"git-history",
"browser-plus",
"atom-jinja2"
]
|
Increase the blink duration to 15s | Promise = require 'bluebird'
fs = Promise.promisifyAll require 'fs'
utils = require './utils'
express = require 'express'
application = require './application'
api = express()
LED_FILE = '/sys/class/leds/led0/brightness'
blink = (ms = 200) ->
fs.writeFileAsync(LED_FILE, 1)
.delay(ms)
.then -> fs.writeFileAsync(LE... | Promise = require 'bluebird'
fs = Promise.promisifyAll require 'fs'
utils = require './utils'
express = require 'express'
application = require './application'
api = express()
LED_FILE = '/sys/class/leds/led0/brightness'
blink = (ms = 200) ->
fs.writeFileAsync(LED_FILE, 1)
.delay(ms)
.then -> fs.writeFileAsync(LE... |
Add admin field to user. | a = DS.attr
ETahi.User = DS.Model.extend
imageUrl: a('string')
fullName: a('string')
username: a('string')
name: Ember.computed.alias 'fullName'
ETahi.Assignee = ETahi.User.extend()
ETahi.Reviewer = ETahi.User.extend()
| a = DS.attr
ETahi.User = DS.Model.extend
imageUrl: a('string')
fullName: a('string')
username: a('string')
name: Ember.computed.alias 'fullName'
admin: a('boolean')
ETahi.Assignee = ETahi.User.extend()
ETahi.Reviewer = ETahi.User.extend()
|
Add a label to the Move toolbox dropdown | {div, ul, li, span, i, p, a, button} = React.DOM
module.exports = ToolboxMove = React.createClass
displayName: 'ToolboxMove'
shouldComponentUpdate: (nextProps, nextState) ->
return not(_.isEqual(nextState, @state)) or
not(_.isEqual(nextProps, @props))
render: ->
direction... | {div, ul, li, span, i, p, a, button} = React.DOM
module.exports = ToolboxMove = React.createClass
displayName: 'ToolboxMove'
shouldComponentUpdate: (nextProps, nextState) ->
return not(_.isEqual(nextState, @state)) or
not(_.isEqual(nextProps, @props))
render: ->
direction... |
Use more descriptive variable name | 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... | setTimeout ->
isDOMContentLoaded =
loaded: true
interactive: !(document.documentMode < 11)
complete: true
if isDOMContentLoaded[document.readyState]
FactlinkJailRoot.host_ready_promise.resolve()
else
document.addEventListener('DOMContentLoaded', -> FactlinkJailRoot.host_ready_promise.resolve... |
Allow removal of all tags | React = require 'react'
PopoverButton = require '../high_order/popover_button.cjsx'
TagStore = require '../../stores/tag_store.coffee'
tagIsNew = (tag) ->
TagStore.getFiltered({ tag: tag }).length == 0
tags = (props, remove) ->
props.tags.map (tag) =>
remove_button = (
<button className='bu... | React = require 'react'
PopoverButton = require '../high_order/popover_button.cjsx'
TagStore = require '../../stores/tag_store.coffee'
tagIsNew = (tag) ->
TagStore.getFiltered({ tag: tag }).length == 0
tags = (props, remove) ->
props.tags.map (tag) =>
remove_button = (
<button className='bu... |
Fix HTML syntax in reporter | h = buster.reporters.html
h._lists = []
# original private function defined in Buster.js. Re-writing it here in CS
el = (doc, tagName, properties) ->
e = doc.createElement(tagName)
for prop, value of properties
e.setAttribute prop, value if prop is "http-equiv"
prop = "innerHTML" if prop == "text"
e[pr... | h = buster.reporters.html
h._lists = []
# original private function defined in Buster.js. Re-writing it here in CS
el = (doc, tagName, properties) ->
e = doc.createElement(tagName)
for prop, value of properties
e.setAttribute prop, value if prop is "http-equiv"
prop = "innerHTML" if prop == "text"
e[pr... |
Move assignment up and comment reasoning | React = require 'react'
BS = require 'react-bootstrap'
Router = require 'react-router'
_ = require 'underscore'
LearningGuide = require '../../flux/learning-guide'
PracticeButton = require './practice-button'
WeakerSections = require './weaker-sections'
WeakerPanel = React.createClass
propTypes:
courseId: ... | React = require 'react'
BS = require 'react-bootstrap'
Router = require 'react-router'
_ = require 'underscore'
LearningGuide = require '../../flux/learning-guide'
PracticeButton = require './practice-button'
WeakerSections = require './weaker-sections'
WeakerPanel = React.createClass
propTypes:
courseId: ... |
Disable atom rdio equalizer (make my macbook so slow) | 'exception-reporting':
'userId': '3ba70428-f782-5321-e73a-7b678f36511c'
'release-notes':
'viewedVersion': '0.94.0'
'welcome':
'showOnStartup': false
'metrics':
'userId': '9e20623847c7c22109bc7b34e71c459485f8781a'
'editor':
'showInvisibles': true
'fontFamily': 'Monaco'
'showIndentGuide': true
'softTabs':... | 'exception-reporting':
'userId': '3ba70428-f782-5321-e73a-7b678f36511c'
'release-notes':
'viewedVersion': '0.94.0'
'welcome':
'showOnStartup': false
'metrics':
'userId': '9e20623847c7c22109bc7b34e71c459485f8781a'
'editor':
'showInvisibles': true
'fontFamily': 'Monaco'
'showIndentGuide': true
'softTabs':... |
Throw an exception if you try to pass in a model that is not in the storage manager if one exists | window.Brainstem ?= {}
class Brainstem.ModelLoader extends Brainstem.AbstractLoader
_getCollectionName: ->
@loadOptions.name.pluralize()
_createObjects: ->
id = @loadOptions.only[0]
@internalObject = @storageManager.createNewModel @loadOptions.name
@internalObject.set('id', id)
@externalObje... | window.Brainstem ?= {}
class Brainstem.ModelLoader extends Brainstem.AbstractLoader
_getCollectionName: ->
@loadOptions.name.pluralize()
_createObjects: ->
id = @loadOptions.only[0]
cachedModel = @storageManager.storage(@_getCollectionName()).get(id)
if cachedModel && @loadOptions.model && cache... |
Fix bug in hard copy workaround for IE | mutate = (instance, klass, args = []) ->
throw 'Instance must be an object' if typeof instance isnt 'object'
throw 'Klass must be a class' if typeof klass isnt 'function'
instance.__proto__ = klass.prototype
klass.apply(instance, args)
instance
fixForIE = (instance, klass, args = []) ->
throw 'Instance mu... | mutate = (instance, klass, args = []) ->
throw 'Instance must be an object' if typeof instance isnt 'object'
throw 'Klass must be a class' if typeof klass isnt 'function'
instance.__proto__ = klass.prototype
klass.apply(instance, args)
instance
fixForIE = (instance, klass, args = []) ->
throw 'Instance mu... |
Fix paths for fetched from GitHub Tamia source files. | # Installs/updates latest version of the Tâmia Stylus framework.
# Also installs jQuery.
# https://github.com/sapegin/tamia
'use strict'
fs = require 'fs'
util = require 'util'
path = require 'path'
base = require '../base'
module.exports = class Generator extends base
Generator::checkUpdate = ->
@update = fs.exis... | # Installs/updates latest version of the Tâmia Stylus framework.
# Also installs jQuery.
# https://github.com/sapegin/tamia
'use strict'
fs = require 'fs'
util = require 'util'
path = require 'path'
base = require '../base'
module.exports = class Generator extends base
Generator::checkUpdate = ->
@update = fs.exis... |
Add preventDefault when menu is closing | Template.layout.events
'click .applicationContent.menu-open': (event, template) ->
if not $(event.target).hasClass 'menu-toggler'
$('.applicationContent').removeClass('menu-open')
'click .menu-toggler': (event, template) ->
$('.applicationContent').toggleClass('menu-open')
| Template.layout.events
'click .applicationContent.menu-open': (event, template) ->
if not $(event.target).hasClass 'menu-toggler'
event.preventDefault()
$('.applicationContent').removeClass('menu-open')
'click .menu-toggler': (event, template) ->
$('.applicationContent').toggleClass('menu-open')
|
Quit minigraph mode if in diagram only mode | HashParams = require '../utils/hash-parameters'
ImportActions = require '../actions/import-actions'
AppSettingsActions = Reflux.createActions(
[
"diagramOnly"
"showMinigraphs"
]
)
AppSettingsStore = Reflux.createStore
listenables: [AppSettingsActions, ImportActions]
init: ->
@settings =
... | HashParams = require '../utils/hash-parameters'
ImportActions = require '../actions/import-actions'
AppSettingsActions = Reflux.createActions(
[
"diagramOnly"
"showMinigraphs"
]
)
AppSettingsStore = Reflux.createStore
listenables: [AppSettingsActions, ImportActions]
init: ->
@settings =
... |
Use parseFloat to avoid string subtraction | @ScrollToOnMountMixin =
componentDidMount: ->
$('body').animate scrollTop: @positionInPage() - @marginTop(), 700
positionInPage: ->
@jQueryElement().offset().top
marginTop: ->
@jQueryElement().css('margin-top').replace('px', '')
jQueryElement: ->
$(ReactDOM.findDOMNode(this))
| @ScrollToOnMountMixin =
componentDidMount: ->
$('body').animate scrollTop: @positionInPage() - @marginTop(), 700
positionInPage: ->
parseFloat @jQueryElement().offset().top
marginTop: ->
parseFloat @jQueryElement().css('margin-top').replace('px', '')
jQueryElement: ->
$(ReactDOM.findDOMNode(t... |
Add test for resolved refs | require('./helpers')
fs = require('fs')
path = require('path')
glob = require('glob')
refaker = require('../lib')
describe 'other specs', ->
it 'should fail on invalid input', (done) ->
refaker {}, (err, refs) ->
expect(err).toBeUndefined()
expect(refs).toEqual {}
expect(refaker).toThrow()
... | require('./helpers')
fs = require('fs')
path = require('path')
glob = require('glob')
refaker = require('../lib')
describe 'other specs', ->
it 'should fail on invalid input', (done) ->
refaker {}, (err, refs) ->
expect(err).toBeUndefined()
expect(refs).toEqual {}
expect(refaker).toThrow()
... |
Send notification if PS submits are pending | import {GROUPS} from '../../client/lib/informaticsGroups'
import {START_SUBMITS_DATE} from '../api/dashboard'
import send from '../metrics/graphite'
import Result from "../models/result"
export default sendMetrics = () ->
queries =
ok: {ok: 1, lastSubmitTime: {$gt: START_SUBMITS_DATE}},
ps: {ps: 1... | import {GROUPS} from '../../client/lib/informaticsGroups'
import {START_SUBMITS_DATE} from '../api/dashboard'
import send from '../metrics/graphite'
import notify from '../metrics/notify'
import Result from "../models/result"
sendGraphite = () ->
queries =
ok: {ok: 1, lastSubmitTime: {$gt: START_SUBMITS_D... |
Return blank features, not default features if no bonuses | _ = require("underscore")
logger = require('logger-sharelatex')
User = require('../../models/User').User
Settings = require "settings-sharelatex"
module.exports = ReferalFeatures =
getBonusFeatures: (user_id, callback = (error) ->) ->
query = _id: user_id
User.findOne query, (error, user) ->
return callback(er... | _ = require("underscore")
logger = require('logger-sharelatex')
User = require('../../models/User').User
Settings = require "settings-sharelatex"
module.exports = ReferalFeatures =
getBonusFeatures: (user_id, callback = (error) ->) ->
query = _id: user_id
User.findOne query, (error, user) ->
return callback(er... |
Fix "undefined" issue in sorting rule list items. | DotLedger.module 'Views.SortingRules', ->
class @ListItem extends Backbone.Marionette.ItemView
tagName: 'tr'
template: 'sorting_rules/list_item'
templateHelpers: ->
flag: =>
if @model.get('review')
'Review'
| DotLedger.module 'Views.SortingRules', ->
class @ListItem extends Backbone.Marionette.ItemView
tagName: 'tr'
template: 'sorting_rules/list_item'
templateHelpers: ->
flag: =>
if @model.get('review')
'Review'
else
''
|
Use the CoffeeScript this syntax vs. the JS syntax | #Utilities for particular grammars
_ = require 'underscore'
module.exports =
splitStatements: (code) ->
reducer = (statements, char, i, code) ->
if char == '('
this.parenDepth = (this.parenDepth or 0) + 1
this.inStatement = true
else if char == ')'
this.parenDepth = (this.pare... | #Utilities for particular grammars
_ = require 'underscore'
module.exports =
splitStatements: (code) ->
reducer = (statements, char, i, code) ->
if char == '('
@parenDepth = (@parenDepth or 0) + 1
@inStatement = true
else if char == ')'
@parenDepth = (@parenDepth or 0) - 1
... |
Change tick rate from 1 tps to 60 tps | requirejs.config({
paths: {
fabric: [
'lib/fabric']
}
})
define ['game', 'synchronizedtime', 'position', 'lib/fabric'], (Game, SynchronizedTime, Position) -> # Fabric is deliberately not set as an argument
console.log "Fabric: ", fabric
console.log "Position: ", new Position([1,2], 0, 5)
canvas = n... | requirejs.config({
paths: {
fabric: [
'lib/fabric']
}
})
define ['game', 'synchronizedtime', 'position', 'lib/fabric'], (Game, SynchronizedTime, Position) -> # Fabric is deliberately not set as an argument
console.log "Fabric: ", fabric
console.log "Position: ", new Position([1,2], 0, 5)
canvas = n... |
Load / run scripts synchronously | fs = require 'fs'
path = require 'path'
module.exports = (robot, scripts) ->
scriptsPath = path.resolve(__dirname, 'src')
fs.exists scriptsPath, (exists) ->
if exists
for script in fs.readdirSync(scriptsPath)
if scripts? and '*' not in scripts
robot.loadF... | fs = require 'fs'
path = require 'path'
module.exports = (robot, scripts) ->
scriptsPath = path.resolve(__dirname, 'src')
if fs.existsSync scriptsPath
for script in fs.readdirSync(scriptsPath).sort()
if scripts? and '*' not in scripts
robot.loadFile(scriptsPath, script) if s... |
Remove boilerplate code from JS-Data code | # RESTful data adapter for hooking angular JS into the backend API.
# Checkout "js-data-angular" docs for more info.
data = (DS) ->
deviceMethods = {}
DS.defineResource
name: "device"
endpoint: 'devices',
basePath: '/api',
idAttribute: "_id"
methods: deviceMethods
DS.defineResource
name: ... | # RESTful data adapter for hooking angular JS into the backend API.
# Checkout "js-data-angular" docs for more info.
data = (DS) ->
DS.defineResource
name: "device"
endpoint: 'devices',
basePath: '/api',
idAttribute: "_id"
DS.defineResource
name: "step"
endpoint: 'steps',
basePath: '/ap... |
Simplify product naming in cart | Darkswarm.factory 'Variants', ->
new class Variants
variants: {}
clear: ->
@variants = {}
register: (variant)->
@variants[variant.id] ||= @extend variant
extend: (variant)->
variant.extended_name = @extendedVariantName(variant)
variant.base_price_percentage = Math.round(vari... | Darkswarm.factory 'Variants', ->
new class Variants
variants: {}
clear: ->
@variants = {}
register: (variant)->
@variants[variant.id] ||= @extend variant
extend: (variant)->
variant.extended_name = @extendedVariantName(variant)
variant.base_price_percentage = Math.round(vari... |
Tweak to popular news phrase. | # Description:
# Get most popular story from MEN
# See also https://github.com/github/hubot-scripts/blob/master/src/scripts/chartbeat.coffee
#
# Dependencies:
# None
#
# Configuration:
# HUBOT_CHARTBEAT_API_KEY
#
# Command: [not included in help script]
# election - find election candidates
#
# Author:
# ro... | # Description:
# Get most popular story from MEN
# See also https://github.com/github/hubot-scripts/blob/master/src/scripts/chartbeat.coffee
#
# Dependencies:
# None
#
# Configuration:
# HUBOT_CHARTBEAT_API_KEY
#
# Command: [not included in help script]
# election - find election candidates
#
# Author:
# ro... |
Add a few more standard ports | net = require 'net'
httpProxy = require 'http-proxy'
module.exports = class LocalhostProxy
constructor: (port) ->
@port = port
@remoteHost = 'http://ile.learn.co'
@desiredPorts = ['3000', '4000', '8000', '9393']
start: ->
@withAvailablePort((ports) =>
server = httpProxy.createProxyServer({ta... | net = require 'net'
httpProxy = require 'http-proxy'
module.exports = class LocalhostProxy
constructor: (port) ->
@port = port
@remoteHost = 'http://ile.learn.co'
@desiredPorts = ['3000', '4000', '4567', '8000', '9292', '9393']
start: ->
@withAvailablePort((ports) =>
server = httpProxy.creat... |
Add uglify task to grunt | module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON("package.json")
coffee:
compile:
files:
'chrome-app/lib/pomodoro.js': ['src/*.coffee']
grunt.loadNpmTasks "grunt-contrib-concat"
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-... | module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON("package.json")
coffee:
compile:
files:
'chrome-app/lib/pomodoro.js': ['src/*.coffee']
uglify:
build:
src: 'chrome-app/lib/pomodoro.js',
dest: 'chrome-app/lib/pomodoro.min.js'
grunt.loa... |
Fix an issue that non-markdown preview is not updated | module.exports =
class BroadcastTarget
editor: null
listener: null
isMarkdownPreview: false
constructor: ->
@editor = atom.workspace.activePaneItem
@isMarkdownPreview = @editor[0]?
@editor.on 'markdown-preview:markdown-changed', =>
@listener?()
setListener: (listener) ->
@listener = ... | module.exports =
class BroadcastTarget
editor: null
listener: null
isMarkdownPreview: false
constructor: ->
@editor = atom.workspace.activePaneItem
@isMarkdownPreview = @editor[0]?
if @isMarkdownPreview
@editor.on 'markdown-preview:markdown-changed', =>
@listener?()
else
@... |
Make API work with citysdk data | RESTstop.configure()
RESTstop.add 'trips/:tiploc?', ->
tiploc = @params.tiploc
unless tiploc?
return [403,
success: false
message:'You need to provide a tiploc as a parameter'
]
schedules = getTodaysScheduleForTiploc(tiploc)
result = getArrivalAndDepartureTimes(tiploc, schedules)
results:... | RESTstop.configure()
RESTstop.add 'trips/:tiploc?', ->
tiploc = @params.tiploc
unless tiploc?
return [403,
success: false
message:'You need to provide a tiploc as a parameter'
]
schedules = getTodaysScheduleForTiploc(tiploc)
result = getArrivalAndDepartureTimes(tiploc, schedules)
results:... |
Modify enabled state when activated. | LineFocusStatsView = require './line-focus-stats-view'
module.exports = LineFocusStats =
lineFocusStatsViews: null
activate: (state) ->
console.log 'activate LineFocusStats'
@lineFocusStatsViews = []
atom.commands.add 'atom-workspace',
'line-focus-stats:toggle': => @toggle()
# @enable()
... | LineFocusStatsView = require './line-focus-stats-view'
module.exports = LineFocusStats =
lineFocusStatsViews: null
activate: (state) ->
console.log 'activate LineFocusStats'
@lineFocusStatsViews = []
atom.commands.add 'atom-workspace',
'line-focus-stats:toggle': => @toggle()
enabled = fals... |
Reduce achor navigation animation time | $ ->
$('a[href*=#]:not([href=#])').click ->
if location.pathname.replace(/^\//, '') == @pathname.replace(/^\//, '') and location.hostname == @hostname
target = $(@hash)
target = if target.length then target else $('[name=' + @hash.slice(1) + ']')
if target.length
$('html,body').animate {... | $ ->
$('a[href*=#]:not([href=#])').click ->
if location.pathname.replace(/^\//, '') == @pathname.replace(/^\//, '') and location.hostname == @hostname
target = $(@hash)
target = if target.length then target else $('[name=' + @hash.slice(1) + ']')
if target.length
$('html,body').animate {... |
Fix videoLoader. Run `load` for HTMLElement instead jQuery el. | {
jQuery: $
} = uploadcare
uploadcare.namespace 'utils', (ns) ->
trackLoading = (image, src) ->
def = $.Deferred()
if src
image.src = src
if image.complete
def.resolve(image)
else
$(image).one 'load', =>
def.resolve(image)
$(image).one 'error', =>
def.reje... | {
jQuery: $
} = uploadcare
uploadcare.namespace 'utils', (ns) ->
trackLoading = (image, src) ->
def = $.Deferred()
if src
image.src = src
if image.complete
def.resolve(image)
else
$(image).one 'load', =>
def.resolve(image)
$(image).one 'error', =>
def.reje... |
Use package name in menu | 'menu': [
'label': 'Packages'
'submenu': [
'label': 'Markdown'
'submenu': [
'label': 'Toggle Preview'
'command': 'markdown-preview:toggle'
]
]
]
'context-menu':
'.markdown-preview':
'Copy': 'core:copy'
'Save As HTML\u2026': 'core:save-as'
| 'menu': [
'label': 'Packages'
'submenu': [
'label': 'Markdown Preview'
'submenu': [
'label': 'Toggle Preview'
'command': 'markdown-preview:toggle'
]
]
]
'context-menu':
'.markdown-preview':
'Copy': 'core:copy'
'Save As HTML\u2026': 'core:save-as'
|
Add correct virtualenv dir to PATH | # Your init script
fs = require 'fs'
path = require 'path'
DEFAULT_WORKON_HOME = path.join(process.env.HOME, '.virtualenvs')
# Get path to directory containing all Python virtualenvs
getVirtualenvHome = ->
if process.env.WORKON_HOME
return process.env.WORKON_HOME
else
return DEFAULT_WORKON_HOME
# Acti... | # Your init script
fs = require 'fs'
path = require 'path'
DEFAULT_WORKON_HOME = path.join(process.env.HOME, '.virtualenvs')
# Get path to directory containing all Python virtualenvs
getVirtualenvHome = ->
if process.env.WORKON_HOME
return process.env.WORKON_HOME
else
return DEFAULT_WORKON_HOME
# Acti... |
Stop deletes overlapping comments (but leads to occasional flickering) | define [
"base"
], (App) ->
App.directive "reviewPanelSorted", ($timeout) ->
return {
link: (scope, element, attrs) ->
layout = () ->
entries = []
for el in element.find(".rp-entry")
entries.push {
el: el
scope: angular.element(el).scope()
}
entries.sort (a,b) -> a.s... | define [
"base"
], (App) ->
App.directive "reviewPanelSorted", ($timeout) ->
return {
link: (scope, element, attrs) ->
layout = () ->
entries = []
for el in element.find(".rp-entry")
entries.push {
el: el
scope: angular.element(el).scope()
}
entries.sort (a,b) -> a.s... |
Add oninput to contributions new | Neighborly.Projects.Contributions = {} if Neighborly.Projects.Contributions is undefined
Neighborly.Projects.Contributions.New =
modules: -> []
init: ->(
initialize: ->
$('.maturity-option .header').click this.boxClicked
$('.order-size-input').on 'keyup', this.orderSizeChanged
boxClicked: (ev... | Neighborly.Projects.Contributions = {} if Neighborly.Projects.Contributions is undefined
Neighborly.Projects.Contributions.New =
modules: -> []
init: ->(
initialize: ->
$('.maturity-option .header').click this.boxClicked
$('.order-size-input').on 'keyup input', this.orderSizeChanged
boxClicke... |
Implement item filtering in Model class | { flatten } = require('sdk/util/array');
class Model
constructor : (@sources, @filters) ->
@feeds = flatten(source.getFeeds() for source in @sources)
feed.on("updated", @onFeedUpdated) for feed in @feeds
@requestUpdate()
onFeedUpdated : (feed) =>
for item in feed.items
console.log(item.link)... | { flatten } = require('sdk/util/array');
Promise = require("sdk/core/promise")
class Model
constructor : (@sources, @filters) ->
@feeds = flatten(source.getFeeds() for source in @sources)
feed.on("updated", @onFeedUpdated) for feed in @feeds
@requestUpdate()
onFeedUpdated : (feed) =>
@filter(item)... |
Access active pane item from atom.workspace | class FocusAction
constructor: ->
isComplete: -> true
isRecordable: -> false
focusCursor: ->
editor = atom.workspaceView.getActivePaneItem()
editorView = atom.workspaceView.getActiveView()
if editor? and editorView?
cursorPosition = editor.getCursorBufferPosition()
editorView.scrollToBu... | class FocusAction
constructor: ->
isComplete: -> true
isRecordable: -> false
focusCursor: ->
editor = atom.workspace.getActivePaneItem()
editorView = atom.workspaceView.getActiveView()
if editor? and editorView?
cursorPosition = editor.getCursorBufferPosition()
editorView.scrollToBuffer... |
Add atom and xip.io stuff. | 'editor':
'showIndentGuide': true
'fontFamily': 'Menlo'
'fontSize': 15
'core':
'excludeVcsIgnoredPaths': true
'ignoredNames': [
'.bundle'
'.git'
'log'
'repositories'
'tmp'
'vendor'
]
'themes': [
'unity-ui'
'glacier-syntax'
]
'hideGitIgnoredFiles': true
'disabledPackag... | "*":
editor:
showIndentGuide: true
fontFamily: "Menlo"
fontSize: 15
invisibles: {}
core:
excludeVcsIgnoredPaths: true
ignoredNames: [
".bundle"
".git"
"log"
"repositories"
"tmp"
"vendor"
]
themes: [
"unity-ui"
"glacier-syntax"
]
... |
Refresh view when draft becomes message | NylasStore = require 'nylas-store'
Reflux = require 'reflux'
_ = require 'underscore'
{Message,
Actions,
DatabaseStore,
AccountStore,
FocusedContentStore,
DestroyDraftTask,
DatabaseView} = require 'nylas-exports'
class DraftListStore extends NylasStore
constructor: ->
@listenTo DatabaseStore, @_onDataChang... | NylasStore = require 'nylas-store'
Reflux = require 'reflux'
_ = require 'underscore'
{Message,
Actions,
DatabaseStore,
AccountStore,
FocusedContentStore,
DestroyDraftTask,
DatabaseView} = require 'nylas-exports'
class DraftListStore extends NylasStore
constructor: ->
@listenTo DatabaseStore, @_onDataChang... |
Add option to add account from context menu | React = require 'react'
{Actions} = require 'nylas-exports'
{RetinaImg} = require 'nylas-component-kit'
AccountCommands = require '../account-commands'
class AccountSwitcher extends React.Component
@displayName: 'AccountSwitcher'
@propTypes:
accounts: React.PropTypes.array.isRequired
focusedAccounts: Rea... | React = require 'react'
{Actions} = require 'nylas-exports'
{RetinaImg} = require 'nylas-component-kit'
AccountCommands = require '../account-commands'
class AccountSwitcher extends React.Component
@displayName: 'AccountSwitcher'
@propTypes:
accounts: React.PropTypes.array.isRequired
focusedAccounts: Rea... |
Remove crufty mark as read method | angular.module('loomioApp').directive 'threadPreviewCollection', ->
scope: {query: '=', limit: '=?'}
restrict: 'E'
templateUrl: 'generated/components/thread_preview_collection/thread_preview_collection.html'
replace: true
controller: ($scope, Records, CurrentUser) ->
$scope.lastVoteByCurrentUser = (thread... | angular.module('loomioApp').directive 'threadPreviewCollection', ->
scope: {query: '=', limit: '=?'}
restrict: 'E'
templateUrl: 'generated/components/thread_preview_collection/thread_preview_collection.html'
replace: true
controller: ($scope, Records, CurrentUser) ->
$scope.lastVoteByCurrentUser = (thread... |
Refactor and remove empty lines | angular.module("admin.products").directive "setOnDemand", ->
link: (scope, element, attr) ->
onHand = element.context.querySelector("#variant_on_hand")
onDemand = element.context.querySelector("#variant_on_demand")
if onDemand.checked
onHand.disabled = 'disabled'
onHand.dataStock = onHand.val... | angular.module("admin.products").directive "setOnDemand", ->
link: (scope, element, attr) ->
onHand = element.context.querySelector("#variant_on_hand")
onDemand = element.context.querySelector("#variant_on_demand")
disableOnHandIfOnDemand = ->
if onDemand.checked
onHand.disabled = 'disabled... |
Add specs for enhanced class-list handling | DefaultFileIcons = require '../lib/default-file-icons'
FileIcons = require '../lib/file-icons'
describe 'FileIcons', ->
afterEach ->
FileIcons.setService(new DefaultFileIcons)
it 'provides a default', ->
expect(FileIcons.getService()).toBeDefined()
expect(FileIcons.getService()).not.toBeNull()
it '... | fs = require 'fs-plus'
temp = require('temp').track()
path = require 'path'
DefaultFileIcons = require '../lib/default-file-icons'
FileIcons = require '../lib/file-icons'
describe 'FileIcons', ->
afterEach ->
FileIcons.setService(new DefaultFileIcons)
it 'provides a default', ->
expect(FileIcons.getServi... |
Use beforeEach block in validation message spec | #= require magic_word
describe 'ValidationMessage', ->
messageBox = $('<div>Stuff</div>')
m = new MagicWord.ValidationMessage messageBox
describe '#constructor', ->
it 'creates a validation message div', ->
expect(messageBox.siblings('.validation-msg').length).toBe(1)
describe '#successMessage', ->... | #= require magic_word
describe 'ValidationMessage', ->
beforeEach ->
@messageBox = $('<div>Stuff</div>')
@m = new MagicWord.ValidationMessage @messageBox
describe '#constructor', ->
it 'creates a validation message div', ->
expect(@messageBox.siblings('.validation-msg').length).toBe(1)
descri... |
Make the iframe with the player higher, to avoid scrolling even when the selection stats are displayed | ###* @jsx React.DOM ###
window.WFplayer = React.createClass
componentDidMount: ->
$node = $(@getDOMNode())
mediaObj = @props.mediaObj
$(document).tooltip
content: -> $node.prop('title')
corpus_id = mediaObj.corpus_id
line_key = mediaObj.mov.line_key
mov = mediaObj.mov.movie_loc
pa... | ###* @jsx React.DOM ###
window.WFplayer = React.createClass
componentDidMount: ->
$node = $(@getDOMNode())
mediaObj = @props.mediaObj
$(document).tooltip
content: -> $node.prop('title')
corpus_id = mediaObj.corpus_id
line_key = mediaObj.mov.line_key
mov = mediaObj.mov.movie_loc
pa... |
Make options argument optional in define function | behaviours = {}
share.attach = attach = (behaviour, args...) ->
check behaviour, Match.OneOf Function, String
if Match.test behaviour, String
options = behaviours[behaviour].options
behaviour = behaviours[behaviour].behaviour
if Match.test behaviour, Function
context =
collection: @
opt... | behaviours = {}
share.attach = attach = (behaviour, args...) ->
check behaviour, Match.OneOf Function, String
if Match.test behaviour, String
options = behaviours[behaviour].options
behaviour = behaviours[behaviour].behaviour
if Match.test behaviour, Function
context =
collection: @
opt... |
Update fixture package to use a tree-sitter grammar | 'name': 'Test Ruby'
'scopeName': 'test.rb'
'firstLineMatch': '^\\#!.*(?:\\s|\\/)(?:testruby)(?:$|\\s)'
'fileTypes': [
'rb'
]
'patterns': [
{
'match': 'ruby'
'name': 'meta.class.ruby'
}
]
| 'name': 'Test Ruby'
'type': 'tree-sitter'
'scopeName': 'test.rb'
'parser': 'tree-sitter-ruby'
'firstLineRegex': '^\\#!.*(?:\\s|\\/)(?:testruby)(?:$|\\s)'
'fileTypes': [
'rb'
]
|
Rename a local variable in "translate" function | CompositeDisposable = null
Range = null
module.exports = TranslatorPlusDictionary =
subscriptions: null
activate: (state) ->
# Initialize modules and classes
CompositeDisposable ?= require('atom').CompositeDisposable
Range ?= require('atom').Range
# Initialize fields
@subscriptions = new Comp... | CompositeDisposable = null
Range = null
module.exports = TranslatorPlusDictionary =
subscriptions: null
activate: (state) ->
# Initialize modules and classes
CompositeDisposable ?= require('atom').CompositeDisposable
Range ?= require('atom').Range
# Initialize fields
@subscriptions = new Comp... |
Revert "tabs dont handle cmd-w" | tabs:
'cmd-shift-{': (tabs) -> tabs.pane.prevTab()
'cmd-shift-}': (tabs) -> tabs.pane.nextTab()
'cmd-1': (tabs) -> tabs.pane.switchToTab 1
'cmd-2': (tabs) -> tabs.pane.switchToTab 2
'cmd-3': (tabs) -> tabs.pane.switchToTab 3
'cmd-4': (tabs) -> tabs.pane.switchToTab 4
'cmd-5': (tabs) -> tabs.pane.switchToT... | tabs:
'cmd-w': (tabs) -> tabs.pane.closeActiveTab()
'cmd-shift-{': (tabs) -> tabs.pane.prevTab()
'cmd-shift-}': (tabs) -> tabs.pane.nextTab()
'cmd-1': (tabs) -> tabs.pane.switchToTab 1
'cmd-2': (tabs) -> tabs.pane.switchToTab 2
'cmd-3': (tabs) -> tabs.pane.switchToTab 3
'cmd-4': (tabs) -> tabs.pane.switch... |
Add compress as default task | gulp = require 'gulp'
uglify = require 'gulp-uglify'
rename = require 'gulp-rename'
gulp.task 'compress', ->
gulp.src 'dist/position-sticky.js'
.pipe uglify()
.pipe rename('position-sticky.min.js')
.pipe gulp.dest 'dist'
| gulp = require 'gulp'
uglify = require 'gulp-uglify'
rename = require 'gulp-rename'
gulp.task 'compress', ->
gulp.src 'dist/position-sticky.js'
.pipe uglify()
.pipe rename('position-sticky.min.js')
.pipe gulp.dest 'dist'
gulp.task 'default', ['compress']
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.