Skip to content

Instantly share code, notes, and snippets.

View mouadcherkaoui's full-sized avatar
🎯
Focusing

Mouad Cherkaoui mouadcherkaoui

🎯
Focusing
View GitHub Profile
@mouadcherkaoui
mouadcherkaoui / electron-sqlite3.md
Created May 28, 2018 22:33 — forked from craigvantonder/electron-sqlite3.md
Electron SQLite3 Integration

Electron SQLite3 Integration

When trying to use the node-sqlite3 module in Electron I got the error:

Error: Cannot find module '/path/to/my/application/node_modules/sqlite3/lib/binding/electron-v1.4-linux-x64/node_sqlite3.node'

Using Ubuntu 16.04 with Node 7.1.0 and Electron 1.4.12.

I read the following:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PresenterMapperDto.Attributes
{
[System.AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
public sealed class MapToEntityAttribute : Attribute
using System.Collections.Generic;
using System.Windows;
using System.Windows.Media;
namespace Hardcodet.Wpf.Util
{
/// <summary>
/// Helper methods for UI-related tasks.
/// </summary>
public static class TreeHelper
@mouadcherkaoui
mouadcherkaoui / AppDataContext.csx
Last active March 22, 2020 19:13
Example of using EntityFramework in Azure Functions
#load "member.csx"
using System.Data.Entity;
using Microsoft.Azure;
public class AppContext: DbContext {
public static string connectionString = CloudConfigurationManager.GetSetting("SqlAzureConnectionString");
// we should have an appSetting named SqlAzureConnectionString
// or simply use it in connectionStrings section and use this method
// ConfigurationManager.ConnectionStrings["ConnectStringToUse"].ConnectionString
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"functionAppName": {
"type": "string",
"metadata": {
"description": "The name of the function app that you wish to create."
}
},
@mouadcherkaoui
mouadcherkaoui / Guid.ts
Created December 12, 2018 10:19 — forked from emptyother/Guid.ts
GUID class for Typescript
class Guid {
public static newGuid(): Guid {
return new Guid('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
const r = Math.random() * 16 | 0;
const v = (c == 'x') ? r : (r & 0x3 | 0x8);
return v.toString(16);
}));
}
public static get empty(): string {
return '00000000-0000-0000-0000-000000000000';
@mouadcherkaoui
mouadcherkaoui / ViewModelBase.cs
Created April 6, 2019 17:16 — forked from mariodivece/ViewModelBase.cs
A simple ViewModelBase for WPF Apps
namespace Unosquare.Wpf
{
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
public abstract class ViewModelBase : INotifyPropertyChanged
{
// uncomment the line below for Log4Net Logging
using System;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using ObjectDumper;
using Xunit;
namespace Classdynamic.BK5
@mouadcherkaoui
mouadcherkaoui / Struct.ps1
Created April 12, 2019 22:22 — forked from proxb/Struct.ps1
Using PowerShell and Reflection to dynamically build a Struct with Constructors and Methods
#region Module Builder
$Domain = [AppDomain]::CurrentDomain
$DynAssembly = New-Object System.Reflection.AssemblyName(([guid]::NewGuid().ToString()))
$AssemblyBuilder = $Domain.DefineDynamicAssembly($DynAssembly, [System.Reflection.Emit.AssemblyBuilderAccess]::Run) # Only run in memory
$ModuleBuilder = $AssemblyBuilder.DefineDynamicModule(([guid]::NewGuid().ToString()), $False)
#endregion Module Builder
#region STRUCTs
#Order of creating these Structs is important
#region MyStruct
$Attributes = 'AutoLayout, AnsiClass, Class, Public, SequentialLayout, Sealed, BeforeFieldInit'
public interface IFluentApiDefinition
{
IFluentEndpoint HasEndpointUri(string endpoint);
}
public interface IFluentEndpoint
{
IWithVersion OfVersion(string apiVersion);