This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// function for calculating 6 letters hex value | |
export const hexToRgbaFull = (hex, opacity = 1) => { | |
hex = ( hex.charAt(0) === "#" ? hex.substr(1) : hex ); | |
var r = parseInt(hex.substring(0, 2), 16); | |
var g = parseInt(hex.substring(2, 4), 16); | |
var b = parseInt(hex.substring(4, 6), 16); | |
return `rgba( ${r}, ${g}, ${b}, ${opacity} )`; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mplayer -tv driver=v4l2:width=270:height=190: -vo xv -vf mirror tv:// -geometry "99%:99%" -noborder -ontop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {any} obj The object to inspect. | |
* @returns {boolean} True if the argument appears to be a plain object. | |
*/ | |
export default function isPlainObject(obj) { | |
if (typeof obj !== 'object' || obj === null) return false | |
let proto = obj | |
while (Object.getPrototypeOf(proto) !== null) { | |
proto = Object.getPrototypeOf(proto) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"lastUpload":"2019-06-04T15:16:59.712Z","extensionVersion":"v3.2.9"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import types from "./App/components/Post/types"; | |
const schema = [ | |
{ type: "text,image,video", model: 'squ', item: {} }, | |
{ type: "video,image,text", model: 'rec', item: {} }, | |
{ type: "video,image,text", model: 'rec', item: {} }, | |
{ type: "text,image,video", model: 'squ', item: {} }, | |
{ type: "text,image,video", model: 'squ', item: {} }, | |
{ type: "video,image,text", model: 'big', item: {} }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible | |
filetype off | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
Plugin 'VundleVim/Vundle.vim' | |
" Add plugins here | |
Plugin 'ctrlpvim/ctrlp.vim' | |
Plugin 'gkapfham/vim-vitamin-onec' | |
Plugin 'itchyny/lightline.vim' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// go run main.go --config ./config/config.yaml | |
// go run main.go --config ./config/config.json | |
// go run main.go --config ./config/config.toml | |
// file name also can be any name : config, app and etc. | |
var configFile = flag.String("config", "./config/config.yaml", "Address of config file") | |
func parseConfig() { | |
dir, file := path.Split(*configFile) | |
ext := path.Ext(file) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func init() { | |
viper.SetConfigFile(`config.json`) | |
err := viper.ReadInConfig() | |
if err != nil { | |
panic(err) | |
} | |
if viper.GetBool(`debug`) { | |
fmt.Println("Service RUN on DEBUG mode") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dbHost := viper.GetString(`database.host`) | |
dbPort := viper.GetString(`database.port`) | |
dbUser := viper.GetString(`database.user`) | |
dbPass := viper.GetString(`database.pass`) | |
dbName := viper.GetString(`database.name`) | |
connection := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s", dbUser, dbPass, dbHost, dbPort, dbName) | |
val := url.Values{} | |
val.Add("parseTime", "1") | |
val.Add("loc", "Asia/Jakarta") | |
dsn := fmt.Sprintf("%s?%s", connection, val.Encode()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`SELECT | |
* | |
FROM | |
Posts | |
WHERE | |
CreateAt `+direction+` (SELECT CreateAt FROM Posts WHERE Id = :PostId) | |
AND ChannelId = :ChannelId | |
AND DeleteAt = 0 | |
ORDER BY CreateAt `+sort+` | |
LIMIT :Limit |
OlderNewer