Skip to content

Instantly share code, notes, and snippets.

View ralt's full-sized avatar

Florian Margaine ralt

View GitHub Profile
module.exports = {
io: null,
socket: null,
createReactiveMethod: function() {},
initialize: function(server) {
console.log("initialized!");
this.io = require('socket.io').listen(server);
var that = this;
@ralt
ralt / x.js
Created May 29, 2012 17:22 — forked from Raynos/x.js
var UserCollection = require("../dataSources/user")
var User = {
find: function( name, skypeName, callback ) {
if ( skypeName ) {
findBySkypeName( name, callback );
}
// The rest of your logic there
}
}
// Assume errorPage, jsonBody, formBody exist within scope.
function methods(routes, handleHttpForms) {
if (handleHttpForms) {
return createHttpFormsRequestHandler(routes)
}
return requestHandler.bind(this)
}
function requestHandler(req, res) {
@ralt
ralt / jquery-second-click.js
Created September 28, 2012 19:13 — forked from ryankinal/jquery-second-click.js
jQuery "second click" plugin
// Untested, off-the-cuff
$.fn.secondClick = function(handler)
{
if ( !$( this ).data( 'click' ) ) {
$( this ).data( 'click', 1 );
}
else if ( $( this ).data( 'click' ) === 1 ) {
handler();
$( this ).data( 'click', '' );
}
@ralt
ralt / rl-input.user.js
Last active December 11, 2015 17:28 — forked from rlemon/rl-input.user.js
// ==UserScript==
// @name rlInput box
// @author Robert Lemon
// @version 0.1
// @namespace http://rlemon.com
// @description Produces a small input area for you to execute Javascript on the page. Saves scripts in LocalStorage and executes on page load.
// @include *
// ==/UserScript==
(function () {
@ralt
ralt / mk_awsm.js
Last active December 12, 2015 01:29 — forked from Zirak/mk_awsm.js
//ths fnctn tks sntnc nd trns t t awsm
//md fr jvscrpt rm
// http://chat.stackoverflow.com/transcript/message/7491494#7491494
var mk_awsm = function(sntnc) {
return sntnc.split(' ').map(function(wrd) {
return 1 >= wrd.length ?
wrd :
2 == wrd.length ?
wrd[0] :
/:.*(.)/.test(wrd) ?
@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 / linux.md
Last active August 29, 2015 14:22 — forked from Zirak/linux.md

In order (maybe). Some stuff are Arch specific.

Base system stuff

  • grub
  • os-prober

A decent shell and a way to talk to the world

  • zsh
  • grml-zsh-config
  • fish
@ralt
ralt / 000.mkd
Created February 25, 2018 21:45 — forked from packz/000.mkd
Static cryptsetup

I suppose you use Debian-like systems

$ mkdir rootdir && cd rootdir && export ROOTDIR=$PWD
$ apt-get source libdevmapper1.02.1
$ apt-get source cryptsetup