Skip to content

Instantly share code, notes, and snippets.

Avatar

Vasyl Boroviak koresar

View GitHub Profile
@koresar
koresar / verify-signature.js
Last active Dec 25, 2019
WebAuthn "none" signature verification
View verify-signature.js
// The code below was largely taken from:
// https://github.com/strangerlabs/webauthn/blob/9959cb2b5f87692b8b1fecd799dd4029a3bf61b1/src/Webauthn.js#L501
const crypto = require("crypto");
const base64url = require("base64url");
const cbor = require("cbor");
function parseAttestationObject(attestationObject) {
const attestationObjectBuffer = base64url.toBuffer(attestationObject);
return cbor.decodeAllSync(attestationObjectBuffer)[0];
View 1clipboard.js
module.exports = {
    ra: {
        action: {
            delete: 'Видалити',
            show: 'Перегляд',
            list: 'Список',
            save: 'Зберегти',
            create: 'Список',
            edit: 'Редагувати',
            sort: 'Сортувати',
View gist:2a2f94bdd0bef1d7c533fe21fc321110

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
View 1clipboard.js
var ru = {
'WINDOW_MAIN':'1Clipboard',
'WINDOW_PREFERENCES':'Настройки',
'TOPBAR_RECENT':'Последние',
'TOPBAR_STARRED':'Избранные',
'TOPBAR_SEARCH':'Поиск',
'TOPBAR_MORE':'Дополнительно',
'TOPBAR_OFFLINE':'Offline',
'TOPBAR_PAUSED':'Пауза',
@koresar
koresar / ua.js
Last active Oct 26, 2017
1Clipboard Ukrainian translation
View ua.js
var ua = {
'WINDOW_MAIN':'1Clipboard',
'WINDOW_PREFERENCES':'Налаштування',
'TOPBAR_RECENT':'Останні',
'TOPBAR_STARRED':'Вибрані',
'TOPBAR_SEARCH':'Пошук',
'TOPBAR_MORE':'Додатково',
'TOPBAR_OFFLINE':'Offline',
'TOPBAR_PAUSED':'Пауза',
@koresar
koresar / app2-test3.js
Last active Jul 23, 2017
Fun with Stamps. Episode 17. Easy 100% unit test coverage in JS: - app2-test3.js
View app2-test3.js
describe('server', () => {
const App = require('../app2');
it('should call exit process after setImmediate()', (done) => {
let errorCallback = null;
let setImmediateCalled = false;
const MockedApp = App.props({
http: {
createServer() {
return {
@koresar
koresar / app2-test2.js
Last active Jul 23, 2017
Fun with Stamps. Episode 17. Easy 100% unit test coverage in JS: - app2-test2.js
View app2-test2.js
describe('routing', () => {
const App = require('../app2');
const {handleNotFound, handleGenericError} = App.compose.methods;
it('should set status code to 404 when no route found', (done) => {
handleNotFound({}, {}, (error) => {
if (!error || error.status !== 404) {
throw new Error('Error status should be 404');
}
done();
@koresar
koresar / app2-test1.js
Last active Jul 23, 2017
Fun with Stamps. Episode 17. Easy 100% unit test coverage in JS: - app2-test1.js
View app2-test1.js
describe('express app setup', () => {
const http = {
createServer() {
return {on() {}, listen() {}};
}
};
const App = require('../app2').props({http});
it('should share ./public', (done) => {
const express = () => ({set() {}, use() {}});
@koresar
koresar / app2.js
Last active Sep 4, 2017
Fun with Stamps. Episode 17. Easy 100% unit test coverage in JS: - app2.js
View app2.js
module.exports = require('@stamp/it')({
props: {
express: require('express'),
path: require('path'),
logger: require('morgan'),
cookieParser: require('cookie-parser'),
bodyParser: require('body-parser'),
http: require('http'),
debug: require('debug')('my-app-name:server'),
process,
@koresar
koresar / app.js
Last active Jul 23, 2017
Fun with Stamps. Episode 17. Easy 100% unit test coverage in JS: - app.js
View app.js
const express = require('express');
const path = require('path');
const logger = require('morgan');
const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');
const http = require('http');
const debug = require('debug')('my-app-name:server');
// Application
const app = express();
You can’t perform that action at this time.