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
abstract class Parsec::Parser(T) | |
getter error_message | |
def initialize | |
@is_satisfied = false | |
@is_failed = false | |
@cargo = "" | |
@error_message = "" | |
end |
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
get "/users/:id{Int32}", do |env, id| | |
# id here Int32 | |
# if :id couldn't parsed as Int32 an error thrown or 404 | |
puts "#{id + 100}" | |
end |
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
root@localhost:~/crystal# make | |
CRYSTAL_CONFIG_PATH=`pwd`/src ./bin/crystal build -o .build/crystal src/compiler/crystal.cr -D without_openssl -D without_zlib | |
Invalid memory access (signal 11) at address 0x7ff5ffeefab8 | |
[12638893] __crystal_sigfault_handler +61 | |
[24690684] sigfault_handler +40 |
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
object DeepGoal { | |
implicit val deepGoalCodec = AutomaticJsonCodecBuilder[DeepGoal] | |
def apply(goal:GoalWithId, prevailingMeasure:Option[MeasureWithId]) = { | |
new DeepGoal(goal.id.id, | |
goal.model.status, | |
goal.model.name, | |
goal.model.agencies, | |
goal.model.relatedDatasets, | |
goal.model.isPublic, |
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
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) |
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
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 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 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 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 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 | |
} | |
} |