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
/* @ngInject */ | |
export class MyComponent { | |
constructor($scope: ng.IScope, $ngRedux: ngRedux.INgRedux) { | |
const unsubscriber = $ngRedux.connect(state => state.myState)(this); | |
// disconnect redux on component destroy | |
$scope.$on('$destroy', unsubscriber); | |
} | |
} |
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 responsifyFactory($window, rx, screenSize) { | |
// observable singleton | |
const observable$ = rx.Observable.fromEvent($window, 'resize') | |
.map(() => screenSize.get()) | |
.distinctUntilChanged() | |
return ($scope = null) => { | |
// you might need to interact with observable directly in controller | |
// simply return observable if service has been called with no arguments | |
if ($scope === null) { |
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 puppeteer = require('puppeteer') | |
const express = require('express') | |
const app = express() | |
// page with angularjs application | |
const url = 'http://ng-seo.sourcelab.xyz/' | |
app.get('/', async function (req, res) { | |
const browser = await puppeteer.launch() | |
const page = await browser.newPage() |
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
// environments/environment.ts | |
export const environment = { | |
production: false, | |
hmr: true | |
}; |
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
#!/bin/bash | |
rm -rf dist | |
mkdir dist | |
find ./ \( \ | |
-name "*.js" -o -name "*.js.map" -o -name "*.d.ts" -o -name "*.metadata.json" -o -name "package.json" \ | |
\) -not \( \ | |
-path "./node_modules/*" -o -path "./dist/*" \ | |
\) | xargs cp --parent -t ./dist | |
gh-pages -d dist -b npmjs |
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
#!/bin/bash -e | |
# assuming you've already installed GO and direnv | |
# and your desired workspace is at $HOME/go-workspace | |
# first, create workspace skeleton and go to workspace | |
mkdir -p ~/workspace/{bin,src,pkg} | |
cd ~/workspace/ | |
# create .envrc with predefined layout (direnv built-in layout) |
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
#!/usr/bin/env bash | |
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin | |
gluster volume start public_upload force | |
gluster volume start uploads force | |
mkdir -p /var/www/{uploads,public/upload} | |
mount.glusterfs 127.0.0.1:/public_upload /var/www/public/upload | |
mount.glusterfs 127.0.0.1:/uploads /var/www/uploads |
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 { timer } from 'rxjs/observable/timer'; | |
import { delayWhen } from 'rxjs/operators'; | |
export const delayThreshold = (threshold: number, start = Date.now()) => | |
delayWhen(() => { | |
const delay = threshold - (Date.now() - start); | |
return timer(delay > 0 ? delay : 0); | |
}); |
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 { HttpClient } from '@angular/common/http'; | |
import { Injectable } from '@angular/core'; | |
import { Actions, Effect } from '@ngrx/effects'; | |
import { DataPersistence } from '@nrwl/nx'; | |
import { from } from 'rxjs/observable/from'; | |
import { bufferCount, concatAll, switchMap } from 'rxjs/operators'; | |
import { AppState } from './app.interfaces'; | |
@Injectable() |
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
mkdir ~/extensions | |
git clone -b ubuntu-18.04 --single-branch https://github.com/passingthru67/workspaces-to-dock.git --depth 1 ~/extensions/workspaces-to-dock | |
ln -sf ~/extensions/workspaces-to-dock/workspaces-to-dock/[email protected] $HOME/.local/share/gnome-shell/extensions/ | |
killall -3 gnome-shell |