This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
X = features.values | |
y = df["target"].values | |
# use a full grid over all parameters | |
param_grid = { | |
"max_depth": [3, None], | |
"max_features": [1, 3, 10, 100, 1000], | |
"min_samples_split": [1, 3, 10], | |
"min_samples_leaf": [1, 3, 10], | |
"bootstrap": [True, False], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.actor.ActorSystem | |
import akka.stream.FlowMaterializer | |
import akka.stream.scaladsl._ | |
import org.reactivestreams.Publisher | |
import scala.concurrent.Future | |
import scala.util.Try | |
object AkkaStreamOnComplete extends App { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def by_user(user) | |
questions_map(user.audiences.flat_map {|audience| by_audience(audience) }) | |
end | |
def by_audience(audience) | |
begin | |
audience.option_codes.uniq | |
rescue | |
[] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.actor.{Props, ActorLogging, Actor, ActorSystem} | |
import akka.stream.FlowMaterializer | |
import akka.stream.actor.ActorSubscriberMessage.OnNext | |
import akka.stream.scaladsl.Source | |
import akka.util.Timeout | |
import scala.concurrent.Future | |
import scala.concurrent.duration._ | |
object StreamFutureApp extends App { | |
implicit val system = ActorSystem("StreamFuture") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.actor.{Props, ActorLogging, Actor, ActorSystem} | |
import akka.stream.FlowMaterializer | |
import akka.stream.actor.ActorSubscriberMessage.OnNext | |
import akka.stream.scaladsl.Source | |
import akka.util.Timeout | |
import scala.concurrent.Future | |
import scala.concurrent.duration._ | |
object StreamFutureApp extends App { | |
implicit val system = ActorSystem("StreamFuture") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Author: Nikita Kovalev, https://gist.github.com/maizy/c4d31c1f539694f721f6 | |
# Based on: https://gist.github.com/visenger/5496675 | |
# Use java7 dependency (openjdk) instead of java6. | |
# Tested in Ubuntu 12.04.5 (precise) | |
SCALA="2.11.2" | |
SBT="0.13.5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'yaml' | |
class Host | |
attr_reader :uri | |
def initialize(uri, port, username, password) | |
@uri = uri | |
@port = port |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "#update" do | |
subject { response } | |
let(:attributes) { stub('attributes') } | |
def do_put | |
put :update, :id => user.id, :user => attributes, :format => format | |
end | |
def expect_user_update_attributes_and_return(result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Outher throwin class, Class.new | |
DayTimeInvalidStringFormat = Class.new(RuntimeError) | |
class DayTime | |
... | |
end | |
begin | |
day_time = DayTime.from_s('11:00') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
/* | |
* GHOST | |
* Simple dependency management for JavaScript. | |
*/ | |
var Ghost = { | |
/* | |
* List of registered modules, which can be loaded with require() call. | |
*/ |
NewerOlder