Skip to content

Instantly share code, notes, and snippets.

View rhyslbw's full-sized avatar

Rhys Bartels-Waller rhyslbw

  • Input Output Global
  • UK
  • 20:22 (UTC +01:00)
View GitHub Profile
@rhyslbw
rhyslbw / README.MD
Last active September 4, 2017 12:29
My standard Pug lint configuration with demo Gulp task

pug | gulp-pug-lint

var gulp = require('gulp');
var puglint = require('gulp-pug-lint');

gulp.task('pugLint', function() {
  return gulp
    .src(./src/views/**/*.pug)
 .pipe(puglint());

Keybase proof

I hereby claim:

  • I am rhyslbw on github.
  • I am rhyslbw (https://keybase.io/rhyslbw) on keybase.
  • I have a public key ASA1LtOQ9oH8reuT7-p4I5knrALphM_uy5LzxrfTjbeEEwo

To claim this, I am signing this object:

@rhyslbw
rhyslbw / abstract-timestamp-checking-in-space-aggregate-tests.coffee
Created October 1, 2015 10:46
Proposed API for abstracting timestamp checking in Space Aggregate testing
describe 'Space.accounts.User', ->
beforeEach ->
@createUser = new Space.accounts.CreateUser {
targetId: new Guid
username: new Username('testUsername')
email: new EmailAddress('test@email.com')
password: new Password('123')
}
@rhyslbw
rhyslbw / Simple_capped_logging_collection.coffee
Created June 24, 2015 10:54
Very simple way to log events into a 1GB capped collection on the current Meteor server
Logs = new Mongo.Collection 'logs'
# Collection capped at 1GB and
# http://docs.mongodb.org/manual/core/capped-collections/
# https://github.com/meteor/meteor/blob/07b6a2245a1e091830844881e7376c38adda3592/packages/mongo/collection.js
Logs._createCappedCollection 1000000000, 8000000
Meteor.methods
'log': (source, event) ->
@unblock()
@rhyslbw
rhyslbw / job-collection-manager.js
Last active August 29, 2015 14:23
Proof of concept for Job Collection
/**
*
* @constructor
* @param {string} name A name for the queue instance
* @param {Object} options - options.driver String Alternative Mongo Url, options.customIndexes Object, options.setLogStream String, options.autoStart Boolean, options.security Object, options.jobsPublish Object, options.queues Array,
* @returns {undefined}
* @public
*/
# on the server: server.coffee
Metrics = (name, aggregationQuery, collection, interval) ->
@name = name
@aggregationQuery = aggregationQuery
@collection = collection
@interval = interval or 1000*10
@_collectionName = 'metrics-transport'
Metrics.prototype._getCollectionName = -> "metrics-#{@name}"
@rhyslbw
rhyslbw / meteor_patterns.md
Last active August 29, 2015 14:08
Meteor Patterns

Asynchronous task

Wrap call or code with Meteor.defer() (same as Meteor.setTimeout()with value of 0) to allow the method to continue executing without waiting for the task to fully complete.

Meteor.defer(function(){
    Email.send({
      from: "hello@todoapp.com",
      to: follower,
 subject: "New todo added",
@rhyslbw
rhyslbw / meteor_node_tools.md
Last active August 29, 2015 14:08
Meteor Node Tools
@rhyslbw
rhyslbw / js_libraries_i_use.md
Last active August 29, 2015 14:08
Javascript Libraries I Use

DOM Manipulation, Event Handling, AJAX

jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers. With a combination of versatility and extensibility, jQuery has changed the way that millions of people write JavaScript.

  • meteor add jquery
  • npm install jquery
  • bower install jquery

##Underscore.js Utility Belt of Helpers