code
stringlengths
1
1.73M
language
stringclasses
1 value
# Require any additional compass plugins here. # Set this to the root of your project when deployed: http_path = "/" css_dir = "theme/css" sass_dir = "theme/scss" images_dir = "images" javascripts_dir = "js" # You can select your preferred output style here (can be overridden via the command line): output_style = :co...
Ruby
source "http://rubygems.org" gem 'rake', '0.8.7' gem 'json' group :development do gem 'test-unit' gem 'thoughtbot-shoulda' gem 'ruby-debug' end
Ruby
begin require 'main/init' rescue LoadError require 'src/main/ruby/main/init' end require 'pathname' require 'test/unit' require 'shoulda/integrations/test_unit' require 'lib/configuration' require 'lib/crawling' java_import [de.recipeminer.environments.ExecutionContextProvider, de.recipeminer.environ...
Ruby
require 'test/unit' require 'shoulda/integrations/test_unit' require 'src/main/ruby/main/init' class TestJava < Test::Unit::TestCase context "The java integrations" do should "be able to provide 'magic' access to de.* and eu.* Java-packages" do assert_nothing_raised do assert_instance_of(java.lang...
Ruby
begin require 'main/init' rescue LoadError require 'src/main/ruby/main/init' end require 'test/unit' require 'shoulda/integrations/test_unit' require 'lib/configuration' class TestConfig < Test::Unit::TestCase context "#{Configuration::ConfigContainer}" do context "in the test enviroment" do setu...
Ruby
begin require 'main/init' rescue LoadError require 'src/main/ruby/main/init' end require 'net/http' require 'json' require 'lib/configuration' require 'lib/crawling' module Testing def self.print_info puts "The Ruby VM is: #{RUBY_DESCRIPTION}" puts 'My Loadpath is:' puts $: puts 'My classpath is:'...
Ruby
require 'java' require 'pathname' module Init EXPECTED_HOME_ENTRIES = ['pom.xml', 'src', 'Gemfile'] RELATIVE_INIT_PATH = 'src/main/ruby/main/init.rb' class << self def add_package_shortcuts [:de, :eu].each do |meth| Kernel.module_eval <<-EOM def #{meth} JavaUt...
Ruby
require 'src/main/ruby/main/init' require 'pathname' require 'singleton' java_import(de.recipeminer.environments.ExecutionContextProvider) module Configuration class << self def project_home_path Init::project_home_path end alias_method :project_path, :project_home_path def maven_r...
Ruby
#encoding: UTF-8 java_import [de.recipeminer.persistence.Db4oHelpers, de.recipeminer.crawling.chefkoch.ChefkochJsonRecipe, de.recipeminer.tools.Tools] java_import(java.lang.String) {'JString'} module Workflow module Workflow def run begin execute rescue Exce...
Ruby
#encoding: utf-8 require 'lib/configuration' require 'net/http' require 'json' require 'set' require 'pp' require 'yaml' require 'singleton' java_import [de.recipeminer.environments.ExecutionContextProvider, de.recipeminer.environments.ExecutionContext, de.recipeminer.crawling.chefkoch.Chefko...
Ruby
puts "probing for #{JAR_PROBING_STRING}" path_template = $:.select { |p| p.end_with? JAR_PROBING_STRING } unless path_template.empty? entry = path_template[0].sub(JAR_PROBING_STRING, JAR_LOCATION_RUBY) $: << entry entry else nil end
Ruby
#encoding: UTF-8 require 'rake' require 'rake/clean' require 'rubygems/package_task' require 'rdoc/task' require 'rake/testtask' require 'fileutils' require 'set' spec = Gem::Specification.new do |s| s.name = 'recipeminer' s.version = '0.0.1' s.has_rdoc = true s.extra_rdoc_files = ['README', 'LI...
Ruby
#!/usr/bin/env ruby # # Bootloader for wmii configuration. # #-- # Copyright protects this work. # See LICENSE file for details. #++ # create a logger to aid debugging require 'logger' LOG = Logger.new(__FILE__ + '.log', 5) class << LOG # emulate IO.write alias write << def flush # ignore end end # capt...
Ruby
# DSL for wmiirc configuration. #-- # Copyright protects this work. # See LICENSE file for details. #++ require 'shellwords' require 'pathname' require 'yaml' require 'rubygems' gem 'rumai', '~> 3' require 'rumai' include Rumai class Handler < Hash def initialize super {|h,k| h[k] = [] } end ## # If a ...
Ruby
# Require any additional compass plugins here. # Set this to the root of your project when deployed: http_path = "/" css_dir = "theme/css" sass_dir = "theme/scss" images_dir = "images" javascripts_dir = "js" # You can select your preferred output style here (can be overridden via the command line): output_style = :co...
Ruby
#!/usr/bin/env ruby require 'rubygems' require 'mqtt' MQTT::Client.connect('localhost',1883) do |client| client.get('#') do |topic,message| puts "#{topic}: #{message}" end end
Ruby
require 'sinatra/activerecord/rake' require './main'
Ruby
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'sinatra-activerecord' gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client' group :development do gem 'rake' gem 'sqlite3-ruby' end
Ruby
class CreateUsers < ActiveRecord::Migration def up create_table :users do |t| t.string :profile_id t.string :email t.string :refresh_token end add_index :users, :profile_id end def down drop_table :users end end
Ruby
# Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Ruby
require 'sinatra.rb' # Sinatra defines #set at the top level as a way to set application configuration set :run, false set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development) require './main' run Sinatra::Application
Ruby
# Require any additional compass plugins here. # Set this to the root of your project when deployed: http_path = "/" css_dir = "theme/css" sass_dir = "theme/scss" images_dir = "images" javascripts_dir = "js" # You can select your preferred output style here (can be overridden via the command line): output_style = :co...
Ruby
require 'sinatra/activerecord/rake' require './main'
Ruby
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'sinatra-activerecord' gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client' group :development do gem 'rake' gem 'sqlite3-ruby' end
Ruby
class CreateUsers < ActiveRecord::Migration def up create_table :users do |t| t.string :profile_id t.string :email t.string :refresh_token end add_index :users, :profile_id end def down drop_table :users end end
Ruby
# Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Ruby
require 'sinatra.rb' # Sinatra defines #set at the top level as a way to set application configuration set :run, false set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development) require './main' run Sinatra::Application
Ruby
require 'sinatra/activerecord/rake' require './main'
Ruby
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'sinatra-activerecord' gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client' group :development do gem 'rake' gem 'sqlite3-ruby' end
Ruby
class CreateUsers < ActiveRecord::Migration def up create_table :users do |t| t.string :profile_id t.string :email t.string :refresh_token end add_index :users, :profile_id end def down drop_table :users end end
Ruby
# Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Ruby
require 'sinatra.rb' # Sinatra defines #set at the top level as a way to set application configuration set :run, false set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development) require './main' run Sinatra::Application
Ruby
require 'java' message = "Hello ColdFusion. This is Ruby via JRuby and Java." $nv = message
Ruby
require 'sinatra/activerecord/rake' require './main'
Ruby
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'sinatra-activerecord' gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client' group :development do gem 'rake' gem 'sqlite3-ruby' end
Ruby
class CreateUsers < ActiveRecord::Migration def up create_table :users do |t| t.string :profile_id t.string :email t.string :refresh_token end add_index :users, :profile_id end def down drop_table :users end end
Ruby
# Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Ruby
require 'sinatra.rb' # Sinatra defines #set at the top level as a way to set application configuration set :run, false set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development) require './main' run Sinatra::Application
Ruby
require 'sinatra/activerecord/rake' require './main'
Ruby
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'sinatra-activerecord' gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client' group :development do gem 'rake' gem 'sqlite3-ruby' end
Ruby
class CreateUsers < ActiveRecord::Migration def up create_table :users do |t| t.string :profile_id t.string :email t.string :refresh_token end add_index :users, :profile_id end def down drop_table :users end end
Ruby
# Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Ruby
require 'sinatra.rb' # Sinatra defines #set at the top level as a way to set application configuration set :run, false set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development) require './main' run Sinatra::Application
Ruby
require 'RMagick' class NumberImageGenerator @@IMAGE_DIR = 'numbers-hdpi/' def generate(text, fs=18) #filename = "b" + sprintf("%03d", text) + ".png"; filename = "" + sprintf("%03d", text) + ".png"; font_size = fs; height = 35; width = 35; image = Magick::Image.new(width, height) {self.ba...
Ruby
#!/usr/bin/env ruby # encoding: utf-8 project = 'battery-indicator' user = `cat ~/.netrc | awk '{print $4;}'`.strip pass = `cat ~/.netrc | awk '{print $6;}'`.strip version = `grep "android:versionName=" AndroidManifest.xml`.split('"')[1] apk_location = "BatteryIndicatorPro-#{version}.apk" system("cp bin/*-release.ap...
Ruby
#!/usr/bin/env ruby require 'net/http' require 'uri' LANGS_URI = 'http://ath.darshancomputing.com/bi/langs/' langs = Net::HTTP.get(URI.parse(LANGS_URI)).split() langs.each do |lang| if lang.length == 2 dir = 'res/values-' << lang else dir = 'res/values-' << lang[0,2] << '-r' << lang[2,2] end if ! D...
Ruby
# Rake Quick Reference # by Greg Houston # http://ghouston.blogspot.com/2008/07/rake-quick-reference.html # ----------------------------------------------------------------------------- # Running Rake # ----------------------------------------------------------------------------- # running rake from the command-line:...
Ruby
#!/usr/bin/ruby # # Find unused resources in all the apps found recursively under the current directory # Usage: # find_unused_resources.rb [-html] # # If -html is specified, the output will be HTML, otherwise it will be plain text # # Author: cbeust@google.com require 'find' debug = false @@stringIdPattern = Rege...
Ruby
#!/usr/bin/ruby # # Find unused resources in all the apps found recursively under the current directory # Usage: # find_unused_resources.rb [-html] # # If -html is specified, the output will be HTML, otherwise it will be plain text # # Author: cbeust@google.com require 'find' debug = false @@stringIdPattern = Rege...
Ruby
# Rake Quick Reference # by Greg Houston # http://ghouston.blogspot.com/2008/07/rake-quick-reference.html # ----------------------------------------------------------------------------- # Running Rake # ----------------------------------------------------------------------------- # running rake from the command-line:...
Ruby
#!/usr/bin/ruby # # Find unused resources in all the apps found recursively under the current directory # Usage: # find_unused_resources.rb [-html] # # If -html is specified, the output will be HTML, otherwise it will be plain text # # Author: cbeust@google.com require 'find' debug = false @@stringIdPattern = Rege...
Ruby
#!/usr/bin/ruby # # Find unused resources in all the apps found recursively under the current directory # Usage: # find_unused_resources.rb [-html] # # If -html is specified, the output will be HTML, otherwise it will be plain text # # Author: cbeust@google.com require 'find' debug = false @@stringIdPattern = Rege...
Ruby
class CreateUsers < ActiveRecord::Migration def up create_table :users do |t| t.string :profile_id t.string :email t.string :refresh_token end add_index :users, :profile_id end def down drop_table :users end end
Ruby
# Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Ruby
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'sinatra-activerecord' gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client' group :development do gem 'rake' gem 'sqlite3-ruby' end
Ruby
require 'sinatra.rb' # Sinatra defines #set at the top level as a way to set application configuration set :run, false set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development) require './main' run Sinatra::Application
Ruby
require 'sinatra/activerecord/rake' require './main'
Ruby
#!/usr/bin/env ruby ## git-rank-contributors: a simple script to trace through the logs and ## rank contributors by the total size of the diffs they're responsible for. ## A change counts twice as much as a plain addition or deletion. ## ## Output may or may not be suitable for inclusion in a CREDITS file. ## Probably...
Ruby
#!/usr/bin/env ruby ## git-rank-contributors: a simple script to trace through the logs and ## rank contributors by the total size of the diffs they're responsible for. ## A change counts twice as much as a plain addition or deletion. ## ## Output may or may not be suitable for inclusion in a CREDITS file. ## Probably...
Ruby
#!/usr/bin/env ruby ## git-rank-contributors: a simple script to trace through the logs and ## rank contributors by the total size of the diffs they're responsible for. ## A change counts twice as much as a plain addition or deletion. ## ## Output may or may not be suitable for inclusion in a CREDITS file. ## Probably...
Ruby
#!/usr/bin/env ruby ## git-rank-contributors: a simple script to trace through the logs and ## rank contributors by the total size of the diffs they're responsible for. ## A change counts twice as much as a plain addition or deletion. ## ## Output may or may not be suitable for inclusion in a CREDITS file. ## Probably...
Ruby
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }]) # Mayor.create(:name =>...
Ruby
class CreateAppPermissions < ActiveRecord::Migration def self.up create_table :app_permissions do |t| t.references :app t.references :permission t.timestamps end add_index :app_permissions, :app_id add_index :app_permissions, :permission_id end def self.down drop_table :ap...
Ruby
class CreateTargets < ActiveRecord::Migration def self.up create_table :targets do |t| t.string :name t.timestamps end add_index :targets, :name, :unique => true end def self.down drop_table :targets end end
Ruby
class CreateVisuals < ActiveRecord::Migration def self.up create_table :visuals do |t| t.references :app t.timestamps end add_index :visuals, :app_id end def self.down drop_table :visuals end end
Ruby
class CreatePermissions < ActiveRecord::Migration def self.up create_table :permissions do |t| t.string :name t.timestamps end add_index :permissions, :name, :unique => true end def self.down drop_table :permissions end end
Ruby
class CreateComments < ActiveRecord::Migration def self.up create_table :comments do |t| t.integer :rating t.string :creationTime t.string :authorName t.string :text t.string :authorId t.references :app t.timestamps end add_index :comments, :app_id add_index ...
Ruby
class CreateRatings < ActiveRecord::Migration def self.up create_table :ratings do |t| t.string :rating t.integer :ratingCount t.integer :downloadCount t.string :downloadCountText t.references :app t.timestamps end add_index :ratings, :app_id, :unique => true end ...
Ruby
class AddAttachmentImageToVisual < ActiveRecord::Migration def self.up add_column :visuals, :image_file_name, :string add_column :visuals, :image_content_type, :string add_column :visuals, :image_file_size, :integer add_column :visuals, :image_updated_at, :datetime end def self.down remove_co...
Ruby
class CreateVestalVersions < ActiveRecord::Migration def self.up create_table :versions do |t| t.belongs_to :versioned, :polymorphic => true t.belongs_to :user, :polymorphic => true t.string :user_name t.text :modifications t.integer :number t.integer :reverted_from t...
Ruby
class CreateAppTargets < ActiveRecord::Migration def self.up create_table :app_targets do |t| t.references :app t.references :target t.timestamps end add_index :app_targets, :app_id add_index :app_targets, :target_id end def self.down drop_table :app_targets end end
Ruby
class CreateApps < ActiveRecord::Migration def self.up create_table :apps do |t| t.string :creator t.string :packageName t.string :title t.text :description t.string :appId t.string :category t.text :recentChanges t.string :email t.string :phone t.string...
Ruby
ENV["RAILS_ENV"] = "test" require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. # # Note: You'll currently still have to declare fixtures explicitly in integrati...
Ruby
source 'http://rubygems.org' gem 'rails', '3.0.3' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'mysql2' gem 'paperclip' gem 'will_paginate' gem 'vestal_versions', :git => 'git://github.com/adamcooper/vestal_versions' # Use unicorn as the web server # gem 'unicorn' # D...
Ruby
#!/usr/bin/env ruby # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. APP_PATH = File.expand_path('../../config/application', __FILE__) require File.expand_path('../../config/boot', __FILE__) require 'rails/commands'
Ruby
module ApplicationHelper end
Ruby
module VisualsHelper end
Ruby
module AppPermissionHelper end
Ruby
module AppTargetHelper end
Ruby
module PermissionsHelper end
Ruby
module AppsHelper end
Ruby
module CommentsHelper end
Ruby
class Visual < ActiveRecord::Base belongs_to :app has_attached_file :image, :url => "/:attachment/:id/:style/:basename.:extension", :path => ":rails_root/public/:attachment/:id/:style/:basename.:extension" validates_attachment_presence :image validates_attachment_co...
Ruby
class AppPermission < ActiveRecord::Base belongs_to :app belongs_to :permission end
Ruby
class Target < ActiveRecord::Base has_many :app_targets has_many :apps, :through => :app_targets end
Ruby
class Rating < ActiveRecord::Base versioned belongs_to :app end
Ruby
class Comment < ActiveRecord::Base belongs_to :app end
Ruby
class Permission < ActiveRecord::Base validates_uniqueness_of :name validates_presence_of :name has_many :app_permissions has_many :apps, :through => :app_permissions end
Ruby
class App < ActiveRecord::Base validates_uniqueness_of :packageName has_one :rating, :dependent => :destroy has_many :visuals, :dependent => :destroy has_many :comments, :dependent => :destroy has_many :app_targets has_many :targets, :through => :app_targets has_many :app_permissions has_many :...
Ruby
class AppTarget < ActiveRecord::Base belongs_to :app belongs_to :target end
Ruby
class Record attr_accessor :id, :exists end
Ruby
class ApplicationController < ActionController::Base # protect_from_forgery end
Ruby
class AppTargetsController < ApplicationController # POST /app_targets.xml # POST /app_targets.json def create @app_target = AppTarget.new(params[:app_target]) respond_to do |format| if @app_target.save format.xml { render :xml => @app_target, :status => :created, :location => @app_targ...
Ruby
class CommentsController < ApplicationController # POST /comments.xml # POST /comments.json def create @app = App.find(params[:app_id]) @comment = @app.comments.new(params[:comment]) respond_to do |format| if @comment.save format.xml { render :xml => @comment, :status => :...
Ruby
class PermissionsController < ApplicationController # POST /permission.xml # POST /permission.json def create @permission = Permission.new(:name => params[:permission]) respond_to do |format| if @permission.save format.xml { render :xml => @permission, :status => :created, :location => @...
Ruby
class AppsController < ApplicationController # GET /apps # GET /apps.xml # GET /apps.json def index @apps = App.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @apps } format.json { render :json => @apps } end end # GET /apps/1 ...
Ruby
class VisualsController < ApplicationController # POST /visuals def create @app = App.find(params[:app_id]) @visual = @app.visuals.new(:image => params[:image]) respond_to do |format| if @visual.save format.html { render :json => @visual, :status => :created} else ...
Ruby
class AppPermissionsController < ApplicationController # POST /app_permissions/update_permissions.xml # POST /app_permissions/update_permissions.json def update_permissions app = App.find(params[:app_id]) app.permission_ids = params[:permissions] respond_to do |format| if app.save! ...
Ruby
# Be sure to restart your server when you modify this file. # Add new inflection rules using the following format # (all these examples are active by default): # ActiveSupport::Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', ...
Ruby
# Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } # You can also remove all the silencers if you're trying to debug a probl...
Ruby