Skip to content
You signed in with another tab or window. to refresh your session.
You signed out in another tab or window. to refresh your session.
You switched accounts on another tab or window. to refresh your session.
| "use strict" |
| api1 = |
| a: (x,y,z,cb) -> setTimeout cb.bind(null, null, x+y+z+1), 500 |
| b: (x,y,z,cb) -> setTimeout cb.bind(null, null, x+y+z+2), 500 |
| api2 = |
| b: (x,y,z,cb) -> setTimeout cb.bind(null, null, x+y+z+3), 500 |
| c: (x,y,z,cb) -> setTimeout cb.bind(null, null, x+y+z+4), 500 |
| # In an Iron Router Route (requires that the below publication is also set up) |
| # ===================================== |
| Router.configure |
| layoutTemplate: 'layout' |
| loadingTemplate: 'loading' |
| Router.map -> |
| @route 'member_show', |
| # like join, but returns an array |
| interpose = (array, glue) -> |
| array.reduce (res,x) -> [].concat res, glue, x |
| export default interpose |
Syfaro
/ foxbot.coffee
Created
Joins the FurCast IRC channel, spams ":3"s, then leaves and randomly joins again sometime in the next day
| irc = require 'irc' |
| client = new irc.Client 'irc.ircfox.net', 'FoxBot' |
| String.prototype.repeat = (num) -> |
| return new Array(num + 1).join this |
| randomNumber = (min, max) -> |
| return Math.floor Math.random() * (max - min) + min |
| Meteor.publish 'paths', (since) -> |
| pointHandles = {} |
| publishPath = (pathId) => |
| pointHandles[pathId] = Points.find({pathId: pathId}).observe |
| added: (obj) => |
| @set('points', obj._id, obj) |
| @flush() |
| # these two should never happen |
| changed: (obj) => |
| class Batman.SetTransform extends Batman.Set |
| constructor: (@source, observedItemKeys..., @transform) -> |
| super() |
| @transformIndex = new Batman.SimpleHash |
| if @source.isObservable |
| @_setObserver = new Batman.SetObserver(@source) |
| @_setObserver.observedItemKeys = observedItemKeys |
| @_setObserver.observerForItemAndKey = @observerForItemAndKey |
| @_setObserver.on 'itemsWereAdded', @add |
| @_setObserver.on 'itemsWereRemoved', @remove |
| # Gulp and plugins |
| gulp = require('gulp') |
| gutil = require('gulp-util') |
| plugins = require("gulp-load-plugins")(scope: ["dependencies", "devDependencies"]) |
| # Utilities |
| grunt = require('grunt') |
| glob = require('glob') |
| path = require('path') |
| event = require "events" |
| _ = require "underscore" |
| # Helps to organize callbacks. At this time, it breaks normal |
| # conventions and makes not attempt to catch errors or fire an 'error' |
| # event. |
| class Flow extends event.EventEmitter |
| constructor: -> |
| @count = 0 |
Most Common Regular Expressions Written in CoffeeScript
| # Drupal editor configuration normalization |
| # @see http://editorconfig.org/ |
| # This is the top-most .editorconfig file; do not search in parent directories. |
| root = true |
| # All files. |
| [*] |
| end_of_line = LF |
| indent_style = space |
You canβt perform that action at this time.