This guide is based on the very informative discussion in this article: Using node_sqlite3 with Electron
Install sqlite3
npm install sqlite3 --save
| # to generate your dhparam.pem file, run in the terminal | |
| openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
| var mongoObjectId = function () { | |
| var timestamp = (new Date().getTime() / 1000 | 0).toString(16); | |
| return timestamp + 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, function() { | |
| return (Math.random() * 16 | 0).toString(16); | |
| }).toLowerCase(); | |
| }; |
| var connectionString = 'postgres://localhost:5432/postgres'; | |
| var Promise=require('bluebird'); | |
| var knex = require('knex')({ | |
| client: 'pg', | |
| connection: { | |
| user: 'postgres', | |
| database: 'postgres', | |
| port: 5432, |
This guide is based on the very informative discussion in this article: Using node_sqlite3 with Electron
Install sqlite3
npm install sqlite3 --save
process — это объект, позволяющий получить информацию о типе запущенного процесса (рендеринг или основной процесс), версию Chrome и Electron, а также путь до выполняемого js-файла.
Объект File — это абстракция над нативным File, передающая стандартному HTML5 file API путь к физическому расположению файла в файловой системе пользователя.
| app.factory('ArrayService', function(){ | |
| return { | |
| deleteElement: function(array, element) { | |
| var index = array.indexOf(element); | |
| if(index == -1){ | |
| return false; | |
| } | |
| array.splice(index, 1); |
| function MyCustomError(message) { | |
| this.message = message; | |
| this.name = "MyCustomError"; | |
| Error.captureStackTrace(this, MyCustomError); | |
| } | |
| // or util.inherits(MyCustomError, Error); | |
| MyCustomError.prototype = Object.create(Error.prototype); | |
| MyCustomError.prototype.constructor = MyCustomError; |
| 'use strict'; | |
| var gulp = require('gulp'); | |
| var gutil = require('gulp-util'); | |
| var del = require('del'); | |
| var uglify = require('gulp-uglify'); | |
| var gulpif = require('gulp-if'); | |
| var exec = require('child_process').exec; | |
| var notify = require('gulp-notify'); |
| import _ from 'lodash'; | |
| import angular from 'angular'; | |
| import 'angular-new-router'; | |
| import 'oclazyload'; | |
| function AppController ( ) { | |
| } | |
| AppController.$routeConfig = []; |
| To install virtualenv via pip | |
| $ pip3 install virtualenv | |
| Note that virtualenv installs to the python3 directory. For me it's: | |
| $ /usr/local/share/python3/virtualenv | |
| Create a virtualenvs directory to store all virtual environments | |
| $ mkdir somewhere/virtualenvs | |
| Make a new virtual environment with no packages |