Voice and Messaging platform

Create an app in plivo for Auth Id and Auth token.

note: In a sandbox, add all the numbers to make a call and send messages.

Call

require 'rubygems'
require 'plivo'
include Plivo
client = Plivo::RestClient.new('*A*U*T*H*I*D*', '**********A*U*T*H*T*O*K*E*N*****')#client.calls.create('your_source_number'['your_destination_number'],'https://answer.url')client.calls.create('+91**********',['+91**********'],'url')

handling daylight saving, time zone and time with ruby on rails

Knowledge transfer from Surendran Sukumaran

  1. Time zone select with daylight handling

On Fri, 12 Jun 2020 22:27:45

Daylight saving time in the United States 2020 in Colorado began onSunday,8 March and ends on Sunday,1 November

Daylight saving is…

While working with agreements get into the situation of printing an agreement after preview.

while printing the agreement, instead of entire page need to print the selective element.

Tried many solutions given is stack over flow but only few have worked.
agreement.html

<h4>Sample Agreement</h4>
<p>Sample Content</p>
<button type="button" class="btn btn-green default-okay-button print-agreement">Print</button>

print.js

$('.print-agreement').click(function(){
var sraHeader = $(".sra-header").text()
var sraContent = $(".sra-content").text()
var winPrint = window.open('', '', 'left=0,top=0,width=800,height=600,toolbar=0,scrollbars=0,status=0')
winPrint.document.write(sraHeader + '<br>' + sraContent);
winPrint.document.close();
winPrint.focus();
winPrint.print();
})

Other way by using jQuery printing plugin

Rails Migration files update by regular expression

We recently upgrade from rails 4 to rails 5 and while running rspec migration need to update all migration file by adding [5.0]

From “ActiveRecord::Migration”

To “ActiveRecord::Migration[5.0]”

We have around 400 files and changing manually is hard. So small script with regular expression to replace “ActiveRecord::Migration” to “ActiveRecord::Migration[5.0]”

`To “ActiveRecord::Migration[5.0]”

Dir.glob("#{Rails.root}/db/migrate/*").each do |file_name|text = File.read(file_name)File.open(file_name, "w") {|file| file << text.gsub(/\bActiveRecord::Migration\b/,"ActiveRecord::Migration[5.0]") }end

openCV with Python

  1. Installation and version managing
  2. Basic OpenCV, python
  3. Sample code

Install OpenCV on Ubuntu 18.04

Sample image to grayscale image

object-detection.pyimport cv2import numpy as npfrom matplotlib import pyplot as pltimg = cv2.imread('watch.jpg', 0)cv2.imshow('image',img)cv2.waitKey(0)cv2.destroyAllWindows()

library

  1. Matplotlib is an optional choice for displaying frames from video or images…

code and configuration

About code wise upgrade

Stack upgrade effects(from 14.x to 18.x)
a. wkhtmltopdf
b. postgress
c. aws-S3
d. redis
e. sidekiq
f. Environments stack from Ubutu 14.x to 18.x( staging / pre-production / production)

a. wkhtmltopdf

We faced issue in wkhtmltopdf with s3 https image accessing . No issues with http…

Javascript, ruby on rails, coffeescript, css, reactjs, angular1, html, scss, sass

Ruby Style Guide

https://github.com/bbatsov/ruby-style-guide
https://github.com/airbnb/ruby
https://github.com/thoughtbot/guides/tree/master/style/rails
https://web.archive.org/web/20160410033955/https://github.com/styleguide/ruby
https://github.com/hopsoft/rails_standards

Js Style Guide

https://javascript.info/coding-style
https://github.com/airbnb/javascript
https://github.com/airbnb/javascript/tree/master/css-in-javascript
https://github.com/bendc/frontend-guidelines
https://developer.wordpress.org/coding-standards/wordpress-coding-standards/javascript/
https://github.com/bevacqua/js
https://github.com/rwaldron/idiomatic.js/
https://github.com/Khan/style-guides/blob/master/style/javascript.md#braces
https://google.github.io/styleguide/jsguide.html
https://www.w3schools.com/js/js_conventions.asp
https://contribute.jquery.org/style-guide/js/#equality

CoffeeScript Style Guide

https://github.com/polarmobile/coffeescript-style-guide
https://www.npmjs.com/package/coffeescript-styleguide
https://github.com/apiaryio/coffeescript-style-guide
https://github.com/polarmobile/coffeescript-style-guide

CSS Style Guide

https://google.github.io/styleguide/htmlcssguide.html
https://cssguidelin.es/#removing-comments
https://codeguide.co/
https://levelup.gitconnected.com/the-complete-css-style-guide-for-your-next-project-bb5a5d8f7bc9
https://github.com/airbnb/css
https://github.com/bendc/frontend-guidelines
https://github.com/dropbox/css-style-guide

ReactJS-Style-Guide

https://github.com/airbnb/javascript/tree/master/react
https://airbnb.io/javascript/react/
https://github.com/pagarme/react-style-guide
https://css-tricks.com/react-code-style-guide/

Angular1 Style Guide

https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md
https://ultimatecourses.com/blog/rewriting-angular-styleguide-angular-2
https://github.com/toddmotto/angularjs-styleguide
https://github.com/mgechev/angularjs-style-guide
Add a custom foo

HTML Style Guide

https://google.github.io/styleguide/htmlcssguide.html
https://gist.github.com/ryansechrest/8693303
https://contribute.jquery.org/style-guide/html/
https://codeguide.co/
https://www.w3schools.com/html/html5_syntax.asp
https://github.com/bendc/frontend-guidelines
https://html-style-guide.netlify.com/

SCSS Style Guide

https://docs.gitlab.com/ee/development/fe_guide/style/scss.html
https://www.npmjs.com/package/scss-style-guide

SASS Style Guide

https://sass-guidelin.es/#about-sass
https://codinginadtech.com/posts/the-ultimate-sass-style-guide
https://css-tricks.com/sass-style-guide/

Praaveen Vr

Tech blogger..

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store