Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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|
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 / 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) }
@evolve2k
evolve2k / gist:1059953
Created July 2, 2011 11:29
Updating your own authored gem
$ git commit # commit your changes like usual
$ rake version:bump:patch
$ rake gemspec # to update version to new version number, etc.
$ rake build # create the new gem package
# Commit the new gemspec file.
$ gem push pkg/<gemname_and_version>.gem # push to rubygems
$ git push # so that the githubs are all up to date!
diff --git a/plugins/git.plugin.zsh b/plugins/git.plugin.zsh
index cbc40a2..d25c2eb 100644
--- a/plugins/git.plugin.zsh
+++ b/plugins/git.plugin.zsh
@@ -2,7 +2,7 @@
alias g='git st'
alias l='git log'
alias d='git diff'
-alias gl='git pull'
+#alias gl='git pull'
@evolve2k
evolve2k / gist:1066540
Created July 6, 2011 04:02
Rails cheatsheet
# MODELS
# ------
# A contest has a host, which is actually a user record
has_one :host, :class_name => "User"
@evolve2k
evolve2k / gist:1077086
Created July 12, 2011 00:05
What makes a good README
Notes from 'Xavier Shay's talk' - What makes a good README file (RORO 2010 Melbourne)
Use Symantic versioning (Major.Minor.Patch)
What
----
What prob u solving
How
---