Skip to content

Instantly share code, notes, and snippets.

View pelid's full-sized avatar

Evgeny Evseev pelid

View GitHub Profile
@pelid
pelid / exampes.js
Last active October 28, 2017 20:53
JS headaches
> "5" - 3
2
> "5" + 3
"53" // почему ?!
>'5' + + '3'
"53" // кажется, здесь все логично
> '5' + - '3'
"5-3" // ан нет
> 'foo' + + 'foo'
@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
@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 / regexp.txt
Created May 5, 2017 10:48
regexp for removing data-react attributes in html
data-reactid="[\d\.\$]+"
@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
<script>
function onYouTubeIframeAPIReady() {
$modal.on('show', function(){
new YT.Player('player', {
height: '360',
width: '640',
videoId: 'M7lc1UVf-VE',
events: {
'onReady': onPlayerReady,
}
@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
@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 / 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 / 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" />