Skip to content

Instantly share code, notes, and snippets.

View ankopainting's full-sized avatar

Anko ankopainting

  • Brisbane, Australia
View GitHub Profile
@ankopainting
ankopainting / RabbitAckker.ex
Created August 18, 2017 23:40
Example of buffering groups of 400 messages before flushing in a genstage
# This will handle the acks back to rabbitmq
defmodule RabbitAckker do
use GenStage
require Logger
def start_link() do
GenStage.start_link(__MODULE__, :ok)
end
def init(:ok) do
@ankopainting
ankopainting / rbx_var_trace.rb
Created May 9, 2012 08:33
rubinius variable tracer - traces set_local to print variables value as they are assigned
require 'rubygems'
require 'pry'
require 'rubinius/debugger'
# monkeypatch to stop the debugger setting a breakpoint at the start
class Rubinius::Debugger
def start_noninteractive(offset=0)
spinup_thread
Thread.current.set_debugger_thread @thread
self
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
<![CDATA[
$(document).ready(function(){
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script>
<script type="text/javascript">
<![CDATA[
$(document).ready(function(){
jruby -J-XstartOnFirstThread bin/cucumber plugins/edit_view/features
Redcar 0.8.0dev ( java )
loading plugins took 5.44
took 2.202s to load textmate assets
initializing gui took 0.853s
project start took 0.017s
#<Redcar::ApplicationSWT::Treebook:0x1e755df3>#<Redcar::ApplicationSWT::Treebook:0x1e755df3>#<Redcar::ApplicationSWT::Treebook:0x1e755df3>start time: 11.627
/Users/nick/.rvm/rubies/jruby-1.5.3/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require': no such file to load -- gherkin (LoadError)
from /Users/nick/.rvm/rubies/jruby-1.5.3/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /Users/nick/.rvm/gems/jruby-1.5.3/gems/gherkin-2.2.8/lib/gherkin/native/java.rb:12:in `native_impl'
class MoveNextLineCommand < DocumentCommand
def execute
doc = tab.edit_view.document
line_ix = doc.line_at_offset(doc.cursor_offset)
if line_ix == doc.line_count - 1
doc.cursor_offset = doc.length
else
doc.cursor_offset = doc.offset_at_line(line_ix + 1) - doc.delim.length
end
doc.ensure_visible(doc.cursor_offset)
#!ruby
require 'rubygems'
require 'sanitize'
require 'cgi'
doc = <<-EOS
<style>body{scrollbar-face-color:white;scrollbar-shadow-color:#C71585;scrollbar-highlight-color:#C71585;scrollbar-3dlight-color:white;scrollbar-darkshadow-color:white;scrollbar-track-color:white;scrollbar-arrow-color:#4169E1;}</style><P>
<P>
<STYLE type="text/css">A:hover{COLOR:white;background:url(http://blah.com/rainbow.GIF);}hr{background-image:url(http://blah.com/rainbow.GIF);width:100%;height:4;border:0;}input{background:url(http://blah.com/rainbow.GIF); border: 1pt solid mediumpurple; font-family: verdana; color: mediumpurple; font-size: 10px;letter-spacing:0pt} --> </STYLE>This is a test <P>
def test(input_string)
puts input_string.gsub(/he/,"she")
end