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
View jsjs.js
function foo() {
this.a = function () { return 96 }
this.b = function () { return this.a() * 10101 }
}
function bar() {}
bar.prototype = new foo
b = new bar
b.a() // 96
View map.txt
# _ = empty
# X = solid ground
# S = sand
_________________
_____SSSSSS______
___SSSXXXXSSS____
____SSSXXXXSSS___
______SSSSSS_____
@mvasilkov
mvasilkov / remove_lines
Created Nov 18, 2013
Remove empty lines at the end of file.
View remove_lines
#!/bin/bash
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%)
@mvasilkov
mvasilkov / replace.py
Created Nov 6, 2013
Helper tool for Box2D-HTML5 conversion. Fucking kill Google, one Closure Library at a time.
View replace.py
import re
import sys
def replacer_pro(match):
print match.group(1)
parts = match.group(1).split('.')
init_code = ''
cur = ''
for part in parts:
if cur:
View gist:7288702
/(?:GLAPI\b)(.*?)(?:GL)?APIENTRY(.*?)\((.*?)\)/
@mvasilkov
mvasilkov / pcat
Created Nov 2, 2013
pcat: patch cat
View pcat
#!/bin/bash
sed -E 's/[[:<:]]SetXYZ?[[:>:]]/Set/g' "$@"
@mvasilkov
mvasilkov / rts
Last active Dec 27, 2015
RTS: remove trailing spaces
View rts
#!/bin/bash
find . -not \( -name CVS -prune -or -name .git -prune \) -type f -print0 \
|xargs -0 sed -Ei '' 's/[[:space:]]{1,}$//'
@mvasilkov
mvasilkov / require.py
Last active Dec 19, 2015
Helper tool for Box2D-HTML5 conversion. Fucking kill Google, one Closure Library at a time.
View require.py
import re
import sys
def wrap(filename):
print(filename)
with open(filename) as f:
text = f.read()
ms = re.findall(r"goog\.require\('(.+?)'\)", text)
if not ms:
ms = ['box2d']
View server.json
{
"apache": {
"process": "/usr/sbin/httpd",
"start": "sudo apachectl start",
"stop": "sudo apachectl stop"
},
"mysql": {
"process": "/usr/local/Cellar/mysql/5.6.12/bin/mysqld",
"start": "mysql.server start > /dev/null",
"stop": "mysql.server stop > /dev/null"
You can’t perform that action at this time.