Skip to content

Instantly share code, notes, and snippets.

View munen's full-sized avatar

Zen Monk Alain M. Lafon munen

View GitHub Profile
@munen
munen / sopro2_restful_models_demo.rb
Created May 3, 2011 23:30
Example of a RESTful interface for sopro2
class TourHistory < ActiveRecord::Base
belongs_to :location
end
class LocationHistory < ActiveRecord::Base
has_many :tours
belongs_to :user
end
class User < ActiveRecord::Base
<!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" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="showdown.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<script>
jQuery(document).ready(function() {
$('#leftContainer textarea').keyup(function() {
var input = $('#leftContainer textarea').val();
struct {
int a;
union {
int b;
float c;
};
int d;
} foo;
Rails 3.x
install bundler
install rack
Possibly migrate to new gitosis: https://wiki.panter.ch/moin/git
Add bundler to project: http://gembundler.com/rails23.html
Add dependencies for POL from pol/README
diff --git a/app/views/pages/edit.html.haml b/app/views/pages/edit.html.haml
index c0e5a6a..f545605 100644
--- a/app/views/pages/edit.html.haml
+++ b/app/views/pages/edit.html.haml
@@ -9,7 +9,7 @@
#page_form{ :style => 'display: none;' }
!= render :partial => 'pages/form'
-#page_content{ }
+#page_content
@munen
munen / gist:1328630
Created October 31, 2011 19:41
git changes
diff --git a/app/views/layouts/pol.html.haml b/app/views/layouts/pol.html.haml
index 1340bfb..1b46a5c 100644
--- a/app/views/layouts/pol.html.haml
+++ b/app/views/layouts/pol.html.haml
@@ -3,11 +3,11 @@
%head
- content_for :title, "Panter llc - #{@page.title}"
!= render :partial => 'layouts/html_head'
- %meta(name='Description' content='Panter bietet umfassende, qualitativ hochstehende Beratungs-,Engineering- und Support-D
- %meta(name='Keywords' content='Consulting, Beratung, Software, Softwareentwicklung, Security, Monitoring, Interception, P
==> Downloading http://irssi.org/files/irssi-0.8.15.tar.bz2
File already downloaded in /Users/preek/Library/Caches/Homebrew
/usr/bin/tar xf /Users/preek/Library/Caches/Homebrew/irssi-0.8.15.tar.bz2
==> Patching
/usr/bin/patch -f -p1 -i 001-homebrew.diff
patching file configure
Hunk #1 succeeded at 14050 (offset -13369 lines).
Hunk #2 succeeded at 14068 with fuzz 2 (offset -13369 lines).
patching file docs/irssi.1
==> ./configure --prefix=/usr/local/Cellar/irssi/0.8.15 --sysconfdir=/usr/local/etc --with-perl=yes --with-perl-lib=/usr/local/Cellar/irssi/0.8.15/lib/perl5/site_perl --with-bot --with-proxy --enable-ssl --enable-ipv6 --with-socks
# --- NEW FILE: users_controller_spec.rb
describe UsersController do
context 'with required parameters' do
it 'creates a new entry' do
post :create, :user => { :name => "foo" }
User.first.name.should eq("foo")
end
end
end
@munen
munen / config.ru
Created January 30, 2012 09:14
ruby one line http directory server using rack
run Rack::Directory.new ('.')
# output bootstrap friendly markup
gem 'formtastic', :git => 'git://github.com/justinfrench/formtastic.git', :branch => '2.1-stable'
gem 'formtastic-bootstrap', :git => 'https://github.com/cgunther/formtastic-bootstrap.git', :branch => 'bootstrap2-rails3-2-formtastic-2-1'
# twitter bootstrap
gem 'anjlab-bootstrap-rails', '2.0.1.1', :require => 'bootstrap-rails'