Skip to content

Instantly share code, notes, and snippets.

View avevlad's full-sized avatar
🚲

Vlad Derzhavin avevlad

🚲
View GitHub Profile
@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);
});
VAGRANTFILE_API_VERSION = "2"
DB_TYPE = "mysql" # postgresql/sqlite
DB_ROOT_PWD = "root"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "private_network", ip: "10.10.10.10"
Selecting previously unselected package libaio1:amd64.
(Reading database ... 26944 files and directories currently installed.)
Preparing to unpack .../libaio1_0.3.109-4_amd64.deb ...
Unpacking libaio1:amd64 (0.3.109-4) ...
Selecting previously unselected package libdbi-perl.
Preparing to unpack .../libdbi-perl_1.630-1_amd64.deb ...
Unpacking libdbi-perl (1.630-1) ...
Selecting previously unselected package libdbd-mysql-perl.
Preparing to unpack .../libdbd-mysql-perl_4.025-1_amd64.deb ...
Unpacking libdbd-mysql-perl (4.025-1) ...
; Start a new pool named 'www'.
; the variable $pool can we used in any directive and will be replaced by the
; pool name ('www' here)
[www]
; Per pool prefix
; It only applies on the following directives:
; - 'slowlog'
; - 'listen' (unixsocket)
; - 'chroot'
@avevlad
avevlad / OKAY
Last active August 29, 2015 14:05
1123
libssl1.0.0:amd64 install
libssl1.0.0:i386 install
libstdc++-4.9-dev:amd64 install
libstdc++5:i386 install
libstdc++6:amd64 install
libstdc++6:i386 install
libsvga1:i386 install
libswitch-perl install
libsybdb5:amd64 install
libsysfs2:amd64 install