Skip to content

Instantly share code, notes, and snippets.

View aeleftheriadis's full-sized avatar

Athanasios Eleftheriadis aeleftheriadis

View GitHub Profile
@aeleftheriadis
aeleftheriadis / CustomFieldDiscriminatorConvention.cs
Created February 6, 2023 13:07 — forked from JamisonWhite/CustomFieldDiscriminatorConvention.cs
C# MongoDb custom field and value discriminator
/// <summary>
/// Map a resource "keyType" to polymorphic classes.
/// </summary>
/// <remarks>
/// Followed example here:
/// http://pastebin.com/9UweEKBe
/// </remarks>
public class CustomFieldDiscriminatorConvention : IDiscriminatorConvention
{
private readonly string elementName;
@aeleftheriadis
aeleftheriadis / polymorphic_aggregation_model.cs
Created February 6, 2023 13:05 — forked from sindbach/polymorphic_aggregation_model.cs
A simple C# example to demonstrate polymorphic abstract classes to interact with MongoDB aggregation result.
using System;
using System.Linq;
using MongoDB.Bson;
using MongoDB.Driver;
using MongoDB.Bson.Serialization.Attributes;
public abstract class MongoModelBase
{
[BsonId]
public ObjectId Id { get; set; }
@aeleftheriadis
aeleftheriadis / self-signed-certificate-with-custom-ca.md
Created September 2, 2020 15:12 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@aeleftheriadis
aeleftheriadis / restricted-psp.yaml
Created July 29, 2019 13:01 — forked from tallclair/restricted-psp.yaml
Restricted PodSecurityPolicy
apiVersion: extensions/v1beta1
kind: PodSecurityPolicy
metadata:
name: restricted
annotations:
seccomp.security.alpha.kubernetes.io/allowedProfileNames: 'docker/default'
apparmor.security.beta.kubernetes.io/allowedProfileNames: 'runtime/default'
seccomp.security.alpha.kubernetes.io/defaultProfileName: 'docker/default'
apparmor.security.beta.kubernetes.io/defaultProfileName: 'runtime/default'
spec:
@aeleftheriadis
aeleftheriadis / git-tag-delete-local-and-remote.sh
Created March 26, 2018 14:33 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@aeleftheriadis
aeleftheriadis / ReduxNavigation.js
Created February 1, 2018 22:04 — forked from carlinisaacson/ReduxNavigation.js
Android hardware back handling in ignite
import React from 'react'
import { BackHandler } from 'react-native' // <<<<<<<<<<< ADDED THIS
import * as ReactNavigation from 'react-navigation'
import { connect } from 'react-redux'
import AppNavigation from './AppNavigation'
// Change to component to get lifecycle functions
// here is our redux-aware smart component
class ReduxNavigation extends React.Component {
@aeleftheriadis
aeleftheriadis / App.js
Created May 26, 2017 11:48 — forked from fdidron/App.js
React Router v4 Auth
//Usage
import React from 'react';
import { BrowserRouter as Router } from 'react-router-dom';
import Route from './AuthRoute';
import Login from './Login';
import Private from './Private';
export default () =>
<Router>
@aeleftheriadis
aeleftheriadis / visor-archivos-online.md
Created March 13, 2017 14:02 — forked from izazueta/visor-archivos-online.md
Google Docs Viewer & Office Web Apps Viewer

Google Docs Viewer

Only files under 25 MB can be previewed with the Google Drive viewer.

Google Drive viewer helps you preview over 16 different file types, listed below:

  • Image files (.JPEG, .PNG, .GIF, .TIFF, .BMP)
  • Video files (WebM, .MPEG4, .3GPP, .MOV, .AVI, .MPEGPS, .WMV, .FLV)
  • Text files (.TXT)
  • Markup/Code (.CSS, .HTML, .PHP, .C, .CPP, .H, .HPP, .JS)
  • Microsoft Word (.DOC and .DOCX)
import { Component } from 'react'
import { createStore, combineReducers } from 'redux'
import parseLinkHeader from 'parse-link-header'
const START = 'start'
const SUCCEED = 'succeed'
const ERROR = 'error'
const inflight = (state={}, action) => (
((state) => (
@aeleftheriadis
aeleftheriadis / Enhance.js
Created September 5, 2016 06:43 — forked from sebmarkbage/Enhance.js
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {