Skip to content

Instantly share code, notes, and snippets.

diff --git a/doc/extensions/authoring/publishing.md b/doc/extensions/authoring/publishing.md
index ddd670600..147efece3 100644
--- a/doc/extensions/authoring/publishing.md
+++ b/doc/extensions/authoring/publishing.md
@@ -19,11 +19,26 @@ At this point, your extension has been built and sent to Sourcegraph. The output
Any user can publish to the Sourcegraph.com extension registry, all Sourcegraph instances can use extensions from Sourcegraph.com, and all Sourcegraph.com extensions are visible to everyone. If you need to publish an extension privately, use a private extension registry on your own self-hosted Sourcegraph instance.
-## Testing your extension
+## Using extensions in local development (sideloading)
@sqs
sqs / sourcegraph-user-config.json
Created January 11, 2018 08:39
Full-text/regexp search across the top 500 Rust crates on Sourcegraph
// Full-text/regexp search across the top 500 Rust crates:
//
// 1. Sign up for Sourcegraph.com at https://sourcegraph.com/sign-up (or sign in)
// 2. Click your username in the top right
// 3. Go to Configuration
// 4. Paste this entire JSON in and click Save
// 5. In the search box, type a search query of the form "repogroup:crates YOUR QUERY"
// and hit enter (regexps, exact matching, etc., are supported)
//
// Examples: "repogroup:crates remove_file"
@sqs
sqs / remoteFileService.ts
Created July 26, 2017 08:17
RemoteFileService with lazy-loaded extensions
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import URI from 'vs/base/common/uri';
import { FileService } from 'vs/workbench/services/files/electron-browser/fileService';
import { IContent, IStreamContent, IFileStat, IResolveContentOptions, IResolveFileOptions, IResolveFileResult, IUpdateContentOptions, FileChangesEvent, FileChangeType, IImportResult } from 'vs/platform/files/common/files';
import { TPromise } from "vs/base/common/winjs.base";
@sqs
sqs / eventemitter.ts
Created June 21, 2017 12:25
typescript eventemitter
/**
* An EventEmitter that implements the NodeJS.EventEmitter interface.
*/
export class EventEmitter implements NodeJS.EventEmitter {
private _events: { [name: string]: Function[] } = Object.create(null);
private _maxListeners = 10;
private _onceListeners: Function[] = [];
@sqs
sqs / file.ts
Created May 24, 2017 11:32
resolves to equal uri typescript vscode.ts
/**
* Returns true iff url == uri-resolve(url, candidate) per
* https://tools.ietf.org/html/rfc3986#section-5.2.2. For example, if currentURL is
* http://example.com/foo and newURL is /foo, then it returns true.
*/
export function resolvesToEqual(url: URI | string, candidate: URI | string): boolean {
if (typeof url === 'string') { url = URI.parse(url); }
if (typeof candidate === 'string') { candidate = URI.parse(candidate); }
const change: {
@sqs
sqs / ToSourcegraph.js
Created May 4, 2017 20:43
Jump to Sourcegraph bookmarklet
javascript:(function(){ if (window.location.hostname !== "github.com" && window.location.hostname !== "sourcegraph.com") { alert("This bookmarklet may only be used on GitHub.com or Sourcegraph.com, not " + window.location.hostname + "."); return; } var pats = [ ["^/([^/]+)/([^/]+)/tree/([^/]+)$", "/github.com/$1/$2@$3", "^/github\.com/([^/]+)/([^/@]+)@([^/]+)$", "/$1/$2/tree/$3"], ["^/([^/]+)/([^/]+)/tree/([^/]+)/(.+)$", "/github.com/$1/$2@$3/-/tree/$4", "^/github\.com/([^/]+)/([^/@]+)@([^/]+)/-/tree/(.+)$", "/$1/$2/tree/$3/$4"], ["^/([^/]+)/([^/]+)/blob/([^/]+)/(.+)$", "/github.com/$1/$2@$3/-/blob/$4", "", ""], ["^/([^/]+)/([^/]+)$", "/github.com/$1/$2", "^/github\.com/([^/]+)/([^/]+)$", "/$1/$2"], ["^/([^/]+)$", "/$1", "^/([^/]+)$", "/$1"], ]; var pathname = window.location.pathname; if (window.location.hostname === 'sourcegraph.com') { if (pathname.indexOf('/sourcegraph.com/') === 0) { pathname = pathname.replace('/sourcegraph.com/', '/github.com/'); } else if (pathname.indexOf('/sourcegraph/') === 0) { pa
@sqs
sqs / sourcegraph_pullrequest_authors_url.js
Created December 9, 2014 12:36
sourcegraph_pullrequest_authors_url.js
// requires the 'btoa' function, which browsers provide. just run this
// in your browser's JS console to try it out. if using node.js, use
// https://github.com/node-browser-compat/btoa/blob/master/index.js.
var tmpl = "https://sourcegraph.com/api/repos/{BASE_REPO}/.deltas/{BASE_BRANCH}==={BASE_RESOLVED_COMMIT_ID}..{BASE64_URL_ENCODED_HEAD_REPO}:{HEAD_BRANCH}==={HEAD_RESOLVED_COMMIT_ID}/.affected-authors";
var vars = {
BASE_REPO: "github.com/JodaOrg/joda-money",
BASE_BRANCH: "master",
BASE_RESOLVED_COMMIT_ID: "1c7920a861a5c55c2fa9bc892b24f4873b593746",
HEAD_REPO: "github.com/ffbit/joda-money",
[
{
“Name”: “twitter-text-dart”,
“Type”: “DartPackage”, // same as defined in the Srclibtoolchain
“Files”: [
“lib/foo.dart”, “lib/bar.dart” // all files related to the Dart package (used as make prereqs in Makefile generated by srclib underlying backend)
],
“Ops”: { // just use this - null means use the registered toolchain for graphing/depresolving DartPackage source units
“graph”: null,
“depresolve: null
@sqs
sqs / queue.go
Created August 11, 2014 22:15
simple postgresql queue in go
package db
import (
"strings"
"time"
"github.com/sqs/modl"
)
// SimpleQueue is a PostgreSQL-backed queue with atomic enqueue and dequeue, no
@sqs
sqs / gist:ce913ce35599d3377c11
Created June 24, 2014 16:07
sourcegraph/go-vcs libgit2 cgo crash - in cgo-crash branch
$ go test -test.run=Concurrency
*** Error in `/tmp/go-build871593397/github.com/sourcegraph/go-vcs/vcs/_test/vcs.test': double free or corruption (top): 0x0000000001549d60 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x80996)[0x7faa96ef7996]
/usr/local/lib/libgit2.so.0(+0x77acc)[0x7faa974d3acc]
/usr/local/lib/libgit2.so.0(+0x77b24)[0x7faa974d3b24]
/usr/local/lib/libgit2.so.0(+0x77cdd)[0x7faa974d3cdd]
/usr/local/lib/libgit2.so.0(+0x9bea5)[0x7faa974f7ea5]
/usr/local/lib/libgit2.so.0(+0x6c1aa)[0x7faa974c81aa]
/usr/local/lib/libgit2.so.0(+0x6c381)[0x7faa974c8381]