Skip to content

Instantly share code, notes, and snippets.

View rbhatia46's full-sized avatar

Rahul Bhatia rbhatia46

  • Bengaluru
View GitHub Profile
@rbhatia46
rbhatia46 / Convert to LIME format.py
Created May 21, 2019 07:00
Converts data with categorical values as string into the right format for LIME, with categorical values as integers labels.
import pandas as pd
def convert_to_lime_format(X, categorical_names, col_names=None, invert=False):
"""Converts data with categorical values as string into the right format
for LIME, with categorical values as integers labels.
It takes categorical_names, the same dictionary that has to be passed
to LIME to ensure consistency.
@rbhatia46
rbhatia46 / Anaconda-Commands.md
Created December 19, 2018 12:57
Basic Anaconda Commands for managing Virtual Environments

Basic Anaconda Commands

  1. Create a New Virtual Environment
conda create --name project1 python=3.5.7 pip numpy 
  1. Activate a particular environment
activate project1
import React from 'react'
import {
TouchableOpacity,
StyleSheet,
View
} from 'react-native'
const height = 40
const padding = 10
const margin = 10
@rbhatia46
rbhatia46 / yarn.md
Created January 25, 2018 16:28
Yarn Basic Commands

GET VERSION

yarn -v (or --version)

GET HELP

yarn help

CREATE PACKAGE.JSON

yarn init yarn init -y // Use defaults

@rbhatia46
rbhatia46 / HelloExpress.js
Last active December 28, 2017 16:00
Hello World in Express
var express = require('express');
var app = express();
app.get('/', function (req, res) {
res.send('Hello World!');
});
app.listen(3000, function () {
console.log('Server running on port 3000');
});
@rbhatia46
rbhatia46 / MaterializeModal.html
Created December 22, 2017 14:19
Example of Modal in Materialize CSS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css" />
<title>Document</title>
</head>
<body>
@rbhatia46
rbhatia46 / PassportAuthentication.js
Last active December 19, 2017 18:24
Boilerplate to authenticate using Google using Passport.js and Express Server
const express = require('express');
const passport = require('passport');
const GoogleStrategy = require('passport-google-oauth20').Strategy;
const keys = require('./config/keys');
const app = express();
passport.use(new GoogleStrategy({
clientID : keys.googleClientID,
clientSecret : keys.googleClientSecret,
@rbhatia46
rbhatia46 / CardSection.js
Created December 15, 2017 21:56
Reusable Card Section Component for React Native
import React from 'react';
import { View } from 'react-native';
const CardSection = (props) => {
return(
<View style={styles.containerStyle}>
{props.children}
</View>
);
}
@rbhatia46
rbhatia46 / Card.js
Created December 15, 2017 21:56
Reusable Card Component for React Native
import React from 'react';
import { View,Text } from 'react-native';
const Card = (props) => {
return (
<View style={styles.containerStyle}>
{props.children}
</View>
);
}
@rbhatia46
rbhatia46 / Button.js
Last active December 15, 2017 21:48
Reusable Button Component for React Native
import React from 'react';
import { Text, TouchableOpacity } from 'react-native';
const Button = (props) => {
return (
<TouchableOpacity style={styles.buttonStyle} onPress={props.onPress}>
<Text style={styles.textStyle}>{props.buttonText}</Text>
</TouchableOpacity>
);
};