This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Marty.HttpStateSource.removeHook('parseJSON'); | |
Marty.HttpStateSource.addHook({ | |
id: 'CSRF', | |
priority: 1, | |
before(req) { req.headers['CSRF-Token'] = /* ... obtain a csrf token from somewhere in your application ... */ } | |
}); | |
class Application extends Marty.Application { | |
constructor(options = {}) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Fiber from 'fibers'; | |
// Modify express to always spawn a new fibre if none are active. | |
export default function (router) { | |
var oldProcess = router.process_params; | |
if (oldProcess) | |
router.process_params = function(...args) { | |
if (!Fiber.current) | |
Fiber(oldProcess.bind(router, ...args)).run(); | |
else | |
oldProcess.apply(router, args); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
(env sed --version &> /dev/null || (echo -e "GNU sed not found, attempting to install package:\n";\ | |
(exec 3>&1 4>&2; sed_error=$( { mingw-get install msys-sed 2>&4 1>&3; } 2>&1 ); exec 3>&- 4>&-;\ | |
if ($sed_error); then echo "Could not install GNU sed, aborting.."; exit 1; fi))) && sed_ver_str=\ | |
$(env sed --version) && sed_ver=$(echo $sed_ver_str | sed -n 's/.*version \([0-9\.]*\).*/\1/p') &&\ | |
echo "GNU sed is already installed. (version $sed_ver)" && mingw-get update && PACKAGES=$(mingw-get list\ | |
| sed -ne "s/\(^Package\:\)[[:blank:]]\?\([[:alnum:][:punct:]]\+\).*$/\2\\n/p")\ && echo -en \ | |
"\nInstalling packages:\n\n$(echo $PACKAGES | tr ' ' '\n' | sort -d | pr -3 -atT)\n\n" && echo -en\ | |
"Package Count: $(echo $PACKAGES | tr ' ' '\n' | wc -l -- | tr -d '[:space:]' && echo)\n\n" && read\ | |
-p "Press return to install" -s && mingw-get --verbose=2 install $PACKAGES |
NewerOlder