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
#include <ostream> | |
#include <string> | |
namespace dts { | |
void whisper(std::ostream &out, std::string msg) { | |
for(char &next : msg) { | |
out << ((next >= 'A' && next <= 'Z') ? (next - ('Z' - 'z')) : next); | |
} | |
} | |
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
Programming Languages: Application and Interpretation by Shriram Krishnamurthi | |
http://www.amazon.com/Operating-System-Concepts-Abraham-Silberschatz/dp/1118129385 | |
http://rads.stackoverflow.com/amzn/click/0201734842 | |
http://rads.stackoverflow.com/amzn/click/0321113586 | |
http://rads.stackoverflow.com/amzn/click/0321227255 | |
http://www.nostarch.com/lyah.htm | |
http://www.amazon.com/The-Programming-Language-2nd-Edition/dp/0131103628 | |
http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882 | |
http://www.amazon.com/The-Pragmatic-Programmer-Journeyman-Master/dp/020161622X | |
http://www.amazon.com/Design-Patterns-Object-Oriented-Professional-Computing/dp/0201634988 |
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
import stdlib | |
routine main : string args | |
while true | |
print("Please enter a number between 1-10: ") | |
int num = NOVAL | |
read(num) | |
if num < 1 | |
print("Too Small. Wrong. ") |
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
php/hack | |
c | |
c++ | |
python3 | |
ruby | |
perl | |
AT&T assembly | |
javascript | |
haskell | |
crystal |
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
#include <iostream> | |
#include <array> | |
#include <utility> | |
class node { | |
public: | |
node(bool=true); | |
node &operator=(bool); | |
friend std::ostream &operator<<(std::ostream&, const node&); |
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
The basics of std::basic_stream<char> | |
===================================== | |
As a part of the standard library, a class is defined called basic_stream<char>, which is typedef-ed to look like this: | |
typedef std::basic_stream<char> std::istream; // note that it might not look exactly like this, but it will evaluate to the same thing | |
The most known instance of std::istream is std::cin, which is linked to stdin, and currently all we are focusing on. There are two common operations used on std::cin. The first is operator >>, which reads one token from the input stream. There are two new terms here: token, and input stream. The input stream is literally just the collection of characters that are waiting to be read in to variables. In the case of std::cin, these characters typically come from the keyboard. For example, if I were to type "My name is DTSCode and I am an 3l1t3 h4xx0r. 10 20 30.4 -7", then that is what the input stream would consist of. The second term, token, is just a part of the input stream. Contin |
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
#lang racket | |
(define (serve port-no) | |
(define listener | |
(tcp-listen port-no 5 #t)) | |
(define (loop) | |
(accept-and-handle listener) | |
(loop)) | |
(loop)) |
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
CREATE TABLE Nicks ( id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, nick VARCHAR(200) NOT NULL); | |
CREATE TABLE Quote ( | |
id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, | |
grabber_id MEDIUMINT UNSIGNED NOT NULL, | |
sayer_id MEDIUMINT UNSIGNED NOT NULL, | |
quote VARCHAR(1500) NOT NULL, | |
CONSTRAINT `fk_grabber_id` | |
FOREIGN KEY (grabber_id) REFERENCES Nicks (id) | |
ON DELETE CASCADE, |
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
import irc, asyncdispatch | |
import strutils | |
import times | |
proc getDaysLeft(year_s: string, today: string, holiday: string): string = | |
var table = @[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] | |
var month: int | |
var day: int | |
var dayOfTheYear: int = 0 | |
var dayOfChristmas: int = 358 |
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
import irc, asyncdispatch, posix | |
const | |
time: cint = 600 | |
server: string = "dtscode.io" | |
port: int = 3038 | |
nick: string = "dtscode" | |
user: string = "dtscode" | |
real: string = "nchambers - dtscode.io" | |
pass: string = "REDACTED_PASSWORD" |
OlderNewer