Skip to content

Instantly share code, notes, and snippets.

@evolve2k
evolve2k / gist:964077
Created May 10, 2011 08:05
Rename files in a directory into a slug format
class String #:nodoc:
def to_slug
self.gsub(/ /,"_").gsub(/&/,"and").gsub(/\?|\!|\#/,"").downcase
end
end
files = Dir.glob("*")
files.each { |f| File.rename(f, f.to_slug) }
Deprecated ERb helper calls
Block helpers that use concat (e.g., form_for) should use <%= instead of <%. The current form will continue to work for now, but you will get deprecation warnings since this form will go away in the future.
More information: http://weblog.rubyonrails.org/
The culprits:
- /Users/richie/Sites/funways/app/views/password_resets/edit.html.erb
- /Users/richie/Sites/funways/app/views/password_resets/new.html.erb
Deprecated constant(s)
Constants like RAILS_ENV, RAILS_ROOT, and RAILS_DEFAULT_LOGGER are now deprecated.
@evolve2k
evolve2k / arbiter_abilities.rb
Created February 17, 2011 02:11
CanCan Abilities for Arbiters
#Abilities.rb:41 - Want some refactoring help
#
#Arbiters for a tournament can manage it
if user && !user.admin?
can [:read, :update, :destroy], Tournament, ['? in (select user_id from tournaments_users where tournament_id = tournaments.id) or tournaments.group_id in (select group_id from group_users where user_id = ? and role = \'Administrator\')', user.id, user.id] do |tournament|
tournament && (tournament.arbiters.include?(user) ||
(tournament.group && tournament.group.administrators.include?(user)))
end
can [:manage], [Division, Round, Pairing, Entry] do |x|
@evolve2k
evolve2k / LineupViewController.m
Created January 29, 2011 14:43
LineupViewController.m
//
// LineupViewController.m
// FootyAssistant
//
//
#import "LineupViewController.h"
#import <QuartzCore/QuartzCore.h>
#import "AppScrollView.h"
#import "DataController.h"
@evolve2k
evolve2k / Stage 3 Everything
Created January 10, 2011 06:21
Stage 3 Everything
<!DOCTYPE HTML>
<html>
<head>
<title>The Ultimate Dr Who Powers Fan Page!!!!!!!!!!!!!!!!!!</title>
<link rel="stylesheet" href="stylesheets/screen.css" media="all" />
<meta charset='utf-8'>
</head>
<body>
<div class="header">
@evolve2k
evolve2k / Stage 2 Main DIVS
Created January 10, 2011 06:19
Stage 2 Main DIVS
<!DOCTYPE HTML>
<html>
<head>
<meta charset='utf-8'>
</head>
<body>
<div class="header">
</div>
<div class="main">
@evolve2k
evolve2k / HTML tute - stage 1
Created January 10, 2011 06:06
Stage 1 Basics
<!DOCTYPE HTML>
<html>
<head>
<meta charset='utf-8'>
</head>
<body>
</body>
</html>
@evolve2k
evolve2k / i9webworkshop
Created January 10, 2011 05:26
Resources for the i9 Web Workshop
Have you setup your laptop for the session? if not see instructions further..
------------------------------------------------------------------------------
Welcome!
Today we are going to make a basic website using some of the main components
of HTML with a little CSS to give you an idea.
As I want you focussed on writing good HTML and CSS, I don't want you
too fussed on the aesthetics(look and feel) and the actual content of the site.
@evolve2k
evolve2k / gist:771672
Created January 9, 2011 13:21
HTML Resources for Noobs
http://colorschemedesigner.com - Awesome web color design tool
http://validator.w3.org - W3C Markup Validation Checker
Wordpress
---------
http://wordpress.stackexchange.com - Wordpress help
<?php
/**
* Debian local configuration file
*
* This file overrides the settings made by phpMyAdmin interactive setup
* utility.
*
* For example configuration see /usr/share/doc/phpmyadmin/examples/config.default.php.gz
*
* NOTE: do not add security sensitive data to this file (like passwords)