Skip to content

Instantly share code, notes, and snippets.

View anowell's full-sized avatar

Anthony Nowell anowell

View GitHub Profile
@anowell
anowell / ui-variables.less
Created February 15, 2023 22:16
MailSpring UI-Darkside Crea Theme
// All themes need a file called `ui-variables` that extends from the base
// variables and overrides colors, padding, etc. Other plugins import
// `ui-variables` to make their custom CSS react to the current theme.
@import 'base/ui-variables';
@goldenrod: #e8aa14;
@sapphire: #006494;
@magenta: #bf1363;
@onyx: #404040;
@anowell
anowell / git-ship
Last active May 29, 2020 07:32
A git script to accommodate my workflow of merging (or rebasing) a particular feature branch into master: pull master, optionally rebase the feature branch, merge back to master, push, and finally remove branch.
#!/bin/sh
#
# My workflow:
# git checkout -b myfeature
# ...edit stuff...git commit...edit stuff...git commit...ready to ship...
# git ship myfeature -rpd
#
# It exits if the merge or rebase requires intervention,
# for merge: fix the conflict, commit the merge, and re-run the git ship command
# for rebase: clean up the conflict, run `git rebase --continue` and then re-run the git ship command
@anowell
anowell / main.rs
Last active April 24, 2019 18:00
Rust Algo Example
use algorithmia::prelude::*;
use serde::{Serialize, Deserialize};
use std::error::Error;
#[derive(Deserialize)]
pub struct Input { name: String }
#[derive(Serialize)]
struct Output { msg: String }
@anowell
anowell / lib.rs
Last active April 17, 2019 17:46
Rust Algo Example 2
use algorithmia::prelude::*;
use serde::{Serialize, Deserialize};
use std::error::Error;
#[derive(Deserialize)]
pub struct Input { name: String }
#[derive(Serialize)]
struct Output { msg: String }
@anowell
anowell / benchmarks
Last active June 13, 2018 23:09
bench iterators and loops of Zip-Map-Sum
(Benchmark disclaimers apply. Don't trust the numbers without double checking my code.)
Scala (functional): 697,099 ns/iter
Scala (for loop): 20,467 ns/iter
Rust (functional): 4,984 ns/iter
Rust (for loop): 4,983 ns/iter // Note: this required adding assertions to prevent bounds checking
C (for loop): 6,172 ns/iter // Note: this used -O2 optimization
@anowell
anowell / Cargo.toml
Last active April 29, 2018 08:13
Calculating equity positions
[dependencies]
csv = { git = "https://github.com/BurntSushi/rust-csv.git" } #"1.0.0-beta.6"
serde = "1.0.38"
serde_derive = "1.0.38"
chrono = { verstion = "0.4.2", features = ["serde"] }
decimal = "2.0.4"
@anowell
anowell / current.rs
Last active September 7, 2017 17:58
Quasar codegen idea
// Current example without codegen
impl Component for TodoList {
fn onload(view: &View<Self>) {
view.query("button").expect("missing todo list button")
.on(EventType::Click, |mut evt| {
match evt.app.query("#message") {
Some(node) => {
let item = TodoItem::new(&node.get("value"));
evt.binding.data_mut().items.push(item);
}
@anowell
anowell / Cargo.toml
Last active February 12, 2017 04:27
My preferred rust template for Algorithmia algorithms
# You'll need at least these dependencies
[dependencies]
algorithmia = "2.0.0"
base64 = "0.3.0"
serde = "0.9.0"
serde_derive = "0.9.0"
serde_json = "0.9.0"
error-chain = "0.9.0"
@anowell
anowell / todo.rs
Last active January 23, 2017 19:24
Quasar To Do Concept (using maud templating)
use quasar::*;
struct TodoItem {
label: String,
complete: bool,
}
struct TodoList {
items: Vec<TodoItem>,
}
@anowell
anowell / random-filters.rb
Last active December 21, 2016 20:53
Apply random deep style filters to a bunch of images
#!/usr/bin/env ruby
#
# Takes an arbitrary number of files as arguments
# and randomly generates PER_IMAGE filtered versions
# of each image while using each filter an equal
# number of times (approx).
#
# It uses batch inputs to minimize API calls,
# but still expect at least 1 API call per filter
#