I hereby claim:
- I am jfromaniello on github.
- I am jose (https://keybase.io/jose) on keybase.
- I have a public key whose fingerprint is E084 A19D 285D C71D D8C2 1E56 FD13 B550 5327 DB0E
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| function onlyStatic (middleware) { | |
| return function (req, res, next) { | |
| var match = /(\.css|\.eot|\.gif|\.html|\.js|\.png|\.svg|\.ttf|\.woff|\.jpg)($|\?.*$)/ig.exec(req.originalUrl); | |
| if (!match) return next(); | |
| middleware(req, res, next); | |
| }; | |
| } | |
| //usage | |
| this.use(onlyStatic(express.static(__dirname + "/public"))); |
| app.get('/foo', function (req, res) { | |
| var proxy = request.get('https://foo.bar/blah'); | |
| //intercept the response: | |
| proxy.pipefilter = function (response, dest) { | |
| console.log('The statusCode was: ', response.statusCode); | |
| }; | |
| proxy.pipe(res); | |
| }); |
| //very very bad: | |
| app.use(express.cookieParser()) | |
| app.use(express.session({ secret: 'keyboard cat', key: 'sid', cookie: { secure: true }, store: blabla})) | |
| app.use(express.static(__dirname + '/public')); | |
| //good: | |
| app.use(express.static(__dirname + '/public')); | |
| app.use(express.cookieParser()) |
| test |
| #!/usr/bin/env bash | |
| set -e | |
| PHANTOM_FILE=phantomjs-1.9.7-linux-x86_64 | |
| cd /usr/local/share | |
| curl -Lo $PHANTOM_FILE.tar.bz2 https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_FILE.tar.bz2 |
| # Description: | |
| # Show an image of a sad panda everytime someone use `@channel` to notify every user on a channel. | |
| # | |
| # Dependencies: | |
| # None | |
| # | |
| # Configuration: | |
| # None | |
| # | |
| # Commands: |
| // From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys | |
| if (!Object.keys) { | |
| Object.keys = (function() { | |
| 'use strict'; | |
| var hasOwnProperty = Object.prototype.hasOwnProperty, | |
| hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'), | |
| dontEnums = [ | |
| 'toString', | |
| 'toLocaleString', | |
| 'valueOf', |
| public class ConversationQueryable<T> : IQueryable<T> | |
| { | |
| private readonly IConversationsContainerAccessor _conversationsContainerAccessor; | |
| private readonly IQueryable<T> _realQueryable; | |
| public ConversationQueryable( | |
| IConversationsContainerAccessor conversationsContainerAccessor, | |
| IQueryable<T> realQueryable) | |
| { | |
| _conversationsContainerAccessor = conversationsContainerAccessor; |