code
stringlengths
1
1.73M
language
stringclasses
1 value
# BuyWins controller controls purchasing of free wins # In 13wins, the user may purchase free 'wins' (or only a 13 winstreak required for the prize) using their WinPoints class BuyWinsController < ApplicationController # GET /buy_wins # GET /buy_wins.xml def index if count = params[:sent_count] flash[...
Ruby
#!/bin/env ruby r = `ps -A -f | grep -v grep | grep -v start_fetcher | grep fetcher` if r.gsub(/\s/,'') == "" fork{`./script/fetcher > /dev/null 2>&1 &`} else puts "fetcher already running." end
Ruby
# Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require(File.join(File.dirname(__FILE__), 'config', 'boot')) require 'rake' require 'rake/testtask' require 'rake/rdoctask' require 'tasks/rails'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/dbconsole'
Ruby
#!/usr/bin/env ruby FETCHER_ROOT = File.dirname(__FILE__) RAILS_ENV = $*.first || "production" puts "Rails env: #{RAILS_ENV}" require "#{FETCHER_ROOT}/../config/environment" require "fetcher" while true begin puts "start fetcher" Fetcher.start rescue Exception=>e puts e.message File.open(File.join(R...
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/runner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/benchmarker'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/request'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/profiler'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/profiler'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/performance/request'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/plugin'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/dbconsole'
Ruby
#!/usr/bin/env ruby FETCHER_ROOT = File.dirname(__FILE__) RAILS_ENV = $*.first || "production" puts "Rails env: #{RAILS_ENV}" require "#{FETCHER_ROOT}/../config/environment" require "fetcher" while true begin puts "start fetcher" Fetcher.start rescue Exception=>e puts e.message File.open(File.join(R...
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/runner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/generate'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/console'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/reaper'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/inspector'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/inspector'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/spawner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/reaper'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../config/boot' require 'commands/process/spawner'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/destroy'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/generate'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info" require 'commands/about'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/plugin'
Ruby
#!/bin/env ruby r = `ps -A -f | grep -v grep | grep -v start_fetcher | grep fetcher` if r.gsub(/\s/,'') == "" fork{`./script/fetcher > /dev/null 2>&1 &`} else puts "fetcher already running." end
Ruby
#!/usr/bin/env ruby fetcher_command = `ps -A -f | grep "ruby ./script/fetcher" | grep -v grep` if fetcher_command != '' pid = fetcher_command.strip.split(/\s+/)[1] `kill #{pid}` else puts "pid not found, is it running?" end
Ruby
class AddFriendsToUsers < ActiveRecord::Migration def self.up add_column :users,:all_friends,:text end def self.down remove_column :users,:friends end end
Ruby
class AddWinstreakIdToBets < ActiveRecord::Migration def self.up add_column :bets, :winstreak_id, :integer end def self.down remove_column :bets, :winstreak_id end end
Ruby
class ChangePointSpreadToFloatFromMatches < ActiveRecord::Migration def self.up change_column :matches,:point_spread,:float end def self.down change_column :matches,:point_spread,:integer end end
Ruby
class AddWinstreakValueToBets < ActiveRecord::Migration def self.up add_column :bets, :winstreak_value, :float end def self.down remove_column :bets, :winstreak_value end end
Ruby
class AddSportIdToMatches < ActiveRecord::Migration def self.up add_column :matches, :sport_id, :integer end def self.down remove_column :matches, :sport_id end end
Ruby
class CreateFetchLogs < ActiveRecord::Migration def self.up create_table :fetch_logs do |t| t.datetime :last_fetched_at t.timestamps end end def self.down drop_table :fetch_logs end end
Ruby
class AddBetsCountToMatches < ActiveRecord::Migration def self.up add_column :matches, :bets_count, :integer,:default=>0 add_index :matches, :bets_count end def self.down remove_index :matches, :column => :bets_count remove_column :matches, :bets_count end end
Ruby
class CreatePointConfigs < ActiveRecord::Migration def self.up create_table :point_configs do |t| t.string :name t.integer :point t.integer :level t.timestamps end end def self.down drop_table :point_configs end end
Ruby
class AddHomePointAndAwayPointToMatches < ActiveRecord::Migration def self.up add_column :matches, :home_point, :integer add_column :matches, :away_point, :integer end def self.down remove_column :matches, :away_point remove_column :matches, :home_point end end
Ruby
class AddTypeToSports < ActiveRecord::Migration def self.up add_column :sports, :type, :string end def self.down remove_column :sports, :type end end
Ruby
class AddMessageToChallenges < ActiveRecord::Migration def self.up add_column :challenges,:message,:string end def self.down end end
Ruby
class AddHideToChallenge < ActiveRecord::Migration def self.up add_column :challenges,:hide,:boolean end def self.down end end
Ruby
class CreateIlogs < ActiveRecord::Migration def self.up create_table :ilogs do |t| t.timestamp :created_at t.integer :user_id t.integer :which_revisit t.integer :pages_per_visit t.string :time_on_site t.integer :no_of_clicks t.integer :no_of_bets t.integer :no_of_co...
Ruby
class AddNameAndAgeAndSexAndCountryAndSchoolAndFriendsCountAndPrizeIdToUsers < ActiveRecord::Migration def self.up add_column :users, :name, :string add_column :users, :age, :integer add_column :users, :sex, :string add_column :users, :country, :string add_column :users, :school, :string add_c...
Ruby
class AddInvitedStaticsToUsers < ActiveRecord::Migration def self.up add_column :users,:invitation_sent_number,:integer add_column :users,:invitation_accept_number,:integer end def self.down end end
Ruby
class ChangeUserTableColumns < ActiveRecord::Migration def self.up remove_column :users,:age remove_column :users,:country remove_column :users,:school remove_column :users,:birthday remove_column :users,:profile_updated_at add_column :users,:wall_count,:string add_column :use...
Ruby
class AddPositionToWinstreaks < ActiveRecord::Migration def self.up add_column :winstreaks, :position, :integer,:default=>0 end def self.down remove_column :winstreaks, :position end end
Ruby
class RemoveWinTeamIdToMatches < ActiveRecord::Migration def self.up remove_column :matches, :win_team_id end def self.down add_column :matches, :win_team_id, :integer end end
Ruby
class AddAliasDoneToTeams < ActiveRecord::Migration def self.up add_column :teams, :alias_done, :boolean,:default=>false end def self.down remove_column :teams, :alias_done end end
Ruby
class CreateUserPrizes < ActiveRecord::Migration def self.up create_table :user_prizes do |t| t.integer :user_id t.integer :prize_id t.integer :streak t.timestamps end end def self.down drop_table :user_prizes end end
Ruby
class AddCidToLeagues < ActiveRecord::Migration def self.up add_column :leagues, :cid, :integer end def self.down remove_column :leagues, :cid end end
Ruby
class AddWinstreakValueToMatches < ActiveRecord::Migration def self.up add_column :matches, :winstreak_value, :float end def self.down remove_column :matches, :winstreak_value end end
Ruby
class CreateFacebookTemplates < ActiveRecord::Migration def self.up create_table :facebook_templates, :force => true do |t| t.string :template_name, :null => false t.string :content_hash, :null => false t.string :bundle_id, :null => true end add_index :facebook_templates, :template...
Ruby
class ChangeWinToDefaultFalseFromBets < ActiveRecord::Migration def self.up change_column :bets,:win,:boolean,:default=>false end def self.down change_column :bets,:win end end
Ruby
class CreateResults < ActiveRecord::Migration def self.up create_table :results do |t| t.string :home_team t.string :away_team t.integer :home_point t.integer :away_point t.boolean :processed t.timestamps end end def self.down drop_table :results end end
Ruby
class AddPlayedToMatches < ActiveRecord::Migration def self.up add_column :matches, :played, :boolean,:default=>false end def self.down remove_column :matches, :played end end
Ruby
class Challenge < ActiveRecord::Migration def self.up create_table :challenges do |t| t.integer :match_id t.integer :from_user_id t.integer :to_user_id t.integer :amount t.string :mode end add_index :challenges,:mode end def self.down end end
Ruby
class CreateCountries < ActiveRecord::Migration def self.up create_table :countries do |t| t.string :name t.timestamps end end def self.down drop_table :countries end end
Ruby
class AddColumnToIlog < ActiveRecord::Migration def self.up add_column :ilogs,:refer_via_comment,:integer add_column :ilogs,:no_of_challenges,:integer end def self.down end end
Ruby
class AddHomePointSpreadAndAwayPointSpreadToMatches < ActiveRecord::Migration def self.up add_column :matches, :home_point_spread, :float add_column :matches, :away_point_spread, :float end def self.down remove_column :matches, :away_point_spread remove_column :matches, :home_point_spread end e...
Ruby
class AddDescriptionToPrizes < ActiveRecord::Migration def self.up add_column :prizes, :description, :string end def self.down remove_column :prizes, :description end end
Ruby
class AddLeagueIdToMatches < ActiveRecord::Migration def self.up add_column :matches, :league_id, :integer end def self.down remove_column :matches, :league_id end end
Ruby
class RemoveHomePointSpreadAndAwayTeamSpreadAndAddPointSpreadAndWinTeamIdToMatches < ActiveRecord::Migration def self.up add_column :matches, :point_spread, :integer add_column :matches, :win_team_id, :integer remove_column :matches,:home_point_spread remove_column :matches,:away_point_spread end ...
Ruby
class CreateSports < ActiveRecord::Migration def self.up create_table :sports do |t| t.string :name,:feed_url t.timestamps end end def self.down drop_table :sports end end
Ruby
class AddGotPrizeToWinstreaks < ActiveRecord::Migration def self.up add_column :winstreaks, :got_prize, :boolean,:default=>false end def self.down remove_column :winstreaks, :got_prize end end
Ruby
class CreatePrizes < ActiveRecord::Migration def self.up create_table :prizes do |t| t.string :name t.integer :streak t.string :pic t.timestamps end end def self.down drop_table :prizes end end
Ruby
class AddBetsCountToUsers < ActiveRecord::Migration def self.up add_column :users, :bets_count, :integer,:default=>0 end def self.down remove_column :users, :bets_count end end
Ruby
class AddBirthdayToUsers < ActiveRecord::Migration def self.up add_column :users, :birthday, :datetime end def self.down remove_column :users, :birthday end end
Ruby
class AddBookmarkHowtoHideToUsers < ActiveRecord::Migration def self.up add_column :users,:hide_bookmark,:boolean add_column :users,:hide_howto,:boolean end def self.down remove_column :users,:hide_bookmark remove_column :users,:hide_howto end end
Ruby
class CreateUsers < ActiveRecord::Migration def self.up create_table :users do |t| t.integer :facebook_id,:limit=>20 t.timestamps end end def self.down drop_table :users end end
Ruby
class CreateBuyWins < ActiveRecord::Migration def self.up create_table :buy_wins do |t| t.integer :user_id t.integer :point_config_id t.integer :winstreak_id t.timestamps end end def self.down drop_table :buy_wins end end
Ruby
class CreateTeams < ActiveRecord::Migration def self.up create_table :teams do |t| t.string :name t.string :pic t.string :description t.timestamps end end def self.down drop_table :teams end end
Ruby
class AddNameAliasToTeams < ActiveRecord::Migration def self.up add_column :teams, :name_alias, :string end def self.down remove_column :teams, :name_alias end end
Ruby
class CreateBets < ActiveRecord::Migration def self.up create_table :bets do |t| t.integer :user_id t.integer :match_id t.boolean :result t.string :status t.timestamps end end def self.down drop_table :bets end end
Ruby
class AddAppUserAndProfileUpdatedAtToUsers < ActiveRecord::Migration def self.up add_column :users, :app_user, :boolean,:default=>false add_column :users, :profile_updated_at, :datetime end def self.down remove_column :users, :profile_updated_at remove_column :users, :app_user end end
Ruby
class AddPositionToSports < ActiveRecord::Migration def self.up add_column :sports, :position, :integer end def self.down remove_column :sports, :position end end
Ruby
class AddWinToBets < ActiveRecord::Migration def self.up add_column :bets, :win, :boolean end def self.down remove_column :bets, :win end end
Ruby
class AddGotPrizeAtToWinstreaks < ActiveRecord::Migration def self.up add_column :winstreaks, :got_prize_at, :datetime end def self.down remove_column :winstreaks, :got_prize_at end end
Ruby
class AddPlayedToBets < ActiveRecord::Migration def self.up add_column :bets, :played, :boolean,:default=>false end def self.down remove_column :bets, :played end end
Ruby
class AddCountryIdToSports < ActiveRecord::Migration def self.up add_column :sports, :country_id, :integer end def self.down remove_column :sports, :country_id end end
Ruby
class AddCommentCountToMatches < ActiveRecord::Migration def self.up add_column :matches,:comment_count,:integer end def self.down remove_column :matches,:comment_count end end
Ruby
class AddMidToMatches < ActiveRecord::Migration def self.up add_column :matches, :mid, :integer end def self.down remove_column :matches, :mid end end
Ruby
class AddWhichInstallToUser < ActiveRecord::Migration def self.up add_column :users,:which_install,:integer end def self.down end end
Ruby
class CreateUserActions < ActiveRecord::Migration def self.up create_table :user_actions do |t| t.integer :user_id t.text :feed t.timestamps end end def self.down drop_table :user_actions end end
Ruby
class AddSportIdToTeams < ActiveRecord::Migration def self.up add_column :teams, :sport_id, :integer end def self.down remove_column :teams, :sport_id end end
Ruby
class CreateLeagues < ActiveRecord::Migration def self.up create_table :leagues do |t| t.string :name t.integer :country_id t.timestamps end end def self.down drop_table :leagues end end
Ruby
class AddTeamIdToBets < ActiveRecord::Migration def self.up add_column :bets, :team_id, :integer end def self.down remove_column :bets, :team_id end end
Ruby
class AddPointToUsersIfNotExists < ActiveRecord::Migration def self.up unless User.column_names.include?("point") add_column :users,:point,:integer,:default=>0 end end def self.down if User.column_names.include?("point") remove_column :users,:point end end end
Ruby
class RemovePointSpreadAndResultFromMatches < ActiveRecord::Migration def self.up remove_column :matches,:point_spread remove_column :matches,:result end def self.down add_column :matches,:result add_column :matches,:point_spread end end
Ruby
class AddCountryIdAndSportIdAndFeedUrlToLeagues < ActiveRecord::Migration def self.up add_column :leagues, :sport_id, :integer add_column :leagues, :feed_url, :string end def self.down remove_column :leagues, :feed_url remove_column :leagues, :sport_id end end
Ruby
class ChangeStreakCountToFloatFromWinstreaks < ActiveRecord::Migration def self.up change_column :winstreaks,:streak_count,:float,:default=>0 end def self.down change_column :winstreaks,:streak_count,:integer end end
Ruby
class AddTimezoneToUsers < ActiveRecord::Migration def self.up add_column :users,:timezone,:string end def self.down end end
Ruby
class AddPrizeIdToWinstreaks < ActiveRecord::Migration def self.up add_column :winstreaks, :prize_id, :integer end def self.down remove_column :winstreaks, :prize_id end end
Ruby
class AddLeagueIdToFetchLogs < ActiveRecord::Migration def self.up add_column :fetch_logs, :league_id, :integer end def self.down remove_column :fetch_logs, :league_id end end
Ruby
class AddWinsCountLossesCountAndWinPercentageToUsers < ActiveRecord::Migration def self.up add_column :users, :wins_count, :integer,:default=>0 add_column :users, :losses_count, :integer,:default=>0 add_column :users, :percentage, :float,:default=>0 end def self.down remove_column :users, :percen...
Ruby