Skip to content

Instantly share code, notes, and snippets.

View avevlad's full-sized avatar
🚲

Vlad Derzhavin avevlad

🚲
View GitHub Profile
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
freopen("apbtest.in", "r", stdin);
freopen("apbtest.out", "w", stdout);
@avevlad
avevlad / 4103.cpp
Last active December 26, 2015 14:59
Римские числа http://www.e-olimp.com/problems/4103
#include <iostream>
#include <string>
unsigned getDecimal(char val)
{
switch (val) {
case 'I': return 1;
case 'V': return 5;
case 'X': return 10;
case 'L': return 50;
#include <iostream>
using namespace std;
int main()
{
#ifdef _DEBUG
freopen("input.txt", "r",stdin);
freopen("output.txt", "w",stdout);
#endif
var dbg = false;
var obj = {
I: 1,
V: 5,
X: 10,
L: 50,
C: 100,
D: 500,
M: 1000
};
@avevlad
avevlad / gist:dc8ba65c8e5b5367f879
Created October 19, 2015 17:00 — forked from ctcarrier/gist:9918087
Joda DateTime Serializer for ReactiveMongo
import reactivemongo.bson.{BSONHandler, BSONDateTime, Macros}
import org.joda.time.format.ISODateTimeFormat
import org.joda.time.{DateTime, DateTimeZone}
package object myApp {
DateTimeZone.setDefault(DateTimeZone.UTC)
implicit object BSONDateTimeHandler extends BSONHandler[BSONDateTime, DateTime] {
val fmt = ISODateTimeFormat.dateTime()
def read(time: BSONDateTime) = new DateTime(time.value)
@avevlad
avevlad / YearOrderIncomeReport.scala
Created October 8, 2015 20:43 — forked from yujikiriki/YearOrderIncomeReport.scala
ReactiveMongo aggregation pipeline example
private def query( ): Future[ List[ JsObject ] ] = {
val group: Group = Group( BSONString( "$order.year" ) )( ("total", SumField( "value" )) )
val pipeline: Seq[ PipelineOperator ] = Seq( group )
val command: Future[ Stream[ BSONDocument ] ] = db.command( Aggregate( "opportunities", pipeline ) )
command map {
c =>
c.toList map {
d =>
toJSON( d ).asInstanceOf[ JsObject ]
}
[].slice.call(document.querySelectorAll('[class]')).map(function (node) {
return node.className
}).sort(function (a, b) {
return b.length - a.length
}).slice(0, 50).map(function (elem) {
console.log(elem);
return elem;
});

Keybase proof

I hereby claim:

  • I am AveVlad on github.
  • I am vld (https://keybase.io/vld) on keybase.
  • I have a public key whose fingerprint is 4E31 484B 8B71 105E 9294 95B1 643D CA5E D5FF 11BD

To claim this, I am signing this object:

debug_google_events();
var $window = $(window);
$window.on('scroll', function() {
var scrollTop = $window.scrollTop();
console.log(scrollTop);
});