Skip to content

Instantly share code, notes, and snippets.

View danlourenco's full-sized avatar

Dan Lourenço danlourenco

  • Slalom _build
  • Boston, MA
View GitHub Profile
@chanmathew
chanmathew / streaming.ts
Last active April 21, 2024 04:40
ElevenLabs streaming implementation - Typescript
const voiceId = '' // Pick any voice ID from https://docs.elevenlabs.io/api-reference/voices
const model = 'eleven_monolingual_v1'
const elUrl = `https://api.elevenlabs.io/v1/text-to-speech/${voiceId}/stream?optimize_streaming_latency=3` // Optimize for latency
const codec = 'audio/mpeg'
const maxBufferDuration = 60 // Maximum buffer duration in seconds
const maxConcurrentRequests = 3 // Maximum concurrent requests allowed
// Create a new MediaSource and Audio element
const mediaSource = new MediaSource()
const audioElement = new Audio()
@markmichon
markmichon / CircuitBreaker-configurable.js
Last active April 18, 2021 03:10
Circuit Breaker examples
class CircuitBreaker {
constructor(request, options = {}) {
const defaults = {
failureThreshold: 3,
successThreshold: 2,
timeout: 6000
}
Object.assign(this, defaults, options, {
request,
state: "CLOSED",
@golman
golman / browsers.js
Created October 10, 2018 07:11
detect browsers by duck-typing
// from https://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser/9851769
// Opera 8.0+
var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
// Firefox 1.0+
var isFirefox = typeof InstallTrigger !== 'undefined';
// Safari 3.0+ "[object HTMLElementConstructor]"
var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || safari.pushNotification);

Frontend Masters: AWS for Frontend Engineers

You should have the following completed on your computer before the workshop:

  • Install the AWS CLI.
  • Have Node.js installed on your system. (Recommended: Use nvm.)
    • Install yarn with brew install yarn.
  • Create an AWS account. (This will require a valid credit card.)
  • Create a Travis CI account. (This should be as simple as logging in via GitHub).
@colbydauph
colbydauph / promisify-callbackify.js
Last active March 21, 2018 20:45
Promisify + Callbackify
// inverse of callbackify
exports.promisify = (func) => (...args) => {
return new Promise((resolve, reject) => {
func(...args, (err, data) => {
err ? reject(err) : resolve(data);
});
});
};
// inverse of promisify
@ygrenzinger
ygrenzinger / CleanArchitecture.md
Last active June 13, 2024 09:52
Summary of Clean Architecture by Robert C. Martin

Summary of book "Clean Architecture" by Robert C. Martin

Uncle Bob, the well known author of Clean Code, is coming back to us with a new book called Clean Architecture which wants to take a larger view on how to create software.

Even if Clean Code is one of the major book around OOP and code design (mainly by presenting the SOLID principles), I was not totally impressed by the book.

Clean Architecture leaves me with the same feeling, even if it's pushing the development world to do better, has some good stories and present robust principles to build software.

The book is build around 34 chapters organised in chapters.

@Geoff-Ford
Geoff-Ford / master-javascript-interview.md
Last active May 27, 2024 16:10
Eric Elliott's Master the JavaScript Interview Series
@samdemaeyer
samdemaeyer / frontend-driven-development.md
Last active March 15, 2021 15:27
Frontend Driven Development

Frontend Driven Development

Abstract

For a long time the frontend has been driven by the backend. As now the frontend frameworks are getting stronger and more and more independent, there is no reason to wait for the backend any more and it actually makes sense to start with the frontend in a lot of the cases.

In the talk, I would like to explain to the audience what is Frontend Driven Development (Frontend First) and in which cases we could argue that it is the right way to go. Obviously its not the correct approach for every application.

Also, the history of the backend being the strong leader for many years, compared to the frontend is very interesting. It is fascinating to see how the frontend slowly has became more and more powerful and independent and therefore is less and less in the shadow of the backend.

We are also looking into creating one or more addons to make frontend driven development even more appealing and useful, so the concepts of these could be part of the talk.

@nrollr
nrollr / MySQL_macOS_Sierra.md
Last active June 7, 2024 20:53
Install MySQL on Sierra using Homebrew

Install MySQL on macOS Sierra

This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :

@wojteklu
wojteklu / clean_code.md
Last active June 26, 2024 20:51
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules