Skip to content

Instantly share code, notes, and snippets.

View pelid's full-sized avatar

Evgeny Evseev pelid

View GitHub Profile
@pelid
pelid / cjs.js
Last active December 19, 2016 15:35
MyMechanic widget integration to car.ru
// код для встраивания на страницу car.ru
// используется chrome extension https://chrome.google.com/webstore/detail/custom-javascript-for-web/poakhlngfciodnhlhhgnaaelnpjljija
var buttonsHTML = (
'<p><button onclick="widget.expand()">Expand</button> <button onclick="widget.collapse()">Collapse</button></p>'+
'<p>'+
'<button onclick="widget.requestForQuote({presets: {carMake: \'BMW\', services: [85702, 52658]}})">Заказать диагностику BMW - button onclick</button>'+
'<a href="#" class="js-activate-mymechanic" data-car-make="Ford" data-car-model="Focus" data-service-area="Москва" data-services="[85702, 52658]">ТО для Ford Focus в Москве - auto bind</a>'+
'<button class="js-activate-mymechanic" data-car-make="Ford" data-car="Toyota Camry 2010">ремонт Toyota Camry 2010 - auto bind with car info as a string</button>'+
'<button class="js-activate-mymechanic">Предпродажный осмотр</button>'+
@pelid
pelid / image_input.html
Last active January 16, 2017 13:54
Image input for mobile devices and desktops
<input type="file" name="file" accept="image/*" capture="camera" />
@pelid
pelid / decorators_usage.js
Last active February 14, 2017 17:30
Moscow JS presentation
let submitSaga = decorate(
_.partial(catchFormErrors, formStore),
preloader.createPreloaderWrapper(formStore),
function*(){
yield* credentials.CredentialsFormSubmitter(inputs)
formStore.dispatch({type: 'SUBMITTED'})
},
)
yield* submitSaga()
@pelid
pelid / handler404.js
Created February 19, 2017 10:28
saga-middleware-example
import {Base404Error, Order404} from './exceptions.js'
import './order404.tag.html'
import './page404.tag.html'
export const handler = func => function*(...args){
try {
return yield* func(...args)
} catch(error) {
if (!(error instanceof Base404Error))
@pelid
pelid / inner_pages_gulpfile.js
Last active March 9, 2017 17:09
SASS gulpfile
// структура каталогов проекта
// test_assets:
// congratulation.png
// person-min.png
// person.png
// ...
// svg-icons
// arrow-down.svg
// ....
// fonts
<script>
function onYouTubeIframeAPIReady() {
$modal.on('show', function(){
new YT.Player('player', {
height: '360',
width: '640',
videoId: 'M7lc1UVf-VE',
events: {
'onReady': onPlayerReady,
}
@pelid
pelid / valli_fail.py
Created April 3, 2017 10:56
WALL·E fail with report: "Названия заглавными буквами с подчёркиванием принято использовать только для глобальных переменных. (например, debug, testing, csrf_enabled, secret_key, sqlalchemy_database_uri, sqlalchemy_track_modifications, sqlalchemy_migrate_repo, debug, development, debug, development, debug, testing)"
import os
basedir = os.path.abspath(os.path.dirname(__file__))
DEBUG = False
DEVELOPMENT = False
TESTING = False
CSRF_ENABLED = False
SECRET_KEY = ''
SQLALCHEMY_DATABASE_URI = ''
SQLALCHEMY_TRACK_MODIFICATIONS = False
@pelid
pelid / regexp.txt
Created May 5, 2017 10:48
regexp for removing data-react attributes in html
data-reactid="[\d\.\$]+"
@pelid
pelid / server.py
Last active August 1, 2017 15:18
Example of livereload integration for Devman 19_site_generator challenge
from livereload import Server
def make_site():
# TODO convert markdown to html, create site
if __name__ == '__main__':
server = Server()
server.watch('templates/*.html', make_site)
# TODO watch for changes in markdown articles
server.serve(root='site/') # folder to serve html files from
@pelid
pelid / .editorconfig
Created August 17, 2017 10:24
Project settings recommended by Devman.org
# top-most EditorConfig file
root = true
# Unix-style newlines without a newline ending every file
[*]
end_of_line = lf
insert_final_newline = false
[*]
trim_trailing_whitespace = true