Skip to content

Instantly share code, notes, and snippets.

View Showtimes's full-sized avatar

Darion Miller Showtimes

View GitHub Profile
@Showtimes
Showtimes / gist:3277867
Created August 6, 2012 19:38
Stripe Gist Supscription Model
class Subscription < ActiveRecord::Base
# Associations
belongs_to :user
has_many :payments, :dependent => :destroy
has_many :fulfillments, :dependent => :destroy
# Accessibles
attr_accessible :plan_type, :major_focus, :minor_focus, :start_date
# Validations
#validates :user, :presence => true
@Showtimes
Showtimes / metaphone.rb
Created November 2, 2012 15:45
metaphone file
def self.lookup(str, pos, length, last)
case str[pos, 1]
when /^A|E|I|O|U|Y$/
if 0 == pos
return 'A', 'A', 1
else
return nil, nil, 1
end
when 'B'
return 'P', 'P', ('B' == str[pos + 1, 1] ? 2 : 1)
@Showtimes
Showtimes / error
Created November 5, 2012 03:32
error
middleware/request/oauth2.rb:62: warning: already initialized constant OAuth2
=> Booting WEBrick
=> Rails 3.2.8 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Users/davidwigder/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych.rb:297:in `initialize': no implicit conversion from nil to integer (TypeError)
from /Users/davidwigder/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych.rb:297:in `open'
from /Users/davidwigder/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych.rb:297:in `load_file'
from /Users/davidwigder/Desktop/rails_projects/emuze/config/initializers/tire.rb:1:in `<top (required)>'
@Showtimes
Showtimes / database.yml
Created November 20, 2012 21:56
database.yml mysql2
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MYSQL driver
# gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
# gem 'mysql2'
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
$scope.addEntry = ->
$scope.entries.push($scope.newEntry)
$scope.newEntry = {}
$scope.drawWinner = ->
pool = []
angular.forEach $scope.entries, (entry) ->
pool.push(entry) if !entry.winner
if pool.length > 0
<h1>Raffler</h1>
<div ng-controller="RaffleCtrl">
<form ng-submit="addEntry()">
<input type="text" ng-model="newEntry.name">
<input type="submit" value="Add">
</form>
<ul>
<li ng-repeat="entry in entries">
.navbar-search{ :action => search_path, :method => "post" }
.input.search-query{ :name => "query", :class=>@query.blank? ? "swap_value" : "", :type => "text", :value => @query.blank? ? "Find your wine" : @query, :size => 80 }
$.plot($("#graph7"), data,
{
series: {
pie: {
show: true,
combine: {
color: '#999',
threshold: 0.1
}
}
$(window).load(function(){
$('body').ready(function() {
$('logo.png').hide();
$('logo.png').each(function(i) {
if (this.complete) {
$(this).fadeIn();
} else {
$(this).load(function() {
$(this).fadeIn(2000);
});