Skip to content

Instantly share code, notes, and snippets.

View cguldogan's full-sized avatar
💭
😼 This is the way

Can GULDOGAN cguldogan

💭
😼 This is the way
View GitHub Profile
@cguldogan
cguldogan / ExcelOperations.cs
Last active March 29, 2016 13:06
Read Excel in C#
public class ExcelOperations
{
public List<List<string>> Read(string filePath)
{
OleDbConnection conn = new OleDbConnection("Provider = Microsoft.ACE.OLEDB.12.0; Data Source = " + filePath + "; Extended Properties = 'Excel 8.0; HDR=NO'");
OleDbCommand cmd = new OleDbCommand("select * from [Sheet1$]", conn);
conn.Open();
OleDbDataReader dr = cmd.ExecuteReader();
@cguldogan
cguldogan / PreFlightHandler.cs
Created March 9, 2016 09:49
PreFlightHandler for Asp.net Web Api
public class PreFlightHandler : DelegatingHandler
{
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
if (request.Headers.Contains("Origin"))
{
var origin = request.Headers.GetValues("Origin").ToList()[0];
if (request.Method.Method.Equals("OPTIONS"))
{
@cguldogan
cguldogan / angularget.html
Created February 28, 2016 00:17
Angular Get
<!doctype html>
<html ng-app='myApp'>
<head>
<title>Simple Angular.Js Get Sample Snippet</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0-beta.1/angular.min.js"></script>
<script>
angular.module('myApp', []).controller('myCtrl', function ($scope, $http) {
$scope.hello = {};
$scope.newName = "";