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
{
"stories": [
{
"id": "e7c16060-829b-490c-80aa-500f445ab80c",
"pub-date": "2021-09-16T00:00:00",
"headline": "Benchmarks surge to all-time highs; telecom, auto stocks rally on reforms push",
"content": "<p class=\"tbnc-default-block\"><span class=\"tbnc-teal-bold\"><span class=\"tbnc-inline-bold\">One-liner:</span></span><span class=\"tbnc-teal-bold\"> </span>The Sensex and Nifty vaulted to fresh lifetime peaks on Wednesday, boosted by telecom and auto stocks which saw brisk buying after the govt announced packages for the sectors.</p>\n<p class=\"tbnc-default-block\"><span class=\"tbnc-teal-bold\"><span class=\"tbnc-inline-bold\">Rupee, FIIs push:</span></span> A rebounding rupee and persistent foreign capital inflows added to the momentum, traders said.</p>\n<p class=\"tbnc-default-block\"><span class=\"tbnc-teal-bold\"><span class=\"tbnc-inline-bold\">Indices rise:</span></span> Rising for the second day, the 30-share BSE Sensex surged 476.11 poi
@lovubuntu
lovubuntu / snake_naming.ts
Created March 21, 2020 08:36 — forked from recurrence/snake_naming.ts
TypeORM Snake Case Naming Strategy
import { NamingStrategyInterface, DefaultNamingStrategy } from 'typeorm'
import { snakeCase } from 'typeorm/util/StringUtils'
export class SnakeNamingStrategy extends DefaultNamingStrategy implements NamingStrategyInterface {
tableName(className: string, customName: string): string {
return customName ? customName : snakeCase(className)
}
columnName(propertyName: string, customName: string, embeddedPrefixes: string[]): string {
return snakeCase(embeddedPrefixes.join('_')) + (customName ? customName : snakeCase(propertyName))
@lovubuntu
lovubuntu / strict_mode_in_console.js
Created November 24, 2019 12:04
Strict mode in developer console of browser
(function()
{
'use strict';
let y = {one: 1, two: 2, three: 3};
Object.freeze(y);
y.one = 234; // This will throw error in console
console.log(y)
}());
@lovubuntu
lovubuntu / twos-complement.js
Created November 23, 2019 13:07
two's complement in JS
// https://www.cs.cornell.edu/~tomf/notes/cps104/twoscomp.html
// https://www.geeksforgeeks.org/efficient-method-2s-complement-binary-string/
const twosComplement = (digits) => {
let twosComplementValue = '';
const lastIndexOfOne = digits.lastIndexOf('1');
if(lastIndexOfOne === -1) {
return '1' + digits;
}
for(let i=0; i < lastIndexOfOne; i++) {
@lovubuntu
lovubuntu / nodejs_addons.md
Created August 26, 2019 05:14
A peek under the hood of node.js

V8:

  • C++ library used by Node to provide its javascript implementation
  • It provides ways of creating objects and calling methods Libuv:
  • C library that implements Event loops, worker threads and its async behaviour
  • Brings in Cross platform capabilities for many common tasks
    • Interacting with Filesystem, Sockets, Timers, System Events
    • pthreads (POSIX thread, an execution model exists independently from a language) like implementation to handle tasks for addons that need to move beyond event loop to handle parallelisation
      • Addon authors are encouraged to avoid blocking IO operations or time intensive tasks (offloading to libuv async system operations, worker threads, or custom use of libuv threads) Internal Node.js libraries:
@lovubuntu
lovubuntu / .travis.yml
Created January 16, 2019 10:30
Travis yml config to deploy to github pages
deploy:
provider: pages
skip_cleanup: true # To avoid cleanup of the artifact generated during script
github_token: $GITHUB_TOKEN # Provided as an environment variable in travis
local_dir: dist/angular-with-ci-cd # Replace this with your project name
on:
branch: master
@lovubuntu
lovubuntu / .travis_intermediate.yml
Last active January 16, 2019 09:47
Travis configuration with appropriate command line arguments for running tests in headless mode.
script:
- yarn lint
- ng test --watch false --browsers ChromeHeadless
- ng e2e --protractor-config='e2e/protractor.ci.conf.js'
- yarn build --prod --base-href $base_href
@lovubuntu
lovubuntu / .travis.yml
Last active January 16, 2019 09:01
Updated scripts
script:
- yarn all_tests #Uses yarn to run our custom script all_tests
- yarn build --prod --base-href $base_href
@lovubuntu
lovubuntu / package.json
Last active January 16, 2019 10:03
Updated package file with scripts to run unit and e2e tests in headless mode
{
"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 / ci.protractor.conf.js
Created January 16, 2019 07:13
Protractor configuration for CI
...
capabilities: {
chromeOptions: {
args: [ "--headless" ]
},
'browserName': 'chrome'
},
...