file_path
stringlengths 3
280
| file_language
stringclasses 66
values | content
stringlengths 1
1.04M
| repo_name
stringlengths 5
92
| repo_stars
int64 0
154k
| repo_description
stringlengths 0
402
| repo_primary_language
stringclasses 108
values | developer_username
stringlengths 1
25
| developer_name
stringlengths 0
30
| developer_company
stringlengths 0
82
|
|---|---|---|---|---|---|---|---|---|---|
src/modal.component.scss
|
SCSS
|
/**
* A more specific selector overwrites bootstrap display properties, but they still enable users
* to overwite them on their apps.
*/
/deep/ modal .modal {
display: flex;
flex: 1;
align-items: center;
justify-content: center;
}
/deep/ .modal {
position: fixed;
top: 0;
left: 0;
width: 100%;
min-height: 100%;
background-color: rgba(0, 0, 0, 0.15);
z-index: 42;
}
/deep/ .modal.in {
opacity: 1;
}
|
zurfyx/angular-custom-modal
| 30
|
Angular2+ Modal / Dialog (with inner component support).
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
src/modal.component.spec.ts
|
TypeScript
|
it('works', () => {});
|
zurfyx/angular-custom-modal
| 30
|
Angular2+ Modal / Dialog (with inner component support).
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
src/modal.component.ts
|
TypeScript
|
/* tslint:disable:component-selector */
import {
Component,
OnDestroy,
ContentChild,
ElementRef,
TemplateRef,
ChangeDetectionStrategy,
ChangeDetectorRef,
Input,
HostListener,
} from '@angular/core';
@Component({
selector: 'modal',
templateUrl: 'modal.component.html',
styleUrls: ['modal.component.scss'],
})
export class ModalComponent implements OnDestroy {
@ContentChild('modalHeader') header: TemplateRef<any>;
@ContentChild('modalBody') body: TemplateRef<any>;
@ContentChild('modalFooter') footer: TemplateRef<any>;
@Input() closeOnOutsideClick = true;
visible = false;
visibleAnimate = false;
constructor(
private elementRef: ElementRef,
private changeDetectorRef: ChangeDetectorRef
) { }
ngOnDestroy() {
// Prevent modal from not executing its closing actions if the user navigated away (for example,
// through a link).
this.close();
}
open(): void {
document.body.classList.add('modal-open');
this.visible = true;
setTimeout(() => {
this.visibleAnimate = true;
});
}
close(): void {
document.body.classList.remove('modal-open');
this.visibleAnimate = false;
setTimeout(() => {
this.visible = false;
this.changeDetectorRef.markForCheck();
}, 200);
}
@HostListener('click', ['$event'])
onContainerClicked(event: MouseEvent): void {
if ((<HTMLElement>event.target).classList.contains('modal') && this.isTopMost() && this.closeOnOutsideClick) {
this.close();
}
}
@HostListener('document:keydown', ['$event'])
onKeyDownHandler(event: KeyboardEvent) {
// If ESC key and TOP MOST modal, close it.
if (event.key === 'Escape' && this.isTopMost()) {
this.close();
}
}
/**
* Returns true if this modal is the top most modal.
*/
isTopMost(): boolean {
return !this.elementRef.nativeElement.querySelector(':scope modal > .modal');
}
}
|
zurfyx/angular-custom-modal
| 30
|
Angular2+ Modal / Dialog (with inner component support).
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
src/modal.module.ts
|
TypeScript
|
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ModalComponent } from './modal.component';
@NgModule({
imports: [
CommonModule,
],
exports: [ModalComponent],
declarations: [ModalComponent],
providers: [],
})
export class ModalModule { }
|
zurfyx/angular-custom-modal
| 30
|
Angular2+ Modal / Dialog (with inner component support).
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
config/environment.prod.ts
|
TypeScript
|
export const environment = {
production: true
};
|
zurfyx/angular-library-starter-kit
| 34
|
Angular 5 Library Starter Kit based on Angular-CLI
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
config/environment.ts
|
TypeScript
|
// The file contents for the current environment will overwrite these during build.
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
// The list of which env maps to which file can be found in `.angular-cli.json`.
export const environment = {
production: false
};
|
zurfyx/angular-library-starter-kit
| 34
|
Angular 5 Library Starter Kit based on Angular-CLI
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
e2e/app.e2e-spec.ts
|
TypeScript
|
import { AppPage } from './app.po';
describe('App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
page.navigateTo();
});
it('should display "<Angular 5 Library Starter Kit>"', () => {
expect(page.getTitleText()).toContain('<Angular 5 Library Starter Kit>');
});
});
|
zurfyx/angular-library-starter-kit
| 34
|
Angular 5 Library Starter Kit based on Angular-CLI
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
e2e/app.po.ts
|
TypeScript
|
import { browser, by, element } from 'protractor';
export class AppPage {
navigateTo() {
return browser.get('/');
}
getTitleText() {
return element(by.css('app-root h1')).getText();
}
}
|
zurfyx/angular-library-starter-kit
| 34
|
Angular 5 Library Starter Kit based on Angular-CLI
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
example/app/app.component.html
|
HTML
|
<div class="greetings center">
<div>
<h1>{{ 'Angular 5 Library Starter Kit' | taggify }}</h1>
<a class="neat shadowy" href="https://github.com/zurfyx/angular-library-starter-kit" rel="noopener" target="_blank">Get your own Angular library published in few minutes</a>
</div>
</div>
|
zurfyx/angular-library-starter-kit
| 34
|
Angular 5 Library Starter Kit based on Angular-CLI
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
example/app/app.component.scss
|
SCSS
|
@import url('https://fonts.googleapis.com/css?family=Montserrat|Open+Sans');
html, body {
color: #444;
font-family: 'Open Sans', sans-serif;
background: #4aabc9;
background: linear-gradient(135deg, #4aabc9 0%,#7db9e8 100%);
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
h1 {
font-family: 'Montserrat';
font-weight: 200;
padding: 30px;
margin: 0;
}
a.neat {
color: inherit;
text-decoration: none;
}
a.shadowy {
padding: .5rem 1rem;
transition: .2s all ease-in;
&:hover {
color: #4aabc9;
background-color: #fff;
}
}
.greetings {
color: #fff;
}
.center {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
}
|
zurfyx/angular-library-starter-kit
| 34
|
Angular 5 Library Starter Kit based on Angular-CLI
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
example/app/app.component.ts
|
TypeScript
|
import { Component, ViewEncapsulation, ViewChild } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
encapsulation: ViewEncapsulation.None,
})
export class AppComponent { }
|
zurfyx/angular-library-starter-kit
| 34
|
Angular 5 Library Starter Kit based on Angular-CLI
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
example/app/app.module.ts
|
TypeScript
|
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { TaggifyModule } from '../../src';
import { AppComponent } from './app.component';
@NgModule({
imports: [
BrowserModule,
TaggifyModule,
],
declarations: [
AppComponent,
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
|
zurfyx/angular-library-starter-kit
| 34
|
Angular 5 Library Starter Kit based on Angular-CLI
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
example/index.html
|
HTML
|
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Angular Library Starter Kit</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
</html>
|
zurfyx/angular-library-starter-kit
| 34
|
Angular 5 Library Starter Kit based on Angular-CLI
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
example/main.ts
|
TypeScript
|
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from '../config/environment';
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.log(err));
|
zurfyx/angular-library-starter-kit
| 34
|
Angular 5 Library Starter Kit based on Angular-CLI
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
example/polyfills.ts
|
TypeScript
|
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
*
* This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file.
*
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
*
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
*/
/***************************************************************************************************
* BROWSER POLYFILLS
*/
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
// import 'core-js/es6/symbol';
// import 'core-js/es6/object';
// import 'core-js/es6/function';
// import 'core-js/es6/parse-int';
// import 'core-js/es6/parse-float';
// import 'core-js/es6/number';
// import 'core-js/es6/math';
// import 'core-js/es6/string';
// import 'core-js/es6/date';
// import 'core-js/es6/array';
// import 'core-js/es6/regexp';
// import 'core-js/es6/map';
// import 'core-js/es6/weak-map';
// import 'core-js/es6/set';
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`.
/** IE10 and IE11 requires the following for the Reflect API. */
// import 'core-js/es6/reflect';
/** Evergreen browsers require these. **/
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
import 'core-js/es7/reflect';
/**
* Required to support Web Animations `@angular/platform-browser/animations`.
* Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
**/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/***************************************************************************************************
* Zone JS is required by Angular itself.
*/
import 'zone.js/dist/zone'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
*/
/**
* Date, currency, decimal and percent pipes.
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
*/
// import 'intl'; // Run `npm install --save intl`.
/**
* Need to import at least one locale-data with intl.
*/
// import 'intl/locale-data/jsonp/en';
|
zurfyx/angular-library-starter-kit
| 34
|
Angular 5 Library Starter Kit based on Angular-CLI
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
example/test.ts
|
TypeScript
|
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/long-stack-trace-zone';
import 'zone.js/dist/proxy.js';
import 'zone.js/dist/sync-test';
import 'zone.js/dist/jasmine-patch';
import 'zone.js/dist/async-test';
import 'zone.js/dist/fake-async-test';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
declare const __karma__: any;
declare const require: any;
// Prevent Karma from running prematurely.
__karma__.loaded = function () {};
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const contextExample = require.context('./', true, /\.spec\.ts$/);
const contextSrc = require.context('../src/', true, /\.spec\.ts$/);
// And load the modules.
contextExample.keys().map(contextExample);
contextSrc.keys().map(contextSrc);
// Finally, start Karma to run the tests.
__karma__.start();
|
zurfyx/angular-library-starter-kit
| 34
|
Angular 5 Library Starter Kit based on Angular-CLI
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
example/typings.d.ts
|
TypeScript
|
/* SystemJS module definition */
declare var module: NodeModule;
interface NodeModule {
id: string;
}
|
zurfyx/angular-library-starter-kit
| 34
|
Angular 5 Library Starter Kit based on Angular-CLI
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
karma.conf.js
|
JavaScript
|
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular/cli'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular/cli/plugins/karma')
],
client:{
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
reports: [ 'html', 'lcovonly' ],
fixWebpackSourcePaths: true
},
angularCli: {
environment: 'dev'
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};
|
zurfyx/angular-library-starter-kit
| 34
|
Angular 5 Library Starter Kit based on Angular-CLI
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
protractor.conf.js
|
JavaScript
|
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare() {
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};
|
zurfyx/angular-library-starter-kit
| 34
|
Angular 5 Library Starter Kit based on Angular-CLI
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
src/index.ts
|
TypeScript
|
export * from './taggify.pipe';
export * from './taggify.module';
|
zurfyx/angular-library-starter-kit
| 34
|
Angular 5 Library Starter Kit based on Angular-CLI
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
src/taggify.module.ts
|
TypeScript
|
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { TaggifyPipe } from './taggify.pipe';
@NgModule({
imports: [
CommonModule,
],
exports: [
TaggifyPipe,
],
declarations: [
TaggifyPipe,
],
providers: [],
})
export class TaggifyModule { }
|
zurfyx/angular-library-starter-kit
| 34
|
Angular 5 Library Starter Kit based on Angular-CLI
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
src/taggify.pipe.spec.ts
|
TypeScript
|
import { TaggifyPipe } from './taggify.pipe';
describe('TaggifyPipe', () => {
let pipe;
beforeEach(() => {
pipe = new TaggifyPipe();
});
it('should taggify a "hey there"', () => {
expect(pipe.transform('hey there')).toBe('<hey there>');
});
it('should not taggify "<hey there>"', () => {
expect(pipe.transform('<hey there>')).toBe('<hey there>');
});
it('should not taggify "" or null', () => {
expect(pipe.transform(null)).toBe('');
expect(pipe.transform('')).toBe('');
});
});
|
zurfyx/angular-library-starter-kit
| 34
|
Angular 5 Library Starter Kit based on Angular-CLI
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
src/taggify.pipe.ts
|
TypeScript
|
import { Pipe, PipeTransform } from '@angular/core';
/**
* Wrap between <>
*
* Usage:
* {{str | taggify}}
*
* Rules:
* An empty or null string will never be taggified.
* A taggified string won't be taggified again.
* All other string values will be taggified.
*/
@Pipe({
name: 'taggify'
})
export class TaggifyPipe implements PipeTransform {
transform(value: string, ...args: any[]): any {
if (!value) {
return '';
}
if (value.startsWith('<') && value.endsWith('>')) {
return value;
}
return `<${value}>`;
}
}
|
zurfyx/angular-library-starter-kit
| 34
|
Angular 5 Library Starter Kit based on Angular-CLI
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
build.sh
|
Shell
|
#!/bin/bash
mvn clean package
|
zurfyx/cassandra-hadoop-example
| 3
|
Cassandra Hadoop Example
|
Java
|
zurfyx
|
Gerard Rovira
|
facebook
|
src/main/java/main/WordCountCassandra.java
|
Java
|
package main;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.*;
import org.apache.cassandra.hadoop.ConfigHelper;
import org.apache.cassandra.hadoop.cql3.CqlConfigHelper;
import org.apache.cassandra.hadoop.cql3.CqlOutputFormat;
import org.apache.cassandra.hadoop.cql3.CqlPagingInputFormat;
import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.log4j.BasicConfigurator;
public class WordCountCassandra {
public static class TokenizerMapper
extends Mapper<Map<String, ByteBuffer>, Map<String, ByteBuffer>, Text, IntWritable> {
private final static IntWritable one = new IntWritable(1);
private Text word = new Text();
public void map(Map<String, ByteBuffer> keys, Map<String, ByteBuffer> columns, Context context
) throws IOException, InterruptedException {
ByteBuffer agentBytes = columns.get("agent");
String agent = agentBytes == null ? "-" : ByteBufferUtil.string(agentBytes);
word.set(agent);
context.write(word, one);
}
}
public static class IntSumReducer
extends Reducer<Text, IntWritable, Map<String, ByteBuffer>, List<ByteBuffer>> {
private IntWritable result = new IntWritable();
public void reduce(Text key, Iterable<IntWritable> values,
Context context
) throws IOException, InterruptedException {
int sum = 0;
for (IntWritable val : values) {
sum += val.get();
}
result.set(sum);
Map<String, ByteBuffer> keys = new LinkedHashMap<String, ByteBuffer>();
keys.put("name", ByteBufferUtil.bytes(key.toString()));
List<ByteBuffer> variables = new ArrayList<ByteBuffer>();
variables.add(ByteBufferUtil.bytes(sum));
context.write(keys, variables);
}
}
public static void main(String[] args) throws Exception {
BasicConfigurator.configure();
Configuration conf = new Configuration();
Job job = Job.getInstance(conf, "word count cassandra");
job.setJarByClass(WordCountCassandra.class);
job.setMapperClass(TokenizerMapper.class);
job.setReducerClass(IntSumReducer.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);
ConfigHelper.setInputInitialAddress(job.getConfiguration(), "206.189.16.183");
ConfigHelper.setInputColumnFamily(job.getConfiguration(), "nyao", "visitors");
ConfigHelper.setInputPartitioner(job.getConfiguration(), "Murmur3Partitioner");
CqlConfigHelper.setInputCQLPageRowSize(job.getConfiguration(), "200");
job.setInputFormatClass(CqlPagingInputFormat.class);
job.setOutputFormatClass(CqlOutputFormat.class);
ConfigHelper.setOutputColumnFamily(job.getConfiguration(), "nyao", "count");
String query = "UPDATE count SET msg = ?";
CqlConfigHelper.setOutputCql(job.getConfiguration(), query);
ConfigHelper.setOutputInitialAddress(job.getConfiguration(), "206.189.16.183");
ConfigHelper.setOutputPartitioner(job.getConfiguration(), "Murmur3Partitioner");
System.exit(job.waitForCompletion(true) ? 0 : 1);
}
}
|
zurfyx/cassandra-hadoop-example
| 3
|
Cassandra Hadoop Example
|
Java
|
zurfyx
|
Gerard Rovira
|
facebook
|
ffmpeg-tv.py
|
Python
|
#!/usr/bin/env python
#
# --------------------------------------------------------------------------------------------------
# == FFMPEG TV STANDARDS ==
# UPDATED FOR 2016 STANDARDS https://scenerules.org/t.html?id=tvx2642k16.nfo
# Author: zurfyx (https://stackoverflow.com/users/2013580/zurfyx)
# Special thanks to: slhck (https://superuser.com/users/48078/slhck)
# https://superuser.com/questions/582198/how-can-i-get-high-quality-low-size-mp4s-like-the-lol-release-group
# --------------------------------------------------------------------------------------------------
#
# Example usages:
# ./ffmpeg-tv.py input.flv output.mkv
# (Resize to HD) ./ffmpeg-tv.py input.mp4 output.mkv --scale "1920:1080"
import argparse
import subprocess
class Default:
# 1.3) Providers which downscale 1080i to 720p (e.g. BellTV) are not allowed.
# 5.10) Resized video must be within 0.5% of the original aspect ratio.
scale="-1:-1" # <width>:<height>; -1 maintain ratio.
# 4.1) Video must be H.264/MPEG-4 AVC encoded with x264 8-bit.
video_encoder="libx264"
# 4.4) Constant Rate Factor (--crf) must be used.
# 4.4.1) CRF values below 18 and above 23 are never allowed.
# http://slhck.info/video/2017/02/24/crf-guide.html
# (lossless) 0 <- (better) 23 <- (worst) 51
# ┌─────────────────┬───────┬───────────────────────────────────────────┐
# │ Compressibility │ CRF │ General Examples │
# ├─────────────────┼───────┼───────────────────────────────────────────┤
# │ High │ 18-19 │ Scripted, Talk Shows, Animation, Stand-Up │
# │ Medium │ 20-21 │ Documentary, Reality, Variety, Poker │
# │ Low │ 22-23 │ Sports, Awards, Live Events │
# └─────────────────┴───────┴───────────────────────────────────────────┘
crf="19"
# 4.6) Settings cannot go below what is specified by preset (--preset) 'slow'.
preset="slow"
# 4.7) Level (--level) must be '4.1'.
level="4.1"
# 6.4) Only sharp resizers, such as Spline36Resize, BlackmanResize or LanczosResize/Lanczos4Resize,
# must be used.
# 6.4.1) Simple resizers, such as Bicubic, PointResize or Simple, are not allowed.
resizer="lanczos"
# 4.17) Optional tuning (--tune) parameters allowed are: 'film', 'grain' or 'animation'.
# https://superuser.com/questions/564402/explanation-of-x264-tune
# film – intended for high-bitrate/high-quality movie content. Lower deblocking is used here.
tune="film"
# 8.1) Audio must be in the original format provided.
# 8.1.1) Transcoding audio is not allowed.
# 8.2) Multiple language audio tracks are allowed.
# Since we cannot ensure that the external content is in an acceptable TV format, we'll recode
# it into aac. We're just playing safe here.
#
# FFmpeg supports two AAC-LC encoders (aac and libfdk_aac) and one HE-AAC (v1/2) encoder
# (libfdk_aac). The license of libfdk_aac is not compatible with GPL, so the GPL does not permit
# distribution of binaries containing incompatible code when GPL-licensed code is also included.
# libfdk_aac is "non-free", and requires ffmpeg to be compiled manually.
# Second best encoder is the native FFmpeg AAC encoder. (aac)
audio_encoder="aac"
# Audio quality (bit rate).
# Use either VBR or CBR. VBR is the easiest.
# https://trac.ffmpeg.org/wiki/Encode/AAC#fdk_vbr
# VBR: Target a quality, rather than a specific bit rate. 1 is lowest quality and 5 is highest
# quality.
# https://trac.ffmpeg.org/wiki/Encode/AAC#fdk_cbr
# http://wiki.hydrogenaud.io/index.php?title=Fraunhofer_FDK_AAC#Bitrate_Modes
# CBR: kbps
vbr="5"
cbr=None
# 8.2) Multiple language audio tracks are allowed.
# 8.2.1) The default audio track must be the language intended for release (e.g. An English release
# containing English, German and Russian audio tracks, must have the default flag set on the English
# track).
# https://trac.ffmpeg.org/wiki/Map
# Include "all" inputs to the output: -map 0
map="0"
# Sample (encode few seconds only).
time_start=None # Seconds (i.e. 30) or timestamp (i.e. 00:00:30.0).
time_duration=None # Seconds
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description='FFmpeg TV.',
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)
parser.add_argument('input', type=str, help='input video'),
parser.add_argument('output', type=str, help='output video'),
parser.add_argument('-s', '--scale', type=str, default=Default.scale, help='scale', metavar='')
parser.add_argument('-ve', '--video-encoder', type=str, default=Default.video_encoder, help='video encoder', metavar='')
parser.add_argument('-c', '--crf', type=str, default=Default.crf, help='constant rate factor (crf)', metavar='')
parser.add_argument('-p', '--preset', type=str, default=Default.preset, help='preset', metavar='')
parser.add_argument('-l', '--level', type=str, default=Default.level, help='level', metavar='')
parser.add_argument('-r', '--resizer', type=str, default=Default.resizer, help='resizer', metavar='')
parser.add_argument('-t', '--tune', type=str, default=Default.tune, help='tune', metavar='')
parser.add_argument('-ae', '--audio-encoder', type=str, default=Default.audio_encoder, help='audio encoder', metavar='')
parser.add_argument('-vb', '--vbr', type=str, default=Default.vbr, help='variable bitrate (vbr)', metavar='')
parser.add_argument('-cb', '--cbr', type=str, default=Default.cbr, help='constant bitrate (cbr)', metavar='')
parser.add_argument('-m', '--map', type=str, default=Default.map, help='map', metavar='')
parser.add_argument('-ts', '--time-start', type=str, default=Default.time_start, help='time start', metavar='')
parser.add_argument('-td', '--time-duration', type=str, default=Default.time_duration, help='time duration', metavar='')
parser.add_argument('-pp', '--params', type=str, default=None, help='your custom ffmpeg params', metavar='')
args = parser.parse_args()
ffmpeg_query = ['ffmpeg']
ffmpeg_query += ['-i', args.input]
if (args.scale):
ffmpeg_query += ['-filter:v', 'scale=%s' % args.scale]
if (args.video_encoder):
ffmpeg_query += ['-c:v', args.video_encoder]
if (args.crf):
ffmpeg_query += ['-crf', args.crf]
if (args.preset):
ffmpeg_query += ['-preset', args.preset]
if (args.level):
ffmpeg_query += ['-level', args.level]
if (args.resizer):
ffmpeg_query += ['-sws_flags', args.resizer]
if (args.tune):
ffmpeg_query += ['-tune', args.tune]
if (args.audio_encoder):
ffmpeg_query += ['-c:a', args.audio_encoder]
if (args.vbr):
ffmpeg_query += ['-vbr', args.vbr]
if (args.cbr):
ffmpeg_query += ['-b:a', args.cbr]
if (args.map):
ffmpeg_query += ['-map', args.map]
if (args.time_start):
ffmpeg_query += ['-ss', args.time_start]
if (args.time_duration):
ffmpeg_query += ['-t', args.time_duration]
if (args.params):
ffmpeg_query += args.params.split(' ')
ffmpeg_query += [args.output]
print('> ' + ' '.join(ffmpeg_query))
subprocess.call(ffmpeg_query)
|
zurfyx/ffmpeg-tv
| 15
|
TV video encoding without hassle.
|
Python
|
zurfyx
|
Gerard Rovira
|
facebook
|
api/index.js
|
JavaScript
|
const express = require('express');
const cors = require('cors');
var app = express();
app.use(cors());
app.use('/', (req, res) => {
const now = Date.now();
setTimeout(() => {
res.send(String(now));
}, 15e3);
});
app.listen(3000, () => console.info('Running on port 3000'));
|
zurfyx/rxjs-unsubscribe
| 1
|
Always unsubscribe your RxJS calls
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
e2e/protractor.conf.js
|
JavaScript
|
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.e2e.json')
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};
|
zurfyx/rxjs-unsubscribe
| 1
|
Always unsubscribe your RxJS calls
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
e2e/src/app.e2e-spec.ts
|
TypeScript
|
import { AppPage } from './app.po';
describe('workspace-project App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
});
it('should display welcome message', () => {
page.navigateTo();
expect(page.getTitleText()).toEqual('Welcome to rxjs-unsubscribe!');
});
});
|
zurfyx/rxjs-unsubscribe
| 1
|
Always unsubscribe your RxJS calls
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
e2e/src/app.po.ts
|
TypeScript
|
import { browser, by, element } from 'protractor';
export class AppPage {
navigateTo() {
return browser.get('/');
}
getTitleText() {
return element(by.css('app-root h1')).getText();
}
}
|
zurfyx/rxjs-unsubscribe
| 1
|
Always unsubscribe your RxJS calls
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
src/app/app.component.html
|
HTML
|
{{ title }}
<button (click)="isFoo = !isFoo">toggle</button>
<app-foo *ngIf="isFoo"></app-foo>
<app-bar *ngIf="!isFoo"></app-bar>
|
zurfyx/rxjs-unsubscribe
| 1
|
Always unsubscribe your RxJS calls
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
src/app/app.component.spec.ts
|
TypeScript
|
import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
AppComponent
],
}).compileComponents();
}));
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
});
it(`should have as title 'rxjs-unsubscribe'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('rxjs-unsubscribe');
});
it('should render title in a h1 tag', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('Welcome to rxjs-unsubscribe!');
});
});
|
zurfyx/rxjs-unsubscribe
| 1
|
Always unsubscribe your RxJS calls
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
src/app/app.component.ts
|
TypeScript
|
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'rxjs-unsubscribe';
}
|
zurfyx/rxjs-unsubscribe
| 1
|
Always unsubscribe your RxJS calls
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
src/app/app.module.ts
|
TypeScript
|
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { AppComponent } from './app.component';
import { FooComponent } from './foo.component';
import { BarComponent } from './bar.component';
@NgModule({
declarations: [
AppComponent,
FooComponent,
BarComponent,
],
imports: [
BrowserModule,
HttpClientModule,
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
|
zurfyx/rxjs-unsubscribe
| 1
|
Always unsubscribe your RxJS calls
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
src/app/bar.component.html
|
HTML
|
foo component
|
zurfyx/rxjs-unsubscribe
| 1
|
Always unsubscribe your RxJS calls
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
src/app/bar.component.ts
|
TypeScript
|
import { Component, OnInit, OnDestroy } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
@Component({
selector: 'app-bar',
templateUrl: 'bar.component.html'
})
export class BarComponent implements OnInit, OnDestroy {
subject = new Subject<void>();
constructor(private http: HttpClient) {}
ngOnInit() {
console.info('[Bar] Loaded');
this.http.get('//localhost:3000').subscribe((val) => {
console.info(`[Bar-bad] Response: ${val}`);
});
this.http.get('//localhost:3000').pipe(
takeUntil(this.subject),
).subscribe((val) => {
console.info(`[Bar-good] Response: ${val}`);
});
}
ngOnDestroy() {
console.info('[Bar] Destroyed');
this.subject.next();
this.subject.complete();
}
}
|
zurfyx/rxjs-unsubscribe
| 1
|
Always unsubscribe your RxJS calls
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
src/app/foo.component.html
|
HTML
|
bar component
|
zurfyx/rxjs-unsubscribe
| 1
|
Always unsubscribe your RxJS calls
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
src/app/foo.component.ts
|
TypeScript
|
import { Component, OnInit, OnDestroy } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
@Component({
selector: 'app-foo',
templateUrl: 'foo.component.html'
})
export class FooComponent implements OnInit, OnDestroy {
subject = new Subject<void>();
constructor(private http: HttpClient) {}
ngOnInit() {
console.info('[Foo] Loaded');
this.http.get('//localhost:3000').subscribe((val) => {
console.info(`[Foo-bad] Response: ${val}`);
});
this.http.get('//localhost:3000').pipe(
takeUntil(this.subject),
).subscribe((val) => {
console.info(`[Foo-good] Response: ${val}`);
});
}
ngOnDestroy() {
console.info('[Foo] Destroyed');
this.subject.next();
this.subject.complete();
}
}
|
zurfyx/rxjs-unsubscribe
| 1
|
Always unsubscribe your RxJS calls
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
src/environments/environment.prod.ts
|
TypeScript
|
export const environment = {
production: true
};
|
zurfyx/rxjs-unsubscribe
| 1
|
Always unsubscribe your RxJS calls
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
src/environments/environment.ts
|
TypeScript
|
// This file can be replaced during build by using the `fileReplacements` array.
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
};
/*
* For easier debugging in development mode, you can import the following file
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
*
* This import should be commented out in production mode because it will have a negative impact
* on performance if an error is thrown.
*/
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
|
zurfyx/rxjs-unsubscribe
| 1
|
Always unsubscribe your RxJS calls
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
src/index.html
|
HTML
|
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>RxjsUnsubscribe</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
</html>
|
zurfyx/rxjs-unsubscribe
| 1
|
Always unsubscribe your RxJS calls
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
src/karma.conf.js
|
JavaScript
|
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../coverage'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};
|
zurfyx/rxjs-unsubscribe
| 1
|
Always unsubscribe your RxJS calls
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
src/main.ts
|
TypeScript
|
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));
|
zurfyx/rxjs-unsubscribe
| 1
|
Always unsubscribe your RxJS calls
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
src/polyfills.ts
|
TypeScript
|
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
*
* This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file.
*
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
*
* Learn more in https://angular.io/guide/browser-support
*/
/***************************************************************************************************
* BROWSER POLYFILLS
*/
/** IE9, IE10, IE11, and Chrome <55 requires all of the following polyfills.
* This also includes Android Emulators with older versions of Chrome and Google Search/Googlebot
*/
// import 'core-js/es6/symbol';
// import 'core-js/es6/object';
// import 'core-js/es6/function';
// import 'core-js/es6/parse-int';
// import 'core-js/es6/parse-float';
// import 'core-js/es6/number';
// import 'core-js/es6/math';
// import 'core-js/es6/string';
// import 'core-js/es6/date';
// import 'core-js/es6/array';
// import 'core-js/es6/regexp';
// import 'core-js/es6/map';
// import 'core-js/es6/weak-map';
// import 'core-js/es6/set';
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`.
/** IE10 and IE11 requires the following for the Reflect API. */
// import 'core-js/es6/reflect';
/**
* Web Animations `@angular/platform-browser/animations`
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
*/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/**
* By default, zone.js will patch all possible macroTask and DomEvents
* user can disable parts of macroTask/DomEvents patch by setting following flags
* because those flags need to be set before `zone.js` being loaded, and webpack
* will put import in the top of bundle, so user need to create a separate file
* in this directory (for example: zone-flags.ts), and put the following flags
* into that file, and then add the following code before importing zone.js.
* import './zone-flags.ts';
*
* The flags allowed in zone-flags.ts are listed here.
*
* The following flags will work for all browsers.
*
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
* (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
*
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
* with the following flag, it will bypass `zone.js` patch for IE/Edge
*
* (window as any).__Zone_enable_cross_context_check = true;
*
*/
/***************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js/dist/zone'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
*/
|
zurfyx/rxjs-unsubscribe
| 1
|
Always unsubscribe your RxJS calls
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
src/styles.css
|
CSS
|
/* You can add global styles to this file, and also import other style files */
|
zurfyx/rxjs-unsubscribe
| 1
|
Always unsubscribe your RxJS calls
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
src/test.ts
|
TypeScript
|
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: any;
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);
|
zurfyx/rxjs-unsubscribe
| 1
|
Always unsubscribe your RxJS calls
|
TypeScript
|
zurfyx
|
Gerard Rovira
|
facebook
|
app/build.gradle
|
Gradle
|
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.zurfyx.travisandroid"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary= true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-vector-drawable:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
|
zurfyx/travis-android
| 2
|
Android Travis CI with Autodeploy (API 26+)
|
Java
|
zurfyx
|
Gerard Rovira
|
facebook
|
app/src/androidTest/java/com/zurfyx/travisandroid/ExampleInstrumentedTest.java
|
Java
|
package com.zurfyx.travisandroid;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.zurfyx.travisandroid", appContext.getPackageName());
}
}
|
zurfyx/travis-android
| 2
|
Android Travis CI with Autodeploy (API 26+)
|
Java
|
zurfyx
|
Gerard Rovira
|
facebook
|
app/src/main/java/com/zurfyx/travisandroid/MainActivity.java
|
Java
|
package com.zurfyx.travisandroid;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomNavigationView;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
private TextView mTextMessage;
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
= new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.navigation_home:
mTextMessage.setText(R.string.title_home);
return true;
case R.id.navigation_dashboard:
mTextMessage.setText(R.string.title_dashboard);
return true;
case R.id.navigation_notifications:
mTextMessage.setText(R.string.title_notifications);
return true;
}
return false;
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mTextMessage = (TextView) findViewById(R.id.message);
BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
}
}
|
zurfyx/travis-android
| 2
|
Android Travis CI with Autodeploy (API 26+)
|
Java
|
zurfyx
|
Gerard Rovira
|
facebook
|
app/src/test/java/com/zurfyx/travisandroid/ExampleUnitTest.java
|
Java
|
package com.zurfyx.travisandroid;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
|
zurfyx/travis-android
| 2
|
Android Travis CI with Autodeploy (API 26+)
|
Java
|
zurfyx
|
Gerard Rovira
|
facebook
|
build.gradle
|
Gradle
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
|
zurfyx/travis-android
| 2
|
Android Travis CI with Autodeploy (API 26+)
|
Java
|
zurfyx
|
Gerard Rovira
|
facebook
|
scripts/tag.sh
|
Shell
|
# Tag last commit as 'latest'.
if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then
git config --global user.email "hi@travis-ci.org"
git config --global user.name "Sr. Travis"
git remote add release "https://${GH_TOKEN}@github.com/zurfyx/travis-android.git"
git push -d release latest
git tag -d latest
git tag -a "latest" -m "[Autogenerated] This is the latest version pushed to the master branch."
git push release --tags
fi
|
zurfyx/travis-android
| 2
|
Android Travis CI with Autodeploy (API 26+)
|
Java
|
zurfyx
|
Gerard Rovira
|
facebook
|
settings.gradle
|
Gradle
|
include ':app'
|
zurfyx/travis-android
| 2
|
Android Travis CI with Autodeploy (API 26+)
|
Java
|
zurfyx
|
Gerard Rovira
|
facebook
|
lib/index.js
|
JavaScript
|
/* eslint-disable no-param-reassign */
/* eslint-disable no-bitwise */
/* eslint-disable class-methods-use-this */
const fs = require('fs').promises;
const EventEmitter = require('events');
const whilst = require('async/whilst');
const HID = require('node-hid');
const intelhex = require('intel-hex');
function isBootloadHID(device) {
return (device.vendorId === 0x16c0 && device.productId === 1503);
}
class BootloadHID extends EventEmitter {
constructor(opts) {
super();
opts = opts || {};
this.manualReset = !!opts.manualReset;
this.debug = opts.debug || false;
this.path = opts.port || null;
if (this.debug) {
const debugFunc = (typeof this.debug === 'function') ? this.debug : console.log;
this.on('connected', (device) => { debugFunc(`connected to bootloader at ${device.path}`); });
this.on('flash:start', () => { debugFunc('flashing, please wait...'); });
// this.on("flash:progress", () => { debugFunc('.'); });
this.on('flash:done', () => { debugFunc('flash complete'); });
}
}
pathFilter(path) {
// also match the path if we have no filter
return !this.path || (this.path === path);
}
async loadHex(file) {
const data = await fs.readFile(file);
const hex = intelhex.parse(data).data;
return {
hex,
startAddr: 0,
endAddr: hex.length,
};
}
async getBoard() {
const info = HID.devices().find(dev => isBootloadHID(dev) && this.pathFilter(dev.path));
if (!info) {
throw new Error('The specified device was not found');
}
const device = new HID.HID(info.path);
device.path = info.path;
this.emit('connected', device);
return device;
}
getBoardInfo(device) {
const buf = Buffer.from(device.getFeatureReport(1, 8));
return {
pageSize: buf.readUIntLE(1, 2),
deviceSize: buf.readUIntLE(3, 4),
};
}
rebootBoard(device) {
return device.sendFeatureReport([0x01, 0x80, 0x48, 0x00, 0x09, 0x09, 0x0f]);
}
async programBoard(device, hex, pageSize, deviceSize, startAddr, endAddr) {
if (endAddr > deviceSize - 2048) {
throw new Error(`Data (${endAddr} bytes) exceeds remaining flash size!`);
}
let mask = 0;
if (pageSize < 128) {
mask = 127;
} else {
mask = pageSize - 1;
}
startAddr &= ~mask; /* round down */
endAddr = (endAddr + mask) & ~mask; /* round up */
this.emit('flash:start', device, startAddr, endAddr, pageSize, deviceSize);
await whilst(cb => cb(null, (startAddr < endAddr)), async () => {
// the following fails as it does not pad partially filled buffers with 0xff
// const slice = hex.slice(startAddr, startAddr + 128);
const slice = Buffer.alloc(128, 0xff);
hex.copy(slice, 0, startAddr, startAddr + 128);
const pre = Buffer.from([0x02, startAddr & 0xff, startAddr >> 8, 0x00]);
const final = Buffer.concat([pre, slice]);
this.emit('flash:progress', device, startAddr, startAddr + slice.length);
device.sendFeatureReport([...final]);
startAddr += slice.length;
});
this.emit('flash:done', device);
}
async flash(file, callback = (() => { })) {
let device;
try {
device = await this.getBoard();
const { hex, startAddr, endAddr } = await this.loadHex(file);
const { pageSize, deviceSize } = this.getBoardInfo(device);
await this.programBoard(device, hex, pageSize, deviceSize, startAddr, endAddr);
if (!this.manualReset) {
this.rebootBoard(device);
}
callback();
} catch (e) {
callback(e);
} finally {
if (device) {
device.close();
}
}
}
static list(callback) {
let deviceInfo;
try {
deviceInfo = HID.devices().filter(isBootloadHID);
} catch (e) {
callback(e);
}
// call outside try/catch to propagate callback throws
callback(undefined, deviceInfo);
}
}
module.exports = BootloadHID;
|
zvecr/bootload-hid
| 0
|
Library for flashing BootloadHID devices
|
JavaScript
|
zvecr
|
Joel Challis
| |
test/test.js
|
JavaScript
|
/* eslint-disable max-len */
/* eslint-env mocha */
const chai = require('chai');
const sinon = require('sinon');
const mockery = require('mockery');
const EventEmitter = require('events');
const DUMMY_HEX = `:100000000C9420030C9464030C947F030C946403FD
:100010000C9464030C9464030C9464030C946403C4
:100020000C9464030C9464030C945A1F0C946403A2
:100030000C9464030C9464030C9464030C946403A4
:100040000C9464030C9464030C9464030C94640394
:100050000C946403620764076F07660768076A0702
:100060006C076E07710773077507800777077907B5
:100070007B077D077F07820783158315B515B515A7
:10008000F5154D174D174D1713164D17AC16AC1629
:100090001C1725174D174617B916B916B916B916F4
:00000001FF`;
const BLOCK_1 = [2, 0, 0, 0, 12, 148, 32, 3, 12, 148, 100, 3, 12, 148, 127, 3, 12, 148, 100, 3, 12, 148, 100, 3, 12, 148, 100, 3, 12, 148, 100, 3, 12, 148, 100, 3, 12, 148, 100, 3, 12, 148, 100, 3, 12, 148, 90, 31, 12, 148, 100, 3, 12, 148, 100, 3, 12, 148, 100, 3, 12, 148, 100, 3, 12, 148, 100, 3, 12, 148, 100, 3, 12, 148, 100, 3, 12, 148, 100, 3, 12, 148, 100, 3, 12, 148, 100, 3, 98, 7, 100, 7, 111, 7, 102, 7, 104, 7, 106, 7, 108, 7, 110, 7, 113, 7, 115, 7, 117, 7, 128, 7, 119, 7, 121, 7, 123, 7, 125, 7, 127, 7, 130, 7, 131, 21, 131, 21, 181, 21, 181, 21];
const BLOCK_2 = [2, 128, 0, 0, 245, 21, 77, 23, 77, 23, 77, 23, 19, 22, 77, 23, 172, 22, 172, 22, 28, 23, 37, 23, 77, 23, 70, 23, 185, 22, 185, 22, 185, 22, 185, 22, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255];
const BLOCK_REBOOT = [0x01, 0x80, 0x48, 0x00, 0x09, 0x09, 0x0f];
const mockFs = {
promises: {
readFile: sinon.stub(),
},
};
mockery.registerMock('fs', mockFs);
class DummyHID extends EventEmitter {
}
DummyHID.prototype.close = sinon.spy();
DummyHID.prototype.getFeatureReport = sinon.stub();
DummyHID.prototype.sendFeatureReport = sinon.stub();
const mockNodeHID = {
devices: sinon.stub(),
HID: DummyHID,
};
mockery.registerMock('node-hid', mockNodeHID);
mockery.enable({
warnOnUnregistered: false,
});
const BootloadHID = require('../lib/index');
chai.should();
describe('BootloadHID EventEmitter', () => {
beforeEach(() => {
this.mod = new BootloadHID({ manualReset: true });
mockFs.promises.readFile.returns(Buffer.from(DUMMY_HEX));
mockNodeHID.devices.returns([{ vendorId: 0x16c0, productId: 1503, path: '/tmp/hidraw1' }]);
DummyHID.prototype.getFeatureReport.returns(Buffer.of(1, 0x80, 0, 0, 0x80, 0, 0, 0));
});
afterEach(() => {
DummyHID.prototype.getFeatureReport.reset();
DummyHID.prototype.sendFeatureReport.reset();
sinon.restore();
});
it('should flash a BootloadHID device', (done) => {
this.mod.flash('asdf.hex', (err) => {
DummyHID.prototype.sendFeatureReport.callCount.should.be.eq(2);
sinon.assert.calledWithExactly(DummyHID.prototype.sendFeatureReport.getCall(0), BLOCK_1);
sinon.assert.calledWithExactly(DummyHID.prototype.sendFeatureReport.getCall(1), BLOCK_2);
done(err);
});
});
it('should reboot a BootloadHID device once finished', (done) => {
this.mod = new BootloadHID({ manualReset: false });
this.mod.flash('asdf.hex', (err) => {
DummyHID.prototype.sendFeatureReport.callCount.should.be.eq(3);
sinon.assert.calledWithExactly(DummyHID.prototype.sendFeatureReport.getCall(2), BLOCK_REBOOT);
done(err);
});
});
it('should support custom debuging functions', async () => {
const logger = sinon.stub();
this.mod = new BootloadHID({ debug: logger });
await this.mod.flash('asdf.hex');
logger.callCount.should.be.greaterThan(0);
});
it('should propogate flashing events', async () => {
const connect = sinon.stub();
const start = sinon.stub();
const progress = sinon.stub();
const finished = sinon.stub();
this.mod.on('connected', connect);
this.mod.on('flash:start', start);
this.mod.on('flash:progress', progress);
this.mod.on('flash:done', finished);
await this.mod.flash('asdf.hex');
connect.callCount.should.be.eq(1);
start.callCount.should.be.eq(1);
progress.callCount.should.be.eq(2);
finished.callCount.should.be.eq(1);
});
it('should not flash a non BootloadHID device', (done) => {
mockNodeHID.devices.returns([{ vendorId: 0x0002, productId: 0x03, path: '/tmp/hidraw3' }]);
this.mod.flash('asdf.hex', (err) => {
if (!err) {
done('flashed wrong device');
} else {
done();
}
});
});
it('should not flash an oversized file', (done) => {
DummyHID.prototype.getFeatureReport.returns(Buffer.of(1, 0x80, 0, 0x50, 0x8, 0, 0, 0));
this.mod.flash('asdf.hex', (err) => {
if (!err) {
done('flashed oversized file');
} else {
done();
}
});
});
it('should propogate file open errors', (done) => {
mockFs.promises.readFile.throws();
this.mod.flash('asdf.hex', (err) => {
if (!err) {
done('error expected');
} else {
done();
}
});
});
it('should propogate device open errors');
it('should propogate device read errors', (done) => {
DummyHID.prototype.getFeatureReport.throws();
this.mod.flash('asdf.hex', (err) => {
if (!err) {
done('error expected');
} else {
done();
}
});
});
it('should propogate device write errors', (done) => {
DummyHID.prototype.sendFeatureReport.throws();
this.mod.flash('asdf.hex', (err) => {
if (!err) {
done('error expected');
} else {
done();
}
});
});
it('should list available devices', (done) => {
mockNodeHID.devices.returns([
{ vendorId: 0x16c0, productId: 1503, path: '/tmp/hidraw1' },
{ vendorId: 0x16c0, productId: 1503, path: '/tmp/hidraw2' },
{ vendorId: 0x0002, productId: 0x03, path: '/tmp/hidraw3' },
]);
BootloadHID.list((err, devices) => {
devices.should.have.lengthOf(2);
devices[0].should.have.property('path', '/tmp/hidraw1');
devices[0].should.have.property('productId', 1503);
devices[0].should.have.property('vendorId', 5824);
devices[1].should.have.property('path', '/tmp/hidraw2');
devices[1].should.have.property('productId', 1503);
devices[1].should.have.property('vendorId', 5824);
done(err);
});
});
});
|
zvecr/bootload-hid
| 0
|
Library for flashing BootloadHID devices
|
JavaScript
|
zvecr
|
Joel Challis
| |
src/index.js
|
JavaScript
|
const { Command, flags } = require('@oclif/command');
const BootloadHID = require('bootload-hid');
class BootloadHIDCli extends Command {
async run() {
const { args, flags: flagz } = this.parse(BootloadHIDCli);
const loader = new BootloadHID({
debug: false,
manualReset: !flagz.leaveBootLoader,
});
loader.on('flash:start', (dev, startAddr, endAddr, pageSize, deviceSize) => {
const totalData = endAddr - startAddr;
console.log(`Page size = ${pageSize} (0x${pageSize.toString(16)})`);
console.log(`Device size = ${deviceSize} (0x${deviceSize.toString(16)}); ${deviceSize - 2048} bytes remaining`);
console.log(`Uploading ${totalData} (0x${totalData.toString(16)}) bytes starting at ${startAddr} (0x${startAddr.toString(16)})`);
});
loader.on('flash:progress', (dev, startAddr, endAddr) => {
console.log(`0x${startAddr.toString(16)} ... 0x${endAddr.toString(16)}`);
});
// GO....
loader.flash(args.file, (error) => {
if (error) {
console.error(error.message);
}
});
}
}
BootloadHIDCli.description = `Utility for flashing BootloadHID devices
...
BootloadHID is a USB boot loader for AVR microcontrollers.
The uploader tool requires no kernel level driver on Windows and can therefore be run without installing any DLLs.
`;
BootloadHIDCli.flags = {
// add --version flag to show CLI version
version: flags.version({ char: 'v' }),
// add --help flag to show CLI version
help: flags.help({ char: 'h' }),
// app specific flags
leaveBootLoader: flags.boolean({
char: 'r',
description: 'reboot device once flashing has finished',
}),
};
BootloadHIDCli.args = [
{
name: 'file',
required: true,
description: 'intel format hex file',
},
];
module.exports = BootloadHIDCli;
|
zvecr/bootload-hid-cli
| 0
|
Utility for flashing BootloadHID devices
|
JavaScript
|
zvecr
|
Joel Challis
| |
test/test.js
|
JavaScript
|
/* eslint-env mocha */
const { expect, test } = require('@oclif/test');
const mockery = require('mockery');
const EventEmitter = require('events');
const ee = new EventEmitter();
class DummyBoot {
constructor(...args) {
ee.args = args;
return ee;
}
}
ee.flash = () => {};
mockery.registerMock('bootload-hid', DummyBoot);
mockery.enable({
warnOnUnregistered: false,
});
const cmd = require('..');
const conf = require('../package.json');
describe('bootloadHID', () => {
beforeEach(() => {
// reset test state
ee.args = undefined;
ee.flash = () => {};
});
test
.stdout()
.do(() => cmd.run(['--version']))
.catch('EEXIT: 0')
.it('prints version', (ctx) => {
expect(ctx.stdout).to.contain(`bootload-hid-cli/${conf.version}`);
});
test
.stdout()
.do(() => cmd.run(['--help']))
.catch('EEXIT: 0')
.it('prints help', (ctx) => {
expect(ctx.stdout).to.contain('USAGE');
});
test
.stdout()
.do(() => cmd.run(['-r', 'asdf.hex']))
.it('reboots device', () => {
expect(ee.args[0].manualReset).to.eq(false);
});
test
.stdout()
.do(() => cmd.run(['asdf.hex']))
.do(() => ee.emit('flash:progress', null, 0, 128))
.it('provides flashing progress', (ctx) => {
expect(ee.args[0].manualReset).to.eq(true);
expect(ctx.stdout).to.contain('0x0 ... 0x80');
});
test
.stderr()
.do(() => { ee.flash = (file, cb) => { cb(new Error('This is some flashing error')); }; })
.do(() => cmd.run(['asdf.hex']))
.it('warns user of flashing errors', (ctx) => {
expect(ctx.stderr).to.contain('This is some flashing error');
});
});
|
zvecr/bootload-hid-cli
| 0
|
Utility for flashing BootloadHID devices
|
JavaScript
|
zvecr
|
Joel Challis
| |
lib/index.js
|
JavaScript
|
/* eslint-disable no-underscore-dangle */
/* eslint-disable prefer-destructuring */
/* eslint-disable no-param-reassign */
/* eslint-disable no-bitwise */
const fs = require('fs');
const path = require('path');
const EventEmitter = require('events');
const whilst = require('async/whilst');
const HID = require('node-hid');
const streamBuffers = require('stream-buffers');
const byline = require('byline');
const { SmartBuffer } = require('smart-buffer');
// Patch linux for its missing usagePage
HID.devices = new Proxy(HID.devices, {
apply(target, ctx, args) {
const devices = target.apply(ctx, args);
if (process.platform === 'linux') {
devices.forEach((d) => {
if (!d.usagePage || !d.usage) {
const hidraw = `/sys/class/hidraw/${path.basename(d.path)}/device/report_descriptor`;
if (fs.existsSync(hidraw)) {
const report = fs.readFileSync(hidraw);
d.usagePage = (report[2] << 8) + report[1];
d.usage = report[4];
}
}
});
}
return devices;
},
});
// Patch for HID.HID.read to use timeout to work round blocking reads and .close()
// not allowing the process to quit - https://github.com/node-hid/node-hid/issues/61
HID.HID = new Proxy(HID.HID, {
construct(Target, args) {
const ret = new Target(...args);
ret.read = function readUseTimeout(callback) {
try {
const data = this.readTimeout(1000);
setTimeout(() => {
callback(null, Buffer.from(data));
}, 0);
} catch (err) {
callback(err, null);
}
};
return ret;
},
});
function isRawHid(device) {
return (device.usagePage === 0xFF31 && device.usage === 0x0074);
}
function createLineBuffer() {
const buffer = new streamBuffers.ReadableStreamBuffer();
return [buffer, byline(buffer)];
}
class HIDListen extends EventEmitter {
constructor({ tick = 1000, delay = 25 } = {}) {
super();
this._tick = tick;
this.once('newListener', () => {
setTimeout(() => {
this.eventLoop();
}, delay);
});
}
removeAllListeners() {
this.emit('close');
super.removeAllListeners();
}
hasListeners() {
return this.eventNames().length > 0;
}
async eventLoop() {
whilst(cb => cb(null, this.hasListeners()), async () => {
const device = await this.search();
if (device) {
await this.listen(device);
}
});
}
async change() {
return new Promise((resolve) => {
setTimeout(() => {
resolve();
this.emit('tick');
}, this._tick);
});
}
async search() {
await this.change();
return new Promise((resolve) => {
const deviceInfo = HID.devices().find(isRawHid);
resolve(deviceInfo);
});
}
async listen(dev) {
return new Promise((resolve) => {
const device = new HID.HID(dev.path);
const [buffer, stream] = createLineBuffer();
stream.on('data', (data) => {
this.emit('data', data.toString(), device);
});
device.on('data', (data) => {
if (data && data.length) {
buffer.put(SmartBuffer.fromBuffer(data).readStringNT(), 'utf8');
}
});
device.on('error', () => {
this.emit('disconnect', device);
resolve();
});
this.once('close', () => device.close());
this.emit('connect', device);
});
}
}
module.exports = HIDListen;
|
zvecr/hid-listen
| 1
|
Library for acquiring debugging information from usb hid devices
|
JavaScript
|
zvecr
|
Joel Challis
| |
test/test.js
|
JavaScript
|
/* eslint-env mocha */
const chai = require('chai');
const sinon = require('sinon');
const mockery = require('mockery');
const EventEmitter = require('events');
const mockFs = {
existsSync: sinon.stub(),
readFileSync: sinon.stub(),
};
mockery.registerMock('fs', mockFs);
class DummyHID extends EventEmitter {
}
DummyHID.prototype.close = sinon.spy();
DummyHID.prototype.readTimeout = sinon.stub();
const mockNodeHID = {
devices: sinon.stub(),
HID: DummyHID,
};
mockery.registerMock('node-hid', mockNodeHID);
mockery.enable({
warnOnUnregistered: false,
});
sinon.stub(process, 'platform').returns('linux');
const HIDListen = require('../lib/index');
const should = chai.should();
describe('HIDListen EventEmitter', () => {
beforeEach(() => {
this.mod = new HIDListen({ tick: 50, delay: 10 });
mockFs.existsSync.returns(true);
mockFs.readFileSync.returns(Buffer.of());
mockNodeHID.devices.returns([{ usagePage: 0xFF31, usage: 0x0074, path: '/tmp/hidraw1' }]);
this.originalPlatform = process.platform;
});
afterEach(() => {
this.mod.removeAllListeners();
sinon.restore();
DummyHID.prototype.readTimeout.reset();
Object.defineProperty(process, 'platform', {
value: this.originalPlatform,
});
});
it('should not connect when no devices', (done) => {
mockNodeHID.devices.returns([]);
this.mod.on('connect', () => done(new Error('Connect should never be called')));
this.mod.on('tick', () => done());
});
it('should emit connection events', (done) => {
this.mod.on('connect', (device) => {
mockNodeHID.devices.returns([]);
device.emit('error');
});
this.mod.on('disconnect', () => done());
});
it('should emit multiple lines on node-hid data', (done) => {
const lines = [];
this.mod.on('connect', (device) => {
device.emit('data', Buffer.from('line1\nline2\n'));
});
this.mod.on('data', (data) => {
lines.push(data);
if (lines.length === 2) {
lines.should.be.eql(['line1', 'line2']);
done();
}
});
});
it('should patch in "missing device usage" on linux', (done) => {
Object.defineProperty(process, 'platform', {
value: 'linux',
});
mockNodeHID.devices.returns([{ path: '/tmp/hidraw1' }]);
mockFs.existsSync.returns(true);
mockFs.readFileSync.returns(Buffer.of(0x00, 0x31, 0xFF, 0x00, 0x74, 0x00));
this.mod.on('connect', () => {
done();
});
});
it('should not patch in "missing device usage" on other platforms', (done) => {
Object.defineProperty(process, 'platform', {
value: 'other',
});
mockNodeHID.devices.returns([{ path: '/tmp/hidraw1' }]);
mockFs.existsSync.throws();
mockFs.readFileSync.throws();
this.mod.on('connect', () => done(new Error('Connect should never be called')));
this.mod.on('tick', () => done());
});
it('should patch in support for reads with timeout - success', (done) => {
this.mod.on('connect', (device) => {
device.readTimeout.returns([]);
device.read((err, data) => {
sinon.assert.calledOnce(device.readTimeout);
should.not.exist(err);
should.exist(data);
done();
});
});
});
it('should patch in support for reads with timeout - error', (done) => {
this.mod.on('connect', (device) => {
device.readTimeout.throws([]);
device.read((err, data) => {
sinon.assert.calledOnce(device.readTimeout);
should.exist(err);
should.not.exist(data);
done();
});
});
});
});
|
zvecr/hid-listen
| 1
|
Library for acquiring debugging information from usb hid devices
|
JavaScript
|
zvecr
|
Joel Challis
| |
src/app.js
|
JavaScript
|
import express from 'express';
import bodyParser from 'body-parser';
import helmet from 'helmet';
import compile from './routes/compile';
import sendFileBuffer from './sendFileBuffer';
// environment defaults
const PORT = process.env.PORT || 8080;
// expressjs constants
const app = express();
// middleware config
app.use(bodyParser.text({ type: 'text/plain' }));
app.use(helmet.hidePoweredBy());
app.use(sendFileBuffer);
app.use('/compile', compile.router);
app.get('/status', (req, res) => {
res.send({ compile: compile.stats() });
});
app.listen(PORT, () => {
console.log(`Listening on port:${PORT}`);
});
export default app;
|
zvecr/rest-ahk
| 0
|
Compile service for AutoHotkey scripts
|
JavaScript
|
zvecr
|
Joel Challis
| |
src/routes/compile.js
|
JavaScript
|
import express from 'express';
import expressQueue from 'express-queue';
import mcache from 'memory-cache';
import { promises as fs } from 'fs';
import proc from 'child_process';
import md5 from 'md5';
import del from 'del';
// TODO: convert to import
// const proc = require('child_process');
const CACHE_TIMEOUT = process.env.CACHE_TIMEOUT || 60000;
const BUILD_TIMEOUT = process.env.BUILD_TIMEOUT || 10000;
// expressjs constants
const router = express.Router();
const queueMw = expressQueue({ activeLimit: 1, queuedLimit: 20 });
/** Utility function to convert script->exe */
async function compileScript(id, script) {
try {
await fs.writeFile(`/tmp/${id}.ahk`, script);
await new Promise(async (resolve) => {
proc.exec(`xvfb-run -a wine Ahk2Exe.exe /in /tmp/${id}.ahk`, { timeout: BUILD_TIMEOUT }, (err, stout, sterr) => {
resolve(err ? stout : sterr);
});
});
return await fs.readFile(`/tmp/${id}.exe`);
} finally {
await del(`/tmp/${id}.*`, { force: true });
}
}
router.post('/', queueMw, async (req, res) => {
if (!req.body) {
res.status(400).send({ error: { code: -1, message: 'Empty body' } });
return;
}
const id = md5(req.body);
let data = mcache.get(id);
if (!data) {
console.log(`processing uncached:${id}`);
try {
data = await compileScript(id, req.body);
mcache.put(id, data, CACHE_TIMEOUT);
} catch (err) {
console.error(err.message);
res.status(500).send({ error: { code: err.code || -1, message: err.message || 'unknown' } });
return;
}
}
// cannot use res.download(`/tmp/${id}.exe`); due to cached buffer
res.sendFileBuffer(`${id}.exe`, data);
});
export default {
stats() {
return {
queue: queueMw.queue.getLength(),
cache: mcache.size(),
};
},
router,
};
|
zvecr/rest-ahk
| 0
|
Compile service for AutoHotkey scripts
|
JavaScript
|
zvecr
|
Joel Challis
| |
src/sendFileBuffer.js
|
JavaScript
|
import { PassThrough } from 'stream';
function sendFileBuffer(req, res, next) {
res.sendFileBuffer = (filename, data) => {
res.setHeader('Content-disposition', `attachment; filename=${filename}`);
res.setHeader('Content-type', 'application/x-msdownload');
const bufferStream = new PassThrough();
bufferStream.end(data);
bufferStream.pipe(res);
};
next();
}
export default sendFileBuffer;
|
zvecr/rest-ahk
| 0
|
Compile service for AutoHotkey scripts
|
JavaScript
|
zvecr
|
Joel Challis
| |
test/e2e.js
|
JavaScript
|
/* eslint-env mocha */
import chai from 'chai';
import chaiHttp from 'chai-http';
import server from '../src/app';
chai.should();
chai.use(chaiHttp);
describe('IT::Status endpoint', () => {
it('should report zero when idle', (done) => {
chai.request(server).get('/status')
.end((err, res) => {
res.should.have.status(200);
res.body.should.be.a('object');
res.body.should.have.property('compile');
res.body.compile.should.be.a('object');
res.body.compile.should.have.property('queue').eql(0);
res.body.compile.should.have.property('cache').eql(0);
done();
});
});
});
|
zvecr/rest-ahk
| 0
|
Compile service for AutoHotkey scripts
|
JavaScript
|
zvecr
|
Joel Challis
| |
test/routes/compile.js
|
JavaScript
|
/* eslint-env mocha */
import chai from 'chai';
import httpMocks from 'node-mocks-http';
import { promises as fs } from 'fs';
import proc from 'child_process';
import sinon from 'sinon';
import ee from 'events';
import compile from '../../src/routes/compile';
chai.should();
const SCRIPT = `^j::
Send, My First Script
return
`;
const ID = '3ab771baa15b807fc028f9766eb111b0';
describe('Compile endpoint', () => {
let exec;
let fswriteFile;
let fsreadFile;
beforeEach(() => {
fswriteFile = sinon.stub(fs, 'writeFile');
fsreadFile = sinon.stub(fs, 'readFile').returns(Buffer.from('<EXE DATA>'));
exec = sinon.stub(proc, 'exec').yields(undefined, undefined);
});
afterEach(() => {
sinon.restore();
});
it('should reject a empty request', (done) => {
const res = httpMocks.createResponse({
eventEmitter: ee.EventEmitter,
});
const req = httpMocks.createRequest({
method: 'POST',
url: '/',
body: '',
});
// TODO: undo bodge with body producing {}
req.body = '';
res.once('end', () => {
res.statusCode.should.equal(400);
done();
});
compile.router.handle(req, res);
});
it('should convert a valid request', (done) => {
const res = httpMocks.createResponse({
eventEmitter: ee.EventEmitter,
});
const req = httpMocks.createRequest({
method: 'POST',
url: '/',
body: SCRIPT,
});
res.sendFileBuffer = (name, data) => {
name.should.be.equal(`${ID}.exe`);
data.should.be.instanceof(Buffer);
// boilerplate to behave as real express middleware
res.status(200).send();
};
res.once('end', () => {
sinon.assert.calledWith(fswriteFile, `/tmp/${ID}.ahk`, SCRIPT);
sinon.assert.calledWith(exec, `xvfb-run -a wine Ahk2Exe.exe /in /tmp/${ID}.ahk`);
sinon.assert.calledWith(fsreadFile, `/tmp/${ID}.exe`);
done();
});
compile.router.handle(req, res);
});
});
|
zvecr/rest-ahk
| 0
|
Compile service for AutoHotkey scripts
|
JavaScript
|
zvecr
|
Joel Challis
| |
babel.config.js
|
JavaScript
|
module.exports = {
presets: [
'@vue/app',
],
};
|
zvecr/vue-ahk
| 9
|
Online Drag-and-Drop editor for AutoHotkey scripts
|
JavaScript
|
zvecr
|
Joel Challis
| |
public/index.html
|
HTML
|
<!DOCTYPE html>
<html lang="en" style="overflow-y: auto;">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta name="description" content="Online Drag-and-Drop editor for AutoHotkey scripts">
<meta name="keywords" content="autohotkey,ahk2exe">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>AutoHotkey Editor</title>
</head>
<body>
<noscript>
<strong>We're sorry but AutoHotkey Editor doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
|
zvecr/vue-ahk
| 9
|
Online Drag-and-Drop editor for AutoHotkey scripts
|
JavaScript
|
zvecr
|
Joel Challis
| |
src/App.vue
|
Vue
|
<template>
<v-app>
<app-header/>
<app-menu/>
<app-quick-help/>
<v-content>
<app-editor ref="editor"/>
</v-content>
<app-footer/>
</v-app>
</template>
<script>
import AppEditor from './components/AHK/Editor.vue';
import AppHeader from './components/Header.vue';
import AppMenu from './components/Menu.vue';
import AppFooter from './components/Footer.vue';
import AppQuickHelp from './components/QuickHelp.vue';
export default {
name: 'App',
components: {
AppEditor,
AppHeader,
AppMenu,
AppFooter,
AppQuickHelp,
},
};
</script>
|
zvecr/vue-ahk
| 9
|
Online Drag-and-Drop editor for AutoHotkey scripts
|
JavaScript
|
zvecr
|
Joel Challis
| |
src/components/AHK/Editor.vue
|
Vue
|
<template>
<app-blockly :config="config" lang="AHK" ref="blockly" v-model="editorState"/>
</template>
<script>
import { saveAs } from 'file-saver';
import AppBlockly from '../Blockly.vue';
import theme from './theme';
import toolbox from './toolbox';
// Bind AHK support
import './generator';
import './blocks';
export default {
components: {
AppBlockly,
},
computed: {
config() {
return {
toolbox,
theme,
sounds: false,
horizontalLayout: false,
toolboxPosition: 'end',
media: './',
grid: {
spacing: 20, length: 3, colour: '#ecf0f1', snap: true,
},
trashcan: false,
};
},
editorState: {
get() {
return this.$store.state.editor;
},
set(value) {
this.$store.commit('editor', value);
},
},
},
created() {
this.$bus.$on('import', this.import);
this.$bus.$on('export', this.export);
this.$bus.$on('download', this.generate);
this.$bus.$on('compile', () => {
throw new Error('Not implemented');
});
},
methods: {
import() {
// TODO: find npm FileReader.readAsText lib like file-saver
const vm = this;
const i = document.createElement('input');
i.type = 'file';
// eslint-disable-next-line func-names
i.onchange = function (event) {
const files = event.dataTransfer
? event.dataTransfer.files
: event.target.files;
const file = files[0];
const fr = new FileReader();
fr.onload = () => {
const xmlish = new DOMParser().parseFromString(fr.result, 'text/xml');
if (xmlish.querySelector('parsererror')) {
return;
}
vm.editorState = fr.result;
// TODO: find a way to propagate change without infinite loop
vm.$refs.blockly.import(fr.result);
};
fr.readAsText(file);
};
i.click();
},
export() {
const blob = new Blob([this.editorState], {
type: 'text/plain;charset=utf-8',
});
saveAs(blob, 'script.xml');
},
generate() {
const blob = new Blob([this.$refs.blockly.generate()], {
type: 'text/plain;charset=utf-8',
});
saveAs(blob, 'script.ahk');
},
},
};
</script>
<style>
/* TODO: tidy up this style investigation */
.blocklySvg {
}
.blocklyText,
.blocklyTreeLabel,
.blocklyHtmlInput {
font-family: "Roboto", sans-serif;
font-size: 14px;
font-weight: 500;
}
.blocklyHtmlInput {
background-color: white;
}
.blocklyTreeLabel {
color: rgba(0, 0, 0, 0.87);
}
.blocklyToolboxDiv {
background-color: #ddd;
/* padding-right: 1px; */
}
.blocklyFlyoutBackground {
fill: #eee;
fill-opacity: 1;
}
.blocklyFlyout {
/* box-shadow */
}
/* .blocklyMainWorkspaceScrollbar,
.blocklyScrollbarBackground{
color: aqua !important;
background: aqua !important;
opacity: 1;
} */
.blocklyScrollbarHandle {
/* rx: 5;
ry: 5; */
fill: rgba(0, 0, 0, 0.12);
fill-opacity: 1;
}
.blocklySelected > .blocklyPath {
stroke: rgba(0, 0, 0, 0.54);
stroke-width: 2px;
}
</style>
|
zvecr/vue-ahk
| 9
|
Online Drag-and-Drop editor for AutoHotkey scripts
|
JavaScript
|
zvecr
|
Joel Challis
| |
src/components/AHK/blocks.js
|
JavaScript
|
import Blockly from 'node-blockly/browser';
const KEYS = [
'F1',
'F2',
'F3',
'F4',
'F5',
'F6',
'F7',
'F8',
'F9',
'F10',
'F11',
'F12',
'F13',
'F14',
'F15',
'F16',
'F17',
'F18',
'F19',
'F20',
'F21',
'F22',
'F23',
'F24',
'!',
'#',
'+',
'^',
'{',
'',
'Enter',
'Escape',
'Space',
'Tab',
'Backspace',
'Delete',
'Insert',
'Up',
'Down',
'Left',
'Right',
'Home',
'End',
'PgUp',
'PgDn',
'CapsLock',
'ScrollLock',
'NumLock',
'Control',
'LControl',
'RControl',
'Alt',
'LAlt',
'RAlt',
'Shift',
'LShift',
'RShift',
'LWin',
'RWin',
'Numpad0',
'Numpad1',
'Numpad2',
'Numpad3',
'Numpad4',
'Numpad5',
'Numpad6',
'Numpad7',
'Numpad8',
'Numpad9',
'NumpadDot',
'NumpadEnter',
'NumpadMult',
'NumpadDiv',
'NumpadAdd',
'NumpadSub',
'NumpadDel',
'NumpadIns',
'NumpadClear',
'NumpadUp',
'NumpadDown',
'NumpadLeft',
'NumpadRight',
'NumpadHome',
'NumpadEnd',
'NumpadPgUp',
'NumpadPgDn',
'Browser_Back',
'Browser_Forward',
'Browser_Refresh',
'Browser_Stop',
'Browser_Search',
'Browser_Favorites',
'Browser_Home',
'Volume_Mute',
'Volume_Down',
'Volume_Up',
'Media_Next',
'Media_Prev',
'Media_Stop',
'Media_Play_Pause',
'Launch_Mail',
'Launch_Media',
'Launch_App1',
'Launch_App2',
'PrintScreen',
'CtrlBreak',
'Pause',
].map(x => [x, x]);
const DETECT_MODS = [['Ctrl', '^'], ['Alt', '!'], ['Shift', '+'], ['Win', '#']];
const SEND_MODS = [
'Ctrl',
'Alt',
'Shift',
'Win',
/*
'RCtrl',
'RAlt',
'RShift',
'RWin',
*/
].map(x => [x, x]);
Blockly.defineBlocksWithJsonArray([{
type: 'ahk_msgbox',
message0: 'Message Box With %1',
args0: [
{
type: 'field_input',
name: 'MSG',
text: 'Hello World',
},
],
previousStatement: 'action',
nextStatement: 'action',
style: 'action_type',
tooltip: '',
helpUrl: '',
},
{
type: 'ahk_hotkey',
message0: 'When %1 Then %2',
args0: [
{
type: 'input_value',
name: 'CONDITION',
check: 'detect',
},
{
type: 'input_statement',
name: 'OUTPUT',
check: 'action',
},
],
style: 'rule_type',
tooltip: '',
helpUrl: '',
},
{
type: 'ahk_print',
message0: 'Print %1',
args0: [
{
type: 'field_input',
name: 'MSG',
text: 'Hello World',
},
],
previousStatement: 'action',
nextStatement: 'action',
style: 'action_type',
tooltip: '',
helpUrl: '',
},
{
type: 'ahk_run',
message0: 'Run %1',
args0: [
{
type: 'field_input',
name: 'EXE',
text: 'notepad.exe',
},
],
previousStatement: 'action',
nextStatement: 'action',
style: 'action_type',
tooltip: '',
helpUrl: '',
},
{
type: 'ahk_send',
message0: 'Send %1',
args0: [
{
type: 'input_value',
name: 'NAME',
check: 'action',
},
],
previousStatement: 'action',
nextStatement: 'action',
style: 'action_type',
tooltip: 'A Send action with fine grain control. See https://autohotkey.com/docs/commands/Send.htm',
helpUrl: '',
},
{
type: 'ahk_send_keypress',
message0: 'Raw Sequence %1 %2',
args0: [
{
type: 'field_input',
name: 'keycode',
text: 'abc',
},
{
type: 'input_value',
name: 'NAME',
check: 'action',
},
],
output: 'action',
style: 'action_type',
tooltip: 'Raw sequence which requires escaping. See https://autohotkey.com/docs/commands/Send.htm',
helpUrl: '',
},
{
type: 'ahk_send_modifier',
message0: 'Modifier %1 and %2',
args0: [
{
type: 'field_dropdown',
name: 'MOD',
options: SEND_MODS,
},
{
type: 'input_value',
name: 'KEY',
check: 'action',
},
],
inputsInline: true,
output: 'action',
style: 'action_type',
tooltip: '',
helpUrl: '',
},
{
type: 'ahk_send_key',
message0: 'Key %1 %2',
args0: [
{
type: 'field_dropdown',
name: 'KEY',
options: KEYS,
},
{
type: 'input_value',
name: 'NAME',
check: 'action',
},
],
inputsInline: false,
output: 'action',
style: 'action_type',
tooltip: '',
helpUrl: '',
},
{
type: 'ahk_detect_mod',
message0: 'Modifier %1 and %2',
args0: [
{
type: 'field_dropdown',
name: 'MOD',
options: DETECT_MODS,
},
{
type: 'input_value',
name: 'NAME',
check: 'detect',
},
],
inputsInline: true,
output: 'detect',
style: 'detect_type',
tooltip: '',
helpUrl: '',
},
{
type: 'ahk_detect_key',
message0: 'Key %1',
args0: [
{
type: 'field_dropdown',
name: 'KEY',
options: KEYS,
},
],
inputsInline: false,
output: 'detect',
style: 'detect_type',
tooltip: '',
helpUrl: '',
},
{
type: 'ahk_detect_keypress',
message0: 'key %1',
args0: [
{
type: 'field_input',
name: 'KEY',
text: 'a',
},
],
output: 'detect',
style: 'detect_type',
tooltip: '',
helpUrl: '',
}]);
|
zvecr/vue-ahk
| 9
|
Online Drag-and-Drop editor for AutoHotkey scripts
|
JavaScript
|
zvecr
|
Joel Challis
| |
src/components/AHK/generator.js
|
JavaScript
|
/* eslint-disable */
import Blockly from 'node-blockly/browser';
Blockly.AHK = new Blockly.Generator('AHK');
Blockly.AHK.ORDER_ATOMIC = 0;
Blockly.AHK.ORDER_NONE = 99;
Blockly.AHK.scrub_ = function (block, code) {
const nextBlock = block.nextConnection && block.nextConnection.targetBlock();
const nextCode = Blockly.AHK.blockToCode(nextBlock);
return (nextCode) ? (`${code}\n${nextCode}`) : code;
};
Blockly.AHK.ahk_hotkey = function (block) {
const value_condition = Blockly.AHK.valueToCode(block, 'CONDITION', Blockly.AHK.ORDER_NONE);
const statements_output = Blockly.AHK.statementToCode(block, 'OUTPUT');
return `; GEN HOTKEY
${value_condition}::
${statements_output}
return
`;
};
Blockly.AHK.ahk_msgbox = function (block) {
const text_msg = block.getFieldValue('MSG');
return `MsgBox, ${text_msg}`;
};
Blockly.AHK.ahk_print = function (block) {
const text_msg = block.getFieldValue('MSG');
return `Send, {Text}${text_msg}`;
};
Blockly.AHK.ahk_run = function (block) {
const text_exe = block.getFieldValue('EXE');
return `Run, ${text_exe}`;
};
Blockly.AHK.ahk_send = function (block) {
const value_name = Blockly.AHK.valueToCode(block, 'NAME', Blockly.AHK.ORDER_NONE);
return `Send, ${value_name}`;
};
Blockly.AHK.ahk_send_keypress = function (block) {
const text_keycode = block.getFieldValue('keycode');
const value_name = Blockly.AHK.valueToCode(block, 'NAME', Blockly.AHK.ORDER_NONE);
const code = text_keycode + value_name;
return [code, Blockly.AHK.ORDER_NONE];
};
Blockly.AHK.ahk_send_modifier = function (block) {
const dropdown_mod = block.getFieldValue('MOD');
const value_key = Blockly.AHK.valueToCode(block, 'KEY', Blockly.AHK.ORDER_NONE);
const code = `{${dropdown_mod} down}${value_key}{${dropdown_mod} up}`;
return [code, Blockly.AHK.ORDER_NONE];
};
Blockly.AHK.ahk_send_key = function (block) {
const dropdown_key = block.getFieldValue('KEY');
const value_name = Blockly.AHK.valueToCode(block, 'NAME', Blockly.AHK.ORDER_NONE);
const code = `{${dropdown_key}}${value_name}`;
return [code, Blockly.AHK.ORDER_NONE];
};
Blockly.AHK.ahk_detect_mod = function (block) {
const dropdown_mod = block.getFieldValue('MOD');
const value_name = Blockly.AHK.valueToCode(block, 'NAME', Blockly.AHK.ORDER_NONE);
const code = `${dropdown_mod}${value_name}`;
return [code, Blockly.AHK.ORDER_NONE];
};
Blockly.AHK.ahk_detect_key = function (block) {
const dropdown_key = block.getFieldValue('KEY');
const code = dropdown_key;
return [code, Blockly.AHK.ORDER_NONE];
};
Blockly.AHK.ahk_detect_keypress = function (block) {
const text_key = block.getFieldValue('KEY');
// lowercase as docs suggest - forces use of shift mod
const code = text_key.toLowerCase();
// TODO: is needed??
// if(code.length > 0){
// console.log("warn: maybe only one char???")
// }
return [code, Blockly.AHK.ORDER_NONE];
};
export default Blockly.AHK;
|
zvecr/vue-ahk
| 9
|
Online Drag-and-Drop editor for AutoHotkey scripts
|
JavaScript
|
zvecr
|
Joel Challis
| |
src/components/AHK/theme.js
|
JavaScript
|
import Blockly from 'node-blockly/browser';
const blockStyles = {
rule_type: {
colourPrimary: '#007F7F',
},
detect_type: {
colourPrimary: '#3498db',
},
action_type: {
colourPrimary: '#e67e22',
},
};
const categoryStyles = {
ahk_rule_category: {
colour: '#3498db',
},
ahk_action_category: {
colour: '#e67e22',
},
ahk_template_category: {
colour: '#95a5a6',
},
};
Blockly.Themes.AHK = new Blockly.Theme(blockStyles, categoryStyles);
export default Blockly.Themes.AHK;
|
zvecr/vue-ahk
| 9
|
Online Drag-and-Drop editor for AutoHotkey scripts
|
JavaScript
|
zvecr
|
Joel Challis
| |
src/components/AHK/toolbox.js
|
JavaScript
|
const toolbox = `<xml xmlns="http://www.w3.org/1999/xhtml" id="toolbox" style="display: none;">
<category name="Rules" colour="#3498db" categorystyle="ahk_rule_category">
<block type="ahk_hotkey"></block>
<block type="ahk_detect_keypress">
<field name="KEY">a</field>
</block>
<block type="ahk_detect_mod">
<field name="MOD">Ctrl</field>
</block>
<block type="ahk_detect_key">
<field name="KEY">Esc</field>
</block>
</category>
<category name="Actions" colour="#e67e22" categorystyle="ahk_action_category">
<block type="ahk_print">
<field name="MSG">Hello World</field>
</block>
<block type="ahk_run">
<field name="EXE">notepad.exe</field>
</block>
<block type="ahk_msgbox">
<field name="MSG">Hello World</field>
</block>
<block type="ahk_send"></block>
<block type="ahk_send_keypress">
<field name="keycode">a</field>
</block>
<block type="ahk_send_key">
<field name="KEY">Esc</field>
</block>
<block type="ahk_send_modifier">
<field name="MOD">Ctrl</field>
</block>
</category>
<sep></sep>
<category name="Templates" colour="#95a5a6" categorystyle="ahk_template_category">
<block type="ahk_hotkey">
<value name="CONDITION">
<block type="ahk_detect_mod">
<field name="MOD">Ctrl</field>
<value name="NAME">
<block type="ahk_detect_keypress">
<field name="KEY">j</field>
</block>
</value>
</block>
</value>
<statement name="OUTPUT">
<block type="ahk_msgbox">
<field name="MSG">Going to type 'Hello World'</field>
<next>
<block type="ahk_print">
<field name="MSG">Hello World</field>
</block>
</next>
</block>
</statement>
</block>
<block type="ahk_hotkey">
<value name="CONDITION">
<block type="ahk_detect_mod">
<field name="MOD">Shift</field>
<value name="NAME">
<block type="ahk_detect_keypress">
<field name="KEY">j</field>
</block>
</value>
</block>
</value>
<statement name="OUTPUT">
<block type="ahk_run">
<field name="EXE">notepad.exe</field>
</block>
</statement>
</block>
<block type="ahk_hotkey">
<value name="CONDITION">
<block type="ahk_detect_key">
<field name="KEY">F23</field>
</block>
</value>
<statement name="OUTPUT">
<block type="ahk_send">
<value name="NAME">
<block type="ahk_send_modifier">
<field name="MOD">Ctrl</field>
<value name="KEY">
<block type="ahk_send_keypress">
<field name="keycode">c</field>
</block>
</value>
</block>
</value>
</block>
</statement>
</block>
<block type="ahk_hotkey">
<value name="CONDITION">
<block type="ahk_detect_key">
<field name="KEY">F24</field>
</block>
</value>
<statement name="OUTPUT">
<block type="ahk_send">
<value name="NAME">
<block type="ahk_send_keypress">
<field name="keycode">{Ctrl down}v{Ctrl up}</field>
</block>
</value>
</block>
</statement>
</block>
</category>
</xml>`;
export default toolbox;
|
zvecr/vue-ahk
| 9
|
Online Drag-and-Drop editor for AutoHotkey scripts
|
JavaScript
|
zvecr
|
Joel Challis
| |
src/components/Blockly.vue
|
Vue
|
<template>
<div class="blocklyDivParent">
<div class="blocklyDiv"/>
</div>
</template>
<script>
import Blockly from 'node-blockly/browser';
export default {
props: {
config: { type: Object, required: true },
lang: { type: String, required: true },
value: { type: String },
},
data() {
return {
worksapce: null,
};
},
mounted() {
const child = this.$el.querySelector('.blocklyDiv');
this.workspace = Blockly.inject(child, this.config);
this.import(this.value);
this.workspace.addChangeListener((event) => {
if (event.type === Blockly.Events.UI) {
return;
}
this.$emit('input', this.export());
});
window.addEventListener(
'resize',
() => Blockly.svgResize(this.workspace),
false,
);
},
methods: {
export() {
const xml = Blockly.Xml.workspaceToDom(this.workspace);
return Blockly.Xml.domToText(xml);
},
import(xmlText) {
Blockly.mainWorkspace.clear();
if (xmlText) {
const xml = Blockly.Xml.textToDom(xmlText);
Blockly.Xml.domToWorkspace(xml, this.workspace);
}
},
generate() {
return Blockly[this.lang].workspaceToCode(this.workspace);
},
},
};
</script>
<style>
.blocklyDivParent {
position: relative;
width: 100%;
height: 100%;
}
.blocklyDiv {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
</style>
|
zvecr/vue-ahk
| 9
|
Online Drag-and-Drop editor for AutoHotkey scripts
|
JavaScript
|
zvecr
|
Joel Challis
| |
src/components/Footer.vue
|
Vue
|
<template>
<v-footer dark padless>
<v-card flat tile width="100%" class="secondary lighten-1 white--text text-center">
<v-card-actions class="secondary justify-center">
© {{ new Date().getFullYear() }} -
<strong>zvecr.com</strong>
</v-card-actions>
</v-card>
</v-footer>
</template>
<script>
export default {
};
</script>
<style>
footer {
user-select: none;
}
</style>
|
zvecr/vue-ahk
| 9
|
Online Drag-and-Drop editor for AutoHotkey scripts
|
JavaScript
|
zvecr
|
Joel Challis
| |
src/components/Header.vue
|
Vue
|
<template>
<div>
<v-app-bar dark color="primary">
<v-app-bar-nav-icon @click="menu = true"></v-app-bar-nav-icon>
<v-toolbar-title>AutoHotkey Editor</v-toolbar-title>
<div class="flex-grow-1"></div>
<v-btn icon>
<v-icon @click="help = true">fas fa-question</v-icon>
</v-btn>
<v-btn icon class="hidden-sm-and-down">
<v-icon @click="$bus.$emit('download')">fa-download</v-icon>
</v-btn>
</v-app-bar>
</div>
</template>
<script>
export default {
computed: {
menu: {
get() {
return this.$store.state.menu;
},
set(value) {
this.$store.commit('menu', value);
},
},
help: {
get() {
return this.$store.state.help;
},
set(value) {
this.$store.commit('help', value);
},
},
},
};
</script>
<style>
</style>
|
zvecr/vue-ahk
| 9
|
Online Drag-and-Drop editor for AutoHotkey scripts
|
JavaScript
|
zvecr
|
Joel Challis
| |
src/components/Menu.vue
|
Vue
|
<template>
<v-navigation-drawer app temporary v-model="menu" width="300">
<v-layout column fill-height>
<v-list>
<v-list-item link @click="$bus.$emit('import')">
<v-list-item-icon>
<v-icon>fa-file-import</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>Import</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-list-item link @click="$bus.$emit('export')">
<v-list-item-icon>
<v-icon>fa-file-export</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>Export</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-divider></v-divider>
<v-list-item link @click="$bus.$emit('download')">
<v-list-item-icon>
<v-icon>fa-download</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>Download script</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-list-item link disabled @click="$bus.$emit('compile')">
<v-list-item-icon>
<v-icon>fa-cogs</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>Compile to exe</v-list-item-title>
</v-list-item-content>
</v-list-item>
<v-divider></v-divider>
<v-list-item link href="https://github.com/zvecr/vue-ahk/wiki">
<v-list-item-icon>
<v-icon>fa-question-circle</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>Online Help</v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list>
<v-spacer></v-spacer>
<v-divider></v-divider>
<v-list>
<v-list-item two-line link href="http://www.zvecr.com">
<v-list-item-avatar tile>
<img src="icon_vector_min.svg" />
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title>zvecr.com</v-list-item-title>
<v-list-item-subtitle>Check out my other creations</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
</v-list>
</v-layout>
</v-navigation-drawer>
</template>
<script>
export default {
computed: {
menu: {
get() {
return this.$store.state.menu;
},
set(value) {
this.$store.commit('menu', value);
},
},
},
};
</script>
<style>
/* bodge to work around blockly */
.theme--dark.v-navigation-drawer,
.theme--light.v-navigation-drawer {
z-index: 100;
}
</style>
|
zvecr/vue-ahk
| 9
|
Online Drag-and-Drop editor for AutoHotkey scripts
|
JavaScript
|
zvecr
|
Joel Challis
| |
src/components/QuickHelp.vue
|
Vue
|
<template>
<v-dialog v-model="help" :width="$vuetify.breakpoint.lgAndUp ? '50%' : 'auto'">
<v-card>
<v-app-bar dark dense color="secondary">
<v-toolbar-title>Quick Help</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn icon>
<v-icon @click="help = false">fa-times</v-icon>
</v-btn>
</v-app-bar>
<v-layout pa-3>
<v-img src="screencast.gif" ontain class="elevation-5"/>
</v-layout>
<v-card-text>
<ol pt-3>
<li>
Add some blocks to the workspace. Start with dragging some
<strong>Rules</strong>, then add some
<strong>Actions</strong>.
</li>
<li>Click the download icon to generate your ahk script.</li>
<li>See the template section for some initial ideas.</li>
</ol>
</v-card-text>
</v-card>
</v-dialog>
</template>
<script>
export default {
computed: {
help: {
get() {
return this.$store.state.help;
},
set(value) {
this.$store.commit('help', value);
},
},
},
};
</script>
<style>
</style>
|
zvecr/vue-ahk
| 9
|
Online Drag-and-Drop editor for AutoHotkey scripts
|
JavaScript
|
zvecr
|
Joel Challis
| |
src/main.js
|
JavaScript
|
import Vue from 'vue';
import App from './App.vue';
import vuetify from './plugins/vuetify';
import store from './store/Store';
Vue.config.productionTip = false;
Vue.use({
install(_Vue) {
// eslint-disable-next-line no-param-reassign
_Vue.prototype.$bus = new Vue();
Vue.mixin({
beforeDestroy() {
// only destroy on root instances
if (!this.$parent) {
this.$bus.$destroy();
}
},
});
},
});
new Vue({
store,
vuetify,
render: (h) => h(App),
}).$mount('#app');
|
zvecr/vue-ahk
| 9
|
Online Drag-and-Drop editor for AutoHotkey scripts
|
JavaScript
|
zvecr
|
Joel Challis
| |
src/plugins/vuetify.js
|
JavaScript
|
import Vue from 'vue';
import Vuetify from 'vuetify/lib';
import '@fortawesome/fontawesome-free/css/all.css';
import 'typeface-roboto/index.css';
Vue.use(Vuetify);
export default new Vuetify({
icons: {
iconfont: 'fa',
},
theme: {
dark: false,
themes: {
light: {
primary: '#2C3539',
secondary: '#007F7F',
},
dark: {
primary: '#2C3539',
secondary: '#007F7F',
},
},
},
});
|
zvecr/vue-ahk
| 9
|
Online Drag-and-Drop editor for AutoHotkey scripts
|
JavaScript
|
zvecr
|
Joel Challis
| |
src/store/Store.js
|
JavaScript
|
/* eslint-disable no-param-reassign */
import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex);
export default new Vuex.Store({
state: {
menu: false,
help: false,
editor: '',
},
mutations: {
menu(state, val) {
state.menu = val;
},
help(state, val) {
state.help = val;
},
editor(state, val) {
state.editor = val;
},
},
});
|
zvecr/vue-ahk
| 9
|
Online Drag-and-Drop editor for AutoHotkey scripts
|
JavaScript
|
zvecr
|
Joel Challis
| |
vue.config.js
|
JavaScript
|
module.exports = {
publicPath: '/',
};
|
zvecr/vue-ahk
| 9
|
Online Drag-and-Drop editor for AutoHotkey scripts
|
JavaScript
|
zvecr
|
Joel Challis
| |
lib/components/RouterLink.js
|
JavaScript
|
function findTag(children, tag = 'a') {
let found;
(children || []).forEach((child) => {
if (child.tag === tag) {
found = child;
} else if (child.children) {
found = findTag(child.children);
}
});
return found;
}
export default {
name: 'router-link',
props: {
to: {
type: String,
required: true,
},
tag: {
type: String,
default: 'a',
},
event: {
type: String,
default: 'click',
},
activeClass: String,
},
render(createElement) {
const router = this.$router;
const data = {
class: {
// TODO: find a better method to detect 'active'
[this.activeClass]: !router.canEmit(this.to),
},
on: {
[this.event]: () => {
this.$router.emit(this.to);
},
},
};
if (this.tag !== 'a') {
const a = findTag(this.$slots.default);
if (a) {
// Move listener from created tag to child 'a'
a.data = a.data || {};
a.data.on = data.on;
data.on = {};
}
}
return createElement(this.tag, data, this.$slots.default);
},
};
|
zvecr/vue-scxml-router
| 4
|
SCXML state machine vue router
|
JavaScript
|
zvecr
|
Joel Challis
| |
lib/components/RouterView.js
|
JavaScript
|
export default {
name: 'router-view',
functional: true,
render: (_, { children, parent, data }) => {
const createElement = parent.$createElement;
const route = parent.$route.name;
// TODO: better component creation
const component = parent.$options.components[route];
if (!component) {
return createElement();
}
return createElement(component, data, children);
},
};
|
zvecr/vue-scxml-router
| 4
|
SCXML state machine vue router
|
JavaScript
|
zvecr
|
Joel Challis
| |
lib/index.js
|
JavaScript
|
/* eslint-disable no-underscore-dangle */
import { Machine, interpret } from 'xstate';
import RouterView from './components/RouterView';
import RouterLink from './components/RouterLink';
function convert(data) {
// if (typeof data === 'string') {
// // TODO: parse string with xml2js parseString
// data = { scxml: {} };
// } else if (!data) {
// data = { scxml: {} };
// }
console.log('data:', data);
// const machine = (model instanceof Machine) ? Machine(model) : model;
const scxml = data.scxml;
// TODO: convert betterer
const model = {};
model.id = scxml.$.name;
model.initial = scxml.$.initial;
model.states = {};
scxml.state.forEach((state) => {
model.states[state.$.id] = { on: {} };
state.transition.forEach((transition) => {
model.states[state.$.id].on[transition.$.event] = transition.$.target;
});
});
return model;
}
export default class VueStateRouter {
constructor(model, opts = {}) {
if (!VueStateRouter.__installed) {
throw new Error('not installed. Make sure to call `Vue.use(VueStateRouter)` before creating root instance.');
}
const machine = Machine(convert(model));
console.log('load:', machine, opts);
const service = interpret(machine)
.onTransition((state) => { this.__state = state; });
this.__service = service;
}
static install(Vue, opts = {}) {
console.log('installing with options:', opts);
Vue.mixin({
beforeCreate() {
if (this.$options.router) {
this.__routerRoot = this;
this.__router = this.$options.router;
Vue.util.defineReactive(this.__router, '__state', {});
console.log('Starting state machine');
this.__router.__service.onTransition(state => this.$emit('scxml:trans', state));
this.__router.__service.start();
} else {
this.__routerRoot = (this.$parent && this.$parent.__routerRoot) || this;
}
},
});
Object.defineProperty(Vue.prototype, '$router', {
get() {
return {
emit: (...args) => this.__routerRoot.__router.__service.send(...args),
canEmit: event => this.__routerRoot.__router.__state.nextEvents.includes(event),
};
},
});
Object.defineProperty(Vue.prototype, '$route', {
get() {
return {
name: this.__routerRoot.__router.__state.value, // toStrings()[0];//this._service;
toString() { return this.name; },
};
},
});
Vue.component('RouterView', RouterView);
Vue.component('RouterLink', RouterLink);
VueStateRouter.__installed = true;
}
}
|
zvecr/vue-scxml-router
| 4
|
SCXML state machine vue router
|
JavaScript
|
zvecr
|
Joel Challis
| |
example/docs/.vuepress/config.js
|
JavaScript
|
module.exports = {
locales: {
'/': {
lang: 'en',
},
'/zh/': {
lang: 'zh-CN',
}
},
themeConfig: {
locales: {
'/': {
sidebar: [
'/',
'/foo',
'/bar',
]
},
'/zh/': {
sidebar: [
'/zh/',
'/zh/foo',
'/zh/bar',
]
},
}
},
plugins: [
'vuepress-plugin-i18n-fallback'
],
}
|
zvecr/vuepress-plugin-i18n-fallback
| 0
|
Enable fallback of missing/untranslated vuepress content
|
JavaScript
|
zvecr
|
Joel Challis
| |
index.js
|
JavaScript
|
// Copyright 2022 Joel Challis
// SPDX-License-Identifier: MIT
module.exports = (options = {}, ctx) => ({
name: 'vuepress-plugin-i18n-fallback',
async additionalPages(app) {
if (!app.siteConfig.locales) {
console.log(`WARNING: i18n not configured`);
return [];
}
const default_locale = '/';
// Ignore the "default" locale
const locales = Object.keys(app.siteConfig.locales).filter(e => e !== default_locale);
// Collect all pages by locale
let locale_pages = Object.fromEntries(Object.entries(app.siteConfig.locales).map(([k, v]) => [k, {}]))
app.pages.forEach(page => {
locale_pages[page._localePath][page.path] = { path: page.relativePath };
});
// For every default page that does not have a translation
// Map a fallback to the default locale
let fallback_pages = [];
Object.entries(locale_pages[default_locale]).forEach(([page, { path }]) => {
locales.forEach(locale => {
const fallback_file = app.sourceDir + default_locale + path;
const fallback_path = locale + page.substring(1);
if (!locale_pages[locale].hasOwnProperty(fallback_path)) {
console.log(`Adding i18n fallback: ${locale}${path} -> ${default_locale}${path}`);
fallback_pages.push({
"path": fallback_path,
"filePath": fallback_file
});
}
});
});
return fallback_pages;
}
});
|
zvecr/vuepress-plugin-i18n-fallback
| 0
|
Enable fallback of missing/untranslated vuepress content
|
JavaScript
|
zvecr
|
Joel Challis
| |
babel.config.js
|
JavaScript
|
module.exports = {
presets: [
'@vue/app',
],
};
|
zvecr/zvecr.github.io
| 0
|
Vue
|
zvecr
|
Joel Challis
| ||
public/index.html
|
HTML
|
<!DOCTYPE html>
<html lang="en" style="overflow-y: auto;">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta name="description" content="zvecr.com">
<meta name="theme-color" content="#007F7F">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>zvecr</title>
</head>
<body>
<noscript>
<strong>We're sorry but zvecr.com doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
|
zvecr/zvecr.github.io
| 0
|
Vue
|
zvecr
|
Joel Challis
| ||
src/App.vue
|
Vue
|
<template>
<v-app class="temp">
<app-header @menu="menu = true" />
<app-menu v-model="menu" />
<app-main />
<app-footer />
</v-app>
</template>
<script>
import AppHeader from './components/Header.vue';
import AppMenu from './components/Menu.vue';
import AppMain from './components/Main.vue';
import AppFooter from './components/Footer.vue';
export default {
name: 'App',
components: {
AppHeader,
AppMenu,
AppMain,
AppFooter,
},
data() {
return {
menu: false,
};
},
};
</script>
<style>
.v-application,
.v-application .display-1,
.v-application .display-2,
.v-application.temp .display-1,
.v-application.temp .display-2 {
font-family: 'Roboto Mono', monospace !important;
}
</style>
|
zvecr/zvecr.github.io
| 0
|
Vue
|
zvecr
|
Joel Challis
| ||
src/components/Footer.vue
|
Vue
|
<template>
<v-footer dark padless>
<v-card flat tile width="100%" class="secondary lighten-1 white--text text-center">
<v-card-text flat tile>
<v-btn icon href="https://github.com/zvecr">
<v-icon>fab fa-github</v-icon>
</v-btn>
<v-btn icon href="mailto:info@zvecr.com">
<v-icon
@mouseover="mailHovering = true"
@mouseout="mailHovering = false"
>fas {{ mailHovering ? 'fa-envelope-open' : 'fa-envelope' }}</v-icon>
</v-btn>
</v-card-text>
<v-card-actions class="secondary justify-center">
<i class="far fa-copyright"></i> {{ new Date().getFullYear() }} - zvecr.com
</v-card-actions>
</v-card>
</v-footer>
</template>
<script>
export default {
data() {
return {
mailHovering: false,
};
},
};
</script>
<style>
footer {
user-select: none;
}
</style>
|
zvecr/zvecr.github.io
| 0
|
Vue
|
zvecr
|
Joel Challis
| ||
src/components/Header.vue
|
Vue
|
<template>
<v-card class="pa-3 primary white--text">
<v-toolbar dark color="transparent elevation-0">
<v-btn color="secondary" dark href="resume.pdf">
Download Resume
<v-icon right>fas fa-download</v-icon>
</v-btn>
<div class="flex-grow-1"></div>
<v-toolbar-items>
<v-btn icon @click="$emit('menu')"><v-icon>fas fa-bars</v-icon></v-btn>
</v-toolbar-items>
</v-toolbar>
<v-img src="sticker.png" contain height="30em" position="right"/>
<div class="pa-3" :class="{'move-up':$vuetify.breakpoint.lgAndUp}">
<h3 class="display-2 font-weight-medium">Joel Challis</h3>
<h4 class="display-1">Software Engineer</h4>
</div>
</v-card>
</template>
<script>
export default {
data() {
return {};
},
components: {},
};
</script>
<style scoped>
.v-toolbar--floating {
z-index: 10;
position: absolute;
}
.v-card {
background-image: url('/cubes.png');
background-repeat: repeat;
}
.move-up {
margin-top: -5em;
}
</style>
|
zvecr/zvecr.github.io
| 0
|
Vue
|
zvecr
|
Joel Challis
| ||
src/components/Main.vue
|
Vue
|
<template>
<v-content>
<app-statement/>
<app-skills/>
<app-projects/>
</v-content>
</template>
<script>
import AppStatement from './Statement.vue';
import AppProjects from './Projects.vue';
import AppSkills from './Skills.vue';
export default {
components: {
AppStatement,
AppProjects,
AppSkills,
},
};
</script>
<style>
</style>
|
zvecr/zvecr.github.io
| 0
|
Vue
|
zvecr
|
Joel Challis
| ||
src/components/Menu.vue
|
Vue
|
<template>
<v-navigation-drawer right app temporary :value="value" @input="toggle" width="300">
<v-layout column fill-height>
<v-list>
<v-list-item link href="https://zvecr.bigcartel.com">
<v-list-item-icon>
<v-icon>fas fa-shopping-cart</v-icon>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>Store</v-list-item-title>
</v-list-item-content>
</v-list-item>
</v-list>
<v-divider></v-divider>
<v-spacer></v-spacer>
<v-divider></v-divider>
<v-list>
<v-list-item two-line link href="http://www.zvecr.com">
<v-list-item-avatar tile>
<img src="icon_vector_min_infill.png" />
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title>zvecr.com</v-list-item-title>
<v-list-item-subtitle>Check out my other creations</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
</v-list>
</v-layout>
</v-navigation-drawer>
</template>
<script>
export default {
props: ['value'],
methods: {
toggle(value) {
this.$emit('input', value);
},
},
};
</script>
<style>
</style>
|
zvecr/zvecr.github.io
| 0
|
Vue
|
zvecr
|
Joel Challis
| ||
src/components/Projects.vue
|
Vue
|
<template>
<v-container fluid grid-list-md class="primary lighten">
<h2 class="text-center white--text">Projects</h2>
<v-layout pt-3 wrap>
<v-flex pa-2 lg4 sm6 xs12 v-for="project in projects" :key="project.name">
<v-card round height="100%" class="flexcard">
<v-card-title class="secondary lighten-1 white--text">{{project.name}}</v-card-title>
<v-card-text class="pt-2 primary--text grow">{{project.desc}}</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="orange" dark rounded small v-if="project.proj" :href="project.proj">
<v-icon left>fab fa-github</v-icon> Github Repo
</v-btn>
<v-btn color="primary" dark rounded small v-if="project.link" :href="project.link">
Visit <v-icon right>fas fa-arrow-circle-right</v-icon>
</v-btn>
</v-card-actions>
</v-card>
</v-flex>
</v-layout>
</v-container>
</template>
<script>
/* eslint-disable max-len */
export default {
data() {
return {
projects: [
{
name: 'AutoHotkey Editor',
desc: 'Drag-and-Drop Blockly based editor for creating simple AutoHotkey scripts. REST backend service for compiling AutoHotkey scripts .ahk to .exe',
proj: 'https://github.com/zvecr/AutoHotkey-Editor',
link: 'https://ahk.zvecr.com',
},
{
name: 'QMK Firmware',
desc: 'QMK Member. Contributions including CI improvements, ARM split project, porting new/existing hardware, updating legacy code and style conformance, and bugfixes, as well as providing general QMK support to end users.',
proj: 'https://github.com/qmk/qmk_firmware/pulls/zvecr',
},
{
name: 'Keyboard Tools',
desc: 'Work-in-Progress. Cross-platform Node.js ports of various keyboard tools.',
proj: 'https://github.com/zvecr/Keyboard-Tools',
},
{
name: 'split_blackpill Keyboard',
desc: 'Split ortho_4x12 ARM mechanical keyboard. Produced with KiCad, OSH coming soon!',
link: 'https://zvecr.bigcartel.com/product/split_blackpill',
},
{
name: 'vue-scxml-router',
desc: 'Work-in-Progress. vue-scxml-router is state machine based router for Vue.js. It integrates with Vue.js to provide well defined and predictable user navigation.',
proj: 'https://github.com/zvecr/vue-scxml-router',
},
{
name: 'jmeter-smtp-server-plugin',
desc: 'Self contained, pure java SMTP server hosted directly within JMeter. Aligned with the default SMTP sampler, the plugin provides support for various configuration including SMTP auth and TLS.',
proj: 'https://github.com/zvecr/jmeter-smtp-server-plugin',
},
],
};
},
};
</script>
<style scoped>
.flexcard {
display: flex;
flex-direction: column;
}
</style>
|
zvecr/zvecr.github.io
| 0
|
Vue
|
zvecr
|
Joel Challis
| ||
src/components/Skills.vue
|
Vue
|
<template>
<v-container fluid grid-list-md class="primary lighten-2 white--text">
<h2 class="text-center">Skills</h2>
<v-layout
:pt-5="$vuetify.breakpoint.mdAndUp"
:row="$vuetify.breakpoint.mdAndUp"
:column="$vuetify.breakpoint.smAndDown"
wrap
>
<v-flex
xs4 v-for="(skill,group) in skills" :key="group"
pa-2 :pt-10="$vuetify.breakpoint.smAndDown"
>
<v-card height="100%">
<v-card-title class="justify-center primary--text">
<div class="headline">{{skill.name}}</div>
</v-card-title>
<v-btn color="orange" dark absolute top right fab large>
<v-icon>{{skill.icon}}</v-icon>
</v-btn>
<v-card-text class="primary--text">
<ul>
<li v-for="type in skill.sub" :key="type">{{type}}</li>
</ul>
</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-container>
</template>
<script>
export default {
data() {
return {
skills: {
frontend: {
name: 'Frontend',
icon: 'far fa-window-maximize',
sub: [
'Javascript',
'VueJs',
'JSP',
'Keycloak',
'Phonegap/Cordova',
],
},
backend: {
name: 'Backend',
icon: 'fas fa-server',
sub: [
'Java',
'Spring',
'Maven',
'C++',
'Boost',
'Googletest',
'Swagger',
'Postgres',
'SQLite',
],
},
other: {
name: 'Other',
icon: 'fas fa-cogs',
sub: [
'Agile',
'Git/SVN',
'Cucumber',
'Selenium',
'Bash',
'Python',
'Docker',
'Jenkins',
'Travis-ci',
'Vagrant',
],
},
},
};
},
};
</script>
<style>
</style>
|
zvecr/zvecr.github.io
| 0
|
Vue
|
zvecr
|
Joel Challis
| ||
src/components/Statement.vue
|
Vue
|
<template>
<v-container fluid class="primary lighten-1 white--text text-center">
<v-layout align-center justify-center pa-1>
<v-flex xs4>
<v-avatar size="100%">
<v-img src="headshot.jpg" aspect-ratio="1" contain></v-img>
</v-avatar>
</v-flex>
<v-flex xs8>
<blockquote class="blockquote">{{ statement }}</blockquote>
</v-flex>
</v-layout>
</v-container>
</template>
<script>
/* eslint-disable max-len */
export default {
data() {
return {
statement:
'A highly focused software developer with 10 years enterprise experience spanning the full stack.'
+ '\n\n'
+ 'Possessing a high level of intrigue and determination, a methodical approach and excellent problem solving skills. '
+ 'Skills which have led to a proven track record of delivering complex applications against critical deadlines.',
};
},
};
</script>
<style scoped>
blockquote {
white-space: pre-wrap;
}
</style>
|
zvecr/zvecr.github.io
| 0
|
Vue
|
zvecr
|
Joel Challis
| ||
src/main.js
|
JavaScript
|
import Vue from 'vue';
import App from './App.vue';
import vuetify from './plugins/vuetify';
Vue.config.productionTip = false;
new Vue({
vuetify,
render: (h) => h(App),
}).$mount('#app');
|
zvecr/zvecr.github.io
| 0
|
Vue
|
zvecr
|
Joel Challis
| ||
src/plugins/vuetify.js
|
JavaScript
|
import Vue from 'vue';
import Vuetify from 'vuetify/lib';
import '@fortawesome/fontawesome-free/css/all.css';
import 'typeface-roboto-mono/index.css';
Vue.use(Vuetify);
export default new Vuetify({
icons: {
iconfont: 'fa',
},
theme: {
dark: false,
themes: {
light: {
primary: '#2C3539',
secondary: '#007F7F',
},
dark: {
primary: '#2C3539',
secondary: '#007F7F',
},
},
},
});
|
zvecr/zvecr.github.io
| 0
|
Vue
|
zvecr
|
Joel Challis
| ||
vue.config.js
|
JavaScript
|
module.exports = {
publicPath: '/',
};
|
zvecr/zvecr.github.io
| 0
|
Vue
|
zvecr
|
Joel Challis
| ||
bin/build-umd.js
|
JavaScript
|
const fs = require('fs')
const { resolve } = require('path')
const cwd = process.cwd()
function run () {
const pre = `;(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], factory);
} else if (typeof module === 'object' && module.exports) {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory();
} else {
// Browser globals (root is window)
root.CanvasShapesBg = factory();
}
}(typeof self !== 'undefined' ? self : this, function () {`
const after = 'return CanvasShapesBg}));'
const p = resolve(cwd, 'dist/canvas-shapes-bg.js')
let str = '' + fs.readFileSync(p, 'utf-8')
str = str
.replace('"use strict";', '')
.replace('Object.defineProperty(exports, "__esModule", { value: true });', pre)
.replace('exports.default = CanvasShapesBg;', '')
.replace('module.exports = CanvasShapesBg;', after)
fs.writeFileSync(p, str)
}
run()
|
zxdong262/canvas-shapes-bg
| 1
|
Draw simple shape moving animation in canvas as webpage background
|
TypeScript
|
zxdong262
|
ZHAO Xudong
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.