Skip to content

Instantly share code, notes, and snippets.

View gevorg's full-sized avatar
time => code

Gevorg Harutyunyan gevorg

time => code
  • Yerevan, Armenia
View GitHub Profile
@gevorg
gevorg / karma.conf.js
Last active October 21, 2017 19:58
Karma config
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha', 'chai'],
// Sources.
@gevorg
gevorg / custom month name java8
Created October 21, 2017 08:21
Custom month name java8
def monthNameMap = [1L: "MIK", 2L: "PIK", 3L: "CIK"]
LocalDate date = LocalDate.now()
DateTimeFormatter formatter = new DateTimeFormatterBuilder()
.appendPattern("yyyy ")
.appendText(ChronoField.MONTH_OF_YEAR, monthNameMap)
.toFormatter(Locale.FRENCH)
for (int i = 0; i < 12; ++i) {
date = date.minusMonths(1)
@gevorg
gevorg / GPars demo
Created October 21, 2017 07:44
GPars demo
// compile "org.codehaus.gpars:gpars:1.2.1"
import groovyx.gpars.GParsPool
...
static void main(String[] args) {
def aPromises = []
@gevorg
gevorg / index.html
Last active July 3, 2020 19:21
Video Streaming
<video width="400" height="300" autoplay controls>
<source src="video.mp4" type="video/mp4">
</video>
<video width="400" height="300" autoplay controls>
<source src="video2.mp4" type="video/mp4">
</video>
@gevorg
gevorg / specific.path.http.server.js
Created September 13, 2016 23:32
Opening specific path with http-auth and http server.
// HTTP module
var http = require('http');
// Authentication module.
var auth = require('http-auth');
var basic = auth.basic({
realm: "Simon Area.",
file: __dirname + "/../data/users.htpasswd" // gevorg:gpass, Sarah:testpass
});
@gevorg
gevorg / specific.path.js
Last active September 22, 2023 09:07
Exclude specific path from http-auth
// Express module.
var express = require('express');
// Authentication module.
var auth = require('http-auth');
var basic = auth.basic({
realm: "Simon Area.",
file: __dirname + "/../data/users.htpasswd" // gevorg:gpass, Sarah:testpass ...
});
@gevorg
gevorg / gist:955f33a9e5a3a9f90e0e
Created May 26, 2015 19:23
MySQL dumping and restoring in java
File backupFile = new File("C:/Users/gevorg/backup.sql");
String[] command = new String[]{"mysqldump ", "-uroot", "-proot", "test"};
ProcessBuilder processBuilder = new ProcessBuilder(Arrays.asList(command));
processBuilder.redirectError(Redirect.INHERIT);
processBuilder.redirectOutput(Redirect.to(backupFile));
Process process = processBuilder.start();
process.waitFor();
@gevorg
gevorg / gist:9ef7bd4418c0695a0a87
Created May 6, 2015 20:17
AtmosphereClient usage
AtmosphereClient client = ClientFactory.getDefault().newClient(AtmosphereClient.class);
RequestBuilder request = client.newRequestBuilder()
.uri("ws://127.0.0.1:7070/test")
.transport(Request.TRANSPORT.WEBSOCKET);
Socket socket = client.create();
socket.on(Event.CLOSE.name(), new Function<String>() {
@Override
@gevorg
gevorg / gist:7918633
Created December 11, 2013 21:19
Not proxy authentication for http-proxy/http-auth
var http = require('http'),
httpProxy = require('http-proxy');
// Authentication module.
var auth = require('../lib/http-auth');
var basic = auth.basic({
realm: "Simon Area."
}, function (username, password, callback) { // Custom authentication method.
callback(username === "Tina" && password === "Bullock");
}