Skip to content

Instantly share code, notes, and snippets.

@alehano
alehano / gist:fe96934a7f7d421f3e76
Created Jan 12, 2016
Stop / remove all Docker containers
View gist:fe96934a7f7d421f3e76
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
@alehano
alehano / gist:3729edd107c752935237
Last active Aug 29, 2015
Sublime text move cursor with CTRL+JLIKUO
View gist:3729edd107c752935237
[
{ "keys": ["ctrl+l"], "command": "move_to", "args": {"to": "hardeol", "extend": false} },
{ "keys": ["ctrl+j"], "command": "move_to", "args": {"to": "hardbol", "extend": false} },
{ "keys": ["ctrl+i"], "command": "line_jumper", "args": { "number_of_lines": 10, "cmd": "up" } },
{ "keys": ["ctrl+shift+i"], "command": "line_jumper", "args": { "number_of_lines": 10, "cmd": "up_select" } },
{ "keys": ["ctrl+k"], "command": "line_jumper", "args": { "number_of_lines": 10, "cmd": "down" } },
{ "keys": ["ctrl+shift+k"], "command": "line_jumper", "args": { "number_of_lines": 10, "cmd": "down_select" } },
@alehano
alehano / Bootstrap align responsive
Last active Aug 29, 2015
Bootstrap align responsive
View Bootstrap align responsive
/*
* Responsive text aligning
* http://ohryan.ca/2014/08/14/set-responsive-text-alignment-bootstrap-3/
*/
.text-xs-left { text-align: left; }
.text-xs-right { text-align: right; }
.text-xs-center { text-align: center; }
.text-xs-justify { text-align: justify; }
@media (min-width: @screen-sm-min) {
@alehano
alehano / gist:db216ee27b421e4a11b4
Created Jul 31, 2014
Http Handler auth decorator
View gist:db216ee27b421e4a11b4
package main
import (
"fmt"
"net/http"
)
const (
//user_is_authenticated = false
user_is_authenticated = true
View designer.html
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icons/iconsets/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<link rel="import" href="../core-menu/core-submenu.html">
@alehano
alehano / gist:11302364
Last active Aug 29, 2015
Responsive CSS
View gist:11302364
/*
Depend of screen size it adds to all element with class "scr", additional class (e.g. "scr-sm").
In a css file you can define representation of elements for different devices.
CSS e.g.
element.scr-xs {
... style for mobile phones
}
*/
function viewport() {
@alehano
alehano / gist:11167317
Last active Feb 22, 2018
Golang observer pattern
View gist:11167317
package main
import (
"container/list"
"fmt"
)
type Observer interface {
Update()
}
@alehano
alehano / gist:11144804
Last active Aug 29, 2015
Random string in Go
View gist:11144804
import (
"crypto/rand"
)
func randString(n int) string {
const alphanum = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
var bytes = make([]byte, n)
rand.Read(bytes)
for i, b := range bytes {
View martini-mgo.go
package main
import (
"github.com/codegangsta/martini"
"github.com/codegangsta/martini-contrib/binding"
"github.com/codegangsta/martini-contrib/render"
"labix.org/v2/mgo"
)
type Wish struct {
View Golang decorator
package main
import (
"fmt"
)
func decorator(f func(s string)) func(s string) {
return func(s string) {
fmt.Println("Started")
You can’t perform that action at this time.