Skip to content

Instantly share code, notes, and snippets.

@peyanski
peyanski / ESPHome-YAML-ld2410-esp32.yaml
Last active June 29, 2025 06:14
Use this code to make your LD2410 sensor to work with ESP32 or ESP8266 board
esphome:
name: ld2410-esp32
friendly_name: ld2410-esp32
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
@robertdean
robertdean / ng-setup.sh
Last active May 10, 2023 13:37
setup v2
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
echo "${green}${green}creating project shell${reset}"
ng new ui --skip-install=true --routing=true --style=scss --skip-git=true --create-application=false --commit=false --verbose=true
cd ui
echo "${green}creating admin projectl${reset}"
export class Constants {
public static apiRoot = '/api', // If there is some prefix for all the APIs, then define that in constants.
public static API_VERSIONS = {
Version1: 'version1',
};
public static pageSettings(): PageEvent {
return {
length: 0,
pageIndex: 0,
pageSize: 10,
@bennadel
bennadel / app.component.ts
Created July 21, 2020 11:44
Looking At Different Click-To-Edit Implementations In Angular 9.1.12
// Import the core angular services.
import { Component } from "@angular/core";
// ----------------------------------------------------------------------------------- //
// ----------------------------------------------------------------------------------- //
export interface Project {
id: string;
name: string;
}
@piyushchauhan2011
piyushchauhan2011 / jwt.js
Last active February 17, 2024 00:14
Deno Google Sheets using google service accounts JWT authentication
const jwt = require("jsonwebtoken");
const credentials = require('./credentials.json');
const privateKey = credentials["private_key"];
const iss = credentials["client_email"];
const scope = "https://www.googleapis.com/auth/drive.readonly";
const token = jwt.sign(
{
const fetch = require("node-fetch");
const getData = async () => {
try {
const response = await fetch("https://www.facebook.com/api/graphql/", {
headers: {
"content-type": "application/x-www-form-urlencoded"
},
body:
"av=0&__user=0&__a=1&__dyn=7xeUmBwjbgmwCwRyWzEsheC1swgE98nwgU6C4UKewSAAwCxW4E2czobohxi2i3qcw9m7oqx61BwvU2Vwb-q3q5Voy6o2xwbG783pwKx-8wlU-cBweq0wXAy85iaxq3m7Eaoy15wJwBgK4oK227Ua831wLwKwFxe0H8-7Eox21uwjojxm&__csr=&__req=l&__beoa=0&__pc=PHASED%3ADEFAULT&dpr=2&__rev=1001662448&__s=aw8z00%3Asobw97%3Az0y5t9&__hsi=6788100950301358546-0&lsd=AVqtNhkO&jazoest=2748&__spin_r=1001662448&__spin_b=trunk&__spin_t=1580477913&fb_api_caller_class=RelayModern&fb_api_req_friendly_name=MarketplaceNewSearchFeedPaginationQuery&variables=%7B%22count%22%3A16%2C%22cursor%22%3A%22%7B%5C%22pg%5C%22%3A0%2C%5C%22b2c%5C%22%3A%7B%5C%22br%5C%22%3A%5C%22%5C%22%2C%5C%22it%5C%22%3A0%2C%5C%22hmsr%5C%22%3Afalse%2C%5C%22tbi%5C%22%3A0%7D%2C%5C%22c2c%5C%22%3A%7B%5C%22br%5C%22%3A%5C%22AboZViCziur4Ep
@marcusedu
marcusedu / install_flutter_on_windows.bat
Last active October 17, 2020 13:46
Script que baixa e instala o chocolatey, dart-sdk, android studio e o git, depois clona o flutter na pasta src da raiz do disco e inicializa o Flutter doctor.
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
choco install dart-sdk androidstudio git
cd \
mkdir src
cd \src
git clone https://github.com/flutter/flutter.git
cd flutter
start bin/flutter.bat doctor
start flutter_console.bat
@echo off
@faisalmuhammad
faisalmuhammad / development-only.directive.ts
Last active July 13, 2018 18:29
Angular | Development Only Directive
/**
* @author Muhammad FAISAL
* @description Controls the display of html contents only during development mode.
* @example <button development-only>Some Button</button>
*/
// Angular Imports
import { Directive, OnInit, ElementRef, isDevMode } from '@angular/core';
// Define class for the Directive

Visual Studio Code shortcuts I use often

Navigation

Sidebar:

  • Cmd-Shift-F: search
  • Cmd-Shift-E: files

Navigating in current editor:

@gsans
gsans / router-transitions-util.md
Last active April 21, 2018 15:04
Refactoring router transitions

yummy

Refactoring multiple router transitions - Angular (v5+)

We can apply this refactor when we identify a group of transitions running the same animation following the same pattern.

Code:

// BEFORE