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
interface Cases<O, T, E, R> { | |
ok: (value: O) => T; | |
err: (value: E) => R; | |
} | |
export abstract class Result<O, E> { | |
public abstract isOk(): boolean; |
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 bus::{Bus, BusReader}; | |
use futures::task::{Context, Poll}; | |
use futures::Stream; | |
use std::pin::Pin; | |
use std::sync::{Arc, Mutex}; | |
/// `SourceInner` contains the reference to the Bus. `SourceInner` is available to the | |
/// `Source` instance, as well as its connected `SourceNode`. The `inner` needs to be wrapped | |
/// around a `Mutex` so that it's possible to include new receivers, and around a `Arc` so that | |
/// the instance is cloneable, potentially from multiple threads. |
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 r2d2::{Pool, PooledConnection, Error}; | |
use r2d2_diesel::ConnectionManager; | |
use diesel::PgConnection; | |
use rocket::http::Status; | |
use rocket::{Request, State, Outcome}; | |
use rocket::request::{self, FromRequest}; | |
/// DatabaseHandler handles a single connection to the database |
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
version: '2' | |
services: | |
rustql: | |
image: rustql | |
restart: always | |
container_name: rustql | |
networks: | |
rustql-network: | |
ipv4_address: 172.11.0.2 |
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
var selection = _.sortBy(elements, [element => _.lowerCase(element.a), | |
element => _.lowerCase(element.b)]) |
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
#![allow(dead_code)] | |
use std::f32::INFINITY; | |
use std::sync::{Arc}; | |
use std::thread; | |
use std::sync::mpsc::channel; | |
struct Store { | |
name: String, | |
items: Vec<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
fn file_to_bytes(path: &Path) -> Result<Vec<u8>, std::io::Error> { | |
File::open(path).and_then(|mut file| { | |
let mut bytes = Vec::new(); | |
try!(file.read_to_end(&mut bytes)); | |
Ok(bytes) | |
}) | |
} |
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
router.HandleFunc(`/configfile/{filename:[-\w./_0-9]+}`, getConfigfileHandler).Methods("GET") |
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
// gist saved for future use | |
// practice code of the decorator pattern for http requests | |
// extracted from the talk of Tomas Senart (http://bit.ly/22tUcl4) | |
package main | |
import ( | |
"log" | |
"net/http" | |
"os" | |
) |
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
It is possible with the nginx to make a request when the nginx detect an input stream on our application | |
(more info: https://github.com/arut/nginx-rtmp-module/wiki/Directives). | |
As you can see on the wiki of the nginx rtmp module, different triggers are defined (on_play, on_publish, | |
etc.). To detect a new stream coming in our nginx it will be an "on_publish" event called. | |
With this method it will be sended diferent parameters too. This parameters will be sended as a form post | |
data. | |
The parameters sended on the form post are: | |
- clientid - tcurl |
NewerOlder