Skip to content

Instantly share code, notes, and snippets.

View rahulraghavankklm's full-sized avatar
🎯
Focusing

Rahul Raghavan rahulraghavankklm

🎯
Focusing
View GitHub Profile
@rahulraghavankklm
rahulraghavankklm / lazy-video-loader.js
Created April 22, 2019 05:07 — forked from benrobertsonio/lazy-video-loader.js
Lazy Loading Video Based on Connection Speed
class LazyVideoLoader {
constructor() {
this.videos = [].slice.call(document.querySelectorAll('.hero__bgvideo'));
// Abort when:
// - The browser does not support Promises.
// - There no videos.
// - If the user prefers reduced motion.
// - Device is mobile.
if (
{
"_description: Name of City, or Town": {
"State": "The Indian State under which this City/Town exists.",
"GeoCode": [
"Latitude",
"Longitude"
],
"PinCodes": [
"All",
"The",
@rahulraghavankklm
rahulraghavankklm / postman_install.sh
Created August 9, 2018 05:48 — forked from oleg-sh-test/postman_install.sh
Postman install Ubuntu 18.04
#!/bin/bash
# Get postman app
wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz
sudo tar -xzf postman.tar.gz -C /opt
sudo ln -s /opt/Postman/Postman /usr/bin/postman
#Create a Desktop Entry
cat > ~/.local/share/applications/postman.desktop <<EOL
[Desktop Entry]
Encoding=UTF-8
@rahulraghavankklm
rahulraghavankklm / pm_install.sh
Created August 9, 2018 05:38 — forked from punkdata/pm_install.sh
Postman Install Ubuntu 17.10
#!/usr/bash
wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz
sudo tar -xzf postman.tar.gz -C /opt
sudo ln -s /opt/Postman/Postman /usr/bin/postman
#Create a Desktop Entry
cat > ~/.local/share/applications/postman.desktop <<EOL
[Desktop Entry]
Encoding=UTF-8
Name=Postman
@rahulraghavankklm
rahulraghavankklm / Get week number
Created July 31, 2018 09:41 — forked from IamSilviu/Get week number
JavaScript Get week number.
Date.prototype.getWeek = function () {
var onejan = new Date(this.getFullYear(), 0, 1);
return Math.ceil((((this - onejan) / 86400000) + onejan.getDay() + 1) / 7);
};
var myDate = new Date("2001-02-02");
myDate.getWeek(); //=> 5
@rahulraghavankklm
rahulraghavankklm / css-grid-responsive-gallery-grid-layout.markdown
Created May 12, 2018 05:43
CSS Grid - Responsive Gallery Grid Layout
@rahulraghavankklm
rahulraghavankklm / test.js
Created April 7, 2018 06:39 — forked from smalljam/test.js
xlsx library patch, so we can make bold cells and align them to the right
var XLSX = require('xlsx')
function Workbook() {
this.SheetNames = ['Report'];
this.Sheets = {};
}
var wb = new Workbook();
var ws = {
@rahulraghavankklm
rahulraghavankklm / LICENSE
Created April 5, 2018 11:24 — forked from kalebdf/LICENSE
Export Table Data to CSV using Javascript
MIT License
Copyright (c) 2015 Kaleb Fulgham
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@rahulraghavankklm
rahulraghavankklm / media-query.css
Created March 9, 2018 10:35 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
export const expenseFormPlugin = (state, action) => {
if (action.type === '@@redux-form/CHANGE' && action.meta && action.meta.form === 'expenseForm' && action.meta.field) {
if (action.meta.field === 'time' || action.meta.field === 'rate') {
const time = state.values.time? parseInt(state.values.time, 10) : 0
const rate = state.values.rate ? parseInt(state.values.rate, 10): 0
const total = time * rate
return {
...state,
values: {
...state.values,