Skip to content

Instantly share code, notes, and snippets.

namespace :parent do
namespace :child do
task :grandson => :environment
task :granddaughter => :environment
task :other_task_name do
puts 'this should be executed by rake parent:child'
end
end
task :child do
puts 'or is this the only way to do it?'
class RemoveUsersUserid < ActiveRecord::Migration
def self.up
change_table :users do |t|
t.remove :userid
end
end
def self.down
change_table :users do |t|
t.integer :userid
puts 'Hello, what\' s your name?'
name = gets.chomp
puts 'Hello, ' + name + ' .'
if name == 'Chris' or name == 'Katy'
puts ' What a lovely name!'
end
<!-- code to show my post -->
<% form_for [@post, Comment.new] do |f| %>
Body: <%= f.text_field :body %>
<p><%= f.submit "Add Comment" %></p>
<% end %>
array(
'name' => array(
'notempty' => array(
'rule' => array('notempty'),
'allowEmpty' => false,
'required' => true,
),
'isUnique' => array(
'rule' => array('isUnique'),
'message' => 'That group name has already been registered.',
module ApplicationHelper
def spell_text(text)
words = text.split('').map do |letter|
content_tag 'Say' do
letter.sub('.', 'dot').sub('-', 'dash')
end
end
end
end
function add() {
if (!empty($this->data)) {
$user = $this->User->find('first', array('conditions' => array('User.activation_token' => $this->data['User']['activation_token'])));
if($user) {
$this->data['User']['activated'] = '-!NOW()';
$this->data['User']['activation_token'] = '-!NULL';
$this->User->id = $user['User']['id'];
}
$this->User->save($this->data);
}
#!/bin/sh
# NOTE: UGLY!
for i in {0..44} # I think I could have done this with filter-branch, but I'm not sure how to use it.
do
git rebase --continue
lines=$(cat OgreIsland/Sockets/Socket.cs | wc -l)
lines=$(expr $lines - 18)
<?php
class GroupsController extends AppController {
var $name = 'Groups';
var $paginate = array(
'fields' => array(
'Group.id',
'Group.icon',
'Group.name',
'GroupCategory.name',
'Group.location',
@benmanns
benmanns / README.markdown
Created November 17, 2010 22:33
This is a library for polling Liberty's ASIST portal (hence the name).

Asistant

To get this set up you have to run custom versions of the mechanize and twiliolib gems. Unfortunately, some SSL errors and issues with Liberty's login redirect sequence forced me to hack the libraries. Hopefully I can get something "official" looking to get it pulled into the main repository, but for now, install it from my repositories.

Generic Ruby Setup

sudo apt-get install ruby

Generic RubyGems Setup