Skip to content

Instantly share code, notes, and snippets.

View daretodave's full-sized avatar
💫
mterm.io

David Rehmat daretodave

💫
mterm.io
View GitHub Profile
import {get} from "https"
import {once} from "events";
export async function stream(url) {
const [inbound] = await once(get(url), 'response');
const completed = once(inbound, 'end');
async function* request() {
const [line] = await Promise.race([
once(inbound, 'data'),
import {get} from "https"
import {once} from "events";
export async function stream(url) {
const [inbound] = await once(get(url), 'response');
async function* request(completed) {
const raceList = await Promise.race([
once(inbound, 'data'),
completed,
@daretodave
daretodave / path-add.ps1
Created February 16, 2020 19:12
Append to windows path
param(
[Parameter(Mandatory=$True, Position=0, ValueFromPipeline=$False)]
[System.String]
$PATH_ADD
)
$TARGET = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($PATH_ADD)
$PATH = (Get-ItemProperty -Path ‘Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment’ -Name PATH).path
$PATH_DIR = $PATH.split(";");
@daretodave
daretodave / install-nerdfonts.ps1
Last active March 15, 2024 01:50
nerd-fonts windows install script. accepts optional argument for the font to install, otherwise all patched-fonts are installed
# run this with an argument to install a nerdfont on windows
# run this with no arguments to install all fonts
# font name, as seen on https://www.nerdfonts.com/font-downloads
param(
[Parameter(Mandatory=$False, Position=0, ValueFromPipeline=$false)]
[System.String]
$fontTarget="*"
)
# build temp directory for git clone
const routes = //.....\\\\
@NgModule({
declarations: [
AllComponentsThatPersistAlways
],
imports: [BrowserModule, FormsModule, HttpModule, RouterModule.forRoot(routes)],
providers: [
{
provide: RouteReuseStrategy,
import {DefaultRouteReuseStrategy} from '@angular/router/src/router';
import {ActivatedRouteSnapshot} from '@angular/router';
export class CustomRouteReuseStrategy extends DefaultRouteReuseStrategy {
shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean {
let name = future.component && (<any>future.component).name;
return super.shouldReuseRoute(future, curr) && name !== 'ThisWouldBeAComponentThatShouldReload';
}
}
@daretodave
daretodave / ws-right-click.ps1
Created February 4, 2019 23:34
Add WebStorm to right click context menu on windows. Save as a "ps1", run as admin.
$BIN = ("C:\Program Files\Jetbrains","$env:LOCALAPPDATA\Jetbrains")
$TOOL = Get-Childitem `
-Recurse `
–Path $BIN `
-Filter webstorm64.exe `
| Select-Object -first 1 `
| %{$_.FullName}
if (!$TOOL) {
Write-Output "This script could not find webstorm "
@daretodave
daretodave / Core.java
Created April 23, 2018 00:33
The woDA concept - wosome desktop application toolkit
package com.wosome.sc;
import com.wosome.woda.WO;
import com.wosome.woda.WOCore;
import com.wosome.woda.WOFlag;
import java.util.HashMap;
public class Core extends WOCore implements WOCore.WOCoreOnLaunch {