This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //... | |
| // If you want to stop fade-out at will. | |
| // Just clear the fade out time interval. | |
| window.clearInterval(fadeOutWindowIntervalRef); | |
| // If you want to stop fade-in at will. | |
| // Just clear the fade in time interval. | |
| window.clearInterval(fadeInWindowIntervalRef); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { remote } = require("electron"); | |
| // ...`fadeWindowOut` and `fadeWindowIn` functions goes here... | |
| // Get the current window. | |
| const currentWindow = remote.getCurrentWindow(); | |
| // Fade-out window every 2 milliseconds, step by 0.1 | |
| let fadeOutWindowIntervalRef = fadeWindowOut(currentWindow, 0.1, 2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fadeWindowOut = ( | |
| browserWindowToFadeOut, | |
| step = 0.1, | |
| fadeEveryXSeconds = 10 | |
| ) => { | |
| // Get the opacity of the window. | |
| let opacity = browserWindowToFadeOut.getOpacity(); | |
| // Reduce the opacity of the window by `step` every `fadeEveryXSeconds`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fadeWindowIn = ( | |
| browserWindowToFadeIn, | |
| step = 0.1, | |
| fadeEveryXSeconds = 10 | |
| ) => { | |
| // Get the opacity of the window. | |
| let opacity = browserWindowToFadeIn.getOpacity(); | |
| // Increase the opacity of the window by `step` every `fadeEveryXSeconds` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { remote, BrowserWindow } from 'electron'; | |
| const fadeWindowOut = ( | |
| _window: BrowserWindow, | |
| step: number = 0.1, | |
| fadeEveryXSeconds: number = 10 | |
| ) => { | |
| let opacity = _window.getOpacity(); | |
| const interval = setInterval(() => { | |
| if (opacity <= 0) window.clearInterval(interval); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. | |
| # Initialization code that may require console input (password prompts, [y/n] | |
| # confirmations, etc.) must go above this block, everything else may go below. | |
| if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then | |
| source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" | |
| fi | |
| # If you come from bash you might have to change your $PATH. | |
| # export PATH=$HOME/bin:/usr/local/bin:$PATH |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. | |
| # Initialization code that may require console input (password prompts, [y/n] | |
| # confirmations, etc.) must go above this block, everything else may go below. | |
| if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then | |
| source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" | |
| fi | |
| # If you come from bash you might have to change your $PATH. | |
| # export PATH=$HOME/bin:/usr/local/bin:$PATH |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { | |
| Component, | |
| ViewContainerRef, | |
| AfterViewInit, | |
| Renderer2 | |
| } from '@angular/core'; | |
| @Component({ | |
| selector: 'ngx-pipeform', | |
| template: `<ng-content></ng-content>`, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { | |
| Pipe, | |
| PipeTransform | |
| } from '@angular/core'; | |
| @Pipe({ | |
| name: 'PipeForm' | |
| }) | |
| export class FormPipe implements PipeTransform { | |
| // transforms the pipe input and returns a string following this format `[[<input/>]]` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function ObjectToUrlEncode(data) | |
| { | |
| return Object.entries(data).reduce((accumulator, current) => { | |
| return `${accumulator}&${current[0]}=${current[1]}`; | |
| }, '').substring(1); | |
| } | |
| console.log(ObjectToUrlEncode({name: "victor", age: 12, line: 13})); | |
| // OUTPUT: "name=victor&age=12&line=13" |