Skip to content

Instantly share code, notes, and snippets.

View hakunin's full-sized avatar

Michal Hantl hakunin

  • Ostrava, Czech Republic
  • 15:57 (UTC -12:00)
View GitHub Profile
@hakunin
hakunin / show_exception.mirah
Created November 3, 2010 08:48
Exception pretty printing similar to Rack::ShowException
class ShowException
def initialize
@html = '<html>
<style>
body {
font-family:arial;
margin:0;
padding:0;
}
@hakunin
hakunin / gist:656272
Created October 31, 2010 07:52
edit.html.erb
<h1><%= String.valueOf(@offer.title) %></h1>
<!-- END COPY SELECTION HERE --><%=
'<form action="/admin/offers/save/'+String.valueOf(@offer.url_id)+'" method="POST" enctype="multipart/form-data" >
<fieldset><legend>Titulek slevové akce</legend>
<input id="offer_title" type="text" name="offer[title]" value="'+String.valueOf(@offer.title)+'">
</fieldset>
<label>Krátký popis:</label><br>
<textarea name="offer[short_desc]" rows="2" cols="55">'+String.valueOf(@offer.short_desc)+'</textarea>
begin
require 'ant'
rescue LoadError
puts 'This Rakefile requires JRuby. Please use jruby -S rake.'
exit 1
end
neighbor_mirah = File.expand_path '../mirah'
<html>
<head>
<body >
<script>
var map = [
[1000,'M'],
[500,'D'],
[100,'C'],
michal@home:~$ redcar --fork
Redcar 0.7 ( java )
NotImplementedError: Something weird has happened. Please contact us.
Forking isn't supported on this system. Sorry.
Starting normally...
loading plugins took 8.33
took 2.195s to load textmate assets
initializing gui took 0.149s
project start took 0.017s
#<Redcar::ApplicationSWT::Treebook:0x1fd25ce>#<Redcar::ApplicationSWT::Treebook:0x1fd25ce>#<Redcar::ApplicationSWT::Treebook:0x1fd25ce>start time: 14.615
var dd_upload_init = (function(id) {
var is_ff = navigator.userAgent.indexOf("Firefox")!=-1;
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
if (!is_ff && !is_chrome) {
return;
}
//handy functions
How to make Redcar editor http://redcareditor.com/ highlite your Mirah source code
Open this file, where your gems are located:
~/.gem/ruby/1.8/gems/redcar-0.4/plugins/textmate/vendor/redcar-bundles/Bundles/Ruby.tmbundle/Syntaxes/Ruby.plist
and around line 49:
<key>fileTypes</key>
<array>
<string>rb</string>
#!/usr/bin/ruby
AUDIO_EXTENSIONS =
Hash[*
"flac ogg mp3 wav ape".
split.
map { |f| ['.'+f,true] }.
flatten
]
begin
require 'ant'
rescue LoadError
puts 'This Rakefile requires JRuby. Please use jruby -S rake.'
exit 1
end
ENV['MIRAH_HOME'] ||= File.expand_path('~/mystuff/mirah/')
if ENV['MIRAH_HOME'] && File.exist?(ENV['MIRAH_HOME'] +'/lib/mirah.rb')
// compressed by hand and edited as is
C="▒▓███";n=35;a=[];M=['\n'];r=0;setInterval('a[r]=r=Math.random()*n|0;for(i=n*n;i-->n;M[i]=M[i-n]||C[a[i%n]--]||" ");document.body.innerHTML="<pre>"+M',n)