Skip to content

Instantly share code, notes, and snippets.

Tyom Semonov tyom

Block or report user

Report or block tyom

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tyom
tyom / redirect-to-trailing-slash.js
Created May 8, 2019
This is technique is useful when dealing with static subdirectories. Unless the current directory has trailing slash it won't be regarded it as such, leading to wrong relative path.
View redirect-to-trailing-slash.js
window.location.href.match(/[^/]$/) && (window.location.href += '/');
@tyom
tyom / global.js
Created Nov 12, 2018
Import all Vue components that match regex as global
View global.js
const requireComponent = require.context(
'~/components', // components dir
true, // recursive
/^(\.\/.*)*V[A-Z].+\.vue$/, // name regex
);
requireComponent.keys().forEach(fileName => {
let baseComponentConfig = requireComponent(fileName);
baseComponentConfig = baseComponentConfig.default || baseComponentConfig;
@tyom
tyom / config.yaml
Last active Aug 17, 2018
PR preview and tests with now.sh
View config.yaml
version: 2
references:
container_config: &container_config
docker:
- image: circleci/node:10.8
restore_deps_cache: &restore_deps_cache
restore_cache:
keys:
@tyom
tyom / js-enabled
Created Jun 27, 2018
Insert in the head of the document to replace `no-js` class with `js-enabled` before `body` gets parsed.
View js-enabled
<script>(function(d){d.className=d.className.replace(/\bno-js\b/,'js-enabled')})(document.documentElement)</script>
@tyom
tyom / .eslintrc
Created Sep 7, 2016
ESLint config template
View .eslintrc
{
"extends": "eslint:recommended",
"root": true,
"env": {
"es6": true,
"browser": true,
"node": true
},
"parserOptions": {
"sourceType": "module"
@tyom
tyom / package.json
Last active Aug 3, 2016
Simple Webpack Dev Server + Sass config
View package.json
{
"devDependencies": {
"babel-core": "^6.11.4",
"babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.9.0",
"babel-register": "^6.11.6",
"css-loader": "^0.23.1",
"extract-text-webpack-plugin": "^1.0.1",
"file-loader": "^0.9.0",
"node-sass": "^3.8.0",
View keybase.md

Keybase proof

I hereby claim:

  • I am tyom on github.
  • I am tyom (https://keybase.io/tyom) on keybase.
  • I have a public key whose fingerprint is 070D 4B95 A4C5 F5A6 09A4 52F0 DD60 5FE8 EA45 DAE0

To claim this, I am signing this object:

@tyom
tyom / .editorconfig
Last active Apr 12, 2018
Editorconfig settings
View .editorconfig
# http://editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
@tyom
tyom / launch.command
Created Jan 6, 2014
Launch Python local server for script directory. Useful for distributing static HTML prototypes (e.g. Middleman builds) with simple instructions: "Double-click on `launch.command`".
View launch.command
#!/bin/bash
cd `dirname $0` && open "http://localhost:8000" && python -m SimpleHTTPServer;
@tyom
tyom / .irbrc
Last active Dec 19, 2015
Use Pry (Rails) and Awesome Print outside of Bundler in Rails 3 (when other Rails developers don't want you adding good stuff into Gemfile)
View .irbrc
begin
require 'pry-rails'
require 'awesome_print'
Pry.start
exit
rescue LoadError => e
warn 'Unable to load gems'
puts e
end
You can’t perform that action at this time.