Skip to content

Instantly share code, notes, and snippets.

View lnaie's full-sized avatar
🏠

Lucian Naie lnaie

🏠
View GitHub Profile
@andrewminerd
andrewminerd / nmea.cs
Created August 4, 2011 04:17
Simple C# NMEA (GPS) parser, made for the Netduino
using System;
namespace Nmea
{
class Parser
{
private enum STATES : byte
{
begin, body, checksum1, checksum2, checksum_lr, checksum_cf, cf
}
@hyle
hyle / ko.utils.signatures.js
Last active May 14, 2022 21:15
KnockoutJS utils (ko.utils) signatures
// knockout 2.2.1
ko.utils.arrayFilter = function (array, predicate) { /* .. */ }
ko.utils.arrayFirst = function (array, predicate, predicateOwner) { /* .. */ }
ko.utils.arrayForEach = function (array, action) { /* .. */ }
ko.utils.arrayGetDistinctValues = function (array) { /* .. */ }
@addyosmani
addyosmani / pubsub.md
Created October 28, 2011 06:49
Four ways to do Pub/Sub with jQuery 1.7 and jQuery UI (in the future)

#Four Ways To Do Pub/Sub With jQuery and jQuery UI (in the future)

Between jQuery 1.7 and some of work going into future versions of jQuery UI, there are a ton of hot new ways for you to get your publish/subscribe on. Here are just four of them, three of which are new.

(PS: If you're unfamiliar with pub/sub, read the guide to it that Julian Aubourg and I wrote here http://msdn.microsoft.com/en-us/scriptjunkie/hh201955.aspx)

##Option 1: Using jQuery 1.7's $.Callbacks() feature:

$.Callbacks are a multi-purpose callbacks list object which can be used as a base layer to build new functionality including simple publish/subscribe systems. We haven't yet released the API documentation for this feature just yet, but for more information on it (including lots of examples), see my post on $.Callbacks() here:

@justinwoo
justinwoo / using-rxjs-instead-of-flux-with-react.md
Last active October 21, 2023 10:16
Using RxJS instead of Flux with React to organize data flow

Reposted from Qiita

For almost a year now, I've been using this "flux" architecture to organize my React applications and to work on other people's projects, and its popularity has grown quite a lot, to the point where it shows up on job listings for React and a lot of people get confused about what it is.

Why I'm tired of using and teaching flux

There are a billion explainations on the internet, so I'll skip explaining the parts. Instead, let's cut to the chase -- the main parts I hate about flux are the Dispatcher and the Store's own updating mechanism.

If you use a setup similar to the examples in facebook/flux, and you use flux.Dispatcher, you probably have this kind of flow:

@rmacfie
rmacfie / MediatRExtensions.cs
Last active July 12, 2022 12:42
Register MediatR handlers in Asp.Net 5 / vNext / Core
namespace Microsoft.AspNet.Builder
{
public static class MediatRExtensions
{
public static IServiceCollection AddMediatR(this IServiceCollection services, params Assembly[] handlerAssemblies)
{
services.AddTransient<IMediator>(x => new Mediator(x.GetService<SingleInstanceFactory>(), x.GetService<MultiInstanceFactory>()));
services.AddTransient<SingleInstanceFactory>(x => t => x.GetRequiredService(t));
services.AddTransient<MultiInstanceFactory>(x => t => x.GetServices(t));
@MikeMKH
MikeMKH / setup.cs
Last active March 25, 2024 08:33
How to live with a circular reference with AutoFixture
[TestInitialize]
public void BeforeEach()
{
_fixture = new Fixture();
// client has a circular reference from AutoFixture point of view
_fixture.Behaviors.Remove(new ThrowingRecursionBehavior());
_fixture.Behaviors.Add(new OmitOnRecursionBehavior());
}
@matpag
matpag / Database.cs
Created April 15, 2016 10:10
Xamarin Forms SQLite database upgrade strategy
using ProjectTest.MyModels;
using SQLite.Net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace ProjectTest.Database
@cknaap
cknaap / SimpleLogCheck.cs
Last active December 17, 2021 22:11
Easily check ILogger<T> interactions with ASP.NET Core Logging and Moq
using Microsoft.Extensions.Logging;
using Moq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Xunit;
namespace Knaap.Utilties
{
@a3dho3yn
a3dho3yn / mongodb_c#_cheatsheet.md
Last active March 27, 2024 00:04
MongoDB C# Driver Cheat Sheet

MongoDB C# Driver Cheat Sheet

(C) 2015 by Derek Hunziker, (C) 2017 by AppsOn

As of releasing MongoDB 3.4 and C# Driver v2.4, original cheatsheet by Derek is outdated. In addition, it has some deficiencies like connecting to MongoDB, creating indexes, etc. This updated version works fine with C# Driver v2.4.7 and MongoDB v3.4.

Setup

Define Document Models

Note: Defined models and collections will be used in entire cheatsheet.