Skip to content

Instantly share code, notes, and snippets.

@odahcam
odahcam / package.json
Last active October 20, 2020 22:09
Scripts for Building and Testing pure TypeScript applications.
{
"main": "./cjs/index.js",
"module": "./esm/index.js",
"typings": "./esm/index.d.ts",
"esnext": "./esm/index.js",
"scripts": {
"clean": "yarn shx rm -rf dist output",
"test": "yarn test:build && yarn test:run",
"test:build": "tsc --build tsconfig.test.json",
"test:run": "mocha -r tsconfig-paths/register --timeout 200000 output/tests/**/*.spec.js",
@odahcam
odahcam / package.json
Created May 10, 2020 09:46 — forked from jayphelps/package.json
TypeScript output es2015, esm (ES Modules), CJS, UMD, UMD + Min + Gzip. Assumes you install typescript (tsc), rollup, uglifyjs either globally or included as devDependencies
{
"scripts": {
"build": "npm run build:es2015 && npm run build:esm && npm run build:cjs && npm run build:umd && npm run build:umd:min",
"build:es2015": "tsc --module es2015 --target es2015 --outDir dist/es2015",
"build:esm": "tsc --module es2015 --target es5 --outDir dist/esm",
"build:cjs": "tsc --module commonjs --target es5 --outDir dist/cjs",
"build:umd": "rollup dist/esm/index.js --format umd --name YourLibrary --sourceMap --output dist/umd/yourlibrary.js",
"build:umd:min": "cd dist/umd && uglifyjs --compress --mangle --source-map --screw-ie8 --comments -o yourlibrary.min.js -- yourlibrary.js && gzip yourlibrary.min.js -c > yourlibrary.min.js.gz",
}
}
@odahcam
odahcam / README.md
Created April 20, 2020 06:25
Minha impressão do Slim versão 4
  • Slim muito mais consistente.
  • Slim pode ser wrapper da aplicação inteira, como a Startup no ASP.NET C#.
  • Tanto o routing quanto IoC é decoupled no Slim 4, da pra integrar como quiser, no more gambi.
  • Usar o composer.json na raíz como um arquivo .sln e criar um composer.json dentro de cada camada como se fosse um .csproj para isolar escopos de projeto. Usar então o composer-merge-plugin para fazer .sln agregar os .csproj e interpreta-los no install e update.
```
string ObfuscarEmail(string input)
{
int arroba = 0;
int firstDot = 0;
int secondDot = 0;
string firstPart = "";
string secondPart = "";
string thirdPart = "";
@odahcam
odahcam / aliexpress.md
Created January 7, 2019 17:04
Analises de UI/UX

Exibição de preço de produto no AliExpress

Listas

Os produtos são listados de dois modos:

  • Compacto promocional.
  • Moderado comum.

Compacto com promoção

@odahcam
odahcam / play-pause-next-prev.ahk
Created January 7, 2019 17:00
Auto Hot Key scripts
^!Left::Send {Media_Prev}
^!F12::Send {Media_Play_Pause}
^!Right::Send {Media_Next}
@odahcam
odahcam / BasicAuthToken.cs
Created October 10, 2018 12:24
Method for creating a Basic Auth token for HTTP in C#.
using System;
using System.Text;
namespace MyNamespace
{
public class MyClass
{
/// <summary>
/// Creates an Authentication Token for "Basic Auth" HTTP Authorization.
/// </summary>
@odahcam
odahcam / first-word.pipe.ts
Created October 8, 2018 21:14
Angular 6 Pipe that gets only the first word of a string.
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'firstWord'
})
export class FirstWordPipe implements PipeTransform {
transform(value: string): string {
if (!value) { return ''; }
return value.split(' ')[0];
@odahcam
odahcam / parallax.directive.ts
Created October 5, 2018 22:31
Parallax effect built on top of Angular 6 CDK Scrollable.
import { Directive, Input, ElementRef } from '@angular/core';
import { ScrollDispatcher, CdkScrollable } from '@angular/cdk/overlay';
@Directive({
selector: '[appParallax]'
})
export class ParallaxDirective {
el: HTMLElement;