Skip to content

Instantly share code, notes, and snippets.

View nitincoded's full-sized avatar
💭
Picking a coding challenge every week, while actively on a job-search.

Nitin Reddy nitincoded

💭
Picking a coding challenge every week, while actively on a job-search.
View GitHub Profile
@nitincoded
nitincoded / app.rb
Created August 4, 2017 18:27
Sinatra Demo
#
# Author: Nitin Reddy
#
# Requires user authentication, hard-coded in: "post '/login' "
# Saves the form data that is posted to /save-form
#
require 'sinatra'
require 'sinatra/base'
require 'mongo'
@nitincoded
nitincoded / dashing03.html
Created July 20, 2017 05:04
Dashboard prototype using FlexBox
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/flexboxgrid/6.3.1/flexboxgrid.min.css" type="text/css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css" />
<style>
.red-bg { background-color: red; }
.green-bg { background-color: green; }
@nitincoded
nitincoded / Initial.java
Created June 12, 2017 13:14
Gson and Spark demo
import com.google.gson.Gson;
import com.katkam.entity.Organization;
import com.katkam.entity.Part;
/**
* Created by Developer on 6/12/17.
*/
public class Initial {
public static void main(String args[]) {
Gson gson = new Gson();
@nitincoded
nitincoded / create-4-ranges-for-KPI.sql
Created February 12, 2017 08:19
Flex: Create 4 ranges for the created KPI
--Flex for R5HOME PostInsert
declare @dupcnt int;
declare @homcod nvarchar(30), @hommax numeric(24,6), @homfunc nvarchar(30), @homkpityp nvarchar(30), @typ nvarchar(30);
select @homcod=hom_code, @hommax=HOM_MAX, @homfunc=hom_ewsfunction, @homkpityp=hom_kpitype, @typ=hom_type from r5home where hom_sqlidentity=:rowid;
--Note: Right now, we're only doing this for the requisition screen
if @homfunc<>'SSREQU' or @homkpityp not in ('D', 'SB') or @typ<>'+' or @hommax<4
return;
@nitincoded
nitincoded / add-kpi-inbox-to-user.sql
Created February 12, 2017 08:16
Add KPI and Inbox entries to the user's Start Center
create procedure uspAddKpiToUser(
@usrcod nvarchar(30),
@kpicod nvarchar(30)
)
as
begin
declare @dupcnt int;
select @dupcnt=count(1) from r5homeusers where hmu_user=@usrcod and hmu_homcode=@kpicod and hmu_homtype='+';
if @dupcnt=0 and exists(select 1 from r5home where hom_code=@kpicod and hom_type='+') and exists(select 1 from r5users where usr_code=@usrcod)
begin
@nitincoded
nitincoded / uspCreateStoreForOrg.sql
Created February 6, 2017 09:39
Creates a store for an org code in EAM
--exec dbo.uspCreateStoreForOrg 'UAE-DXB-RED'; --precondition is it must be be a 3 part org code
create procedure uspCreateStoreForOrg(
@orgcod nvarchar(30)
) as
begin
declare @dashval_orgcod_loc int;
declare @cod nvarchar(30);
declare @dupcnt int;
@nitincoded
nitincoded / jstl-demo.jsp
Created January 24, 2017 04:13
JSTL Demo
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
This is a JSP test<br />
<c:out value="This is JSTL" />
<br />
@nitincoded
nitincoded / GrizzlyHelper.java
Created January 7, 2017 16:31
Hibernate without XML
import com.fasterxml.classmate.AnnotationConfiguration;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import java.util.Properties;
/**
* Created by Developer on 1/7/17.
*/
@nitincoded
nitincoded / template-01.html
Created January 4, 2017 11:43
Template for simple crud
<!doctype html><html>
<head>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
@nitincoded
nitincoded / newuser-and-mbox-in-psh.txt
Created January 3, 2017 06:19
PowerShell script for new user and mailbox
$newuserpass=ConvertTo-SecureString "ablublah" -AsPlainText -Force
New-ADUser -Name "fname.lname" -GivenName "fname" -Surname "lname" -DisplayName "fname lname" -AccountPassword $newuserpass -Path "OU=subgroup,DC=dcname,DC=dcupname" -Enabled 1
#On Exchange Server
Enable-Mailbox -Identity fname.lname -Database MBOX01