Skip to content

Instantly share code, notes, and snippets.

Avatar
🚲

Vlad Derzhavin avevlad

🚲
View GitHub Profile
View gist:8d0e773a1a22e8f9d2d1f404b66fb1b3
No such command: fake_command
Commands:
build Build or rebuild services
config Validate and view the Compose file
create Create services
down Stop and remove containers, networks, images, and volumes
events Receive real time events from containers
exec Execute a command in a running container
help Get help on a command
View gist:1166a43e448fd007c10dca3e813c0be2
No such command: dasd
Commands:
build Build or rebuild services
config Validate and view the Compose file
create Create services
down Stop and remove containers, networks, images, and volumes
events Receive real time events from containers
exec Execute a command in a running container
help Get help on a command
@avevlad
avevlad / gist:dc8ba65c8e5b5367f879
Created October 19, 2015 17:00 — forked from ctcarrier/gist:9918087
Joda DateTime Serializer for ReactiveMongo
View gist:dc8ba65c8e5b5367f879
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
View YearOrderIncomeReport.scala
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 ]
}
View fuck_bem.js
[].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;
});