let v = 0
min( max( v, 0), 5)
if v <= 0 { v = 0 }
else
if v >= 5 { v = 5 }
v <= 0 ? 0 : (v >= 5 ? 5 : (v))
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
```rust | |
use std::env::args; | |
fn main() { | |
for name in args() { | |
if let Some(char_1) = name.chars().next() { | |
match char_1 { | |
'A' => println!("Hello, {}!", 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
#!/bin/bash | |
# | |
# This script will create transpile ES6 (with JSX) support in babel | |
# to ES5 that evaluatable in regular node.js | |
# Script will create a filename.out file, evaluates it, then remove the file. | |
# | |
# First off, you'll need Node.js. | |
# | |
# Steps: | |
# 1) Install babel globally npm install -g babel-cli |
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
let location = locations[locations.count - 1]
if location.horizontalAccuracy > 0 {
locationMgr.stopUpdatingLocation()
}
}
# Import dataset:
dataset = read.csv('Data.csv')
#dataset = dataset[, 2:3]
# Split dataset into training and test sets:
#install.packages('caTools')
library(caTools)
set.seed(101)
split = sample.split(dataset$Purchased, SplitRatio = 0.8)
#include <MicroView.h>
void setup() {
uView.begin();
uView.clear(PAGE);
uView.print("Hello world");
uView..display()
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
#set("title") { Home } | |
#set("body") { | |
<h1>Files</h1> | |
#for(file in files) { | |
<a href="/uploads/originals/#(file)" target="_blank"> | |
<img src="/uploads/thumbs/#(file)" | |
style="border: 1px solid black; margin: 20px;" /> | |
</a> |
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
try services.register(LeafProvider()) | |
config.prefer(LeafRenderer.self, for: ViewRenderer.self) | |
var middleware = MiddlewareConfig.default() | |
middleware.use(FileMiddleware.self) | |
services.register(middleware) |