This file contains hidden or 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
func create_collision(): | |
var body = StaticBody.new() | |
var collision = CollisionShape.new() | |
var shape = CylinderShape.new() | |
shape.radius = 100 | |
shape.height = 50 | |
collision.set_shape(shape) | |
body.add_child(collision) | |
self.add_child(body) |
This file contains hidden or 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 has_even(numbers: Vec<i32>) -> bool { | |
for num in numbers { | |
if num % 2 == 0 { | |
return true; | |
} | |
} | |
return false; | |
} | |
fn main() { | |
let vec = vec![1, 9, 2, 5, 4]; |
This file contains hidden or 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
from typing import List | |
def has_even(numbers: List[int]) -> bool: | |
for num in numbers: | |
if num % 2 == 0: | |
return True | |
return False | |
def main() -> None: | |
vec = [1,9,2,5,4] | |
even_exists = has_even(vec) |
This file contains hidden or 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 has_even(numbers): | |
for num in numbers: | |
if num % 2 == 0: | |
return True | |
return False | |
def main(): | |
vec = [1,9,2,5,4] | |
even_exists = has_even(vec) | |
print("Has even number", even_exists) |
This file contains hidden or 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 has_even<T0, RT>(numbers: T0) -> RT { | |
for num in numbers { | |
if num % 2 == 0 { | |
return true; | |
} | |
} | |
return false; | |
} | |
fn main() { | |
let vec = vec![1, 9, 2, 5]; |
This file contains hidden or 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
struct Genesis { | |
timestamp: ST0, | |
prev_hashes: ST1, | |
} | |
impl Genesis { | |
fn __init__<T0>(&self, creation_time: T0) { | |
self.timestamp = creation_time; | |
self.prev_hashes = vec![]; | |
} |
This file contains hidden or 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
class Genesis(Block): | |
def __init__(self, creation_time): | |
self.timestamp = creation_time | |
self.prev_hashes = [] | |
def get_hash(self): | |
return self.precalculated_genesis_hash |
This file contains hidden or 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 main() { | |
let mut numbers = vec![1, 5, 10]; | |
let multiplied = numbers.iter().map(|num| num * 3).collect::<Vec<_>>(); | |
println!("{:?} {:?} ", "result is", multiplied); | |
} |
This file contains hidden or 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
if __name__ == "__main__": | |
numbers = [1,5,10] | |
multiplied = list(map(lambda num: num*3, numbers)) | |
print("result is", multiplied) |
This file contains hidden or 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/sh | |
LAYOUT_COUNT=2 | |
CURRENT_LAYOUT=$(gsettings get org.gnome.desktop.input-sources current) | |
CURRENT_LAYOUT_NUMBER=$(echo -n $CURRENT_LAYOUT | tail -c 1) | |
DESIRED_LAYOUT=$(expr $CURRENT_LAYOUT_NUMBER + 1) | |
if [ `expr $DESIRED_LAYOUT % $LAYOUT_COUNT` -eq 0 ] |
NewerOlder