Skip to content

Instantly share code, notes, and snippets.

View maxov's full-sized avatar

Max Ovsiankin maxov

View GitHub Profile
@maxov
maxov / perms.py
Created January 10, 2015 09:08
perms
from django.db.models import Q, F
from perms.spaces import QueryPermissionSpace
from repo.models import Project
space = QueryPermissionSpace()
@space.query_resolver('project.*')
def resolve_project_perms(perm, user):
return Project.objects.filter(
@maxov
maxov / query.sql
Last active August 29, 2015 14:12
SELECT
"repo_namespace"."id",
"repo_namespace"."name",
"repo_repouser"."namespace_ptr_id",
"repo_repouser"."password",
"repo_repouser"."last_login",
"repo_repouser"."is_superuser",
"repo_repouser"."email",
"repo_repouser"."is_staff",
"repo_repouser"."is_active",
@maxov
maxov / -
Created December 31, 2014 23:07
# All colors must be in the form of '#rrggbb' or '#rgb'.
# You cannot use color names.
log-view:
nickname-format: '%n'
scroller-highlight-color: '#f0f'
input-text:
font-family: 'Lucida Grande'
font-size: 13.0
background-color: '#fff'
@maxov
maxov / -
Created December 31, 2014 23:07
html {
font-family: 'Lucida Grande';
font-size: 9pt;
background-color: #f7f7f7;
color: #000;
word-wrap: break-word;
margin: 0;
padding: 0;
}
$ sphinx-intl update-txconfig-resources --pot-dir ../build/locale --transifex-project-name sponge-docs | gist
Traceback (most recent call last):
File "/usr/local/bin/sphinx-intl", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/site-packages/sphinx_intl/commands.py", line 576, in main
run(sys.argv[1:])
File "/usr/local/lib/python2.7/site-packages/sphinx_intl/commands.py", line 568, in run
commands[cmd](options)
File "/usr/local/lib/python2.7/site-packages/sphinx_intl/commands.py", line 157, in __call__
return self.function(**kwargs)
@maxov
maxov / -
Created December 25, 2014 19:40
sphinx-intl update -p ../build/locale -l bn -l de -l fa -l hr -l ja -l mk -l pl -l si -l tr -l zh_TW -l ca -l es -l fi -l hu -l ko -l nb_NO -l pt_BR -l sk -l uk_UA -l cs -l et -l fr -l id -l lt -l ne -l pt_PT -l sl -l vi -l da -l eu -l he -l it -l lv -l nl -l ru -l sv -l zh_CN
23:02 gratimax: turt2live: ehh
23:02 gratimax: here's a very high-level overview of docker:
23:03 gratimax: it uses libcontainer, which allows you to run virtual linux containers with very little overhead
23:03 gratimax: now, it has images which are very much like git commits - they're versions of an entire machine with filesystem and OS and such
23:03 gratimax: we "run" an image to get a container, which is like the VM
23:04 gratimax: but here's the really cool thing
23:04 gratimax: you can pull an image from the docker repository(takes a few minutes), but then running containers out of it takes seconds
23:04 gratimax: so there's no "building" if you already have an image that you want to run
23:05 gratimax: however, you will probably use a Dockerfile to build a new image to run your PRs in, but after the image is built you can deploy it to the docker hub and spin up containers very easily
23:06 gratimax: vagrant does some similar stuff, but it does use a VM which I consider as unecessary overhead compared t
abstract class Equation {
abstract double get(double x);
public Equation compose(Equation that) {
return new Equation {
double get(double x) {
this.get(that.get(x));
}
}
@maxov
maxov / -
Created December 13, 2014 05:33
var gulp = require('gulp');
var gutil = require('gulp-util');
var bower = require('main-bower-files');
var rimraf = require('gulp-rimraf');
var uglify = require('gulp-uglify');
var minify = require('gulp-minify-css');
var concat = require('gulp-concat');
var templates = require('gulp-jade');
var nodemon = require('gulp-nodemon');
var stylus = require('gulp-stylus');
@maxov
maxov / -
Created December 9, 2014 06:49
--- file1.txt
+++ file2.txt
@@ -1,6 +1,6 @@
a
-b
+banana
+added
c
-d
-e