Skip to content

Instantly share code, notes, and snippets.

View ralt's full-sized avatar

Florian Margaine ralt

View GitHub Profile
@ralt
ralt / gist:8805241
Last active September 7, 2016 16:28
Design/Integration tools
Here is the kind of tool I want.
The design team is interested in helping us be faster at integrating their work.
Here is what the integration teams need:
- Font families: on which text?
- Font sizes: on which text?
- Cut icons and pictograms (PNG or SVG)
- Sizes of layout (columns, rows, borders)
@ralt
ralt / gist:8499332
Created January 19, 2014 01:40
Pandoc and Beamer
$ pandoc -D beamer > beamer.tex # See the template that pandoc uses to generate the latex
$ pandoc -t beamer file.md -i --toc -V theme:Szeged -V colortheme:crane -o file.pdf
# -i is to show incrementally the items of a list
# --toc generates the table of contents
# -V replaces a variable used in the beamer.tex template
# Reference: http://johnmacfarlane.net/pandoc/demo/example9/producing-slide-shows-with-pandoc.html
@ralt
ralt / gist:7168284
Created October 26, 2013 11:19
SO Login using node.js
var http = require('http'),
https = require('https'),
jsdom = require('jsdom'),
url = require('url'),
req;
req = http.request({
method: 'POST',
host: 'stackoverflow.com',
path: '/users/signin',
@ralt
ralt / gist:5705968
Last active December 18, 2015 01:48
oOOoOoOoo is annoying
http://chat.stackoverflow.com/messages/9801864/history
http://chat.stackoverflow.com/messages/9802972/history
http://chat.stackoverflow.com/messages/9803139/history
http://chat.stackoverflow.com/messages/9901384/history
http://chat.stackoverflow.com/messages/9902279/history
http://chat.stackoverflow.com/messages/10055261/history
http://chat.stackoverflow.com/messages/10160974/history
http://chat.stackoverflow.com/messages/10177459/history
http://chat.stackoverflow.com/messages/10590194/history
http://chat.stackoverflow.com/messages/10590195/history
// module.js
module.exports = function() {
var not = 'shared',
between = 'objects';
return {
an: ['array'],
some: method() {}
};
@ralt
ralt / gist:5644131
Last active December 17, 2015 17:09 — forked from Zirak/gist:5644118

Current situation: A small amount of users annoy the lot of us, we have no power to ban them, mods are annoyed.

Official solution: Go into Gallery mode, so all users can view, only users with explicit write permissions can write. This has the problem of approving users. We don't want to manually approve nearly everyone just to disapprove a small number.

Wayward solution: Use Gallery mode with the bot. When a user enters the room, the bot grants him write access automatically. If the user already has the access, the write access request will just send back a 400 error. No biggie. As it's automatic, the transition is nearly seamless. If a user is banned, the bot won't grant him write access.

@ralt
ralt / gist:5574170
Last active December 17, 2015 07:39
function serialize(form) {
return [].reduce.call(form.elements, function(r, element) {
return r + (r === '' ? '' : '&') + (function() {
switch (element.type) {
case 'checkbox':
return name(element.checked);
case 'radio':
return element.checked ? name(element.value) : '';
@ralt
ralt / gist:5561744
Last active December 17, 2015 05:59
Example of bind usage
var obj = {
clickHandler: function() {
console.log(this); // "el"
}
};
el.addEventListener('click', obj.clickHandler.bind(el));
// Without "bind", we need something like this:
var obj = {
@ralt
ralt / gist:5543578
Last active December 17, 2015 03:29
List of list of books
List of list of books so that we can do book exchanges.
Florian Margaine: https://gist.github.com/Ralt/5543525
@ralt
ralt / gist:5543525
Created May 8, 2013 20:46
My programming books
Code Complete 2