Skip to content

Instantly share code, notes, and snippets.

-- Two dashes start a one-line comment.
--[[
Adding two ['s and ]'s makes it a
multi-line comment.
--]]
----------------------------------------------------
-- 1. Variables and flow control.
----------------------------------------------------
@nikgalushko
nikgalushko / 0_reuse_code.js
Last active August 29, 2015 14:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
kAudioFormatMPEG4AAC
kAudioFormatAppleLossless
kAudioFormatAppleIMA4
kAudioFormatiLBC
kAudioFormatULaw
kAudioFormatLinearPCM

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
chrome.browserAction.onClicked.addListener(
function(tab) {
var currentURL = tab.url;
if (currentURL.indexOf("gyazo") == -1)
return;
console.log(currentURL.split("/"));
var src = "http://i.gyazo.com/" + currentURL.split("/").pop() + ".png";
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://qps.ru/api?url=" + src + "&format=text", true);
xhr.onreadystatechange = function () {
@nikgalushko
nikgalushko / mgoExample.go
Created December 1, 2016 12:29 — forked from border/mgoExample.go
mgo example
package main
import (
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"time"
)
type Person struct {
@nikgalushko
nikgalushko / custom_json.go
Created December 23, 2016 09:43 — forked from mdwhatcott/custom_json.go
Example of implementing MarshalJSON and UnmarshalJSON to serialize and deserialize custom types to JSON in Go. Playground: http://play.golang.org/p/7nk5ZEbVLw
package main
import (
"bytes"
"encoding/json"
"fmt"
"strconv"
)
func main() {
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nikgalushko
nikgalushko / godoc output
Created October 1, 2018 14:05 — forked from cthom06/godoc output
Godoc example
PACKAGE
package example
import "example"
This is the package comment, a top-level piece of documentation
used to explain things about the package (see json or exp/template)
All godoc comments are in this form
with no whitespace between them and what they accompany
{
"workbench.editor.enablePreview": false,
"workbench.editor.enablePreviewFromQuickOpen": false,
"window.zoomLevel": 0,
"explorer.confirmDelete": false,
"editor.tabCompletion": true,
"explorer.confirmDragAndDrop": false
}