Skip to content

Instantly share code, notes, and snippets.

Oren Ben-Kiki orenbenkiki

Block or report user

Report or block orenbenkiki

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
orenbenkiki /
Last active Aug 12, 2019
Plotly Dash Fast Large Heatmap
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import plotly.graph_objs as go
import pandas as pd
import numpy as np
from math import ceil
from math import floor
orenbenkiki /
Last active Dec 20, 2015
macro_export not working?
mod code {
use macros; // compiler warning: unused import :-(
fn asserts() {
assert_eq!(1, 1);
assert_ne!(1, 2); // compiler error: macro undefined :-(
View Upgrade read lock to write lock - take 1
/// Intern a string using the task local interner.
pub fn intern(burrowed: &str) -> Intern {
do local_data::get(KEY_ARC_INTERNER) |maybe_arc_interner| {
match maybe_arc_interner {
None => fail!("no task local ARC for global interner"),
Some(arc_interner) => {
// TRICKY: Only obtain a read lock for the common case
// where the string was previously interned.
do |interner| {
match interner.str_to_intern.find(&burrowed.to_str()) {
View Errors
src/anthill/ 73:25 error: instantiating a type parameter with an incompatible type `intern::intern::Interner`, which does not fulfill `Send+Freeze`
src/anthill/ do |interner| {
src/anthill/ interner.id_to_str[].clone()
src/anthill/ }
src/anthill/ 108:21 error: instantiating a type parameter with an incompatible type `intern::intern::Interner`, which does not fulfill `Send+Freeze`
src/anthill/ do |interner| {
src/anthill/ match interner.str_to_intern.find(&burrowed.to_str()) {
src/anthill/ Some(intern) => *intern,
src/anthill/ None => {
src/anthill/ // TRICKY: If we didn't find it above, we need
View Shell Results
$ rustc --lib src/atom/
src/anthill/ 5:5 warning: missing documentation for a struct
src/anthill/ pub struct Atom {
src/anthill/ priv id: int,
src/anthill/ }
src/anthill/ 4:18 note: lint level defined here
src/anthill/ #[warn(missing_doc)]
warning: missing crate link meta `name`, using `crate` as default
warning: missing crate link meta `vers`, using `0.0` as default
orenbenkiki / gist:5189329
Created Mar 18, 2013
Enhanced mix cover (generate index.html, and more)
View gist:5189329
defmodule Mix.Tasks.Test do
use Mix.Task
@shortdoc "Run a project's tests"
@moduledoc """
Run the tests for a project.
This task will preload the `test/test_helper.exs` which
should do all testing setup and then require all files
orenbenkiki / enhanced_extension.ex
Last active Oct 7, 2019
Elixir module inheritance
View enhanced_extension.ex
defmodule Extension do
defmacro extends(module) do
# As above...
defmacro implements(module, protocol: protocol) do
quote do
defimpl unquote(protocol), for: unquote(module) do
import Extension
orenbenkiki / http.ex.patch
Created Feb 23, 2013
Patch expm http.ex to pass http proxy settings to hackney
View http.ex.patch
diff --git a/lib/repositories/http.ex b/lib/repositories/http.ex
index 2dae690..bdb1ece 100644
--- a/lib/repositories/http.ex
+++ b/lib/repositories/http.ex
@@ -9,7 +9,7 @@ defrecord Expm.Repository.HTTP, url: "", username: nil, password:
{"accept", "text/html"},
{"user-agent", "expm/#{Expm.version}"},
- "", [follow_redirect: true, force_redirect: true])
+ "", Expm.Repository.HTTP.Decoder.proxy(follow_redirect: true, force_redirect: true))
orenbenkiki / gist:4027328
Created Nov 6, 2012
lein autodoc can't find "sh"
View gist:4027328
Exception in thread "main" java.lang.IllegalAccessError: sh does not exist
at clojure.core$refer.doInvoke(core.clj:3778)
at clojure.lang.RestFn.applyTo(
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$load_lib.doInvoke(core.clj:5279)
at clojure.lang.RestFn.applyTo(
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$load_libs.doInvoke(core.clj:5298)
at clojure.lang.RestFn.applyTo(
at clojure.core$apply.invoke(core.clj:605)
You can’t perform that action at this time.