Skip to content

Instantly share code, notes, and snippets.

View wailorman's full-sized avatar

Sergey Popov wailorman

View GitHub Profile
@wailorman
wailorman / README.md
Last active August 15, 2022 10:48
vscode rubocop

How to configure vscode's rubocop extension

While working on multiple projects with different ruby versions, vscode may run rubocop with wrong ruby version, which leads to warnings like command bundle exec rubocop returns empty output! please check configuration.

As a solution I've created "proxy binary" for rubocop where it pulls correct ruby version from .ruby-version file from project root and executes rubocop with bundler.

Place this file to ~/.vscode/bin/rubocop and configure vscode to use this binary as rubocop executable:

{ "ruby.rubocop.executePath": "~/.vscode/bin/" }
@wailorman
wailorman / README.md
Last active November 17, 2019 10:11
Kubernetes: Sharing secrets between namespaces without --export flag

Kubernetes: Sharing secrets between namespaces without --export flag

Since --export flag was deprecated in kubernetes, this convinient command won't work anymore after ~1.18:

kubectl get secret localdockerreg --namespace=default --export -o yaml | kubectl apply --namespace=dev -f -

Instead, some people recommend to use this:

@wailorman
wailorman / README.md
Last active July 24, 2019 19:14
Install docker & docker-compose
wget -qO- https://gist.githubusercontent.com/wailorman/e49552b520344af40fd75b2d5df2d05a/raw/8a45ebc02d6a0a9c256667e167c3279ed2b68db8/install.sh | bash
@wailorman
wailorman / file.js
Created December 3, 2017 21:55
code example
console.log('123444444444')
<!-- тест судьи -->
-
<div class="test_judge"><button class="test_judge__start t__button t__button_status_active">Играть</button></div>
<script src="/js/test.js" defer=""></script>
-
<!-- тест танакана -->
-
<div class="test_judge tanakan"><button class="test_judge__start t__button t__button_status_active">Играть</button></div>
<script src="/js/tanakan.js" defer=""></script>
@wailorman
wailorman / README.md
Last active June 1, 2016 16:28
Sinon sandbox factory

How to use:

Inside your mocha's test file:

const createSinonSandbox = require('./sinon-sandbox.js');
 
describe('...', ()=> {
  
 createSinonSandbox((sandbox)=> {
 sandbox.spy(...);
@wailorman
wailorman / owen-crc.js
Created February 17, 2016 18:04
owen crc
function owenCRC16(packet, length){
var i, j;
var crc;
crc = 0;
for (i = 0; i < length; i++)
{
var b = packet[i];
for (j = 0; j < 8; j++)
{
@wailorman
wailorman / ibb-post-hunter.js
Created January 31, 2016 22:32
ibb-post-hunter.js
'use strict';
/*! jQuery v2.2.0 | (c) jQuery Foundation | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="2.2.0",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return e.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:e.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a){return n.each(this,a)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)})
function myParseInt(str) {
return /^\s*\d+\s*$/.test(str) ? +str : NaN;
}
@wailorman
wailorman / Vagrantfile
Last active November 24, 2015 19:03
rails vagrant
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at