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
void main() { | |
int n = 600851475143; | |
var l = new List<int>(); | |
for (int i = 0; i < n; i++) { | |
l.add(i); | |
} | |
} | |
/* Prints: | |
Exhausted heap space, trying to allocate 1073741856 bytes. | |
Unhandled exception: |
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
// dart version | |
void main() { | |
List<int> l = [1,10,5]; | |
l.sort(); | |
print(l); // [1, 5, 10] | |
} | |
// js version | |
var l = [1, 10, 5]; | |
l.sort(); |
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
#include <iostream> | |
int main() { | |
int i = 0; | |
std::cout << i << " " << ++i << std::endl; | |
return 0; | |
} |
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
import 'dart:core'; | |
import 'dart:collection'; | |
class Test { | |
SplayTreeMap m; | |
Test() { | |
m = new SplayTreeMap<String, RTest>(_compare); | |
} | |
int _compare(String s1, String s2) { |
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
CC=g++ | |
CFLAGS=-Wall -Werror | |
LDFLAGS=-lopencv_core -lopencv_highgui | |
all: main | |
OBJS = main.o | |
main: $(OBJS) | |
$(CC) -o $@ $(OBJS) $(LDFLAGS) |
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
foreach (NavMeshAgent a in agents) | |
{ | |
if (a.GetComponent<Animator>() != null) | |
{ | |
Animator anim = a.GetComponent<Animator>(); | |
anim.SetFloat("VSpeed", a.velocity.z); | |
anim.SetFloat("HSpeed", a.velocity.x); | |
if (Input.GetButtonDown("Fire3")) { |
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
Linking CXX executable /home/hcs/ros_wk/devel/lib/image_listener/image_listener_node | |
CMakeFiles/image_listener_node.dir/src/image_listener.cpp.o: In function `ImageListener::image_callback(boost::shared_ptr<sensor_msgs::Image_<std::allocator<void> > const> const&)': | |
image_listener.cpp:(.text._ZN13ImageListener14image_callbackERKN5boost10shared_ptrIKN11sensor_msgs6Image_ISaIvEEEEE[_ZN13ImageListener14image_callbackERKN5boost10shared_ptrIKN11sensor_msgs6Image_ISaIvEEEEE]+0x51d): undefined reference to `threshold_image(cv::Mat)' | |
collect2: error: ld returned 1 exit status | |
make[2]: *** [/home/hcs/ros_wk/devel/lib/image_listener/image_listener_node] Error 1 | |
make[1]: *** [image_listener/CMakeFiles/image_listener_node.dir/all] Error 2 | |
make: *** [all] Error 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
- lib.rs | |
""" | |
mod my_mod; | |
""" | |
- my_mod/ | |
- mod.rs | |
""" | |
#[cfg(test)] | |
mod test; | |
""" |
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 main() { | |
let world = World::new(); // or builder pattern | |
let physics = PhysicsSystem::new(); // this would create the ncollide world inside | |
// world takes ownership of systems | |
world.add_system(physics); | |
// etc. | |
world.run(); |
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
struct Entity { | |
pub id: usize, | |
pub ver: usize, | |
} | |
impl Eq for Entity { | |
fn eq(self, other: Entity) { | |
return (self.id == other.id) && (self.ver == other.ver); | |
} | |
} |
OlderNewer