Seu trabalho é abrir uma janela do navegador padrão em http://codegolf.stackexchange.com .
Seu código deve abrir o próprio navegador e não pode depender de um aberto.
Isso é código-golfe , então a resposta mais curta em bytes vence.
Seu trabalho é abrir uma janela do navegador padrão em http://codegolf.stackexchange.com .
Seu código deve abrir o próprio navegador e não pode depender de um aberto.
Isso é código-golfe , então a resposta mais curta em bytes vence.
Respostas:
GNU Emacs,
292714 bytesO EWW é um navegador dentro do Emacs. A
browse-web
função é um alias paraeww
e, portanto, tornaeww
o navegador padrão no Emacs:Obrigado a @CoolestVeto, @ Jonathan Leech-Pepin e @ zyabin101.
fonte
www.ppcg.lol
vez dehttp://ppcg.lol
?//
, eu não acho. (Eu não uso emacs, mas é geralmente aceite sem a//
)Oração , 41 bytes
Não vencendo, mas com certeza foi divertido. A partir de agora, estou apenas 1 bytee atrás do python!
Explicação:
I need
compilaimport $1
comwebbrowser
sendo o módulo.Now
executa o seguinte comando do módulo comomodule.command
nos argumentos de qualquer coisa a seguir.Portanto, isso compila para:
No
http:
entanto, acabo precisando da peça, e não pode ser reduzida.fonte
"http://ppcg.lol"
com"http:ppcg.lol"
. Não tenho certeza se você pode remover o espaço entreopen
e"http:..."
, mas tente?Lote, 17 bytes
Economizou 3 bytes graças ao Mego.
Isso será aberto no seu navegador padrão se você o executar na linha de comando do Windows.
Acho que também funcionará em Powershell, mas não tenho certeza.
fonte
start
vez deexplorer
.start www.ppcg.lol
vez disso, você pode usar para que o Windows o analise implicitamente como HTTP. Funciona no CMD e no PowerShell.www.
?PowerShell,
1716 bytesUsando um domínio ainda mais curto fornecido pelo Milo.
Enquanto
start
é um alias conhecido,Start-Process
existe outro parasaps
. Você pode ver isso emGet-Alias
. Segue a convenção para similarStart-
eStop-
cmdlets.fonte
Terminal (OSX),
201817 bytesGuardado 2 graças a CoolestVeto
fonte
open
é um utilitário OSX, não um bash; isso seria chamado de forma mais apropriada "linha de comando OSX".//
.open http:ppcg.ga
MATLAB,
2825 byteswww
é menor quehttp://
e garante que o endereço seja processado como um URLweb('www.ppcg.lol', '-browser')
.web ppcg.lol -browser
pois o MATLAB anexará automaticamente umhttp://
( 21 bytes )Alternativas :
Nas janelas, isso pode ser reduzido para ( 19 bytes )
No OS X ( 21 bytes )
O seguinte funcionaria em um aplicativo MATLAB implantado ( 16 bytes )
Se o navegador embutido puder ser usado, isso poderá ser reduzido ainda mais conforme
http
está implícito ( 12 bytes )fonte
open
command does the same.!
does in MATLAB, it's the equivalent ofsystem(command)
. I had it as more of a demonstration of other alternatives that could be executed from within MATLAB. Is that OK?www.
?www
is unnecessary only on OS XAutoHotKey, 16 bytes
fonte
Python,
5248474544 bytesShamelessly borrowing that shortened link.
Thanks to CrazyPython for -4 bytes, and Sp3000 for a further one.
Edit: shaved 2 more off thanks to CoolestVeto
Edit: thanks to MD XF for registering ppcg.ga and saving another byte
fonte
//
.python -m webbrowser -t http:ppcg.lol
which I think counts as 30 charsppcg.lol
has been unregistered, invalidating this answer :I However, I just registeredppcg.ga
, so you can use that instead, saving a byte anyway.Bash,
2422 bytesNot as short as some others.
firefox ppcg.lol
is shorter, but it doesn't meet question spec.fonte
xdg-open www.ppcg.lol
works for me as well.//
.xdg-open http:ppcg.lol
also works for me.Java 7,
118115 bytesJava is not the best language for golfing... Here's the same program in a more readable format:
Saved 2 bytes by removing
//
in the URI/L, and another byte by switching to.ga
from.lol
(indirectly thanks to @Milo)fonte
"http://ppcg.lol"
with"http:ppcg.lol"
void f(){ .... }
would be enough.Pylongolf, 11 bytes (Non-Competing)
Pushes ppcg.lol into the stack then
p
opens it.fonte
Java 8,
115112 bytesJava is not the best language for golfing... Here's the same program in a more readable format:
Saved 2 bytes by removing
//
(thanks @CoolestVeto), and another byte by switching to.ga
from.lol
(indirect thanks to @Milo)fonte
//
.interface
is longer thanclass
, you save more bytes because thepublic
modifier is implied.JavaScript, 34 bytes
Uses Node.js
fonte
//
?require`open``http://ppcg.lol`;
(added;
to avoid tripping the formatting)require('open')('//ppcg.lol')
to save 5 bytesppcg.lol
has been unregistered, invalidating this answer :I However, I just registeredppcg.ga
, so you can use that instead, saving a byte anyway.Racket,
4140 bytesfonte
ppcg.lol
has been unregistered, invalidating this answer :I However, I just registeredppcg.ga
, so you can use that instead, saving a byte anyway.Applescript, 28 bytes
fonte
ppcg.lol
has been unregistered, invalidating this answer :I However, I just registeredppcg.ga
, so you can use that instead, saving a byte anyway.Mathematica, 28 bytes
fonte
//
?R, 26 bytes
shell.exec("www.ppcg.lol")
I don't know of any shorter way to do this in R.
fonte
system
/fork
/whatever call is a trivial modification.ppcg.lol
has been unregistered, invalidating this answer :I However, I just registeredppcg.ga
, so you can use that instead, saving a byte anyway.Actionscript 3, 117 bytes
Like Java, this is not a great golfing language. Here's the code with formatting:
fonte
ppcg.lol
has been unregistered, invalidating this answer :I However, I just registeredppcg.ga
, so you can use that instead, saving a byte anyway.Rebol 2,
1615 bytesif you accept an error before opening the page on Linux, no error on Windows
20 bytes without an error
fonte
browse #ppcg.lol
Perl 5,
6657 bytesShould work everywhere, but needs that import :(
8 bytes saved with @msh210 comment.
Also, for funsies :
Perl 5 (Windows), 34 bytes
Perl 5 (Unix), 31 bytes
fonte
-M
instead ofuse
to shave a coupla bytes. (Untested.) Also, I'm guessing you don't need the parens or thewww.
. (Also untested.)ppcg.lol
has been unregistered, invalidating this answer :I However, I just registeredppcg.ga
, so you can use that instead, saving a byte anyway.Common Lisp, 31 bytes
fonte
RFO-BASIC, 22 bytes
Read about RFO-BASIC at laughton.com.
fonte
ppcg.lol
has been unregistered, invalidating this answer :I However, I just registeredppcg.ga
, so you can use that instead, saving a byte anyway. Also, couldn't the space betweenBROWSE
and"
be removed, saving another byte?VBScript, 57 bytes
I used to have lots of fun creating tiny programs in VBScript, back in 2010.
I've remembered this language and used the code on: https://stackoverflow.com/a/13401872/2729937
It still works on Windows 7, at least.
This is a bit different from the usual
start www.ppcg.lol
, in the sense that it executes thewww.ppcg.ga
directly, with an implicitstart
.An alternative way would be
"cmd.exe /C start www.ppcg.ga"
.fonte
ppcg.lol
has been unregistered, invalidating this answer :I However, I just registeredppcg.ga
, so you can use that instead, saving a byte anyway.C#, 33 bytes
Opens the default browser to the web address
fonte
\\
via//
.System.Diagnostics
namespace to be added in orProcess
to be fully qualified to work.ppcg.lol
has been unregistered, invalidating this answer :I However, I just registeredppcg.ga
, so you can use that instead, saving a byte anyway.05AB1E, 16 bytes (non-competing)
Non-competing, since the features used here postdate the challenge. Code:
You can try the string online here. This basically evaluates to this batch answer.
Uses the CP1252 encoding.
fonte
VB.NET,
3230 bytesfonte
Sub Main()
, and +7 forEnd Sub
, which you need in order to run this at least in a VB.NET console program, also you would need to importSystem.Diagnostics
.ppcg.lol
has been unregistered, invalidating this answer :I However, I just registeredppcg.ga
, so you can use that instead, saving a byte anyway.Factor,
383626 bytesI didn't know one could golf-off the
//
in the protocol.fonte
run-process
, and you can wholly drop//
.//
could be left off. As for the space between"
andrun-process
, dropping that would require a word named"run-process
to be present in the current vocabulary search pathsystem
/fork
/whatever call is a trivial modification.xdg-open
in languages which are not equipped with special functions for browsing the web. A C or ASM answer would surely also have to dosystem("xdg-open...")
Python, 44 bytes
URL from this commentEdit: ppcg.ga seems to become more popular now (but it WAS available when I posted this answer).
Ungolfed:
Python, 44 bytes
URL from this answer
Ungolfed:
Python, 45 bytes
Ungolfed:
Take that, ppcg.lol! (1 byte shorter)
Note: I added a separate answer leading to ppcg.lol, 'cause I've noticed the other sites doesn't work for me in Internet explorer 11, and I saw other users having this problem too.
Both are non-non-competing (read that right?)
fonte
Ruby,
222019 bytes (on OS X)Simple.
Thanks to Daniel for 2 bytes off.
fonte
%x
.open http:ppcg.lol
Cheddar, 65 bytes
Accesses cheddar internals and then calls upon
open
package and calls it with string to PPCG. Make sure you haveopen
npm package installedfonte