Skip to content

Instantly share code, notes, and snippets.

@bbudd
bbudd / assets.md
Created June 13, 2019 12:30
Loading static assets using electron-forge v6 and the webpack plugin

I spent a few hours chasing down just how to get my static assets (css, fonts, images) to load in an Electron app built using electron-forge v6 (https://www.electronforge.io/) and its webpack plugin (https://www.electronforge.io/config/plugins/webpack) while in development mode. There really isn't any documentation available online, either in the electron-forge documentation or in places like blogs or gists or stackoverflow. So I thought I'd put it down here.

Step 1

Load CopyWebpackPlugin npm i -D copy-webpack-plugin


Step 2

Use the plugin to move your directories into place.

@dmorosinotto
dmorosinotto / TestTypedForms.ts
Last active July 7, 2023 05:09
Typed @angular/forms FIXED set/patchValue - strict all the way down ^_^
import { FormGroup, FormControl, FormArray, Validators } from "@angular/forms";
function testFormGroupTyped() {
var frm = new FormGroup({
a: new FormArray([new FormControl(0)]),
b: new FormControl(true),
c: new FormGroup({
s: new FormControl("abc"),
n: new FormControl(123)
})
@mohlendo
mohlendo / i18n.component.ts
Last active December 11, 2019 01:35
Angular i18n translations outside a template - JIT only
import { Component } from '@angular/core'
@Component({
selector: 'i18n',
moduleId: module.id,
template: `<span i18n="@@foobar">Hello {{placeholder}}!</span>`
})
export class I18NComponent {
placeholder: any
}
@abbazabacto
abbazabacto / form-builder-typed.ts
Last active March 20, 2022 13:17
Typed Form Builder
// extended upon: https://ruanbeukes.net/Angular-Typesafe-Reactive-Forms/
import { Injectable } from '@angular/core';
import { AbstractControl, FormArray, FormControl, FormGroup, ValidatorFn, AsyncValidatorFn, FormBuilder } from '@angular/forms';
import { Observable } from 'rxjs/Observable';
type PropertyFn<T, R> = (val: T) => R;
interface AbstractControlTyped<T> extends AbstractControl {
readonly value: T;
@callmeloureiro
callmeloureiro / comoSerChatoNoWhatsapp.js
Last active January 15, 2024 20:44
Como fazer alguém te responder no whatsapp
/*
Hoje iremos MUDAR a vida da pessoa que não te responde no whatsappp...
Que tal enviar mensagens pra ela até obter uma resposta?!
Sensacional não acha?! Mas, somos devs, correto?! Então vamos automatizar esse paranauê!
Para utilizar:
- Abra o web.whatsapp.com;
- Selecione a conversa que você quer;
- Abra o console e cole o código que está no gist;
@echo off
if not "%1"=="am_admin" (powershell start -verb runas '%0' am_admin & exit /b)
@rem *** Disable Some Service ***
sc stop DiagTrack
sc stop diagnosticshub.standardcollector.service
sc stop dmwappushservice
sc stop WMPNetworkSvc
sc stop WSearch
@kossnocorp
kossnocorp / v2-pre-releases.md
Last active October 19, 2020 11:33
date-fns v2 pre-releases change log
@codediodeio
codediodeio / database.rules.json
Last active June 22, 2024 07:03
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}
@abnersajr
abnersajr / traceRouteMap.js
Last active October 16, 2022 00:09
Trace Route using Maps API Javascript V3
function traceRouteMap() {
var mapElement = document.getElementById('google-map');
var directionsService = new google.maps.DirectionsService();
var startLatLng = new google.maps.LatLng(-29.687306,-53.815477);
var directionsDisplay= new google.maps.DirectionsRenderer();
var geocoder = new google.maps.Geocoder();
var markers = [];
var center;
var mapOptions = {
zoom: 12,
@franciscocpg
franciscocpg / jetty-install-debian.sh
Last active May 21, 2020 14:51
Install jetty on debian
#!/bin/bash
# do in tmp
cd /tmp
JETTY_FILE='jetty-distribution-9.3.3.v20150827.tar.gz'
JETTY_FOLDER=${JETTY_FILE:0:-7}
# Download
wget http://download.eclipse.org/jetty/stable-9/dist/$JETTY_FILE
# Extract
sudo tar zxvf $JETTY_FILE -C /opt/