Skip to content

Instantly share code, notes, and snippets.

@DisposaBoy
DisposaBoy / main.go
Last active December 18, 2018 21:16
package main
import (
"flag"
"fmt"
"github.com/mholt/certmagic"
"log"
"os"
"os/exec"
"path/filepath"
@DisposaBoy
DisposaBoy / openclipboard.py
Created January 22, 2014 08:26
a sublime text plugin example to open the file path that's in the clipboard
# this plugin creates a command `open_from_clipboard` that opens the path that's currently in the clipboard
# save this file at Packages/User/openclipboard.py
# then add the follow key binding if you like via the menu Preferences > Key Bindings - User
# { "keys": ["ctrl+shift+o"], "command": "open_from_clipboard" }
import sublime
import sublime_plugin
class OpenFromClipboardCommand(sublime_plugin.WindowCommand):
def run(self):
"on_save": [
// automatically replay the current package on save
// for main packages, it compiles it and runs the command with the args passed to `replay`
// for normal packages, it compiles it and runs `go test`
{
"cmd": "gs9o_open",
"args": {
"focus_view": false, // prevent 9o from stealing focus
"run": ["replay"] // "run" is a list of strings ["cmd", "arg1", "arg2"],
// it can be any command you can type into 9o
{
// margo will die if more than 300m memory is used (default is 1000)
"margo_oom": 300,
// don't exclude any linters (enabled gstypes(go/types) linter, although it's buggy)
"lint_filter": [],
// turn calltip-as-you-type on
"autocomplete_live_hint": true,
{
"keys": ["ctrl+b"],
"command": "gs9o_open",
"args": {"run": ["[command here]"]},
"context": [{ "key": "selector", "operator": "equal", "operand": "source.go" }]
}
PACKAGE
package runtime
import "runtime"
Package runtime contains operations that interact with Go's runtime
system, such as functions to control goroutines. It also includes the
low-level type information used by the reflect package; see reflect's
documentation for the programmable interface to the run-time type
system.
package main
import (
"bufio"
"bytes"
"flag"
"fmt"
"github.com/drio/drio.go/common/files"
"io"
"log"
package main
import (
"go/ast"
"go/parser"
"go/token"
"strings"
)
type ImportDecl struct {