Skip to content

Instantly share code, notes, and snippets.

View quietfanatic's full-sized avatar

Leafuw quietfanatic

View GitHub Profile
<html>
<body>
<h4>Test</h4>
</body>
</html>
$ java -jar BlobSlayer2.3.jar
Exception in thread "main" java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(ImageIcon.java:205)
at Board.getImage(Board.java:199)
at Board.<init>(Board.java:168)
at Game.<init>(Game.java:19)
at Game.main(Game.java:102)
$ java -version
java version "1.7.0_51"
// When using first-class functions, c++11 will silently coerce a function returning a value
// into a std::function returning a reference, thus creating a ticking time bomb.
#include <stdio.h>
#include <functional>
const int& f1 (std::function<const int& ()> func) {
return func();
};
@quietfanatic
quietfanatic / make.pl
Created April 25, 2013 22:55
A sample make.pl for a perl-based build system
#!/usr/bin/perl
use strict;
use warnings;
use FindBin;
BEGIN { %make:: or do { require "$FindBin::Bin/tool/make.pm"; make->import(':all') } }
use autodie qw(:all);
my $here;
my @modules;
" local syntax file - set colors on a per-machine basis:
" vim: tw=0 ts=4 sw=4
" Vim color file
hi clear
set background=dark
if exists("syntax_on")
syntax reset
endif
let g:colors_name = "murphyme"
@quietfanatic
quietfanatic / gist:4242187
Created December 8, 2012 22:07
Error while installing Bailador
==> Bailador depends on HTTP::Easy, Template::Mojo, URI
==> HTTP::Easy depends on HTTP::Status
==> Fetching HTTP::Status
==> Building HTTP::Status
Compiling lib/HTTP/Status.pm6
==> Testing HTTP::Status
t/01-basic.t .. ok
All tests successful.
Files=1, Tests=4, 1 wallclock secs ( 0.02 usr 0.00 sys + 0.40 cusr 0.06 csys = 0.48 CPU)
Result: PASS
@quietfanatic
quietfanatic / example1-xml
Created August 10, 2012 01:36
EX examples
#Implementation of http://rosettacode.org/wiki/XML/Output
escape_xml = *.replace(
('<', '&lt;'),
('>', '&gt;'),
('&', '&amp;'),
('"', '&quot;'),
("'", '&apos;'),
);
@quietfanatic
quietfanatic / gist:3180344
Created July 26, 2012 04:57
Pugs: Typename -> Typename()
diff --git a/Pugs/src/Pugs/AST/Internals.hs b/Pugs/src/Pugs/AST/Internals.hs
index cf984b1..afead2e 100644
--- a/Pugs/src/Pugs/AST/Internals.hs
+++ b/Pugs/src/Pugs/AST/Internals.hs
@@ -1166,7 +1166,7 @@ instance Value VStr where
fromVal (VList l) = return . unwords =<< mapM fromVal l
fromVal v@(PerlSV _) = fromVal' v
fromVal VUndef = return ""
- fromVal (VType t) = return (showType t)
+ fromVal (VType t) = return (showType t ++ "()")
@quietfanatic
quietfanatic / structarray.cpp
Created June 21, 2012 00:16
C++11 struct-array hybrid
// Struct-Array Hybrids
// In many situations it is useful to have a static collection of objects
// that can be accessed either by name or by number.
// Previously, you would have to declare an array of unnamed items, followed
// by either an enum or a series of const references. This made it difficult
// to modify by hand and to ensure that the right names were matched to the
// right objects. It also took twice as many code lines.
@quietfanatic
quietfanatic / if.c++
Created June 14, 2012 13:10
Go-style interfaces in C++
#include <stdio.h>
class Talking {
// Vtable
template <class T>
struct implemented_by {
void (T::* talk ) ();
void (T::* talk__int ) (int);
static const implemented_by vtable;
};