This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate libwkhtmltox_sys as libwkhtmltox; // https://github.com/anowell/libwkhtmltox-sys | |
use libwkhtmltox::*; | |
use std::ffi::{CString, CStr}; | |
use std::os::raw::{c_char, c_int, c_uchar}; | |
unsafe extern fn finished_callback(converter: *mut wkhtmltopdf_converter, val: c_int) { | |
println!("finished_callback: {}", val); | |
// Read the PDF output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(test)] | |
extern crate serde_json; | |
extern crate json; | |
extern crate test; | |
#[cfg(test)] | |
mod tests { | |
use json::{self, JsonValue}; | |
use serde_json::{self, Value}; | |
use test::Bencher; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Example usage: | |
Note: in all of these cases, the return value must be `Result<T, E>` where: | |
- `T` has a conversion to `AlgoOutput` (e.g. String, Vec<u8>, JsonValue, (), or anything Serializeable) | |
- `E` has a conversion to `Box<Error>` (e.g. String or any custom type that `impl Error`) | |
-------------Text----------------------- | |
algo_entrypoint! { text => hello } | |
fn hello(input: &str) -> Result<String, String> { | |
Ok(format!("Hello {}", input)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user nginx; | |
worker_processes 1; | |
error_log /var/log/nginx/error.log warn; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
function die { | |
echo >&2 $1 | |
exit 1 | |
} | |
command -v algo >/dev/null 2>&1 || die "Have you installed the Algorithmia CLI" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use quasar::*; | |
struct TodoItem { | |
label: String, | |
complete: bool, | |
} | |
struct TodoList { | |
items: Vec<TodoItem>, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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" |