Skip to content

Instantly share code, notes, and snippets.

View SanthoshRaju91's full-sized avatar
🎯
Focusing

Santhosh Raju SanthoshRaju91

🎯
Focusing
  • Rakuten
  • Bengaluru, India
View GitHub Profile
@SanthoshRaju91
SanthoshRaju91 / .vimrc
Created August 5, 2020 13:50
vimrc configuration
syntax on " enable syntax highlighting
set cursorline " highlight the current line
" set background=dark " darker color scheme
" set ruler " show line number in bar
set nobackup " don't create pointless backup files; Use VCS instead
set autoread " watch for file changes
set number " show line numbers
set showcmd " show selection metadata
set showmode " show INSERT, VISUAL, etc. mode
set showmatch " show matching brackets
@SanthoshRaju91
SanthoshRaju91 / transform.js
Created November 4, 2019 03:48
JSCodeShift transformer for deleting `.scss` import references in your React project, just in case if you changed your mind to use post-css or tailwind.css for your project. Just like me (sh** me)
export default function transformer(file, api) {
const j = api.jscodeshift;
const root = j(file.source);
const match = /([a-zA-Z0-9\s_\\.\-\(\):])+(.scss)$/;
root
.find(j.ImportDeclaration)
.filter(path => match.test(path.value.source.value))
.forEach(path => {
j(path).remove();
@SanthoshRaju91
SanthoshRaju91 / starter.js
Last active December 1, 2018 17:20
React starter
//prettier
// create a .prettierrc file in project root folder
// in VScode - user.settings prettier.requireConfig: true and editor.formatOnSave: true
// prettier format
{
"format": "prettier --write \"src/**/*.{js,jsx,css,json}\""
}
// run this on CI server, to check difference in code format.
@SanthoshRaju91
SanthoshRaju91 / practice.js
Created July 19, 2018 09:57
Just practicing
// function Employee(name, dept) {
// this.name = name;
// this.dept = dept;
// }
// Employee.prototype = {
// getName() {
// return this.name;
// },
// getDept() {
@SanthoshRaju91
SanthoshRaju91 / readme.md
Created May 30, 2018 12:02
how to fix npm install - access permission issue

How to fix npm install 's - access permission issue.

This gist is targeted for users using any linux type OS.

Steps to fix it.

  1. Create a hidden directory named .npm-global in your home directory.

cd ~

@SanthoshRaju91
SanthoshRaju91 / configuration.md
Last active May 16, 2018 05:15
Jest configuration

This is the configuration steps to configure Jest testing framework for react applications.

  1. npm install --save-dev jest

It loads all of the dependencies to work with jest, so you don't need to figure them out individually again.

  1. Add script for jest in package.json
{
....
@SanthoshRaju91
SanthoshRaju91 / algo_practices.md
Last active May 14, 2018 03:18
Practicing my algorithm skills

Finding value of deeply nested objects with object keys.

function findKeyValue(paymentObj, key) {
	const keySplit = key.split('.');
	let value = '';
	function findValue(obj, first, ...keys) {
    	if(typeof obj[first] === 'object') {
    		if(keys) {
              findValue(obj[first], ...keys);
    		}
// finding value for deeply nested objects with object keys
function findKeyValue(paymentObj, key) {
const keySplit = key.split('.');
let value = '';
function findValue(obj, first, ...keys) {
if(typeof obj[first] === 'object') {
if(keys) {
findValue(obj[first], ...keys);
import Ember from 'ember';
const { computed } = Ember;
export default Ember.Component.extend({
fullName: computed('firstName', 'lastName', function() {
console.log('Called in computed');
const firstName = this.get('firstName');
const lastName = this.get('lastName');
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
content: `Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam tempus, lacus ac pellentesque tincidunt, tortor libero laoreet sapien, eu ornare urna nunc tincidunt ipsum. Mauris elementum, lectus ut facilisis pulvinar, enim sapien pretium diam, eleifend elementum tellus diam in quam. Aenean dignissim ipsum aliquam, consectetur massa sit amet, dignissim nulla. Sed ex diam, dictum dapibus lacinia ac, viverra at tellus. Nunc vehicula lorem sit amet luctus bibendum. Vivamus fringilla metus eget venenatis malesuada. Praesent auctor risus ut dictum maximus. Proin quis vestibulum sapien. Vivamus fringilla, felis eu fringilla faucibus, diam ante euismod enim, nec ultrices elit mi eget justo. Vivamus id porttitor turpis. Phasellus sed nisl est. Sed fermentum suscipit justo, id vehicula quam tempor vitae.`
});