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

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
@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() {
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
@nikgalushko
nikgalushko / move-stashes.md
Created December 29, 2018 07:50 — forked from alexeds/move-stashes.md
Move your stashes from one repo to another

Move your stashes from one repo to another


This was useful for me when we created a new branch for a new major release, but were still working on our current version as well. I cloned our repo again and kept the new project on our new branch, but also wanted to get my stashes there.

Download your stashes

git stash show -p > patch

You'll have to specify your stash and name your file whatevery you want. Do this for as all your stashes, and you'll have patch files in your pwd.

@nikgalushko
nikgalushko / signal.go
Created February 18, 2020 06:48 — forked from reiki4040/signal.go
signal handling example for golang
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
)
func main() {