Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Stefan Penner stefanpenner

🎯
Focusing
View GitHub Profile
View gist:4494
require 'rubygems'
require 'yaml'
=begin
Vhost.yml ( path_to_yml_file ) >> Collection of Vhosts
Vhost.new (params) >> Single Vhost
=end
class Vhost
def self.yml(path)
vhosts = []
#load templates
View gist:28951
<td>
<a href="/admin/users/29"><img alt="User" src="/images/user.png?1227591989" /></a>
<b><a href="/admin/users/29">Stefan Penner</a></b>
</td>
View index.html.haml
#_user.html.haml
%tr{:class => cycle('odd','even')}
%td.text-align-left
=link_to image_tag('user.png'),[:admin,user]
%b=link_to user.name,[:admin,user]
%td.text-align-left=user.email
%td= 'confirmed' if user.confirmed?
%td= link_to 'Edit', edit_admin_user_url(user)
%td= link_to image_tag('icon-remove.gif'), [:admin,user], :confirm => 'Are you sure?', :method => :delete
View account.html.haml
!!!
%html{ :lang => "en" }
=render :partial => '/layouts/head'
%body
.container
#header= render :partial => '/shared/header'
=render :partial => '/account/menu'
- flash.each do |key, value|
%div{:class => key}= h(value)
#bd= yield
View index.html
<html>
<head>
<script type="text/javascript" src="jquery-1.2.6.js"></script>
<script type="text/javascript">
// tablelize
(function($){
$.fn.tablize = function(){
var store = new Array();
var toText = function(){ return $(this).text(); };
View _goal.html.haml
- fields_for "financial_plan[goal_attributes][]",goal do |form|
- @goal = goal
= error_messages_for :goal
.text_field
= form.label :months
= form.text_field :months, :class => 'text'
.text_field
= form.label :description
= form.text_field :description, :class => 'text'
.text_field
View .irbrc
require 'rubygems'
require 'wirble'
require 'fileutils'
# Colorize
Wirble.init
Wirble.colorize
# I use vim
alias q exit
View .irbrc
require 'rubygems'
require 'wirble'
require 'fileutils'
# Colorize
Wirble.init
Wirble.colorize
# I use vim
alias q exit
View model_assessible.rb
module StefansAssignment
def self.included(base)
base.class_eval do
extend ClassMethods
include InstanceMethods
end
end
module ClassMethods
def model_accesible(*models)