Skip to content

Instantly share code, notes, and snippets.

View tanepiper's full-sized avatar

Tane Piper tanepiper

View GitHub Profile
var frames = 0, last = 0;
setInterval(function () {
if (last) {
var fps = frames / (Date.now() - last) * 1000;
console.log('fps: ' + fps);
}
last = Date.now();
frames = 0;
}, 1000);
###
Module dependencies
###
require.paths.unshift "#{__dirname}/lib/support/express-csrf/"
require.paths.unshift "#{__dirname}/lib/support/node_hash/lib/"
express = require 'express'
app = module.exports = express.createServer()
RedisStore = require 'connect-redis'
# Swappable Mixins in CoffeeScript
# ================================
# This is experimental. Not tested. It's just a toy, and I'm very new to
# javascript/coffeescript. Be warned.
# Usage
# -----
@tanepiper
tanepiper / gist:823717
Created February 12, 2011 12:03
xml2json
var sys = require('sys'), fs = require('fs'), libxml = require('./libxmljs');
var stack = [];
var parser = new libxml.SaxPushParser(function(cb) {
cb.onStartDocument(function() {
sys.log('Starting to parse ...');
});
cb.onStartElementNS(function(elem, attrs, prefix, uri, namespaces) {
var obj = {};
obj['@'] = {};
require.extensions[".json"] = function (module, filename) {
module.exports = JSON.parse(require("fs").readFileSync(filename, "utf8"))
}
loadSpecs = (paths...) ->
# expand all spec paths to full cache busted file paths
paths = for path in paths
"spec/#{path}_spec.js?#{new Date().getTime()}"
# Load the specs with head.js, and start a spec run 1 second after they load.
head.js paths..., ->
setTimeout ->
jasmine.getEnv().addReporter(new jasmine.TrivialReporter())
jasmine.getEnv().execute()
// Target API:
//
// var s = require('net').createStream(25, 'smtp.example.com');
// s.on('connect', function() {
// require('starttls')(s, options, function() {
// if (!s.authorized) {
// s.destroy();
// return;
// }
//
$.fn.extend
myplugin: (options) ->
self = $.fn.myplugin
opts = $.extend {}, self.default_options, options
$(this).each (i, el) ->
self.init el, opts
self.log el if opts.log
$.extend $.fn.myplugin,
default_options:

10 Ways to improve Github Issues

I love the new GitHub issues, here are some ideas to make it perfect, ordered by priority:

  1. I should be able to pick the assignee and milestone via keyboard when creating a new ticket
  2. Keyboard shortcuts should work everywhere. For example when viewing an existing issue, 'c' will not create a new one.
  3. After creating an issue, the assigned user / milestone should be pre-filled when creating the next issue.
  4. When commenting, I should also be able to assign a different user. Right now this deletes my half-typed comment.
  5. When typing the @ symbol to mention somebody, it should auto-complete the name.
  6. This might just be me, but things feel a little sluggish right now, any improvements would be very welcome.
//First you create your new page element to later be appended to the tab element
var amlPage = new apf.page({
id : "chatUser" + chatUserID,
caption : chatUserName,
name : "groupchat",
closebtn : "true",
childNodes : [
new apf.toolbar({
height : "6"