Skip to content

Instantly share code, notes, and snippets.

View pranavq212's full-sized avatar
:octocat:
Forever Learning

Pranav Singh pranavq212

:octocat:
Forever Learning
View GitHub Profile
@Munawwar
Munawwar / ExcelDataReader.cs
Last active January 14, 2020 12:19
C# - Excel Data Reader Library - Convert Excel (XLSX or XLS) to CSV
/*
* Dependency : Excel Data Reader from http://exceldatareader.codeplex.com/
* You must add the references to the Dlls (downloaded from the link above) with Visual Studio.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Excel;
public class HomeController : Controller {
[AsyncTimeout(1000)]
[HandleError(ExceptionType = typeof(TimeoutException), View = "TimeoutError")]
public async Task<ActionResult> Foo(CancellationToken cancellationToken) {
using (HttpClient client = new HttpClient()) {
await client.GetStringAsync("http://localhost:2098/Home/Wait", cancellationToken);
}
@ChuckSavage
ChuckSavage / XmlLinqConversionExtensions.cs
Created February 20, 2013 00:06
Convert To/From XmlDocument and XDocument/XElements
using System.Xml;
using System.Xml.Linq;
namespace XmlLib
{
/// <summary>
/// Provides extension methods for simple conversion between System.Xml and System.Xml.Linq classes.
/// </summary>
/// <remarks>From: http://brianary.blogspot.com/2010/02/converting-between-xdocument-and.html</remarks>
public static class XmlLinqConversionExtensions
@caged
caged / d3-server.js
Last active October 17, 2023 04:05
Directly render and serve d3 visualizations from a nodejs server.
// Start `node d3-server.js`
// Then visit http://localhost:1337/
//
var d3 = require('d3'),
http = require('http')
http.createServer(function (req, res) {
// Chrome automatically sends a requests for favicons
// Looks like https://code.google.com/p/chromium/issues/detail?id=39402 isn't
// fixed or this is a regression.
@robschmuecker
robschmuecker / README.md
Last active July 22, 2024 12:38
D3.js Drag and Drop, Zoomable, Panning, Collapsible Tree with auto-sizing.

This example pulls together various examples of work with trees in D3.js.

The panning functionality can certainly be improved in my opinion and I would be thrilled to see better solutions contributed.

One can do all manner of housekeeping or server related calls on the drop event to manage a remote tree dataset for example.

Dragging can be performed on any node other than root (flare). Dropping can be done on any node.

Panning can either be done by dragging an empty part of the SVG around or dragging a node towards an edge.

@mariodivece
mariodivece / CsvReader.cs
Last active April 6, 2017 11:17
Very simple CSV file reader. Not to be used for very large files.
/// <summary>
/// Author: Mario Di Vece <mario@unosquare.com>
/// Date: 3/19/2014
/// Updated: 9/18/2014
/// License: MIT
/// </summary>
namespace Unosquare.Utils
{
using System;
using System.Collections.Generic;
@pstoica
pstoica / OnBlurComponent.jsx
Last active August 1, 2023 21:00
onBlur for entire react element
function OnBlurComponent({ onBlur }) {
const handleBlur = (e) => {
const currentTarget = e.currentTarget;
// Check the newly focused element in the next tick of the event loop
setTimeout(() => {
// Check if the new activeElement is a child of the original container
if (!currentTarget.contains(document.activeElement)) {
// You can invoke a callback or add custom logic here
onBlur();
/// <summary>
/// Special JsonConvert resolver that allows you to ignore properties. See http://stackoverflow.com/a/13588192/1037948
/// </summary>
public class IgnorableSerializerContractResolver : DefaultContractResolver {
protected readonly Dictionary<Type, HashSet<string>> Ignores;
public IgnorableSerializerContractResolver() {
this.Ignores = new Dictionary<Type, HashSet<string>>();
}
@sgruhier
sgruhier / .block
Created April 23, 2017 09:58
zoom/pan d3v4
license: mit