Skip to content

Instantly share code, notes, and snippets.

View lovubuntu's full-sized avatar
🎯
Focusing

Prabu K lovubuntu

🎯
Focusing
  • https://www.quintype.com
  • Chennai
View GitHub Profile
@lovubuntu
lovubuntu / initial_travis.yml
Last active January 16, 2019 06:37
Initial Travis configuration file
language: node_js
node_js:
- "10.4.1"
sudo: true
addons:
chrome: stable
branches:
only:
@lovubuntu
lovubuntu / package.json
Last active January 16, 2019 09:17
Default package.json generated by angular
{
"name": "angular-with-ci-cd",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
@lovubuntu
lovubuntu / hosts_file
Created January 8, 2019 09:58
/etc/hosts file after adding new entry for custom domain
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
# Add your domain name here
@lovubuntu
lovubuntu / method_chaining.js
Created October 24, 2018 17:41
Using method chaining in lodash
let _ = require('lodash');
const finalList = _.chain(oldSelectedList)
.unionWith(newlySelectedList, (o, n) => o.id === n.id)
.intersectionWith(newlySelectedList, (u, n) => u.id === n.id)
.value();
@lovubuntu
lovubuntu / old_method.js
Created October 24, 2018 17:40
First try with lodash
let _ = require('lodash');
const unionList = _.unionWith(oldSelectedList, newlySelectedList, (o, n) => o.id === n.id);
const finalList = _.intersectionWith(unionList, newlySelectedList, (u, n) => u.id === n.id);
@lovubuntu
lovubuntu / data.js
Created October 24, 2018 17:39
Data Setup
const oldSelectedList = [
{id: 1, name: 'apple', serverAttribute1: 'some value', serverAttribute2: 'some value'},
{id: 2, name: 'orange', serverAttribute1: 'some value', serverAttribute2: 'some value'}
];
const newlySelectedList = [
{id: 3, name: 'grape'},
{id: 2, name: 'orange'}
];
@lovubuntu
lovubuntu / introrx.md
Created February 2, 2018 07:31 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets

@lovubuntu
lovubuntu / BlockService.Kt
Created November 24, 2017 16:01
Make network calls using Fuel library
import com.fasterxml.jackson.databind.ObjectMapper
import com.github.kittinunf.fuel.httpGet
import com.github.kittinunf.fuel.httpPost
import tech.ajira.kitCoin.models.Block
object BlockService {
fun broadcastNewBlock(nodeAddresses: Set<String>, newBlock: Block) {
val jsonString = ObjectMapper().writeValueAsString(newBlock)
nodeAddresses.forEach { nodeAddress ->
@lovubuntu
lovubuntu / Sha256.kt
Created November 24, 2017 15:58
function to generate Sha-256 in Kotlin
Class Hasher {
fun hash(): String {
val bytes = this.toString().toByteArray()
val md = MessageDigest.getInstance("SHA-256")
val digest = md.digest(bytes)
return digest.fold("", { str, it -> str + "%02x".format(it) })
}
}