This file contains hidden or 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 std::sync::{Arc, Mutex}; | |
| use std::sync::mpsc::SyncSender; | |
| use std::marker::PhantomData; | |
| use iron::prelude::*; | |
| use iron::{BeforeMiddleware, typemap, Request}; | |
| use workers::MetricWriterCommand; |
This file contains hidden or 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
| #[derive(Debug, Deserialize)] | |
| #[serde(default)] | |
| pub struct Theme { | |
| /// Colors used to highlight nicks | |
| pub nick_colors: [u8; 13], | |
| pub clear: Style, | |
| pub user_msg: Style, | |
| pub err_msg: Style, | |
| pub topic: Style, | |
| pub cursor: Style, |
This file contains hidden or 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
| # servers to auto connect | |
| servers: | |
| - addr: irc.mozilla.org | |
| port: 6667 | |
| hostname: freenode | |
| colors: | |
| user_msg: | |
| fg: black | |
| bg: default |
This file contains hidden or 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
| #[macro_export] | |
| macro_rules! retry { | |
| ( @create_multiple_runner $timeout:expr, $started_at:expr, $( $name:ident: $type:ty => $block:expr ),+ ) => { | |
| { | |
| let resources = Resources { | |
| $( | |
| $name: retry!(@create_runner $timeout, $started_at, $block) | |
| ),+ | |
| }; |
This file contains hidden or 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
| pub fn remove_child(&mut self, child: &Box<View>) -> Option<Box<View>> | |
| { | |
| match self.children.iter().position(|v| ptr::eq(v, child)) { | |
| Some(index) => Some(self.children.remove(index)), | |
| None => None | |
| } | |
| } |
This file contains hidden or 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 std::collections::BTreeMap; | |
| use iron::prelude::*; | |
| use iron::{BeforeMiddleware, typemap}; | |
| use params::Params; | |
| use serde_json; | |
| use models::Payload; |
This file contains hidden or 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 rusqlite; | |
| extern crate app_dirs; | |
| extern crate libc; | |
| use rusqlite::{Connection, Statement}; | |
| use app_dirs::*; | |
| use std::fs::{File}; | |
| use std::io::prelude::*; | |
| use std::sync::mpsc::channel; | |
| use std::sync::mpsc::{Sender, Receiver}; |
This file contains hidden or 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
| import requests | |
| instance_url = 'https://mastodon.cloud' | |
| api_base_url = instance_url + '/api/v1' | |
| # final url is https://mastodon.cloud/api/v1/instance | |
| def get_instance_info(): | |
| req = requests.get(api_base_url + '/instance') | |
| return req.json() |
This file contains hidden or 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
| CREATE TABLE "Measures" ( | |
| key text, | |
| created_at timestamp, | |
| updated_at timestamp, | |
| version = timestamp, | |
| start_date text, | |
| end_date text, | |
| unit text, | |
| target varint, | |
| target_type text, |
This file contains hidden or 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
| def list() = { | |
| println(s"-------------------Domain ID: $domainId") | |
| val dashboardKeys = for { | |
| row <- session.execute(GET_DASHBOARD_IDS, domainId.toString).all.asScala | |
| dashboardId <- Option(row.getString("dashboardId")) | |
| key = s"$domainId-$dashboardId" | |
| } yield key | |
| println("---------------------Dashboard keys:") | |
| println(dashboardKeys.toList) |