Skip to content

Instantly share code, notes, and snippets.

@georgebrock
Created March 18, 2013 14:09
Show Gist options
  • Save georgebrock/5187391 to your computer and use it in GitHub Desktop.
Save georgebrock/5187391 to your computer and use it in GitHub Desktop.
Stockholm Vim: Vim Golf challenges
// Before
function foo(hello, world,
how, are,
you) {
}
// After
function foo(parameters) {
var hello = parameters.hello;
var world = parameters.world;
var how = parameters.how;
var are = parameters.are;
var you = parameters.you;
}
// Before
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.
// After
Accusam
Aliquyam
Amet
At
Clita
Consetetur
Diam
Dolor
Dolore
Dolores
Duo
Ea
Eirmod
Elitr
Eos
Erat
Est
Et
Gubergren
Invidunt
Ipsum
Justo
Kasd
Labore
Lorem
Magna
No
Nonumy
Rebum
Sadipscing
Sanctus
Sea
Sed
Sit
Stet
Takimata
Tempor
Ut
Vero
Voluptua
// Before
lamb had a little Mary,
Whose fleece was white as snow.
And everywhere that lamb went,
The Mary was sure to go.
It followed her to school one day,
Which was against the rule.
It made the children laugh and play,
To see a Mary at school.
And so the teacher turned it out,
But still it lingered near,
And waited patiently about,
Till lamb did appear.
"Why does the Mary love lamb so?"
The eager children cry.
"Why, lamb loves the Mary, you know."
The teacher did reply.
// After
Mary had a little lamb,
Whose fleece was white as snow.
And everywhere that Mary went,
The lamb was sure to go.
It followed her to school one day,
Which was against the rule.
It made the children laugh and play,
To see a lamb at school.
And so the teacher turned it out,
But still it lingered near,
And waited patiently about,
Till Mary did appear.
"Why does the lamb love Mary so?"
The eager children cry.
"Why, Mary loves the lamb, you know."
The teacher did reply.
# Before
class Pointless:
def lotsa_arguments(self, first, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth, sixteenth, seventeenth, eighteenth, nineteenth, twentieth, twenty_first, twenty_second, twenty_third):
"Doesn't even use all those arguments. What a waste."
pass
# File-specific indent settings!
# More VimGolf challenges need modelines.
# vim: set sw=4 et ft=python:
# After
class Pointless:
def lotsa_arguments(self, first, second, third, fourth, fifth, sixth,
seventh, eighth, ninth, tenth, eleventh, twelfth,
thirteenth, fourteenth, sixteenth, seventeenth,
eighteenth, nineteenth, twentieth, twenty_first,
twenty_second, twenty_third):
"Doesn't even use all those arguments. What a waste."
pass
# File-specific indent settings!
# More VimGolf challenges need modelines.
# vim: set sw=4 et ft=python:
// Before
1
2
3
4
5
6
7
8
9
10
// After
1
2
3
4
5
6
7
8
9
10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment