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 <stdio.h> | |
#include <stdlib.h> | |
typedef struct node { | |
int data; | |
struct node* next; | |
} node; | |
node* new_node() { | |
node* n = malloc(sizeof(node)); |
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 renderText(TTF_Font* font, string text) { | |
SDL_Color color = {255, 0, 0}; | |
SDL_Surface* rendered = TTF_RenderText_Solid(font, text.c_str(), color); | |
// slightly modified from http://stackoverflow.com/questions/5289447/using-sdl-ttf-with-opengl | |
GLint colors = rendered->format->BytesPerPixel; | |
GLenum format; | |
if (colors == 4) { // alpha | |
if (rendered->format->Rmask == 0x000000ff) { | |
format = GL_RGBA; |
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
let start k = k [] | |
let push stack x k = k (x :: stack) | |
let pop (_ :: stack) k = k stack | |
let add (a :: b :: stack) k = k (a + b :: stack) | |
let stop (x :: _) = x |
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 <stdio.h> | |
#include <stdlib.h> | |
typedef struct { | |
int a; | |
} foo_t; | |
int main() { | |
foo_t *a; | |
a = calloc(10, sizeof(foo_t)); |
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 <stdio.h> | |
int main() { | |
unsigned int x = 11; | |
printf("count:"" %u", x); | |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
unsigned int countOnes(unsigned int input) { | |
// lab answer here | |
} | |
unsigned int countOnesSlow(unsigned int input) { | |
int count = 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
package main | |
import ( | |
"bufio" | |
"fmt" | |
"os" | |
"unicode" | |
) | |
type node struct { |
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
I don't know if using a tool like [ctrlp for vim](https://github.com/kien/ctrlp.vim) is always such a great idea, especially when exploring a directory structure that you're unfamiliar with. ctrlp is great, and I love it for things like rails projects, where I more or less know where all the files are but I'm getting ready to bash my head in from having to type app/views/post/show.html.erb in 50 billion times. | |
Unfortunately, I'm also tempted to love ctrlp in situations where I'm not familiar with the directory structure. While going through some google training exercises, there are parts that go "open blah.cc", which happens to reside in a directory structure I'm not so familiar with. It's really tempting to just ctrl+p and type "blah.cc", but now I have no idea where the file was, and I get to go on doing stuff without getting an understanding of the directory structure. It's much better to spend some time digging through the directory tree to see what's what and where what is. | |
Fuzzy finders like cltrp are |
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
#inclsdfsdf | |
s | |
fsd | |
faf | |
sdf |
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 <fstream> | |
#include <set> | |
#include <algorithm> | |
#include <cctype> | |
using namespace std; | |
class Trie | |
{ | |
public: |