Skip to content

Instantly share code, notes, and snippets.

View przbadu's full-sized avatar
🏠
Working from home

Pushpa Raj Badu przbadu

🏠
Working from home
View GitHub Profile
@przbadu
przbadu / Setup-ubuntu-for-web-development.sh
Last active July 26, 2020 20:42
Setting up ubuntu for web development for first time
#!/bin/sh
# Author: przbadu
# email: przbadu.social@gmail.com
# github: github.com/przbadu
# update ubuntu
sudo apt-get update
# install vim, git, curl, tmux
sudo apt-get install vim git curl tmux
# install the silver searcher
@przbadu
przbadu / Brewfile
Last active June 1, 2017 04:53
Manage brew packages in Brewfile
tap 'caskroom/cask'
tap 'caskroom/fonts'
brew 'ack'
brew 'ctags'
brew 'git'
brew 'gdrive'
brew 'qt@5.5'
brew 'imagemagick'
brew 'vim'
@przbadu
przbadu / form-validation.html
Created May 21, 2017 09:35
Form validation to check, name should present, email should contain @ and . character and password should be atleast 8 character long
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Form validation</title>
<script>
function validate() {
var name = document.getElementById('name').value;
var password = document.getElementById('password').value;
var email = document.getElementById('email').value;
@przbadu
przbadu / php development environment ubuntu 16.04.md
Last active May 7, 2018 21:03
PHP, mysql, apache2 setup for ubuntu 16.04

Install required packages including PHP 7 and 5.6, apache2 and mysql

# Install git
sudo apt-get install git vim

# Add ondrej/php ppa
sudo apt-add-repository -y ppa:ondrej/php

# update package
@przbadu
przbadu / Sublime Setup.md
Last active June 21, 2017 08:14
Setup sublime for devlopment

keymap

[
	{ "keys": ["f6"], "command": "expand_fqcn" },
	{ "keys": ["shift+f6"], "command": "expand_fqcn", "args": {"leading_separator": true} },
	{ "keys": ["f5"], "command": "find_use" },
	{ "keys": ["f4"], "command": "import_namespace" },
	{ "keys": ["alt+ctrl+i"], "command": "reindent", "args": {"single_line": false}},
	{ "keys": ["shift+f12"], "command": "goto_definition_scope" },
@przbadu
przbadu / SQL.sql
Last active July 12, 2017 07:58
Merge different sql into one big giant sql query to improve performance
select * from (
-- Male patients age between(0-9)
(select count(distinct patients.id) as total_male_patients_0_9
from patients
INNER JOIN patient_histories
on patients.id=patient_histories.patient_id
where patient_histories.day=1
AND patient_histories.month=1
AND patient_histories.year=2074
AND patients.gender="male"
@przbadu
przbadu / aspnet-iis.md
Last active September 8, 2017 06:16
Deploy Asp.net mvc web application to IIS server
  1. Publish your project, Create new profile, set export path, select Release version over debug and then Publish
  2. Enable IIS feature: a. search for program and feature ( Windows + R (run dialog box) and type services.msc and hit enter). b. Turn windows features on and off c. Internet Information System (IIS) d. Check Web Management tools -> IIS Management Console e. World Wide Web Services -> Check all (Application Development Features), Common HTTP Features and others as required. f. Click ok, and restart computer. g. sometimes this is not enough, as a safe side, run below commands
@przbadu
przbadu / Docker-commands.md
Last active October 31, 2017 04:43
Learning Docker
@przbadu
przbadu / react-on-docker.md
Last active December 16, 2023 13:44
Setup Docker for React development

STEP 2: setup docker to run react app (dev and production) configuration: https://gist.github.com/przbadu/929fc2b0d5d4cd78a5efe76d37f891b6

Setup Docker for React development

Because we are using Docker, we are not going to install node, npm, create-react-app in our development machine, not even for generating create-react-app scaffold.

For this purpose I am using 2-step docker configuration:

  • In first step, we will create a simple docker container, that does only one thing, install create-react-app
@przbadu
przbadu / _.attempt.js
Created August 28, 2017 03:18
Lodash useful helper functions that we should use from today.
// Using try-catch to handle the JSON.parse error
function parse(str){
try {
return JSON.parse(str);
}
catch(e) {
return false;
}
}