Skip to content

Instantly share code, notes, and snippets.

View KamilaBorowska's full-sized avatar

Kamila Borowska KamilaBorowska

View GitHub Profile
# IRC client implementation for YIBot 2.0. Technically, it's main part of
# program, but YIBot now supports not only IRC :).
{Server} = require '../server'
# Class IRC itself
class exports.IRC extends Server
constructor: (@name, @config) ->
unless @config.Host?
throw new Error "Server #{@name} doesn't have specified server!"
@KamilaBorowska
KamilaBorowska / gist:2007238
Created March 9, 2012 15:59
Configuration?
# List of plugins
Plugins = [
'eightball'
]
# Servers configuration
exports.config =
Freenode:
Type: 'IRC'
Host: 'irc.freenode.net'
# List of plugins
Plugins = [
'eightball'
]
# Servers configuration
exports.config =
Freenode:
Type: 'IRC'
Host: 'irc.freenode.net'
@KamilaBorowska
KamilaBorowska / square.pm
Created March 28, 2012 18:20
ACME::Square
package ACME::Square;
use strict;
use warnings;
use Carp;
use Exporter;
use base 'Exporter';
our $VERSION = 20120328;
our @EXPORT_OK = qw( square );
sub square ($) {
my ($a) = @_;
@KamilaBorowska
KamilaBorowska / gist:2464490
Created April 22, 2012 15:01
Proper JavaScript classes
function makePoint(x, y) {
"use strict";
return {
x: x,
y: y,
distanceTo: function (point) {
var dx = this.x - point.x,
dy = this.y - point.y;
return Math.sqrt(dx * dx + dy * dy);
}
1166921663690473895545451437288890824967209763846036195355478259685499755495985891253762567430324915676001472271918271094415586466723319374588006956374292029453713316363425418160396564203771865064310879611058641475660285382224615198885061067875539388019448617819980260958631744579513784049323687410130880533711492664033421140212284951689598943248600620179682880250418664663957352432341838365673214361630485521517749075741474559956231270665467997137079902474126142762115005984897533653801051793249320473552493343779064645161318303780490402912370748852517808034139243250458164078949047886982796914199764296296807066739570791443109526447262061314030717983609197715534605687201740877720140616147527714824932408027860286615081293619395438085765485290819145397565371607252063200686551164878102219057076558307586325955564879574446512319131921062704960655793267026957167917063794380943217707027830302967462014508509209614605260634239370180237402891199427599903412117002323467259308163914101551274831667014906804464253783176889767632
@KamilaBorowska
KamilaBorowska / gist:2994736
Created June 26, 2012 09:47
awk? It's fast enough...
$ echo aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | time awk /a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
0.00user 0.00system 0:00.00elapsed 0%CPU (0avgtext+0avgdata 3600maxresident)k
0inputs+0outputs (0major+275minor)pagefaults 0swaps
$ echo aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | time perl -nE'print if /a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?a?aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/'
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
65.73user 0.52system 1:06.46elapsed 99%CPU (0avgtext+0avgdata 6832maxresident)k
0inputs+0outputs (0major+477minor)pagefaults 0swaps
== Str.wordcase ==
multi sub wordcase(Str:D :&filter = &lc, :%exceptions = set()) returns Str
multi method wordcase(Str:D: :&filter = &lc, :%exceptions = set()) returns Str
Performs a Unicode titlecase operation on the first character of each word of the string (as defined by a regex « boundary), and forces the rest of the letters through a filter that defaults to lc. After this operation, if any exceptions are supplied and if the word is found in the set of exceptions, the first character is also forced through the filter. Note that the exceptions must be spelled with an initial titlecase, such as "By" or "And", to produce "by" or "and".
== Date.day-of-year ==
method day-of-year(Date:D:) returns Int:D
Returns the day of the year (1..366).
Str.wordcase (Perl 6) http://doc.perl6.org/type/Str#wordcase Performs a Unicode titlecase operation on the first character of each word of the string (as defined by a regex « boundary), and forces the rest of the letters through a filter that defaults to lc. After this operation, if any exceptions are supplied and if the word is found in the set of exceptions, the first character is also forced through the filter. Note that the exceptions must be spelled with an initial titlecase, such as "By" or "And", to produce "by" or "and". multi sub wordcase(Str:D :&filter = &lc, :%exceptions = set()) returns Str\nmulti method wordcase(Str:D: :&filter = &lc, :%exceptions = set()) returns Str
Date.day-of-year (Perl 6) http://doc.perl6.org/type/Date#day-of-year Returns the day of the year (1..366). method day-of-year(Date:D:) returns Int:D
List.shift (Perl 6) http://doc.perl6.org/type/List#shift Removes and returns the first item from the list, fails for an empty list. multi sub shift(List:D )\nmulti metho
glitchmr@strawberry ~/g/perl> ./Configure
Beginning of configuration questions for perl5.
Checking echo to see how to suppress newlines...
...using \c
The star should be here-->*
First let's make sure your kit is complete. Checking...
Looks good...