Skip to content

Instantly share code, notes, and snippets.

View cs-victor-nascimento's full-sized avatar

Victor Oliveira Nascimento cs-victor-nascimento

View GitHub Profile
@cs-victor-nascimento
cs-victor-nascimento / benchee_result
Created January 17, 2018 21:14
An Elixir benchmarking story - final benchee result
warning: redefining module :base64url (current version loaded from _build/bench/lib/base64url/ebin/base64url.beam)
lib/joken/base64url.ex:1
Generated joken app
Operating System: Linux
CPU Information: Intel(R) Core(TM) i7-4510U CPU @ 2.00GHz
Number of Available Cores: 4
Available memory: 15.55 GB
Elixir 1.6.0-rc.1
Erlang 20.2
@cs-victor-nascimento
cs-victor-nascimento / base64url.ex
Created January 17, 2018 21:12
An Elixir benchmarking story - base64url
defmodule :base64url do
def encode(term) when is_binary(term),
do: Base.url_encode64(term, ignore: :whitespace, padding: false)
def encode(term) when is_list(term), do: :erlang.iolist_to_binary(term) |> encode()
def decode(term) when is_binary(term),
do: Base.url_decode64!(term, ignore: :whitespace, padding: false)
def decode(term) when is_list(term), do: :erlang.iolist_to_binary(term) |> decode()
@cs-victor-nascimento
cs-victor-nascimento / fprof1
Last active January 17, 2018 21:11
An Elixir benchmarking story - fprof1
Warmup...
Reading trace data...
..
End of trace!
Processing data...
Creating output...
Done!
CNT ACC (ms) OWN (ms)
Total 1345 3.234 3.165
// Instrumented test
@RunWith(AndroidJUnit4::class)
class UniverseTest {
@Test fun assertSmt() {
Assert.assertTrue(Universe.isInfinite())
}
}
// Local test
class AnotherUniverseTest {
@cs-victor-nascimento
cs-victor-nascimento / test-butler.gradle
Created February 16, 2017 23:45
Test Butler pseudo-plugin for downloading the APK and installing in your emulators on demand if needed
/*
This plugin assumes you have a folder 'tools' in the root dir of your project.
To use this you need to first apply it in your project like:
apply from: "$rootDir/tools/test-butler.gradle // or the location of this file
And then have a property in the extra properties of your root build.gradle with the
TestButler version like:
public class LocalTest {
@Rule
public final RequestMatcherRule serverRule = new LocalTestRequestMatcherRule();
@Before
public void setUp() {
// Setup your application to point to this rootUrl
final HttpUrl rootUrl = serverRule.url("/");
public void test() throws Exception {
// Create a MockWebServer. These are lean enough that you can create a new
// instance for every unit test.
MockWebServer server = new MockWebServer();
// Schedule some responses.
server.enqueue(new MockResponse().setBody("hello, world!"));
server.enqueue(new MockResponse().setBody("sup, bra?"));
server.enqueue(new MockResponse().setBody("yo dog"));
public interface SomeServiceApi {
@GET("somepath")
Call<ListOfResults> getSomething();
@POST("somepath")
Call<Result> createResult(@Body Result result);
}
;;; package -- Emacs Configuration
;;;
;;; Commentary:
;;; My Personal quirks for emacs
;;;
;;; Code:
;; Enable full screen on open
(custom-set-variables
'(initial-frame-alist (quote ((fullscreen . maximized)))))