Skip to content

Instantly share code, notes, and snippets.

View ahkohd's full-sized avatar
🔨
building

Victor Aremu ahkohd

🔨
building
View GitHub Profile
//...
// 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);
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);
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`.
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`
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);
@ahkohd
ahkohd / .zshrc
Created November 28, 2019 06:55
My zsh config and iTerm color palate.
# 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
@ahkohd
ahkohd / .zshrc
Created November 28, 2019 06:55
My zsh config and iTerm color palate.
# 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
import {
Component,
ViewContainerRef,
AfterViewInit,
Renderer2
} from '@angular/core';
@Component({
selector: 'ngx-pipeform',
template: `<ng-content></ng-content>`,
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/>]]`
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"