Category: Uncategorized
QUnit – javascript unit testing
QUnit is used by jQuery and many more frameworks for unit testing javascript code.
Setting custom background color on a web page in Chrome
“Care your eyes” – extension for Chrome:
Change a webpage’s background color to reseda or night mode to protect your eyes from intensity of white or other lightness color.
https://chrome.google.com/webstore/detail/care-your-eyes/fidmpnedniahpnkeomejhnepmbdamlhl
“Deluminate” – extension for Chrome:
Invert the brightness of the web without changing the colors! Useful as a night mode to darken most bright web sites (like Google), or just for making the web soothing black instead of glaring white. Similar to the “High Contrast” or “Hacker Vision” extensions, but tries not to ruin images by blowing out the contrast or changing the colors.
https://chrome.google.com/webstore/detail/deluminate/iebboopaeangfpceklajfohhbpkkfiaa
TrackJS JavaScript Error Tracking
JavaScript Error Tracking for Modern JavaScript Web Applications
Exception Tracking | Analytics for Web (analytics.js) | Google Developers
Log javascript exceptions with Google Analytics
Source: Exception Tracking | Analytics for Web (analytics.js) | Google Developers
General Naming Conventions
https://msdn.microsoft.com/en-us/library/ms229045(v=vs.110).aspx
AngleSharp .NET library for scraping and parsing html/xml/css
AngleSharp is a .NET library that gives you the ability to parse angle bracket based hyper-texts like HTML, SVG, and MathML. XML without validation is also supported by the library. An important aspect of AngleSharp is that CSS can also be parsed. The parser is built upon the official W3C specification. This produces a perfectly portable HTML5 DOM representation of the given source code. Also current features such as querySelector
or querySelectorAll
work for tree traversal.
.NET C# to SQL Server Data Types Mapping table
SQL Server and the .NET Framework are based on different type systems. For example, the .NET Framework Decimal structure has a maximum scale of 28, whereas the SQL Server decimal and numeric data types have a maximum scale of 38.
Source: SQL Server Data Type Mappings
Permanently Remove the ‘Get Windows 10’ Icon
How to setup wep api to only return json and enable Cors: (web api v2)
In WebApiConfig.cs file from App_Start folder and add the following code in the Register method –
config.EnableCors(); //if cross origin requests should be enabled var json = config.Formatters.JsonFormatter; json.SerializerSettings.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.Objects; json.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); config.Formatters.Remove(config.Formatters.XmlFormatter);
This code does the following:
1. Converts names of properties to camel case while serializing the objects to JSON
2. Removes XML formatter from Web API’s formatters to make sure JSON data is returned on each request
Use this code to easily return json formatted response from api controller:
var employees= EmployeesRepository.GetAllEmployees(); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, employees); return response;
Example code for setting up controller and action with cors:
[EnableCors(origins: "http://localhost:55058", headers: "*", methods: "*")] public classPTEmployeesController : ApiController { // GET api/ptemployees [Route("api/ptemployees")] public HttpResponseMessage Get() { var employees= EmployeesRepository.GetAllEmployees(); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, employees); return response; } ... }
From http://www.dotnetcurry.com/aspnet/1063/create-rest-service-using-aspnet-webapi