This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 <string> | |
#include <boost/range/counting_range.hpp> | |
typedef boost::iterator_range<boost::counting_iterator<int> > counting_range_int_t; | |
counting_range_int_t operator "" _ri(char const* wtf, std::size_t len) | |
{ | |
static std::istringstream parse; | |
parse.clear(); |
This file contains hidden or 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 <string> | |
#include <boost/range/counting_range.hpp> | |
typedef boost::iterator_range<boost::counting_iterator<int> > counting_range_int_t; | |
counting_range_int_t operator "" _ri(char const* wtf, std::size_t len) | |
{ | |
static std::istringstream parse; | |
parse.clear(); |