Skip to content

Instantly share code, notes, and snippets.

@cout
cout / gist:aa5d6196371f1a429f69
Created July 22, 2014 18:12
cannot specialize a member of an unspecialized template
#include <iostream>
template<typename T, typename U>
class Foo
{
public:
template<typename V>
void operator()(V const &)
{
std::cout << "default" << std::endl;
@cout
cout / gist:8b0dbab304a9cf5bed2d
Created July 10, 2014 19:57
generic std::function ?
#include <iostream>
#include <functional>
class Foo { };
class MyMessage { };
template<typename Msg_T>
void foo(
Msg_T const & msg,
std::function<Foo(Msg_T const &)> callback)
@cout
cout / dispatch.cpp
Created June 19, 2014 13:45
hi teckla
#include <iostream>
#include <boost/variant.hpp>
class Message
{
public:
virtual ~Message() { }
};
class Message1 : public Message { };
require 'ffi'
module Foo
extend FFI::Library
ffi_lib 'ruby-1.9.1'
attach_function :rb_intern, [:string], :long
attach_function :rb_obj_id, [:long], :long
attach_function :rb_funcall2, [:long, :long, :int, :pointer], :long
end
@cout
cout / gist:3426098
Created August 22, 2012 14:25
nondeterministic behavior
s1 = [
{
"attributes" => {
"role"=>"grad-research-assistant",
},
"from" => "47baa997c443e40ae6519aae096d9e72",
"relationship_type" => "project_role"
},
{
"attributes" => {
09:42:55,374 ERROR [CdaContentGenerator] Failed to execute: [ pt.webdetails.cda.dataaccess.UnsupportedDataAccessException ] - Failed: ResourceException .( Cause [ org.pentaho.reporting.libraries.resourceloader.ResourceLoadingException ] [test/cda/sparc_test.cda] can not be found or you do not have permission to access it.
pt.webdetails.cda.dataaccess.UnsupportedDataAccessException: Failed: ResourceException
at pt.webdetails.cda.settings.SettingsManager.parseSettingsFile(SettingsManager.java:135)
at pt.webdetails.cda.CdaContentGenerator.listParameters(CdaContentGenerator.java:346)
at pt.webdetails.cda.CdaContentGenerator.createContent(CdaContentGenerator.java:149)
at org.pentaho.platform.web.servlet.GenericServlet.doGet(GenericServlet.java:261)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.Appli
t = Thread.new do
system("sleep 1000000")
end
sleep 1
@cout
cout / gist:2771364
Created May 22, 2012 20:16
win32/mc failure
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'win32/mc'
=> true
irb(main):003:0> m = Win32::MC.new('foo.mc')
=> #<Win32::MC:0x803e008 @res_file="foo.res", @mc_file="foo.mc", @dll_file="foo.
dll">
irb(main):004:0> m.create_all
Win32::MC::Error: No .rc file found:
from C:/Ruby187/lib/ruby/gems/1.8/gems/win32-eventlog-0.5.3/lib/win32/mc
@cout
cout / gist:2659871
Created May 11, 2012 14:04
pry-disasm example
[3] pry(main)> require 'pry-disasm'
=> true
[4] pry(main)> class Foo; def foo; 1+1; end; end
=> nil
[5] pry(main)> disassemble Foo#foo
== disasm: <RubyVM::InstructionSequence:foo@(pry)>======================
0000 trace 8 ( 4)
0002 trace 1
0004 putobject 1
0006 putobject 1