Skip to content

Instantly share code, notes, and snippets.

@kulikov
kulikov / 0_reuse_code.js
Created June 2, 2014 11:26
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
diff --git a/src/app/panels/table/module.html b/src/app/panels/table/module.html
index b1aa49f..515ba06 100644
--- a/src/app/panels/table/module.html
+++ b/src/app/panels/table/module.html
@@ -52,6 +52,24 @@
padding: 10px;
border: 1px solid #666;
}
+ .table-field-level-error {
+ border-radius: 3px;
l = ["1", "32", "hello", "3", "my 43"]
return [int(_) for _ in filter(lambda _: _.isdigit(), l)]
val timeout = new TimeValue(600000)
val requestBuilder = client
.prepareSearch(index)
.setTypes(indexType)
.setSize(size.getOrElse(5000))
.setScroll(timeout)
.setSearchType(SearchType.SCAN)
query foreach requestBuilder.setQuery
package com.digsolab.euler.util.format
import org.scalatest.FlatSpec
import org.scalatest.matchers.MustMatchers
import com.fasterxml.jackson.annotation.JsonInclude
import com.fasterxml.jackson.annotation.JsonInclude.Include
case class Person(name: String, age: Int)
@kulikov
kulikov / .zshrc
Last active January 2, 2016 19:19
ZSH=$HOME/.oh-my-zsh
ZSH_THEME="robbyrussell"
plugins=(osx brew git sbt bower)
source $ZSH/oh-my-zsh.sh
PROMPT='%{$fg[yellow]%}➤%{$fg_bold[green]%}%p %{$fg[cyan]%}%c $ % %{$reset_color%}'
---
- name: install supervisord
apt: pkg=supervisor state=present
- name: add nsq group
group: name=nsq
- name: add nsq user
user: name=nsq group=nsq
def series(items: List[Int]) {
if (items.nonEmpty) {
Future {
doHeavyWork(items.head)
} onComplete {
case res =>
// handler results
series(items.tail)
}
object ScaleFactor {
val T1MicroSpeed = 10.0
def calcNeedInstances(avgSpeed: Int, queueSize: Int): Int = {
val taskPerHour = avgSpeed * 3600
val maxInstances = math.ceil(avgSpeed / T1MicroSpeed)
queueSize / taskPerHour.toDouble match {
case h if h < 1 math.ceil(maxInstances * h).toInt
object Solution extends App {
val bf = Array.newBuilder[String]
(1 to Console.readLine().toInt)
.map(_ => Console.readLine())
.foreach(s => println(calc(s)))
@annotation.tailrec
def sum(n: Int, res: Int = 0): Int = if (n <= 0) res else sum(n - 1, res + n)