Skip to content

Instantly share code, notes, and snippets.

@mvasilkov
mvasilkov / cemetery.sh
Created July 13, 2012 08:27
Shell commands cemetery ^^
for i in `cat ~/Documents/icons8.txt`; do find . -name "$i" -exec mv {} ~/Projects/icons8/ \;; done
@mvasilkov
mvasilkov / Makefile
Created September 6, 2012 08:32
Makefile for Tako Neko :3
vx:
virtualenv vx
requirements: vx
vx/bin/pip install -r requirements.txt
test_modules = main users
test:
vx/bin/python manage.py test $(test_modules) -v2 --failfast
@mvasilkov
mvasilkov / foo.js
Created October 1, 2012 21:54
TypeScript as a JS pretty print tool
/* Original code */
var s = 'foo.bar', im = new Image
im.src = s; s = im.src
console.log(s)
/* TypeScript output */
var s = 'foo.bar';
var im = new Image();
@mvasilkov
mvasilkov / test.js
Created October 2, 2012 08:56
QUnit test with RequireJS (partial)
define(['events'], function(events) {
module('events.js')
test('Basic methods', function() {
// `register` and `bind`
var str = 'Life is beautiful'
events.register('str_replace')
events.bind('str_replace', function() { str = str.replace('Life', 'Flower') })
@mvasilkov
mvasilkov / requestAnimationFrame.js
Created October 23, 2012 09:12
requestAnimationFrame.js
/*
requestAnimationFrame polyfill, by Mark Vasilkov
http://careers.stackoverflow.com/mvasilkov
Released into the public domain.
*/
if (typeof requestAnimationFrame === "undefined") {
["moz", "webkit", "ms"].some(function(p) {
var fun = this[p + "RequestAnimationFrame"]
if (typeof fun === "function") {
return requestAnimationFrame = fun
@mvasilkov
mvasilkov / failsystem.js
Created October 25, 2012 15:47
FAILSYSTEM lol
function everythingIsRuinedForever(error) {
console.log(error)
}
- function(filename) {
var quota = 1 << 24
webkitStorageInfo.requestQuota(PERSISTENT, quota, function(bytes) {
webkitRequestFileSystem(PERSISTENT, bytes, function(fs) {
console.log(fs.name)
var obj = function() {}
obj.prototype.f = function(name) { if (this[name] === void 0) this[name] = new obj; return this[name] }
obj.prototype.get = function(name) { return this[name] }
obj.prototype.set = function(name, value) { this[name] = value }
// Usage:
var x = new obj
x.f("file").f("document").f("properties").set("т прнс?", true)
@mvasilkov
mvasilkov / baka.conf
Created February 7, 2013 19:38
./comment.sh baka.conf sendsms-user
group = core
admin-port =
admin-password =
log-file = "/var/log/kannel/bearerbox.log"
log-level = 3
status-password =
access-log = "/var/log/kannel/access_kannel.log"
store-location = "/var/log/kannel/store_sms"
smsbox-port =
# dlr-storage = mysql
{
"jam": {
"packageDir": "media/lib",
"baseUrl": "media",
"dependencies": {
"jquery": null,
"raphael": null
}
}
}
@mvasilkov
mvasilkov / array2d.c
Last active December 14, 2015 08:39
This is a demo of 2D arrays in C written for my (imaginary) friend.
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char const *argv[])
{
int **array2d, n, i, j;
puts("Enter a number:");
scanf("%d", &n);
puts("Thank you, kind sir.");