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 / README.md
Created September 8, 2023 21:39 — forked from mbleigh/README.md
Firebase Hosting Fetch All Files

Fetch All Files from Firebase Hosting

This script fetches all of the files from the currently deployed version of a Firebase Hosting site. You must be signed in via the Firebase CLI and have "Site Viewer" permission on the site in question to be able to properly run the script.

Running via NPX

npx https://gist.github.com/mbleigh/9c8680cf319ace2f506f57380da66e7d <site_name>
@leblancmeneses
leblancmeneses / comment_feature_tests.ts
Last active October 16, 2020 00:49
e2e selenium interview question
import {authenticate} from '../utils/authenticator';
import {DetailView} from '../views/detail_view';
describe('comment behavior', () => {
describe('authenticated', () => {
it('should allow user to comment', async() => {
authenticate('username', 'password');
const detailView = new DetailView();
await detailView.navigateTo();
});
@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)
@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

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);
await new Promise(resolve => setTimeout(resolve, 100000));
@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 {
@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 {
.....
};
// 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 / 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_