Skip to content

Instantly share code, notes, and snippets.

Avatar

Olexandr Sydorchuk osv

  • Ukraine
View GitHub Profile
View .xsessionrc
xscreensaver &
kbdd
sleep 10
setxkbmap -layout "us,ru(winkeys),ua(winkeys)" -option grp:menu_toggle,grp_led:scroll
View nginx.vhost
upstream my-web-app-here {
server 127.0.0.1:8080;
}
server {
listen 80;
listen 443 ssl http2;
listen [::]:80;
listen [::]:443 ssl http2;
@osv
osv / formikGotoErrorOnSubmitEffect.tsx
Last active Mar 4, 2019
React Formik, scroll to first element in DOM that is not valid and has error (Hook + Typescript version)
View formikGotoErrorOnSubmitEffect.tsx
import { connect, FormikContext, getIn } from 'formik';
import * as React from 'react';
import { useEffectWhenCountIncremented } from './reactHooks';
import { PageContext } from './context';
const FormikGotoErrorOnSubmitEffectFn: React.FunctionComponent<{
formik?: FormikContext<any>;
}> = ({ formik }) => {
@osv
osv / readme.md
Last active Feb 6, 2018
Timestamp standard input with relative timestamp and less noise using node.js
View readme.md

Pretty formatter with relative time stamp, inspired by moreutils ts but with less noise, print only changes :)

Install

Save file

chmod +x ts.js

Example of usage

@osv
osv / decorate state go.js
Last active Mar 30, 2017
I use it in dev console to debug $state.go calls
View decorate state go.js
var $state = angular.element(document).injector().get('$state');
var go = $state.go;
$state.go = function(...x) {
console.trace('!! state.go(', angular.copy(x), ')'); return go.apply($state, x)
};
@osv
osv / e2e-in-docker-update-images
Last active Feb 16, 2017
Copy from actual to baseline image when test is failes
View e2e-in-docker-update-images
#!/bin/bash
#
# Update baseline image from "actual" directory if test is failed.
#
# This script parse stdin for "Expected false to be true, 'screenshot " message
# and copies image file from "actual" to "baseline" directory
#
# Example of usage
# e2e/foo.spec.js:
# it('matches screenshots', async () => {
View String.prototype.template.js
String.prototype.template = function (object) {
// Andrea Giammarchi - WTFPL License
var
stringify = JSON.stringify,
re = /\$\{(.*?)\}/g,
evaluate = [],
i = 0,
m
;
while (m = re.exec(this)) {
View dl-invitation-email.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XX:TITLE</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
</head>
@osv
osv / sitemap.config.js
Created Feb 8, 2016
gulp sitemap task
View sitemap.config.js
// ISO_3166 language map. http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_3166.html
var LANGUAGES = {
en: 'en',
ru: 'ru',
sv: 'si',
fi: 'fi',
tr: 'tr',
el: 'gr'
};
@osv
osv / server-meteor-paypal.js
Created Jan 8, 2016
server side paypal class
View server-meteor-paypal.js
var paypal = new PaypalSDK();
Meteor.startup(function ObservePaypalSettings() {
/*
var paypalSchema = new SimpleSchema({
enable: {
type: Boolean,
defaultValue: false,
},
isSandBox: {
You can’t perform that action at this time.