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:
(eww"ppcg.ga")
O EWW é um navegador dentro do Emacs. A browse-web
função é um alias para eww
e, portanto, torna eww
o navegador padrão no Emacs:
Seu trabalho é abrir uma janela do navegador padrão em http://codegolf.stackexchange.com .
Obrigado a @CoolestVeto, @ Jonathan Leech-Pepin e @ zyabin101.
www.ppcg.lol
vez de http://ppcg.lol
?
//
, eu não acho. (Eu não uso emacs, mas é geralmente aceite sem a //
)
Não vencendo, mas com certeza foi divertido. A partir de agora, estou apenas 1 bytee atrás do python!
I need webbrowser
Now open "http:ppcg.ga"
Explicação:
I need
compila import $1
com webbrowser
sendo o módulo.
Now
executa o seguinte comando do módulo como module.command
nos argumentos de qualquer coisa a seguir.
Portanto, isso compila para:
#!/usr/bin/env python3
import webbrowser
webbrowser.open("http:ppcg.ga")
No http:
entanto, acabo precisando da peça, e não pode ser reduzida.
"http://ppcg.lol"
com "http:ppcg.lol"
. Não tenho certeza se você pode remover o espaço entre open
e "http:..."
, mas tente?
Economizou 3 bytes graças ao Mego.
start www.ppcg.ga
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.
start
vez de explorer
.
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.
?
saps www.ppcg.lol
Usando um domínio ainda mais curto fornecido pelo Milo.
saps www.ppcg.ga
Enquanto start
é um alias conhecido, Start-Process
existe outro para saps
. Você pode ver isso em Get-Alias
. Segue a convenção para similar Start-
e Stop-
cmdlets.
open http:ppcg.ga
Guardado 2 graças a CoolestVeto
open
é um utilitário OSX, não um bash; isso seria chamado de forma mais apropriada "linha de comando OSX".
//
.
open http:ppcg.ga
web www.ppcg.lol -browser
www
é menor que http://
e garante que o endereço seja processado como um URLweb('www.ppcg.lol', '-browser')
.web ppcg.lol -browser
pois o MATLAB anexará automaticamente um http://
( 21 bytes )Alternativas :
Nas janelas, isso pode ser reduzido para ( 19 bytes )
!start www.ppcg.lol
No OS X ( 21 bytes )
!open http://ppcg.lol
O seguinte funcionaria em um aplicativo MATLAB implantado ( 16 bytes )
web www.ppcg.lol
Se o navegador embutido puder ser usado, isso poderá ser reduzido ainda mais conforme http
está implícito ( 12 bytes )
web ppcg.lol
open
command does the same.
!
does in MATLAB, it's the equivalent of system(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 X
Run www.ppcg.lol
Shamelessly borrowing that shortened link.
from webbrowser import*;open("http:ppcg.ga")
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
//
.
python -m webbrowser -t http:ppcg.lol
which I think counts as 30 chars
ppcg.lol
has been unregistered, invalidating this answer :I However, I just registered ppcg.ga
, so you can use that instead, saving a byte anyway.
xdg-open http:ppcg.lol
Not as short as some others. firefox ppcg.lol
is shorter, but it doesn't meet question spec.
xdg-open www.ppcg.lol
works for me as well.
//
.
xdg-open http:ppcg.lol
also works for me.
class P{public static void main(String[]a)throws Exception{java.awt.Desktop.getDesktop().browse(new java.net.URI("http://ppcg.lol"));}}
Java is not the best language for golfing... Here's the same program in a more readable format:
class P {
public static void main (String[] a) throws Exception {
java.awt.Desktop.getDesktop().browse(new java.net.URI("http:ppcg.ga"));
}
}
Saved 2 bytes by removing //
in the URI/L, and another byte by switching to .ga
from .lol
(indirectly thanks to @Milo)
"http://ppcg.lol"
with "http:ppcg.lol"
interface P{static void main(String[]a)throws Exception{java.awt.Desktop.getDesktop().browse(new java.net.URI("http:ppcg.ga"));}}
Java is not the best language for golfing... Here's the same program in a more readable format:
interface P {
static void main (String[] a) throws Exception {
java.awt.Desktop.getDesktop().browse(new java.net.URI("http:ppcg.ga"));
}
}
Saved 2 bytes by removing //
(thanks @CoolestVeto), and another byte by switching to .ga
from .lol
(indirect thanks to @Milo)
//
.
interface
is longer than class
, you save more bytes because the public
modifier is implied.
require('open')('http://ppcg.lol')
Uses Node.js
//
?
require`open``http://ppcg.lol`;
(added ;
to avoid tripping the formatting)
require('open')('//ppcg.lol')
to save 5 bytes
ppcg.lol
has been unregistered, invalidating this answer :I However, I just registered ppcg.ga
, so you can use that instead, saving a byte anyway.
(require net/sendurl)(send-url"ppcg.ga")
ppcg.lol
has been unregistered, invalidating this answer :I However, I just registered ppcg.ga
, so you can use that instead, saving a byte anyway.
open location"http:ppcg.lol"
ppcg.lol
has been unregistered, invalidating this answer :I However, I just registered ppcg.ga
, so you can use that instead, saving a byte anyway.
SystemOpen@"http://ppcg.lol"
//
?
shell.exec("www.ppcg.lol")
I don't know of any shorter way to do this in R.
ppcg.lol
has been unregistered, invalidating this answer :I However, I just registered ppcg.ga
, so you can use that instead, saving a byte anyway.
package{import flash.display.Sprite;public class A extends Sprite{function A(){navigateToUrl("ppcg.lol","_blank")}}}
Like Java, this is not a great golfing language. Here's the code with formatting:
package
{
import flash.display.Sprite;
public class A extends Sprite
{
function A()
{
navigateToUrl("ppcg.lol", "_blank")
}
}
}
ppcg.lol
has been unregistered, invalidating this answer :I However, I just registered ppcg.ga
, so you can use that instead, saving a byte anyway.
Should work everywhere, but needs that import :(
8 bytes saved with @msh210 comment.
use Browser::Open open_browser;open_browser"http:ppcg.ga"
Also, for funsies :
system "start http://www.ppcg.ga"
system "xdg-open http:ppcg.ga"
-M
instead of use
to shave a coupla bytes. (Untested.) Also, I'm guessing you don't need the parens or the www.
. (Also untested.)
ppcg.lol
has been unregistered, invalidating this answer :I However, I just registered ppcg.ga
, so you can use that instead, saving a byte anyway.
ppcg.lol
has been unregistered, invalidating this answer :I However, I just registered ppcg.ga
, so you can use that instead, saving a byte anyway. Also, couldn't the space between BROWSE
and "
be removed, saving another byte?
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.
set S=CreateObject("WScript.Shell")
S.run("www.ppcg.ga")
This is a bit different from the usual start www.ppcg.lol
, in the sense that it executes the www.ppcg.ga
directly, with an implicit start
.
An alternative way would be "cmd.exe /C start www.ppcg.ga"
.
ppcg.lol
has been unregistered, invalidating this answer :I However, I just registered ppcg.ga
, so you can use that instead, saving a byte anyway.
Process.Start("http://ppcg.lol");
Opens the default browser to the web address
\\
via //
.
System.Diagnostics
namespace to be added in or Process
to be fully qualified to work.
ppcg.lol
has been unregistered, invalidating this answer :I However, I just registered ppcg.ga
, so you can use that instead, saving a byte anyway.
Non-competing, since the features used here postdate the challenge. Code:
’…Ò ™³.ÐÏg.´¢’.E
You can try the string online here. This basically evaluates to this batch answer.
Uses the CP1252 encoding.
Process.Start("http:ppcg.lol")
Sub Main()
, and +7 for End Sub
, which you need in order to run this at least in a VB.NET console program, also you would need to import System.Diagnostics
.
ppcg.lol
has been unregistered, invalidating this answer :I However, I just registered ppcg.ga
, so you can use that instead, saving a byte anyway.
[ "http:ppcg.ga" open-url ]
I didn't know one could golf-off the //
in the protocol.
run-process
, and you can wholly drop //
.
//
could be left off. As for the space between "
and run-process
, dropping that would require a word named "run-process
to be present in the current vocabulary search path
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 do system("xdg-open...")
from webbrowser import*;open('http:ppcg.ga')
URL from this comment
Edit: ppcg.ga seems to become more popular now (but it WAS available when I posted this answer).
Ungolfed:
from webbrowser import * # Loads everything in the webbrowser module
open("http://ppcg.ga/") # Opens default browser to http://ppcg.ga/
from webbrowser import*;open('http:gfa1.tk')
URL from this answer
Ungolfed:
from webbrowser import * # Loads everything in the webbrowser module
open("http://gfa1.tk/") # Opens default browser to http://gfa1.tk/
from webbrowser import*;open('http:ppcg.lol')
Ungolfed:
from webbrowser import * # Loads everything in the webbrowser module
open('http://ppcg.lol/') # Opens default browser to http://ppcg.lol/
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?)
`open http:ppcg.ga`
Simple.
Thanks to Daniel for 2 bytes off.
%x
. open http:ppcg.lol
cheddar.internal(cheddar.uid).require("open").c("http://ppcg.ga")
Accesses cheddar internals and then calls upon open
package and calls it with string to PPCG. Make sure you have open
npm package installed