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 <functional> | |
template <typename T> | |
struct Property | |
{ | |
T value; | |
std::function<T()> getter; | |
std::function<void(T)> setter; | |
operator T(){ return getter(); } | |
void operator= (T wtf){ setter(wtf); } |
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
org.jruby.exceptions.RaiseException: (NoMethodError) undefined method `cache_container' for nil:NilClass | |
at RUBY.manager(/home/torquebox/.rvm/gems/jruby-1.7.2/gems/torquebox-cache-2.3.0-java/lib/cache.rb:275) | |
at RUBY.cache(/home/torquebox/.rvm/gems/jruby-1.7.2/gems/torquebox-cache-2.3.0-java/lib/cache.rb:264) | |
at RUBY.initialize(/home/torquebox/.rvm/gems/jruby-1.7.2/gems/torquebox-cache-2.3.0-java/lib/cache.rb:72) | |
at RUBY.cache(/home/torquebox/.rvm/gems/jruby-1.7.2/gems/torquebox-cache-2.3.0-java/lib/active_support/cache/torque_box_store.rb:125) | |
at RUBY.initialize(/home/torquebox/.rvm/gems/jruby-1.7.2/gems/torquebox-cache-2.3.0-java/lib/active_support/cache/torque_box_store.rb:32) | |
at RUBY.lookup_store(/home/torquebox/.rvm/gems/jruby-1.7.2/gems/activesupport-3.2.13/lib/active_support/cache.rb:69) | |
at RUBY.Bootstrap(/home/torquebox/.rvm/gems/jruby-1.7.2/gems/railties-3.2.13/lib/rails/application/bootstrap.rb:54) | |
at RUBY.silence_warnings(/home/torquebox/.rvm/gems/jruby-1.7.2/gems/activesupport-3.2.13/lib/a |
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
`app/admin/product.rb` | |
ActiveAdmin.register Product do | |
controller do | |
def permitted_params | |
params.permit(product_arts_attributes: [:uri]) | |
end | |
end | |
form({ html: { multipart: true } }) do |f| |
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 <cstdlib> | |
namespace pwned { | |
template <class ForwardIterator, class OutputIterator> | |
ForwardIterator counting_unique (ForwardIterator first, ForwardIterator last, OutputIterator out) | |
{ | |
if (first==last) return last; | |
ForwardIterator result = first; | |
std::size_t count= 1; |
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 Java | |
require 'blpapi3.jar' | |
opts = com.bloomberglp.blpapi.SessionOptions.new | |
opts.server_host = 'localhost' | |
opts.server_port = 8194 | |
session = com.bloomberglp.blpapi.Session.new opts | |
service = '//blp/refdata' | |
throw "Can't start Bloomberg" unless session.start && session.open_service(service) |
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
Creating a JVM from a C Program | |
First, here's the completed C program for reference. Our program dispenses with niceties like error checking that you, of course, would like to do in your real programs: | |
#include <stdio.h> | |
#include <jni.h> | |
JNIEnv* create_vm() { | |
JavaVM* jvm; | |
JNIEnv* env; |
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
def stream_lol | |
headers['Cache-Control'] = 'no-cache' | |
response['Transfer-Encoding'] = 'chunked' | |
self.response_body = Enumerator.new do |y| | |
5.times do |i| | |
metin= "Paket #{i}: #{Time.now.to_s}<br/>" | |
sleep 1 | |
Rails.logger.info metin | |
y<< metin | |
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
#include <iostream> | |
#include <map> | |
#include <boost/any.hpp> | |
#include <curl/curl.h> | |
typedef std::map<std::string, boost::any> params_t; | |
void open(params_t params) | |
{ | |
if(boost::any_cast<bool>(params["session"])) |
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
x= Class.new Object do | |
def inspect | |
"lol!" | |
end | |
end | |
module Lol | |
end | |
Object.const_set("Wtf", x) |
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
remove Lock = Caps_Lock | |
keycode 66 = Tab ISO_Left_Tab Tab ISO_Left_Tab | |
keycode 23 = Caps_Lock NoSymbol Caps_Lock |