Skip to content

Instantly share code, notes, and snippets.

View kapouer's full-sized avatar
💭
finalizing pageboard, next gen website editor

Jérémy Lal kapouer

💭
finalizing pageboard, next gen website editor
View GitHub Profile
.\" Generated with Ronnjs 0.4.0
.\" http://github.com/kapouer/ronnjs
.
.TH "NODE\-GYP" "1" "March 2013" "" ""
.
.SH "NAME"
\fBnode-gyp\fR \-\- native addon build tool for node
.
.SH "SYNOPSIS"
.
@kapouer
kapouer / gist:6301360
Last active December 21, 2015 11:49
however bad these examples are, they show the basic way to pipe stuff into node-tar
function createEntry(data, path, root) {
var entry = new stream.Readable();
var allpushed = false;
entry._read = function(s) {
if (allpushed) {
this.push(null);
} else {
this.push(data);
allpushed = true;
}
@kapouer
kapouer / gist:7634923
Last active December 29, 2015 07:19
GH-177 test cooking
require('./common');
var http = require('http');
var server = http.createServer();
server.listen();
var engine = eio.attach(server, {
allowUpgrades: true,
transports: ['polling', 'websocket'],
pingInterval:4000,
@kapouer
kapouer / gist:74ee29861971d99fd5dc
Created May 25, 2014 23:15
node-orm2 PostGIS custom type example
orm.db.defineType('GeoJSON', {
datastoreType: function GeoJSON_datastoreType(prop) {
return 'geometry(Geometry, 4326)';
},
datastoreGet: function GeoJSON_datastoreGet(prop, helper) {
return 'ST_AsGeoJSON(' + prop.mapsTo + ')::JSON';
},
valueToProperty: function GeoJSON_valueToProperty(value, prop) {
if (typeof value == "string") return JSON.parse(value);
else return value;
@kapouer
kapouer / gist:566615bbb9929e99d765
Created October 13, 2014 18:16
ogr2ogr no error but error
var ogr2ogr = require('../')
var sampleNogeom = __dirname+'/samples/sample-nogeom.csv'
// createdb|dropdb nogeomtest
ogr2ogr(sampleNogeom)
.format("PostgreSQL")
.project("EPSG:4326")
.destination('PG:dbname=nogeomtest')
function getXml(url, cb) {
var xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.onreadystatechange = function (e) {
if (xhr.readyState == 4) {
var code = xhr.status;
if (code >= 200 && code < 400) {
cb(null, xhr.responseXML);
} else {
var err = new Error(xhr.responseText);
session rights /lefigaro.fr s4sfqJBi5_euHMCU3WBAS68g5Axx5kCW [ 'read' ] [ 'write lefigaro.fr', 'auth' ]
set sid:s4sfqJBi5_euHMCU3WBAS68g5Axx5kCW
GET 200 20.783 ms /lefigaro.fr?auth=01020304 - 49
set right=auth&type=json http://localhost:3000/lefigaro.fr?auth=01020304
set right=auth&type=json http://localhost:3000/lefigaro.fr?auth=01020304
set sid:zWqh4RmAw5HX9i3ShrUavG2JUf8oH6sZ
GET 302 55.039 ms /lefigaro.fr/test/write?_token=123456 - 102
vary for { right: 'read,write lefigaro.fr' }
vary for { right: 'read' }
vary for { right: 'write lefigaro.fr' }
Comment soumettre un formulaire ?
1. Validation en javascript
Quand valide, javascript envoie le formulaire en XHR - ou si on veut
gagner du temps, on peut soumettre le formulaire par HTML.
2. POST vers l'url du document
La route s'occupe de faire la requête correcte vers la ressource concernée,
et ce qui est renvoyé dépend du client:
- si HTML, on fait une redirection
Resource.relationMappings = {
27 + children: {
28 + relation: Model.ManyToManyRelation,
29 + modelClass: Resource,
30 + join: {
31 + from: 'raja_resources.id',
32 + through: {
33 + from: 'raja_relations.parent_id',
34 + to: 'raja_relations.child_id'
35 + },
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.