Votre travail consiste à ouvrir une fenêtre du navigateur par défaut vers http://codegolf.stackexchange.com .
Votre code doit ouvrir le navigateur lui-même et ne peut pas compter sur un navigateur ouvert.
C'est du code-golf , donc la réponse la plus courte en octets est gagnante.
Réponses:
GNU Emacs,
292714 octetsEWW est un navigateur dans Emacs. La
browse-web
fonction est un alias poureww
, et donc cela rendeww
le navigateur par défaut dans Emacs:Merci à @CoolestVeto, @Jonathan Leech-Pepin et @ zyabin101.
la source
www.ppcg.lol
au lieu dehttp://ppcg.lol
?//
, je ne pense pas. (Je n'utilise pas emacs, mais c'est généralement accepté sans le//
)Oration , 41 octets
Ne pas gagner, mais c'était amusant. Pour l'instant, je ne suis qu'à un octet de retard sur python!
Explication:
I need
compile àimport $1
d'webbrowser
étant le module.Now
exécute la commande suivante à partir du module commemodule.command
avec les arguments de tout ce qui suit.Donc, cela compile pour:
Je finis par avoir besoin de la
http:
pièce cependant, et elle ne peut pas être raccourcie.la source
"http://ppcg.lol"
par"http:ppcg.lol"
. Je ne sais pas si vous pouvez supprimer l'espace entreopen
et"http:..."
, mais essayez-le?Lot, 17 octets
Sauvegardé 3 octets grâce à Mego.
Cela s'ouvrira dans votre navigateur par défaut si vous l'exécutez à partir de la ligne de commande Windows.
Je pense que cela fonctionnera également à Powershell, mais je ne suis pas sûr.
la source
start
au lieu deexplorer
.start www.ppcg.lol
place implicitement pour que Windows l’analyse en tant que HTTP. Fonctionne à la fois dans CMD et PowerShell.www.
?PowerShell,
1716 octetsEn utilisant un domaine encore plus court fourni par Milo.
While
start
est un alias connu carStart-Process
il en existe un autresaps
. Vous pouvez voir cela deGet-Alias
. Il suit la convention pour les applets de commande similairesStart-
etStop-
.la source
Terminal (OSX),
201817 octetsÉconomisé 2 grâce à CoolestVeto
la source
open
est un utilitaire OSX, pas un utilitaire bash; cela s'appellerait plutôt "ligne de commande OSX".//
.open http:ppcg.ga
MATLAB,
2825 octetswww
est plus court quehttp://
et garantit que l'adresse est traitée comme une URLweb('www.ppcg.lol', '-browser')
.web ppcg.lol -browser
car MATLAB ajoutera automatiquement unhttp://
( 21 octets )Alternatives :
Sous Windows, cela peut être réduit à ( 19 octets )
Sous OS X ( 21 octets )
Ce qui suit fonctionnerait dans une application MATLAB déployée ( 16 octets )
Si le navigateur intégré pouvait être utilisé, cela pourrait être réduit encore plus comme cela
http
est supposé ( 12 octets )la source
open
commande intégrée fait la même chose.!
fait MATLAB, c'est l'équivalent desystem(command)
. Je l'ai eu comme plus d'une démonstration d'autres alternatives qui pourraient être exécutées à partir de MATLAB. Est-ce que ça va?www.
?www
n'est pas nécessaire seulement sur OS XAutoHotKey , 16 octets
la source
Python,
5248474544 octetsEmprunter sans vergogne ce lien raccourci.
Merci à CrazyPython pour -4 octets et à Sp3000 pour un autre.
Edit: rasé 2 plus grâce à CoolestVeto
Edit: merci à MD XF d’avoir enregistré ppcg.ga et d’avoir sauvegardé un autre octet
la source
//
.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.la source
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)la source
"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.la source
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)la source
//
.interface
is longer thanclass
, you save more bytes because thepublic
modifier is implied.JavaScript, 34 bytes
Uses Node.js
la source
//
?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 bytesla source
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
la source
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
la source
//
?R, 26 bytes
shell.exec("www.ppcg.lol")
I don't know of any shorter way to do this in R.
la source
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:
la source
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
la source
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
la source
-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
la source
RFO-BASIC, 22 bytes
Read about RFO-BASIC at laughton.com.
la source
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"
.la source
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
la source
\\
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.
la source
VB.NET,
3230 bytesla source
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.la source
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?)
la source
Ruby,
222019 bytes (on OS X)Simple.
Thanks to Daniel for 2 bytes off.
la source
%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 installedla source