Skip to content

Instantly share code, notes, and snippets.

View sidonath's full-sized avatar
🐈
Petting cats

Damir Zekic sidonath

🐈
Petting cats
View GitHub Profile
// is the other bird within a certain distance
def within(dist: Float) = { other: Boid =>
val d = loc distance other.loc
d > 0 && d < dist
}
// Sum, and divide by size
def avg(l: List[Vector]) = (l :\ new Vector)(_ + _) / (l.size max 1)
// Separation
@sidonath
sidonath / keybase.md
Created October 27, 2014 07:10
My identity proof @ Keybase

Keybase proof

I hereby claim:

  • I am sidonath on github.
  • I am sidonath (https://keybase.io/sidonath) on keybase.
  • I have a public key whose fingerprint is 4717 804E 7261 B3B0 670F 2C60 7D14 BE56 5E2F 6DCA

To claim this, I am signing this object:

@sidonath
sidonath / README.md
Last active August 29, 2015 14:20
Generate reports from Slack logs

Put JSON files with Slack logs into the data directory and save the Ruby script outside that directory.

Open Terminal and cd into the directory with the Ruby script. Now type:

ruby parse_logs.rb

You should get output directory with reports in CSV.

#!/usr/bin/env ruby
require 'benchmark'
def add_methods_to_a_module(m)
1_000.times.map do |i|
method_name = "method_#{i}"
m.__send__(:define_method, method_name) {}
method_name
end
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="rspec" tests="9" failures="6" errors="0" time="0.001972" timestamp="2017-06-13T18:46:48+09:00">
<properties>
<property name="seed" value="12345"/>
</properties>
<testcase classname="spec.example_spec" name="some example specs should be pending" file="./spec/example_spec.rb" time="0.000106"><skipped/></testcase>
<testcase classname="spec.example_spec" name="some example specs escapes &lt;html tags=&apos;correctly&apos; and=&quot;such &amp;amp; such&quot;&gt;" file="./spec/example_spec.rb" time="0.000458"><failure message="
expected: &quot;&lt;p&gt;This is &lt;strong&gt;very&lt;/strong&gt; important&lt;/p&gt;&quot;
got: &quot;&lt;p&gt;This is important&lt;/p&gt;&quot;
@sidonath
sidonath / install-chromedriver.sh
Last active May 31, 2019 11:24
Install latest compatible ChromeDriver on SemaphoreCI
#!/bin/bash
set -e
INSTALLED_CHROME_VERSION=$(apt-cache policy google-chrome-stable | grep Installed | egrep -o '[[:digit:]]+' | head -n1)
CHROMEDRIVER_VERSION=$(curl https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$INSTALLED_CHROME_VERSION)
# Download ChromeDriver into Semaphore's cached directory if it doesn't exist already
if ! [ -e $SEMAPHORE_CACHE_DIR/chromedriver-$CHROMEDRIVER_VERSION ]; then
mkdir -p $SEMAPHORE_CACHE_DIR/chromedriver-$CHROMEDRIVER_VERSION