Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Collections.Generic;
using System.Reflection;
namespace Project.Repo
{
public interface IMapper<TEntity> where TEntity : class
{
IEnumerable<PropertyInfo> Properties { get; }
Type Type { get; }
@pimbrouwers
pimbrouwers / reset.css
Created March 27, 2018 13:45
Minimal CSS Reset
html, body, div, span,
h1,h2,h3,h4,h5,h6,hgroup,
ul,ol,dd,
p,figure,
pre,table,fieldset,hr,
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
@pimbrouwers
pimbrouwers / ajax.js
Last active January 26, 2018 14:44
AJAX helpers with jQuery
module.exports = new Ajax();
function Ajax() { };
Ajax.prototype.get = function (url, callback, error) {
var req = this.makeRequest('GET', url, callback, error);
req.send();
};
Ajax.prototype.post = function (url, data, callback, error) {
@pimbrouwers
pimbrouwers / c-sharp-parse-linkheader.cs
Last active April 5, 2024 20:53
C# Parse Link Header
public class LinkHeader
{
public string FirstLink { get; set; }
public string PrevLink { get; set; }
public string NextLink { get; set; }
public string LastLink { get; set; }
public static LinkHeader LinksFromHeader(string linkHeaderStr)
{
LinkHeader linkHeader = null;
@pimbrouwers
pimbrouwers / mssql-calendar-table.sql
Last active October 12, 2023 13:20
SQL Server Calendar Table
USE master
GO
IF OBJECT_ID('dbo.calendar') IS NOT NULL
DROP TABLE dbo.calendar;
IF OBJECT_ID('dbo.fn_generate_calendar') IS NOT NULL
DROP FUNCTION dbo.fn_generate_calendar;
GO
@pimbrouwers
pimbrouwers / mssql-continent-country.sql
Created May 9, 2017 13:53
MSSQL Continents / Countries (Name, ISO2, ISO3, ISO Num)
CREATE SCHEMA [Geo]
GO
CREATE TABLE [Geo].[Continent](
[Code] [char](2) NOT NULL PRIMARY KEY,
[Name] [nvarchar](25) NULL
)
GO
------------------------------
@pimbrouwers
pimbrouwers / .gitignore
Last active December 24, 2016 23:09
.NET Core GitIgnore Base
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
var re = /^[a-z ,.'-]{2}+$/i;
var str = ' ';
var m;
if ((m = re.exec(str)) !== null) {
if (m.index === re.lastIndex) {
re.lastIndex++;
}
// View your result using the m-variable.
// eg m[0] etc.
@pimbrouwers
pimbrouwers / postal-zip-code-regex.js
Created August 5, 2016 18:47
Canadian Postal Code & US Zip Code Regex
var re = /^[ABCEGHJKLMNPRSTVXY][0-9][ABCEGHJKLMNPRSTVWXYZ][0-9][ABCEGHJKLMNPRSTVWXYZ][0-9]$|^\d{5}(?:[-\s]\d{4})?$/i;
var str = 'm5v3e6';
var m;
if ((m = re.exec(str)) !== null) {
if (m.index === re.lastIndex) {
re.lastIndex++;
}
// View your result using the m-variable.
// eg m[0] etc.