Skip to content

Instantly share code, notes, and snippets.

View ImanMahmoudinasab's full-sized avatar
:electron:

Iman Mahmoudinasab ImanMahmoudinasab

:electron:
  • Samsung
  • Canada, Vancouver
View GitHub Profile
public class InMemoryDbSet<T> : IDbSet<T> where T : class
{
readonly HashSet<T> _set;
readonly IQueryable<T> _queryableSet;
public InMemoryDbSet() : this(Enumerable.Empty<T>()) { }
public InMemoryDbSet(IEnumerable<T> entities) {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTNX.DNS.DataAccess.Repositories
{
public class RepositoryBase<T> where T : ModelBase
{
public RepositoryBase()
@ljharb
ljharb / array_iteration_thoughts.md
Last active March 20, 2024 13:40
Array iteration methods summarized

Array Iteration

https://gist.github.com/ljharb/58faf1cfcb4e6808f74aae4ef7944cff

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.

Intro

JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it mu

@juanca
juanca / github_load_all_diffs.js
Created March 2, 2017 18:42
Github PR bookmarklet: Load all file diffs
javascript:
document.querySelectorAll('.load-diff-button').forEach(node => node.click())
@bananita
bananita / How to convert *app to *ipa
Created December 19, 2013 13:23
How to convert *app to *ipa
1. Create a folder called Payload
2. Place the .app folder inside of that
3. Zip up the Payload folder using normal compression
4. Then rename the file with a .ipa extension
@idleberg
idleberg / vscode-macos-context-menu.md
Last active April 16, 2024 08:34
“Open in Visual Studio Code” in macOS context-menu

Open in Visual Studio Code

  • Open Automator
  • Create a new document
  • Select Quick Action
  • Set “Service receives selected” to files or folders in any application
  • Add a Run Shell Script action
    • your default shell should already be selected, otherwise use /bin/zsh for macOS 10.15 (”Catalina”) or later
    • older versions of macOS use /bin/bash
  • if you're using something else, you probably know what to do 😉
@staltz
staltz / introrx.md
Last active April 18, 2024 15:33
The introduction to Reactive Programming you've been missing