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 saveTextAsFile(textToWrite, fileNameToSaveAs, fileType) { | |
| let textFileAsBlob = new Blob([textToWrite], { type: fileType }); | |
| let downloadLink = document.createElement('a'); | |
| downloadLink.download = fileNameToSaveAs; | |
| downloadLink.innerHTML = 'Download File'; | |
| if (window.webkitURL != null) { | |
| downloadLink.href = window.webkitURL.createObjectURL( | |
| textFileAsBlob | |
| ); |
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 | |
| # удаление завершенных контейнеров: | |
| docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v | |
| # удаление неиспользуемых контейнеров: | |
| yes | docker container prune | |
| # удаление не используемых образов: | |
| yes | docker image prune | |
| # удаление не используемых томов: | |
| yes | docker volume prune |
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
| server { | |
| listen 80 default_server; | |
| listen [::]:80 default_server; | |
| # Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response. | |
| return 301 https://$host$request_uri; | |
| } | |
| server { | |
| listen 443 ssl http2; |
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 | |
| set -e | |
| set -u | |
| set -o pipefail | |
| # change work directory | |
| parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) | |
| cd "$parent_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
| const Role = new Proxy({ | |
| ADMIN: 1, | |
| USER: 2, | |
| GUEST: 3 | |
| }, { | |
| get(target, key) { | |
| return isNaN(key) ? target[key] : _.findKey(target, val => val == key); | |
| } | |
| }); |
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
| myApp.config(['$compileProvider', function ($compileProvider) { | |
| $compileProvider.debugInfoEnabled(false); | |
| }]); |
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
| var server = require('./server'); | |
| var shuttingdown = false; | |
| ['SIGINT', 'SIGTERM'].forEach(function(signal) { | |
| if (! shuttingdown) { | |
| shuttingdown = true; | |
| server.close(); | |
| // terminate process after 30 seconds anyway |
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
| // example function where arguments 2 and 3 are optional | |
| function example( err, optionalA, optionalB, callback ) { | |
| // retrieve arguments as array | |
| var args = []; | |
| for (var i = 0; i < arguments.length; i++) { | |
| args.push(arguments[i]); | |
| } | |
| // first argument is the error object |
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
| /* include js lib (lodash) before angular! */ | |
| 'use strict'; | |
| angular | |
| .module('app', []) | |
| .factory('_', ['$window', function($window) { | |
| return $window._; | |
| }]) |
NewerOlder