Su trabajo es abrir una ventana del navegador del navegador predeterminado a http://codegolf.stackexchange.com .
Su código debe abrir el navegador y no puede confiar en uno abierto.
Este es el código de golf , por lo que gana la respuesta más corta en bytes.
Respuestas:
GNU Emacs,
292714 bytesEWW es un navegador dentro de Emacs. La
browse-web
función es un alias paraeww
, y eso hace queeww
el navegador predeterminado en Emacs:Gracias a @CoolestVeto, @Jonathan Leech-Pepin y @ zyabin101.
fuente
www.ppcg.lol
lugar dehttp://ppcg.lol
?//
, no creo. (No uso emacs, pero generalmente se acepta sin el//
)Oración , 41 bytes
No ganar, pero seguro fue divertido. ¡A partir de ahora, solo estoy 1 bytee detrás de Python!
Explicación:
I need
compila aimport $1
conwebbrowser
ser el módulo.Now
ejecuta el siguiente comando desde el módulo comomodule.command
con los argumentos de todo lo que sigue.Entonces esto se compila para:
Sin
http:
embargo, termino necesitando la parte, y no se puede acortar.fuente
"http://ppcg.lol"
con"http:ppcg.lol"
. No estoy seguro de si puedes eliminar el espacio entreopen
y"http:..."
, pero ¿intentarlo?Lote, 17 bytes
Guardado 3 bytes gracias a Mego.
Esto se abrirá en su navegador predeterminado si lo ejecuta desde la línea de comandos de Windows.
Creo que también funcionará en Powershell, pero no estoy seguro.
fuente
start
lugar deexplorer
.start www.ppcg.lol
lugar, puede utilizarlo para que Windows lo analice implícitamente como HTTP. Funciona tanto en CMD como en PowerShell.www.
?PowerShell,
1716 bytesUsando un dominio aún más corto proporcionado por Milo.
Si bien
start
es un alias conocido,Start-Process
hay otro parasaps
. Puedes ver esto desdeGet-Alias
. Sigue la convención para similaresStart-
yStop-
cmdlets.fuente
Terminal (OSX),
201817 bytesGuardado 2 gracias a CoolestVeto
fuente
open
es una utilidad OSX, no bash; esto se llamaría más apropiadamente "línea de comando OSX".//
.open http:ppcg.ga
MATLAB,
2825 byteswww
es más cortohttp://
y garantiza que la dirección se procese como una URLweb('www.ppcg.lol', '-browser')
.web ppcg.lol -browser
ya que MATLAB agregará automáticamente unhttp://
( 21 bytes )Alternativas :
En Windows, esto se puede acortar a ( 19 bytes )
En OS X ( 21 bytes )
Lo siguiente funcionaría en una aplicación MATLAB implementada ( 16 bytes )
Si se pudiera usar el navegador incorporado, esto podría reducirse aún más, como
http
está implícito ( 12 bytes )fuente
open
comando incorporado hace lo mismo.!
hace en MATLAB, es el equivalente desystem(command)
. Lo tuve como una demostración de otras alternativas que podrían ejecutarse desde MATLAB. ¿Eso esta bien?www.
?www
is unnecessary only on OS XAutoHotKey, 16 bytes
fuente
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
fuente
//
.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.fuente
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)fuente
"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.fuente
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)fuente
//
.interface
is longer thanclass
, you save more bytes because thepublic
modifier is implied.JavaScript, 34 bytes
Uses Node.js
fuente
//
?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 bytesfuente
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
fuente
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
fuente
//
?R, 26 bytes
shell.exec("www.ppcg.lol")
I don't know of any shorter way to do this in R.
fuente
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:
fuente
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
fuente
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
fuente
-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
fuente
RFO-BASIC, 22 bytes
Read about RFO-BASIC at laughton.com.
fuente
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"
.fuente
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
fuente
\\
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.
fuente
VB.NET,
3230 bytesfuente
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.fuente
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?)
fuente
Ruby,
222019 bytes (on OS X)Simple.
Thanks to Daniel for 2 bytes off.
fuente
%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 installedfuente