Skip to content

Instantly share code, notes, and snippets.

View bullfight's full-sized avatar
🚀

Patrick Schmitz bullfight

🚀
View GitHub Profile
@bullfight
bullfight / app.css
Created June 25, 2011 14:04
example of compass based layout
@mixin base-style{
@include border-radius(3px);
@include background-image(linear-gradient(top, #eee, #dddddd));
border: 1px solid #ccc;
@include prepend-top(20px);
@include clearfix;
hr{
@include colruler(#fff);
margin:0px;
@bullfight
bullfight / fakeout.rake
Created June 28, 2011 11:09 — forked from matthutchinson/fakeout.rake
fakeout.rake - a simple/configurable rake task that generates some random fake data for the app (using faker) at various sizes
# a simple/configurable rake task that generates some random fake data for the app (using faker) at various sizes
# NOTE: requires the faker or ffaker gem
# sudo gem install faker - http://faker.rubyforge.org
# OR
# sudo gem install ffaker - http://github.com/EmmanuelOga/ffaker
require 'faker'
class Fakeout
@bullfight
bullfight / reddit_rvm.md
Created August 21, 2011 08:27
setup rvm

Start by installing RVM

  1. go to the command line and your home directory
cd ~/
  1. Type the following to install RVM
// This is my handler in the javascript
var uploadCompleteHandler = function(upload_options,event){
$.ajax({
url: '<%= notify_rails_of_successful_upload_path(:format => :js)%>',
global: false,
type: 'POST',
data: ({
'authenticity_token' : '<%= form_authenticity_token %>',
'upload' : {
'file_file_name' : upload_options.FileName,
<script type="text/javascript">
var queueBytesLoaded = 0;
var queueBytesTotal = 0;
var myQueue = null;
var queueChangeHandler = function(queue){
// alert('Uploading Started');
myQueue = queue;
// console.log("COLLECTION CHANGE!");
var list = document.getElementById('file_todo_list');
@bullfight
bullfight / factories.rb
Created September 13, 2011 13:14 — forked from cblunt/factories.rb
Simulate paperclip attachments with FactoryGirl in Rails 3
Factory.define :application do |factory|
factory.attachment :sample, "public/samples/sample.doc", "application/msword"
end
@bullfight
bullfight / example.rb
Created September 28, 2011 11:26
example of need for negation of join
class Cat < ActiveRecord::Base
belongs_to :owner
end
class Owner < ActiveRecord::Base
has_one :cat
scope :adoptable lambda { includes(:cat).
where(:cat => {:id => nil}) }
scope :adopted, lambda { joins(:cat) }
@bullfight
bullfight / example.feature
Created October 26, 2011 11:47
local tunnel class used to open ssh tunnel for webhook testing
Feature: Paying with Google Checkout
Background:
Given my test environment is available via an SSH tunnel
And the Google Checkout Sandbox is configured to callback to my test environment
Scenario: Paying with Google Checkout
Given I have some products in my cart
When I press "Google Checkout"
And I login to Google as "customer" with password "password"
/app/views/shared/_page_search.html.haml
//current placeholder, this search bar is only found on controller index pages and is directed at the individual controller
= simple_form_for "SEARCH", :html => {:id=>'site-page_search'} do |f|
= f.input :q, :label => false, :required => false, :placeholder => "#{placeholder}..."
// a simple solution I have come up with so that search will work on each of the index pages.
= form_tag request.env['REQUEST_PATH'], :method => :get, :id=>'site-page_search' do
= text_field_tag :search, params[:search], :placeholder => "#{placeholder}..."
@bullfight
bullfight / application.js
Created November 15, 2011 16:48
application.js
//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require google_analytics
//= require jquery.spin
//= require spin.min
//= require nested_form
//= require global
//= require subscriptions/subscriptions