Skip to content

Instantly share code, notes, and snippets.

<?php
function gsa_theme_page() {
if (isset($_POST['info_update'])){
if ( isset($_POST['headerimage']) ) {
if ( '' == $_REQUEST['headerimage'] )
delete_option('gsa_header_image');
else {
update_option('gsa_header_image', $_REQUEST['headerimage']);
}
# views/resources/new.html.haml
= form_for @resource do |form|
= form.fields_for :fields do |field_form|
render :partial => "field_template", :locals => { :form => field_form }
= link_to "Add new resource field", empty_field_resources_path, :remote => true
# controllers/resources_controller.rb
class ResourcesController < ApplicationController
def empty_field
respond_with do |format|
wetimetrack steffoz$ bundle exec cucumber --backtrace
Using the default profile...
DEPRECATION WARNING: railtie_name is deprecated and has no effect. (called from require at /Library/Ruby/Gems/1.8/gems/bundler-1.0.0/lib/bundler/runtime.rb:64)
F------F
Failing Scenarios:
cucumber features/sign_up.feature:6 # Scenario: User signs up with valid data
1 scenario (1 failed)
6 steps (6 skipped)
snippet bgaf
:background-attachment fixed$0
snippet bga
:background-attachment fixed$0
snippet bgas
:background-attachment scroll$0
snippet bga
:background-attachment scroll$0
snippet bgc
:background-color #${1:ddd}$0
@stefanoverna
stefanoverna / sphinx.rb
Created April 9, 2011 08:12
Sphinx homebrew recipe with libstemmer support
require 'formula'
class Sphinx < Formula
url 'http://sphinxsearch.com/downloads/sphinx-0.9.9.tar.gz'
homepage 'http://www.sphinxsearch.com'
md5 '7b9b618cb9b378f949bb1b91ddcc4f54'
head 'http://sphinxsearch.googlecode.com/svn/trunk/'
fails_with_llvm "fails with: ld: rel32 out of range in _GetPrivateProfileString from /usr/lib/libodbc.a(SQLGetPrivateProfileString.o)"
@stefanoverna
stefanoverna / app.rb
Created April 21, 2011 12:28
Sinatra GIT/SVN repository viewer (http://goo.gl/q4iiS)
%w(sinatra grit).each { |gem| require gem }
mime_type :binary, 'binary/octet-stream'
set :repo, Grit::Repo.new('/Users/steffoz/dev/richcomments')
before %r{^/(\w+)} do
commit_id = params[:captures].first[0..10]
@commit = settings.repo.commits(commit_id).first
halt "No commit exists with id #{commit_id}" if @commit.nil?
end
+----------------------+-------+-------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
| Controllers | 157 | 133 | 13 | 14 | 1 | 7 |
| Helpers | 142 | 125 | 0 | 13 | 0 | 7 |
| Models | 1344 | 1045 | 37 | 98 | 2 | 8 |
| Model specs | 1328 | 1107 | 0 | 0 | 0 | 0 |
| Controller specs | 112 | 88 | 0 | 0 | 0 | 0 |
| Helper specs | 22 | 9 | 0 | 0 | 0 | 0 |
| Mailer specs | 27 | 19 | 0 | 0 | 0 | 0 |
App.Choice = SC.Record.extend({
label: SC.Record.attr(String, {
isRequired: YES
}),
question: SC.Record.toOne("App.Question", {
isMaster: NO
}),
isSelected: NO
});
App.Question = SC.Record.extend({
# -*- encoding : utf-8 -*-
class Invoice < ActiveRecord::Base
paginates_per 15
belongs_to :campaign
has_and_belongs_to_many :tasks
has_many :expense_notes
validates_presence_of :campaign
validates_presence_of :start_date
require 'rubygems'
require 'twitter'
require 'yaml'
Twitter.configure do |config|
config.consumer_key = "XXX"
config.consumer_secret = "XXX"
config.oauth_token = "XXX"
config.oauth_token_secret = "XXX"
end