Skip to content

Instantly share code, notes, and snippets.

class Test {
int var = 42;
void variableScope() {
switch (var) {
case 42:
int a = 1;
case 43:
// a is visible.
a = 2;
}
class TwoBucketShortestPathCalculator
def initialize(cap_a, cap_b)
@cap_a = cap_a
@cap_b = cap_b
end
def answer
@answer ||= calculate
end
int printf();
int main() {
int (*fp)() = printf;
fp = ******fp;
(*********fp)("asdf\n");
}
all_fullscreen: all_fullscreen.cc
${CXX} -std=c++11 -lX11 -lXinerama -lXrandr -o $@ $^
# -*- 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
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
typedef struct _node {
char c;
struct _node *tr;
struct _node *next;
} node;
#include <stdio.h>
#include <stdlib.h>
#pragma pack(8)
struct shape_vtbl;
typedef struct {
double x, y;
struct shape_vtbl *shape_vtbl;
} SHAPE;
#!/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)
}
xrrtest: xrrtest.cpp
${CXX} -lX11 -lXinerama -lXrandr -o xrrtest xrrtest.cpp
require "rake/clean"
$OUTPUT = File.basename(File.expand_path("..", __FILE__))
$OUTPUTDIR = "out"
$TEX = "platex"
$TEXFLAGS = ""
$DVIPDF = "dvipdfmx"
$DVIPDFFLAGS = ""
$BIBTEX = "pbibtex"