Skip to content

Instantly share code, notes, and snippets.

View LunaBorowska's full-sized avatar

Luna Borowska LunaBorowska

View GitHub Profile
(function () {
// I need to avoid mandatory warning about using deprecated
// function, so I overwrite console.error(), so Node.js will
// think that everything is fine. After I'll do it, I restore
// original console.error()
var consoleError
try {
// This is like "local" in Perl
consoleError = console.error
console.error = function () {}
var format = require('python-format')
var messages = require('./messages')
module.exports = function (response) {
this.response = response
this.parts = Array.prototype.slice.call(arguments, 1)
this.name = 'IrcError'
this.message = format.apply(null, [messages[response]].concat(parts))
}
module.exports.prototype = new Error
>>> math.atan2(0, 0)
0.0
>>> math.atan2(0, -0)
0.0
>>> math.atan2(0, 0.)
0.0
>>> math.atan2(0, -0.)
3.141592653589793

Build Status

python-format is implementation of Python's str.format(). It works both in browser and in Node.js. If you want to use this in Node.js, just type npm install python-format in console.

var format = require('python-format')
console.log(format('My nick is {0}.', 'GlitchMr'))
#include <stdio.h>
#define inform(a) printf("%s", a)
#define LF "\n"
#define _ ; //\
void main() ||
int main()
void; {
return! inform("Hello, world!" LF) _
}
glitchmr@strawberry ~/g/SixtySixBot> perl6 sixtysix.p6
Connecting to irc.freenode.net on port 6667
Could not parse the following IRC event: :moorcock.freenode.net 004 SixtySixBot moorcock.freenode.net ircd-seven-1.1.3 DOQRSZaghilopswz CFILMPQbcefgijklmnopqrstvz bkloveqjfI
Method 'seek' not implemented for type Socket
in method send at src/gen/CORE.setting:7723
in method sendln at lib/Net/IRC/Bot.pm:55
in method connected at lib/Net/IRC/Handlers/Default.pm:39
in sub METAOP_HYPER_CALL at src/gen/CORE.setting:12012
in block at lib/Net/IRC/Bot.pm:163
in method reify at src/gen/CORE.setting:5187
glitchmr@strawberry ~/g/panda> perl6 rebootstrap.pl
==> Bootstrapping Panda
==> Fetching File::Tools
==> Building File::Tools
Compiling lib/File/Find.pm
Compiling lib/Shell/Command.pm
==> Testing File::Tools
t/01-file-find.t ...... ok
t/02-shell-command.t .. ok
All tests successful.
glitchmr@strawberry ~> cat debug.p6
use Grammar::Tracer;
grammar RawEvent {
token TOP {
^
[':' [<user>|<server=host>] <.space> || <?>]
<command>
[ <.space>+ [':'$<params>=(.*)$ || $<params>=<-space>+] ]*
$
}
use Grammar::Tracer;
grammar RawEvent {
token TOP {
^
[':' [<user>|<server=host>] <.space> || <?>]
<command>
[ <.space>+ [':'$<params>=(.*)$ || $<params>=<-space>+] ]*
$
}
grammar RawEvent {
token TOP {
^
[':' [<user>|<server=host>] <.space> || <?>]
<command>
[ <.space>+ [':'$<params>=(.*)$ || $<params>=<-space>+] ]*
$
}
token user {