Skip to content

Instantly share code, notes, and snippets.

Avatar
🤠
Adept Coder - Full Stack Developer

Ankit Kanojia ankitkanojia

🤠
Adept Coder - Full Stack Developer
View GitHub Profile
@ankitkanojia
ankitkanojia / sample.js
Last active Sep 2, 2019
Javascript or Jquery loop iterations, Different type of loop iterations.
View sample.js
var arrayCollection = [“ABC”, “DEF”, “HIJ”];
$.each(arrayCollection, function(index, value){
console.log(“index : ,index, value :, value);
});
$(arrayCollection).each(function(index, value){
console.log(“index : ,index, value :, value);
});
@ankitkanojia
ankitkanojia / helper.cs
Created Sep 2, 2019
Copy property function to copy all properties from one object to another using reflection
View helper.cs
// Common function which is use to copy or make a clone of one object to another with datatype and value
public static void CopyProperties<TSelf, TSource>(this TSelf self, TSource source)
{
try
{
var sourceAllProperties = source.GetType().GetProperties();
foreach (var sourceProperty in sourceAllProperties)
{
var selfProperty = self.GetType().GetProperty(sourceProperty.Name);
@ankitkanojia
ankitkanojia / Test.cs
Created Sep 2, 2019
Send mail using send grid in c#
View Test.cs
using YourProject.Helpers;
namespace YourProject.Controllers
{
public class HomeController : Controller
{
public void SendTestMail1620()
{
SendEmail.Send("EMAIL SUBJECT", "EMAIL TEMPLATE or CONTENT", "TO EMAIL");
@ankitkanojia
ankitkanojia / script.js
Created Sep 2, 2019
Call ajax from any platform using jquery library
View script.js
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
function functionName(){
$.ajax({
type: "POST",
url: "URL",
data: '{parameterName: "' + parameterValue + '"',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
@ankitkanojia
ankitkanojia / Default.aspx.cs
Created Sep 2, 2019
call web method using ajax call in webform c#
View Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
@ankitkanojia
ankitkanojia / Sample.cs
Last active Sep 2, 2019
Upload/Save media file using HttpPostedFileBase class in C# MVC
View Sample.cs
using ProjectNameSpace.Helpers;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
namespace ProjectNameSpace.Controllers
@ankitkanojia
ankitkanojia / App.jsx
Created Sep 3, 2019
API call in reactjs application using axios request
View App.jsx
import React, {Component} from 'react';
import logo from './logo.svg';
import './App.css';
//install axios package using 'npm i axios' command
const axios = require('axios');
class App extends Component {
constructor(props) {
@ankitkanojia
ankitkanojia / App.jsx
Created Sep 3, 2019
API call in reactjs application using fetch request
View App.jsx
import React, {Component} from 'react';
import logo from './logo.svg';
import './App.css';
class App extends Component {
constructor(props) {
super(props);
this.state = {
isLoading: true,
@ankitkanojia
ankitkanojia / App.js
Created Sep 13, 2019
React routing using package 'react-router-dom'
View App.js
import React, {Component} from 'react';
import Header from './component/header';
import Main from './containers/main';
class App extends Component {
render() {
return (
<React.Fragment>
<Header />
<main className="container">
@ankitkanojia
ankitkanojia / Sample.html
Created Sep 17, 2019
Hight chart jquery plugin integration
View Sample.html
<html>
<body>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-3d.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<div id="container" style="height: 400px;width:500px"></></div>