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
@kapouer
kapouer / asan.log
Created May 12, 2016 20:41
engine.io: LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.2 EIO_WS_ENGINE=uws gulp test > asan.log
[22:39:35] Using gulpfile ~/Software/github/engine.io/gulpfile.js
[22:39:36] Starting 'test'...
․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․
․․․․․․․․․․․․․․․․
71 passing (5s)
1 failing

Un petit howto pour certbot / nginx sur une debian testing, en date du 2016-05-04.

sudo -s mkdir /var/www/certbot

et un fichier /etc/nginx/snippets/certbot.conf contenant

location /.well-known/acme-challenge {
users.tsv @@ to_tsquery('(' || array_to_string(ARRAY(SELECT ts_rewrite(to_tsquery(input.tokens), 'SELECT ' || input.tokens || '::tsquery, array_to_string(ARRAY(SELECT CASE WHEN nentry > 1000 THEN (''!'' || word) ELSE users_words.word END AS word FROM users_words, (SELECT ' || input.tokens || '::TEXT AS input) AS c WHERE word % c.input AND length(word) = length(c.input) ORDER BY word <-> c.input ASC LIMIT 2), '' | '', '''')::tsquery') FROM (SELECT unnest(regexp_split_to_array(plainto_tsquery('verney conseil')::TEXT, ' & ')) AS tokens) AS input), ') & (') || ')')
#!/bin/sh
cat <<EOF | patch --backup --forward --strip 1 --quiet --reject-file - || true
--- a/node_modules/webcomponents.js/webcomponents-lite.js
+++ b/node_modules/webcomponents.js/webcomponents-lite.js
@@ -1026,6 +1026,7 @@
return clone;
};
TemplateImpl.fixClonedDom = function(clone, source) {
+ if (!source.querySelectorAll) return;
@kapouer
kapouer / waitReady.js
Created March 12, 2016 14:51
dom ready with IExx compat
function waitReady(cb) {
if (waitReady.done) return cb();
// https://github.com/jquery/jquery/issues/2100
if (document.readyState == "complete" ||
(document.readyState != "loading" && !document.documentElement.doScroll)) {
waitReady.done = true;
return setTimeout(cb);
}
var self = this;
function listener() {
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 + },
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
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' }