Skip to content

Instantly share code, notes, and snippets.

Andrew Bosonchenko andboson

Block or report user

Report or block andboson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@andboson
andboson / slack.js
Created Mar 21, 2017
toggle Slack channels list
View slack.js
var channels = document.querySelector('.channel_list_header_label');
var list = document.querySelector('#channel-list');
channels.addEventListener('click', function(e){
e.preventDefault();e.stopImmediatePropagation();
if (list.style.height != '20px') {
list.style.height = '20px';list.style.overflowY = 'scroll';
} else {
list.style.height = 'auto';list.style.overflowY = 'auto';
}
@andboson
andboson / postgres.sql
Created Mar 7, 2017
insert record with random field
View postgres.sql
insert into cups(reg_id, code, is_enabled, created_at, updated_at )
select
1 as reg_id,
UPPER(substr(md5(''||now()::text||random()::text), 1,8)) as code,
true as is_enabled,
to_date(now()::text,
'YYYY-MM-DD HH24:MI:SS') as created_at,
to_date(now()::text, 'YYYY-MM-DD HH24:MI:SS') as updated_at
from generate_series(1,4000000) on conflict DO NOTHING;
View catch_cmd_output.go
package main
import (
"io"
"os"
"log"
"os/exec"
)
func main() {
View gist:37726aecbfcee90e370ca4085c6bec5e
const REFRESH_EXPIRED_MINUTES = 1
// somewhere (maybe in main.go) run: go WatchExpired(); go RefreshExpired();
func WatchExpired() {
services.RClient.ConfigSet("notify-keyspace-events", "Ex")
pub := services.RClient.PubSub()
pub.PSubscribe("__key*__:*")
debug, _ := conf.AppConfig.Bool("debug")
View sample-js-web-sock
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
View vuejs tabs
<div class="tabs">
<ul>
<li v-for="int in 2" class="ui-tabs-tab ui-corner-top ui-state-default ui-tab"
v-bind:class="[ picked == $index ? 'ui-state-active' : '']">
<label class="ui-tabs-anchor">Tab-${ $index }
<input type="radio" name="tabs" value="${ $index }" v-model="picked" v-show="false">
</label>
</li>
</ul>
<div v-for="w_type in wizard_types" v-show="( picked == $index )">
View postgres insert from sellect, random
insert into questions(article, name, email, text, hash, sale_location_id, created_at, updated_at ) select 1111111 as article, 'drew' as name, 'i@s.com' as email, md5(generate_series(1,10)::text) as text, md5(generate_series(1,10)::text) as hash, 'shop_r002' as sale_location_id, to_date(now()::text, 'YYYY-MM-DD HH:MI:SS') as created_at, to_date(now()::text, 'YYYY-MM-DD HH:MI:SS') as updated_at;
@andboson
andboson / gist:49a7e6b1fdd57389d261
Last active Aug 29, 2015
singleton pattern in go
View gist:49a7e6b1fdd57389d261
package singleton
import (
"sync"
)
//http://marcio.io/2015/07/singleton-pattern-in-go/
type singleton struct {
}
View gist:10be62c66c5c4610f5d5
type FFiltersController struct {
Request *http.Request
Response http.ResponseWriter
}
type inputRequest struct {
Id int `json:"id"`
Url string `json:"url"`
SaleLocationId string `json:"sale_location_id"`
Categories []string `json:"categories"`
View ab-post.txt
'{"url":"/lg-active3D-smart-tv"}'
You can’t perform that action at this time.