Skip to content

Instantly share code, notes, and snippets.

View leblancmeneses's full-sized avatar
🏠
Working from home

Leblanc Meneses leblancmeneses

🏠
Working from home
View GitHub Profile
@leblancmeneses
leblancmeneses / EndpointConfig.cs
Created November 27, 2012 19:03
one set of distributor binaries for 3.3.2 to be used with xdt
public class EndpointConfig : IConfigureThisEndpoint, IWantCustomInitialization, AsA_Server
{
public void Init()
{
Configure.With()
.DefineEndpointName(ConfigurationManager.AppSettings["NServiceBus.Instance"])
.DefaultBuilder()
.XmlSerializer()
.RunDistributorWithNoWorkerOnItsEndpoint();
}
@leblancmeneses
leblancmeneses / gist:4159277
Created November 28, 2012 05:47
forum - distributor without profile data input queue not created
public class EndpointConfig : IConfigureThisEndpoint, IWantCustomInitialization, AsA_Server
{
public void Init()
{
Configure.With()
.DefineEndpointName(ConfigurationManager.AppSettings["NServiceBus.Instance"])
.DefaultBuilder()
.XmlSerializer()
.RunTimeoutManager()
.RunDistributorWithNoWorkerOnItsEndpoint()
@leblancmeneses
leblancmeneses / Automapper EF IQueryable
Last active December 21, 2015 00:59
Automapper EF IQueryable
working expression.ToString();
value(System.Data.Objects.ObjectQuery`1[Host.MockDB.CaseInformation]).MergeAs(AppendOnly).Select(x => new CaseInformationViewModel() {Id = x.Id, CaseNumber = x.CaseNumber, Title = x.ShortTitle, CaseType = IIF((x.CaseTypeDropDown == null), String.Empty, x.CaseTypeDropDown.Name), CaseType_Id = x.CaseTypeDropDown_Id, Category = IIF((x.CategoryDropDown == null), String.Empty, x.CategoryDropDown.Name), Category_Id = x.CategoryDropDown_Id, FilingAttorney = IIF((x.FilingAttorneyDropDown == null), String.Empty, x.FilingAttorneyDropDown.Name), FilingAttorney_Id = x.FilingAttorneyDropDown_Id, PaymentAccount = IIF((x.PaymentAccountDropDown == null), String.Empty, x.PaymentAccountDropDown.Name), PaymentAccount_Id = x.PaymentAccountDropDown_Id, Location = IIF((x.LocationDropDown == null), String.Empty, x.LocationDropDown.Name), Location_Id = x.LocationDropDown_Id, LowerCourt = IIF((x.LowerCourtDropDown == null), String.Empty, x.LowerCourtDropDown.Name), LowerCourt_Id = x.LowerCourtDropDown_
// re-link many to many relationship
var items = new List<ServiceContactInformation>();
foreach (var serviceContact in original.AssociatedServiceContacts)
{
_context.Entry(serviceContact).State = EntityState.Detached;
var entity = new ServiceContactInformation() {Id = serviceContact.Id};
items.Add(entity);
_context.ServiceContactInformations.Attach(entity);
}
original.AssociatedServiceContacts = items;
@leblancmeneses
leblancmeneses / gist:8168088
Last active January 1, 2016 15:59
angular.module - Creation versus Retrieval Example
// registers module with dependencies if any, empty array otherwise
angular.module('Core', ['kendo.directives'])
// gains access to module registration pointer to append more registrations into module
// needed when files are bundled
angular.module('Core')
.directive('requestVerificationToken', [function () {
return {
.....
};
@leblancmeneses
leblancmeneses / bolt-rules-throttle.json
Last active April 4, 2017 13:23 — forked from katowulf/rules.json
throttle messages to no more than one every 5,000 milliseconds, see http://jsfiddle.net/firebase/VBmA5/
type SharedWithInviteRequest {
........
createdDate: RateLimiting
}
// in order to write a message, I must first make an entry in users/${uid}/rate_limiting/{feature} is Number
// additionally, that message must be within 500ms of now, which means I can't
// just re-use the same one over and over, thus, we've effectively required messages
// to be 5 seconds apart
type RateLimiting extends Number {
await new Promise(resolve => setTimeout(resolve, 100000));
import * as admin from "firebase-admin";
admin.initializeApp({
credential: admin.credential.cert('./prod-account.json'),
databaseURL: 'https://this-is-in-firebase-console.firebaseio.com'
});
const sequence = async (items, action) => {
for(let i = 0; i < items.length; i++) {
await action(items[i], i);
@leblancmeneses
leblancmeneses / README.md
Created March 25, 2018 22:24 — forked from gdamjan/README.md
Setup for an easy to use, simple reverse http tunnels with nginx and ssh. It's that simple there's no authentication at all. The end result, a single ssh command invocation gives you a public url for your web app hosted on your laptop.

What

A lot of times you are developing a web application on your own laptop or home computer and would like to demo it to the public. Most of those times you are behind a router/firewall and you don't have a public IP address. Instead of configuring routers (often not possible), this solution gives you a public URL that's reverse tunnelled via ssh to your laptop.

Because of the relaxation of the sshd setup, it's best used on a dedicated virtual machine just for this (an Amazon micro instance for example).

Requirements

@leblancmeneses
leblancmeneses / _int.ps1
Last active March 26, 2020 14:17
build for improving restaurants using robusthaven.devops
task IdentifyBuildVariables {
$BuildNumber = $build_number
$RevisionNumber = $build_vcs_number
$script:AssemblyVersion = "5.0.$BuildNumber.$RevisionNumber"
$script:BuildFolder = (pwd).path
$script:ProjectDirectoryRoot = [io.path]::Combine($BuildFolder, (resolve-path ..).path)