Skip to content

Instantly share code, notes, and snippets.

View html-test.html
<html>
<body>
<h4>Test</h4>
</body>
</html>
View gist:8674393
$ 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"
View lambda-coerce.cpp
// 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 Apr 25, 2013
A sample make.pl for a perl-based build system
View make.pl
#!/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;
View murphyme.vim
" 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 Dec 8, 2012
Error while installing Bailador
View gist:4242187
==> 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
View example1-xml
#Implementation of http://rosettacode.org/wiki/XML/Output
escape_xml = *.replace(
('<', '&lt;'),
('>', '&gt;'),
('&', '&amp;'),
('"', '&quot;'),
("'", '&apos;'),
);
@quietfanatic
quietfanatic / gist:3180344
Created Jul 26, 2012
Pugs: Typename -> Typename()
View gist:3180344
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 Jun 21, 2012
C++11 struct-array hybrid
View structarray.cpp
// 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 Jun 14, 2012
Go-style interfaces in C++
View if.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;
};
You can’t perform that action at this time.