This file contains 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
# ohmyzh plugin that creates a phpver_prompt_info function that you can use in your theme to display your current version of php | |
# It uses two variables to control how that is shown: | |
# ZSH_THEME_PHPVER_PREFIX: sets the prefix of the PHPVER. Defaults to [ | |
# ZSH_THEME_PHPVER_SUFFIX: sets the suffix of the PHPVER. Defaults to ] | |
function phpver_prompt_info(){ | |
if [[ -f "composer.json" ]]; then | |
if php_version=$(/usr/bin/env php --version 2>/dev/null); then | |
PHPVER="$(echo "$php_version" | awk 'NR==1 {split($2, version_parts, "."); print version_parts[1] "." version_parts[2]}')" | |
fi |
This file contains 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 { Router } from 'express'; | |
const group = ((callback: (router: Router) => void) => { | |
const router = Router(); | |
callback(router); | |
return router; | |
}); | |
export default group; |
This file contains 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 { Subject } from 'rxjs'; | |
import { debounceTime } from 'rxjs/operators'; | |
export function Debounce(time: number) { | |
return function ( | |
target: any, | |
propertyKey: string, | |
descriptor: PropertyDescriptor | |
) { | |
const originalMethod = descriptor.value; |
This file contains 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
dpkg-deb -x <app>.deb temp | |
dpkg-deb --control <app>.deb | |
mv DEBIAN/ temp/ | |
sed -ie 's/libappindicator3-1/libayatana-appindicator3-1/' temp/DEBIAN/control | |
dpkg -b temp <app>-fixed.deb | |
sudo apt install ./<app>-fixed.deb | |
rm -rf temp |
This file contains 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
export const mapNested = (nodes: any, mapCallback: any) => { | |
function recursive(nodes: any) { | |
return nodes.map((node: any) => { | |
return recursiveSelector(node, recursive, mapCallback) | |
}); | |
} | |
return recursive(nodes); | |
} | |
const recursiveSelector = (node: any, recursive: any, map: any) => { |
This file contains 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
export const formatNested = function (flatArray: any[], id: any, parentId: any): Array<any> { | |
const collection: Array<any> = []; | |
flatArray.forEach((item) => (collection[item[id]] = { ...item, children: [] })); | |
const result: Array<any> = []; | |
flatArray.forEach((item) => { | |
if (item[parentId]) { | |
if (collection[item[parentId]]) { | |
collection[item[parentId]].children.push(collection[item[id]]); | |
} | |
} else { |
This file contains 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
export const asyncForEach = async function (array: Array<any>, callback: any) { | |
for (let index = 0; index < array.length; index++) { | |
await callback(array[index], index, array); | |
} | |
}; | |
// await asyncForEach(collection, async (item) => { await doSomething(item); }); |
This file contains 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 { Injectable } from '@angular/core'; | |
import { HttpClient, HttpHeaders } from '@angular/common/http'; | |
import { Observable } from 'rxjs'; | |
import { environment } from '@env/environment'; | |
@Injectable({ | |
providedIn: 'root', | |
}) | |
export class ApiService { | |
constructor(private http: HttpClient) {} |
This file contains 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
... | |
@Action(Login) | |
login({ patchState, dispatch, getState }: StateContext<AppStateModel>, { payload }: Login) { | |
let body = {}; | |
let endpoint = ''; | |
if (payload != null) { | |
patchState({ currentUserLoading: true }); | |
body = payload; |
This file contains 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
#! /bin/bash | |
# Checks if rclone exists | |
if ! command -v rclone &> /dev/null | |
then | |
echo "install rclone first" | |
exit; | |
fi | |
# Checks if ~/OneDrive directory exists |