Skip to content

Instantly share code, notes, and snippets.

View rohitkandhal's full-sized avatar

Rohit K rohitkandhal

View GitHub Profile
// imports a couple of java tasks
apply plugin: "java"
// List available tasks in the shell
> gradle tasks
// A Closure that configures the sourceSets Task
// Sets the main folder as Source folder (where the compiler is looking up the .java files)
sourceSets {
main.java.srcDir "src/main"
@rohitkandhal
rohitkandhal / HashMap
Created October 21, 2013 04:56
Java HashMapget function
/**
* Returns the value to which the specified key is mapped,
* or {@code null} if this map contains no mapping for the key.
*/
public V get(Object key) {
if (key == null)
return getForNullKey();
Entry<K,V> entry = getEntry(key);
return null == entry ? null : entry.getValue();
@rohitkandhal
rohitkandhal / NewProjectPrompt
Created July 10, 2013 21:01
Prompt Dialog with action links
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>New Project options:</h3>
</div>
<div class="modal-body">
<div class="row-fluid">
<div class="control-group">
Do you want to create new course or update existing course?
@rohitkandhal
rohitkandhal / HTMLHelpers.cs
Created July 7, 2013 18:18
Custom ActionLink with text and icon
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
namespace LMSPriorTool.Helpers
{
/// <summary>
@rohitkandhal
rohitkandhal / Index.cshtml
Created July 7, 2013 17:39
Modal dialog view
<div class="container">
<!-- Project General Details Section -->
<div class="row span11">
@Html.ActionLink("Create", "Create", "Project",
new { id = 1 },
new { id = "btnCreate", @class = "btn btn-primary modal-link" })
@Html.ActionLink("Edit", "Edit", "Project",
new { id = 1 },
new { id = "btnAdd", @class = "btn btn-success modal-link" })
@Html.ActionLink("Delete", "DeleteProject", "Home",
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<!-- other tags-->
@Styles.Render("~/Content/css", "~/Content/themes/base/css", "~/Content/bootstrap")
@Scripts.Render("~/bundles/modernizr")
<script src="@Url.Content("~/Scripts/jquery-1.9.1.min.js")" type="text/javascript"></script>
</head>
<body>
@model DialogTest.ViewModels.DeleteConfirmationViewModel
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Delete @Html.DisplayFor(x => x.HeaderText)</h3>
</div>
@using (Html.BeginForm(Model.PostDeleteAction, Model.PostDeleteController, FormMethod.Post, new { @class = "modal-form form-horizontal" }))
{
@Html.ValidationSummary()
@rohitkandhal
rohitkandhal / DropDown
Last active December 19, 2015 10:18
Using drop-down list with ViewModel in ASP.net MVC4
Objective: In this page, we will see how to populate a drop-down list on View in ASP.net MVC4.
Setup: Suppose you have a Project entity with two properties:
a) Project Name
b) Project Status (can be Active, Inactive, Inprogress etc.)
Models > Project.cs
public partial class Project
{
// Scalar Properties