Skip to content

Instantly share code, notes, and snippets.

View melvinodsa's full-sized avatar
🙃
Learning Rust

Melvin Davis melvinodsa

🙃
Learning Rust
View GitHub Profile
@melvinodsa
melvinodsa / Redis.md
Created March 21, 2019 15:53
Issue for shredx plans

Redis

  • Spend some time learning Redis
  • Create a small set of applications to discover different use case of Redis.
    • A dummy application to mock data for e-commerce platform. Through this application, we can feed in data. Call it a data publisher. It will push platform metrics data into Redis cache. Then will pass the message through Redis about the data changes
    • Another application that uses Redis cache to store and keeps a real-time track of the platform metrics(call it data subscriber). This web application will retrieve the platform metrics information on-demand from Redis cache. It will use web sockets for active connection with its client. It subscribes to the data changes published by the data publisher. If data change, ti will push the new metric information to the client.

Features to be covered

  • Redis Overview
  • Redis key-value cache store
  • Master/slave replication in Redis
@melvinodsa
melvinodsa / jsonstring.go
Created January 27, 2019 03:28
Parse JSON in Golang
package main
import (
"encoding/json"
"fmt"
"log"
"strings"
)
func main() {
const iNeverFail = insurance({
foo: 'bar',
baz: {
qux: 10,
name: 'yoyo'
},
});
iNeverFail.asd //ƒ anonymous()
iNeverFail.asd.name // "Undefined"
function insurance(obj) {
return new Proxy(obj, {
get(target, key) {
const accessedProperty = Reflect.get(target, key);
if (typeof accessedProperty === 'object') {
return insurance(accessedProperty);
} else {
return accessedProperty == undefined ?
Undefined:
var handler = {
get: function(obj, prop) {
return prop in obj ?
obj[prop] :
37;
}
};
var p = new Proxy({}, handler);
p.a = 1;
const Undefined = new Proxy(function() {}, {
get(target, key, receiver) {
if (key === 'name') {
return 'Undefined';
}
return Undefined;
},
apply() {
return Undefined;
@melvinodsa
melvinodsa / .vimrc
Created November 8, 2018 00:01
My vim rc
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
import { Injectable } from '@angular/core';
/**
* ConfigService has the configuration utilities required for the application
*/
@Injectable({
providedIn: 'root'
})
export class ConfigService {
/**
@melvinodsa
melvinodsa / Blur Admin Compiled App CSS
Last active March 8, 2017 05:21
Blur Admin Compiled CSS
@charset "UTF-8";.bootstrap-switch .bootstrap-switch-container:focus,.bootstrap-switch:focus,.compose-container .ta-text.ta-editor div:focus{outline:0}.lists-widget ol.blur,.lists-widget ol.blur ol{counter-reset:section}.alert{color:#fff;font-size:13px;font-weight:300}.alert .alert-link,.alert strong,.chartist h5{font-weight:400}.alert .close{margin-top:-3px}.alert .control-alert{padding-top:10px}.alert .control-alert button{margin-right:10px}.closeable button{color:#cbcbcb}.bg-success{background-color:rgba(144,185,0,.85);color:#fff}.bg-success a{color:#c54949}.bg-success a:hover{color:#e85656}.bg-info{background-color:rgba(45,172,209,.85);color:#fff}.bg-info a{color:#e9cd60}.bg-info a:hover{color:#dfb81c}.bg-warning{background-color:rgba(223,184,28,.85);color:#fff}.bg-warning a{color:#c54949}.bg-warning a:hover{color:#e85656}.bg-danger{background-color:rgba(232,86,86,.85);color:#fff}.bg-danger a{color:#e9cd60}.bg-danger a:hover{color:#dfb81c}.basic-btns{padding-top:8px;margin-bottom:-8px}.basic-btns h5{line-
@melvinodsa
melvinodsa / Tic tac.markdown
Last active August 29, 2015 14:27
Tic tac