Skip to content

Instantly share code, notes, and snippets.

View EdwardAngeles's full-sized avatar

Edward Angeles EdwardAngeles

View GitHub Profile
@Klerith
Klerith / vite-testing-config.md
Last active July 29, 2024 06:40
Vite + Jest + React Testing Library - Configuraciones a seguir

Instalación y configuracion de Jest + React Testing Library

En proyectos de React + Vite

  1. Instalaciones:
yarn add --dev jest babel-jest @babel/preset-env @babel/preset-react 
yarn add --dev @testing-library/react @types/jest jest-environment-jsdom
  1. Opcional: Si usamos Fetch API en el proyecto:
@jeroensmink98
jeroensmink98 / angular_single_file.js
Created January 25, 2022 11:13
Compile a Angular Project to a single HTML file
// Create gulpfile.js
const gulp = require("gulp");
const inline = require("gulp-inline");
gulp.task("default", () => {
return gulp
.src("./dist/*/*.html")
.pipe(inline())
.pipe(gulp.dest("./single-dist"));
});
@cgbeutler
cgbeutler / ShapePolygon2D.gd
Created January 7, 2021 00:12
A Polygon2D that can take a Shape2D.
tool
class_name ShapePolygon2D extends Polygon2D
func _get_configuration_warning() -> String:
if shape == null:
return "Shape resource is null"
if shape is ConvexPolygonShape2D and len(shape.points) <= 1:
return "ConvexPolygonShape2D has too few points to draw"
if shape is ConcavePolygonShape2D:
@rajasharma1603
rajasharma1603 / material.module.ts
Created April 11, 2020 15:14
One single module import file to import all Angular Material Modules.
// IMPORT ALL MATERIAL COMPONENTS
// #STEPS
// 1- Import this file as module in app.module.ts ==> import { MaterialModule } from './xyz/abc';
// 2- Initialize it in imports:[] array ==> imports:[MaterialModule]
import { NgModule } from '@angular/core';
// *************** FORM CONTROLS ***************
import {MatAutocompleteModule} from '@angular/material/autocomplete';
import {MatCheckboxModule} from '@angular/material/checkbox';
import {MatDatepickerModule} from '@angular/material/datepicker';
@caroso1222
caroso1222 / dom.service.ts
Last active August 18, 2023 13:34
Service to dynamically append Angular components to the body
import {
Injectable,
Injector,
ComponentFactoryResolver,
EmbeddedViewRef,
ApplicationRef
} from '@angular/core';
@Injectable()
export class DomService {
@sadikaya
sadikaya / cmder-in-webstorm.md
Created November 28, 2016 06:52
Cmder inside Webstorm terminal
  1. Set an environment variable called CMDER_ROOT to your root Cmder folder (in my case C:\Program Files (x86)\Cmder). It seems to be important that this does not have quotes around it because they mess with concatenation in the init script.
  2. In your IntelliJ terminal settings, use "cmd" /k ""%CMDER_ROOT%\vendor\init.bat"" as the Shell path. The double-double-quotes are intentional, as they counteract the missing double quotes in the environment variable.
@MarianoGnu
MarianoGnu / fill_tileset_scene.gd
Created May 11, 2016 22:51
Fill a scene with autogenerated sprites with collisions to export as a tileset.
tool
extends EditorScript
# ------------------HOW TO USE-------------------------
# CONFIGURE CONSTANTS TO AUTOGENERATE THE TILESET SCENE
# -----------------------------------------------------
# PATH TO TEXTURE FILE
@paulirish
paulirish / bling.js
Last active July 23, 2024 14:51
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
};
NodeList.prototype.__proto__ = Array.prototype;
@mikelehen
mikelehen / generate-pushid.js
Created February 11, 2015 17:34
JavaScript code for generating Firebase Push IDs
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/