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
class Test { | |
int var = 42; | |
void variableScope() { | |
switch (var) { | |
case 42: | |
int a = 1; | |
case 43: | |
// a is visible. | |
a = 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
class TwoBucketShortestPathCalculator | |
def initialize(cap_a, cap_b) | |
@cap_a = cap_a | |
@cap_b = cap_b | |
end | |
def answer | |
@answer ||= calculate | |
end |
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
int printf(); | |
int main() { | |
int (*fp)() = printf; | |
fp = ******fp; | |
(*********fp)("asdf\n"); | |
} |
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
all_fullscreen: all_fullscreen.cc | |
${CXX} -std=c++11 -lX11 -lXinerama -lXrandr -o $@ $^ |
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
# -*- coding: utf-8 -*- | |
from __future__ import division, absolute_import, print_function, unicode_literals | |
def indicate_last(gen): | |
saved_e = None | |
prev_value = next(gen) | |
value = None | |
while True: | |
if saved_e is not None: | |
raise saved_e |
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 <stdbool.h> | |
#include <stdlib.h> | |
typedef struct _node { | |
char c; | |
struct _node *tr; | |
struct _node *next; | |
} 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
#include <stdio.h> | |
#include <stdlib.h> | |
#pragma pack(8) | |
struct shape_vtbl; | |
typedef struct { | |
double x, y; | |
struct shape_vtbl *shape_vtbl; | |
} SHAPE; |
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/gawk -f | |
# $ echo 'a[1] = b[1]' | ./test.awk pattern='.\\[[[:digit:]]\\]' | |
# a[1] | |
# b[1] | |
{ | |
s = $0 | |
while (match(s, pattern)) { | |
print substr(s, RSTART, RLENGTH) | |
s = substr(s, RSTART+RLENGTH) | |
} |
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
xrrtest: xrrtest.cpp | |
${CXX} -lX11 -lXinerama -lXrandr -o xrrtest xrrtest.cpp |
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
require "rake/clean" | |
$OUTPUT = File.basename(File.expand_path("..", __FILE__)) | |
$OUTPUTDIR = "out" | |
$TEX = "platex" | |
$TEXFLAGS = "" | |
$DVIPDF = "dvipdfmx" | |
$DVIPDFFLAGS = "" | |
$BIBTEX = "pbibtex" |
NewerOlder