Skip to content

Instantly share code, notes, and snippets.

я котик пур-пур mvasilkov

Block or report user

Report or block mvasilkov

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
mvasilkov / auth_form.js
Created Jun 25, 2019 modal form with wrappedComponentRef
View auth_form.js
import React from 'react'
import { Form, Input } from 'antd'
import lang from '../app/lang'
export default Form.create({ name: 'auth' })(
class AuthForm extends React.Component {
render() {
const { getFieldDecorator } = this.props.form
mvasilkov /
Created Mar 15, 2013
Recursively remove trailing whitespace from all files in the working directory.
find . -not \( -name .git -prune -o -name .hg -prune -o -name .svn -prune \) \
-type f -exec sed -i '' 's/[[:blank:]]*$//' '{}' \;
View music_formula_collection.txt
Collection of oneliner music formulas. Version 2011-10-18
I've tried to collect all the formulas in the related threads etc.
(excluding those that clearly sound like random first experiments or total
crap; when several variants are available, i've chosen the shortest one)
If you think I've missed something that should be here, please let me know.
====== 1ST ITERATION ======
import Image, ExifTags
try:, fileName))
for orientation in ExifTags.TAGS.keys():
if ExifTags.TAGS[orientation]=='Orientation': break
if exif[orientation] == 3:
image=image.rotate(180, expand=True)
mvasilkov /
Created Feb 9, 2012
Return first non-repeating (unique) symbol in the string. With tests and timeit.
#!/usr/bin/env python
import re
from timeit import timeit
import unittest
UNIQ_RE = re.compile(r'(.)(?=.*?\1)')
'test': 'e',
'plperl': 'e',
mvasilkov /
Created Jan 27, 2012
RestfulView from libanimuchan
from django.shortcuts import render
class RestfulView(object):
allowed_methods = ["GET", "POST"]
def __call__(self, request, *args, **kwargs):
if request.method not in self.allowed_methods or not hasattr(self, request.method):
return self.method_not_allowed(request)
return getattr(self, request.method)(request, *args, **kwargs)
View map.txt
# _ = empty
# X = solid ground
# S = sand
mvasilkov / remove_lines
Created Nov 18, 2013
Remove empty lines at the end of file.
View remove_lines
last_non_blank_ln=$(grep -En ^. $1 |tail -n 1 |sed 's/:.*//')
head -n $((last_non_blank_ln + 1)) $1 > _xxx
mv _xxx $1
View gist:7487460
(box2d-html5) -> git commit
[master e170981] There are two sides to every issue: one side is right and the other is wrong, but the middle is always evil.
120 files changed, 125 insertions(+), 125 deletions(-)
rename contrib/{Enhancements/Controllers/b2BuoyancyController.js => enhancements/controllers/buoyancycontroller.js} (100%)
rename contrib/{Enhancements/Controllers/b2ConstantAccelController.js => enhancements/controllers/constantaccelcontroller.js} (100%)
rename contrib/{Enhancements/Controllers/b2ConstantForceController.js => enhancements/controllers/constantforcecontroller.js} (100%)
rename contrib/{Enhancements/Controllers/b2Controller.js => enhancements/controllers/controller.js} (100%)
rename contrib/{Enhancements/Controllers/b2GravityController.js => enhancements/controllers/gravitycontroller.js} (100%)
rename contrib/{Enhancements/Controllers/b2TensorDampingController.js => enhancements/controllers/tensordampingcontroller.js} (100%)
rewrite contrib/paths.json (99%)
You can’t perform that action at this time.