Skip to content

Instantly share code, notes, and snippets.

Avatar

Leblanc Meneses leblancmeneses

View GitHub Profile
@leblancmeneses
leblancmeneses / comment_feature_tests.ts
Last active Sep 22, 2020
e2e selenium interview question
View comment_feature_tests.ts
import {authenticate} from '../utils/authenticator';
import {DetailView} from '../views/detail_view';
describe('comment behavior', () => {
describe('authenticated', () => {
beforeEach(() => {
authenticate('username', 'password');
});
it('should allow user to comment', async() => {
@leblancmeneses
leblancmeneses / _int.ps1
Last active Mar 26, 2020
build for improving restaurants using robusthaven.devops
View _int.ps1
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)
@leblancmeneses
leblancmeneses / README.md
Created Mar 25, 2018 — 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.
View README.md

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

View gist:8af7da70d45c96420e6b69b5c40460ca
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);
View gist:1ddc46271191cffea1db9a46b85aaade
await new Promise(resolve => setTimeout(resolve, 100000));
@leblancmeneses
leblancmeneses / bolt-rules-throttle.json
Last active Apr 4, 2017 — forked from katowulf/rules.json
throttle messages to no more than one every 5,000 milliseconds, see http://jsfiddle.net/firebase/VBmA5/
View bolt-rules-throttle.json
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 {
@leblancmeneses
leblancmeneses / gist:8168088
Last active Jan 1, 2016
angular.module - Creation versus Retrieval Example
View gist:8168088
// 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 {
.....
};
View gist:6555489
// 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;
View 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_
@leblancmeneses
leblancmeneses / gist:4159277
Created Nov 28, 2012
forum - distributor without profile data input queue not created
View gist:4159277
public class EndpointConfig : IConfigureThisEndpoint, IWantCustomInitialization, AsA_Server
{
public void Init()
{
Configure.With()
.DefineEndpointName(ConfigurationManager.AppSettings["NServiceBus.Instance"])
.DefaultBuilder()
.XmlSerializer()
.RunTimeoutManager()
.RunDistributorWithNoWorkerOnItsEndpoint()
You can’t perform that action at this time.