- Declaring an empty vector and then pushing values
// creates an empty vector
std::vector<int> vec;
// push values into vector
vec.push_back(10);
vec.push_back(20);
vec.push_back(30);| OK, Let's begin. Hello, Everybody. | |
| My name is Narihiro Nakamura. | |
| Today, I'm talking about "Parallel worlds of CRuby's GC". | |
| I'm very happy now, because I'm meeting attendee in rubyconf. | |
| And, one of my dreams is to talk in rubyconf. | |
| So, I'm very happy and exciting. | |
| Today is my first presentation in English. | |
| My English is not good. |
Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.
| module TwosComplement | |
| def self.encode(n) | |
| if n < 0 | |
| binary = (n + 1).abs.to_s(2).chars.map { |c| c == "0" } | |
| binary.unshift(true) unless binary.first == true | |
| else | |
| binary = n.to_s(2).chars.map { |c| c == "1" } | |
| binary.unshift(false) unless binary.first == false | |
| end |
| module TwosComplement | |
| def self.encode(n) | |
| if n < 0 | |
| binary = (n + 1).abs.to_s(2).chars.map { |c| c == "0" } | |
| binary.unshift(true) unless binary.first == true | |
| else | |
| binary = n.to_s(2).chars.map { |c| c == "1" } | |
| binary.unshift(false) unless binary.first == false | |
| end |
cribbed from http://pastebin.com/xgzeAmBn
Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.
| // This program is an example of how to run a command such as | |
| // ps aux | grep root | grep sbin | |
| // using C and Unix. | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| int pid; | |
| int pipe1[2]; | |
| int pipe2[2]; |
Here'e an example of how to register a nick on Freenode IRC. It's a little tricky, but if you follow some simple steps, you'll get through it okay. All you need to do is connect to the Freenode IRC network and have a little talk with NickServ.
The first and most confusing questions can be combined:
Start by connecting your client to irc.freenode.net and joining any chat.
Next, type this command in the chat window:
| GDB commands by function - simple guide | |
| --------------------------------------- | |
| More important commands have a (*) by them. | |
| Startup | |
| % gdb -help print startup help, show switches | |
| *% gdb object normal debug | |
| *% gdb object core core debug (must specify core file) | |
| %% gdb object pid attach to running process | |
| % gdb use file command to load object |
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |