Skip to content

Instantly share code, notes, and snippets.

View vmandic's full-sized avatar
🤠
chillin'

Vedran Mandić vmandic

🤠
chillin'
View GitHub Profile
@vmandic
vmandic / google-search-script.js
Created November 8, 2017 21:14
A short snippet providing two functions to process a Google search query from the console while on www.google.* website.
function searchGoogleForString(searchStr) {
var baseLink = "https://" + window.location.hostname + "/search?q=" + searchStr;
var xhr = new XMLHttpRequest();
xhr.open("GET", baseLink, true);
xhr.onload = function () {
if (xhr.readyState === 4 && xhr.status === 200) {
var d = document.createElement("div");
d.innerHTML = xhr.response;
@vmandic
vmandic / atd13-react-dead-simple.md
Last active December 6, 2017 10:13
A short react.js bootstrapper guide.

REACT DEV ENV SETUP

Below, a simple boilerplate to bootstrap a React dev env with the latest npm packages that were available on Dec 2017.

The Setup

  1. npm init
    • in project root you will get a package.json file
  2. install react
    • $ npm i -S react react-dom
{
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 1000,
"editor.acceptSuggestionOnCommitCharacter": true,
"editor.acceptSuggestionOnEnter": "on",
"editor.quickSuggestions": {
"other": true,
"comments": false,
"strings": false
},
DotJoshJohnson.xml
EditorConfig.EditorConfig
HookyQR.beautify
Leopotam.csharpfixformat
ecmel.vscode-html-css
formulahendry.auto-close-tag
formulahendry.auto-rename-tag
jchannon.csharpextensions
jorgeserrano.vscode-csharp-snippets
k--kato.docomment
{
"editor.fontSize": 11,
"editor.wordWrap": "on",
"editor.minimap.showSlider": "always",
"editor.renderControlCharacters": true,
"editor.renderWhitespace": "all",
"editor.renderIndentGuides": true,
"editor.minimap.enabled": true,
"editor.minimap.renderCharacters": false,
"editor.minimap.maxColumn": 50,
@vmandic
vmandic / git-commit-log-stats.md
Created February 13, 2018 14:11 — forked from eyecatchup/git-commit-log-stats.md
Some commands to get git commit log statistics for a repository on the command line.

git commit stats

Commands to get commit statistics for a Git repository from the command line -
using git log, git shortlog and friends.




@vmandic
vmandic / dotnet core .gitignore
Last active May 7, 2025 08:10
A default .NET Core project .gitignore file - or just type `dotnet new gitignore`
# From .NET Core 3.0 you can use the command: `dotnet new gitignore` to generate a customizable .gitignore file
*.swp
*.*~
project.lock.json
.DS_Store
*.pyc
# Visual Studio Code
.vscode
@vmandic
vmandic / ODataEntityFrameworkModelBuilder.cs
Last active February 2, 2023 14:00 — forked from dariusclay/ODataEntityFrameworkModelBuilder.cs
How to build OData IEdmModel from .NET Framework Entity Framework 6 model
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Data.Entity;
using System.Data.Entity.Core.EntityClient;
using System.Data.Entity.Infrastructure;
using System.Diagnostics;
Dictionary<string, string> options = new Dictionary<string, string>()
{
{"$select" , "ID" },
{"$expand" , "ProductDetail" },
{"$filter" , "Categories/any(d:d/ID gt 1)" },
{"$orderby" , "ID desc" },
{"$top" , "1" },
{"$count" , "true" },
{"$search" , "tom" },
};

An EF Core / OData - Generic Repository 🛠 😵

This library offers an implementation of the Generic Repository Pattern for Microsoft's Entity Framework Core 2.0 ORM supporting the use of OData v4 querying service protocol.

The OData part of the library offers an additional Repository implementation named ODataEfRepository with its complementing interface type IODataEfRepository. The OData Repository exposes several methods that allow querying an IQueryable<T> with OData's query options where the queryable can be produced out of EF's DbSet<T> or any other valid IQueryable<T>. This way you can pre/post filter/select/expand EF queryable sources using OData syntax.

Beta dependency caution 💣

The library currently uses the latest Microsoft.AspnetCore.OData (7.0.0-beta2) to provide OData services and it might be buggy as it is not a stable offical release.