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("/hello/<name>/<age>/<cool>")] | |
fn hello(name: &str, age: u8, cool: bool) -> String { | |
if cool { | |
format!("You're a cool {} year old, {}!", age, name) | |
} else { | |
format!("{}, we need to talk about your coolness.", name) | |
} | |
} |
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
app.get('/hello/:name/:age([0-9]+)/:cool(true|false)', (req, res, next) => { | |
let {name, age, cool} = req.params; | |
cool = (cool === 'true'); | |
age = parseInt(age); | |
if (cool) { | |
res.send(`You're a cool ${age} year old, ${name}`); | |
} else { | |
res.send(`${name}, we need to talk about your coolness.`); | |
} |
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
<?php | |
/** | |
* Here we conditionally defined Zend_Registry | |
* When our custom Zephir module is installed, Zend\Registry becomes available. | |
* https://github.com/sean3z/zendframework-zephir | |
*/ | |
if (class_exists('Zend\\Registry')) { | |
class Zend_Registry extends Zend\Registry { | |
// No code block needed here since we extend Zend\Registry |
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
;## | |
;# ============== | |
;# Tiberian Sun Filter - TSF | |
;# $Id: 3.01 02/02/11 14:55:01 Sean Wragg <[email protected]> - sean3z $ | |
;# http://triggsolutions.com/mirc-snippets/tiberian-sun-filter-3-01/415/ | |
;# ============== | |
;# | |
;# INSTALLTION - | |
;# 1) open mIRC/load 'tsf.msl' into remotes - type /tsf | |
;# 2) append "127.0.0.1 servserv.westwood.com" to hosts configuration file |
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
fetch('https://api.chucknorris.io/jokes/random') | |
.then(response => response.json()) | |
.then(body => { | |
console.log(body); | |
}); |
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
[sean@lappy486:~] $ wrk -d1m http://localhost:8080/ | |
Running 1m test @ http://localhost:8080/ | |
2 threads and 10 connections | |
Thread Stats Avg Stdev Max +/- Stdev | |
Latency 133.90us 26.21us 2.64ms 84.63% | |
Req/Sec 36.23k 1.02k 39.12k 75.58% | |
4326188 requests in 1.00m, 602.36MB read | |
Requests/sec: 72103.47 | |
Transfer/sec: 10.04MB |
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
[sean@lappy486:~] $ wrk -d1m http://localhost:8080/ | |
Running 1m test @ http://localhost:8080/ | |
2 threads and 10 connections | |
Thread Stats Avg Stdev Max +/- Stdev | |
Latency 696.69us 1.47ms 157.02ms 99.76% | |
Req/Sec 7.53k 1.00k 8.90k 66.58% | |
898973 requests in 1.00m, 140.60MB read | |
Requests/sec: 14981.94 | |
Transfer/sec: 2.34MB |
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 strict"; | |
const restify = require('restify'); | |
const app = restify.createServer(); | |
app.get('/', (req, res, next) => { | |
res.send('Hello, world!'); | |
}); | |
app.listen(8080, () => { |
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(plugin)] | |
#![plugin(rocket_codegen)] | |
extern crate rocket; | |
#[get("/<name>/<age>")] | |
fn hello(name: String, age: u8) -> String { | |
format!("Hello, {} year old named {}!", age, name) | |
} |
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(plugin)] | |
#![plugin(rocket_codegen)] | |
extern crate rocket; | |
#[macro_use] extern crate rocket_contrib; | |
#[macro_use] extern crate serde_derive; | |
use rocket_contrib::{Json, Value}; | |
mod hero; |