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
<!-- We can call the function using the onclick function on the html --> | |
<input type="image" id="sayhi_input" onclick="pop.create('Say hi!')"> | |
<script> | |
//Declaration of the Class "Popup" | |
function Popup() { | |
} | |
Popup.prototype = { | |
constructor: Popup, //Construct |
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 a new user on the local active directory | |
public bool add_user(string user_name, string user_password) { | |
try { | |
DirectoryEntry AD = new DirectoryEntry("WinNT://" + Environment.MachineName + ",computer"); | |
DirectoryEntry NewUser = AD.Children.Add(user_name, "user"); | |
NewUser.Invoke("SetPassword", new object[] { password_password }); | |
NewUser.Invoke("Put", new object[] { "Description", user_name }); | |
NewUser.CommitChanges(); |
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 |
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
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
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
#![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
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
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
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 |
OlderNewer