Skip to content

Instantly share code, notes, and snippets.

View Enome's full-sized avatar

Geert Pasteels Enome

View GitHub Profile
Installation
Install it using npm:
npm install ab-trolley --save
Pass you base Express.js application to trolley.
var trolley = require('ab-trolley');
trolley.use(app, '$', '/yourbackend')
Include the following locals in your template. Make sure you don't escape the values.
// Main.jade
block vars
h1=hey
// child.jade
block vars
-var hey = 'oh, hi';
for sport in voetbal rugby handbal vollybal basket tchouckball hockey
.{sport}
background: url(/images/bg_{sport}.jpg
@Enome
Enome / gist:4596942
Last active December 11, 2015 11:49
var http = require('http');
var express = require('express');
var app = express();
app.get('/my-form', function (req, res, next) {
var form_data = req.flash('form_data');
res.locals.form_data = form_data;
var validation_errors = req.flash('validation_errors');
res.locals.validation_errors = validation_errors;
<?php
# WRITE TO FILE
function write_to_file ($file, $str) {
@Enome
Enome / gist:4525325
Last active December 11, 2015 01:39
var controllers = {
GrowsIndexCtrl: function ($scope, data) {
$scope.grows = data.grows.many(); // Returns an array
$scope.remove = function (grow) {
data.grows.remove(grow); // Deletes from that same array
};
%lex
%%
\n+ { process.stdout.write('[ENDLINE(S)]\n'); return 'ENDLINE'; }
<<EOF>> { process.stdout.write('[EOF]'); return 'EOF'; }
app.configure(function(){
app.use(express.cookieParser());
app.use(express.session({ secret: 'keyboard cat' }));
app.use(function (req, res, next) { res.locals.session = req.session; next();});
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
//app.use(express.logger());
app.use(express.bodyParser());
include nodejs
package { 'serve':
ensure => latest,
provider => 'npm',
}
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="CustomerID"
DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="CustomerID" HeaderText="CustomerID" ReadOnly="True"
SortExpression="CustomerID" />
<asp:BoundField DataField="CompanyName" HeaderText="CompanyName"
SortExpression="CompanyName" />
<asp:BoundField DataField="ContactName" HeaderText="ContactName"
SortExpression="ContactName" />