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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
function toTitleCase(str) { | |
return str.replace(/_/g, " ").replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}); | |
} |
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> |
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> | |
#include <sstream> | |
struct Tester { | |
static void print(std::ostream& out) {} | |
template <typename Head, typename... Tail> | |
static void print(std::ostream& out, const Head& head, const Tail&... tail) { | |
out << head; |
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
#!/usr/bin/env mocha | |
/* Change "mocha" to "node" in the first line, and it works. */ | |
var requirejs = require("requirejs"); | |
var one = requirejs("./one"); | |
console.log(one); |
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
1. Create rectangle. | |
2. Set custom fill color to "4af" (light blue) | |
3. Create another rectangle. | |
4. Resize it to be smaller than the first (it will sit in a corner). | |
5. Set custom fill color on the new rectangle to "f66" (light red) | |
6. Export as PNG | |
The generated image will have the two rectangles in the correct dimensions. | |
The larger rectangle will have a blue that looks darker, more saturated than what I saw in the browser, but that's fine. |
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
/* A model of output iterator that will count every time it gets incremented. */ | |
class Counter { | |
public: | |
/* Implement a getter if you want. */ | |
int n; | |
Counter(int n = 0) : n(n) {} | |
Counter(Counter const& other) : n(other.n) {} | |
Counter& operator* () { return *this; } | |
template <typename T> |
NewerOlder