Skip to content

Instantly share code, notes, and snippets.

View ognyandim's full-sized avatar

Ognyan Dimitrov ognyandim

View GitHub Profile
@johnazariah
johnazariah / LinqExtensions.cs
Last active May 22, 2024 08:39
Maybe Monad in C#
public static partial class LinqExtensions
{
public static Maybe<C> SelectMany<A, B, C>(this Maybe<A> ma, Func<A, Maybe<B>> f, Func<A, B, C> select) => ma.Bind(a => f(a).Map(b => select(a, b)));
}
@gricard
gricard / webpack4upgrade.md
Last active February 29, 2024 20:23
Just some notes about my attempt to upgrade to webpack 4

If you enjoyed reading this, I'm intending to do more blogging like this over here: https://cdgd.tech

This is not a complaint about Webpack or v4 in any way. This is just a record of my process trying it out so I could provide feedback to the webpack team

Hmm... I don't see any docs for 4.0 on https://webpack.js.org. I guess I'll just wing it. All I need to do is npm i -D webpack@next, right?

+ webpack@4.0.0-beta.2
@oleurud
oleurud / local-mongo-replicaset-with-docker
Last active November 16, 2023 16:57
[Local mongo replicaset with docker] #docker #mongo
# pull the official mongo docker container
docker pull mongo
# create network
docker network create my-mongo-cluster
# create mongos
docker run -d --net my-mongo-cluster -p 27017:27017 --name mongo1 mongo mongod --replSet my-mongo-set --port 27017
docker run -d --net my-mongo-cluster -p 27018:27018 --name mongo2 mongo mongod --replSet my-mongo-set --port 27018
docker run -d --net my-mongo-cluster -p 27019:27019 --name mongo3 mongo mongod --replSet my-mongo-set --port 27019
@ognyandim
ognyandim / CastleDictionaryAdapterExample.cs
Last active August 29, 2015 14:23 — forked from BenHall/CastleDictionaryAdapterExample.cs
Abstracting away application configuration - runtime user provided, environment provided, app settings provided
using System;
using System.Collections;
using System.Configuration;
using Castle.Components.DictionaryAdapter;
using Castle.Facilities.TypedFactory;
using Castle.MicroKernel;
using Castle.MicroKernel.Context;
using Castle.MicroKernel.Registration;
using Castle.Windsor;
@SidShetye
SidShetye / HardenSSL.ps1
Last active August 14, 2023 14:59
Script to harden SSL/TLS on Azure Cloud Service
# Call this from inside a startup task/batch file as shown in the next two lines (minus the '# ')
# PowerShell -ExecutionPolicy Unrestricted .\HardenSsl.ps1 >> log-HardenSsl.txt 2>&1
# EXIT /B 0
# Credits:
# http://azure.microsoft.com/blog/2014/10/19/how-to-disable-ssl-3-0-in-azure-websites-roles-and-virtual-machines/
# http://lukieb.blogspot.com/2014/11/tightening-up-your-azure-cloud-service.html
$nl = [Environment]::NewLine
$regkeys = @(
@brianclements
brianclements / Commit Formatting.md
Last active May 25, 2024 12:17
Angular Commit Format Reference Sheet

Commit Message Format

This specification is inspired by and supersedes the [AngularJS commit message format][commit-message-format].

We have very precise rules over how our Git commit messages must be formatted. This format leads to easier to read commit history.

Each commit message consists of a header, a body, and a footer.

@mrkelly
mrkelly / event.builder.js
Created August 6, 2014 19:44
Angular Logstash
angular.module('hf.events.builder', [
'app.resources',
'app.values'
])
.factory('EventBuilder', function ($injector, $window, apiUrl) {
var EventBuilder = function EventBuilder(message) {
this['@timestamp'] = new Date();
this['@message'] = message || '';
return this;
};
@fearphage
fearphage / README.md
Last active October 18, 2022 20:19
$.whenAll jQuery extension

$.whenAll is an extension to jQuery's $.when. The main difference is $.when stops when it receives the first rejected promise. This extension treats all successes and failures as progress events. After all the promises have completed, the global promise is resolved if there were no errors. Otherwise the global promise is rejected.

Sameple #1

$.whenAll($.get('http://github.com'), $.get('good luck with this one'))
  .then(
    // success callback
    function(request) {}
    // failure callback - called once at the end
 ,function() {}
@sgruhier
sgruhier / gist:1086231
Created July 16, 2011 10:14
override jquery UI widget method
// If you dont need to call original method
$.widget("ui.addresspicker", $.extend({}, $.ui.addresspicker.prototype, {
_updatePosition: function(){
// Do what you want to
}
}));
// If you need to call original method
var _updatePosition = $.ui.addresspicker.prototype._updatePosition;
$.widget("ui.addresspicker", $.extend({}, $.ui.addresspicker.prototype, {
@BenHall
BenHall / CastleDictionaryAdapterExample.cs
Created July 22, 2010 21:20
Castle Dictionary Adapter Example
using System;
using System.Configuration;
using Castle.Components.DictionaryAdapter;
using Castle.MicroKernel.Registration;
using Castle.Windsor;
using Rhino.Mocks;
namespace CastleDictionaryAdapterExample
{
class Program