code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
# -----------------------------------------------
# Sass implementation of the Noisy jquery plugin:
# https://github.com/DanielRapp/Noisy
# by @philippbosch
# https://gist.github.com/1021332
# -----------------------------------------------
module Sass::Script::Functions
def background_noise(kwargs = {})
opts = {}... | Ruby |
require "compass"
# for background_noise
require "chunky_png"
require "base64"
require File.join(File.dirname(__FILE__), 'compass-recipes', 'sass_extensions')
Compass::Frameworks.register("recipes", :path => "#{File.dirname(__FILE__)}/..") | Ruby |
# Manually bring in Compass Recipes for styling shortcuts
require File.join(File.dirname(__FILE__), '..', 'compass-recipes', 'lib', 'compass-recipes')
sass_path = File.dirname(__FILE__)
css_path = File.join(sass_path, "..", "css")
output_style = :expanded # nested/expanded/compact/compressed
environment = :developmen... | Ruby |
#!/usr/bin/ruby
require 'optparse'
class LinuxVersionCleaner
def initialize
@output_file = ""
@input_file = ""
@kernel_version = ""
@defs = Array.new
@undefs = Array.new
@option = OptionParser.new
@script_name = File.basename($0)
@option.set_summary_indent(' ')
@option.banner =... | Ruby |
#!/usr/bin/ruby
require 'fileutils'
require "pp"
def get_kernel_version(config)
file = File.join("/",config[:path],"Makefile")
if not File.file?(file) then raise "#{config[:path]} not a valid kernel directory." end
lines = File.readlines(file)
config[:majver] = lines[0].split(" ")[2]
config[:minver] = lines[... | Ruby |
rootdir = Dir.pwd
task :configure do
cd rootdir
sh "make -C #{rootdir}/squashfs_compressor configure"
sh "cd #{rootdir}/yaml; autoconf; ./configure"
end
task :check_if_should_rebuild do
if not File.exists?("squashfs_compressor/libsquashfs_compressor.a") or not File.exists?("rb_tree/librb_tree.a")
puts "re... | Ruby |
require "test/unit"
require "yaml"
class TestGetopts < Test::Unit::TestCase
def run_getopts(arg_str)
str = ""
cmd = File.dirname(File.dirname(__FILE__))
cmd = File.join(cmd,"./test")
IO.popen(cmd + " " + arg_str + " 2>&1") { |io| str += io.read }
#puts "<--" + str + "-->"
#puts "fafafa--" + ... | Ruby |
require "test/unit"
require "fileutils"
require "yaml"
class TestOptsValidator < Test::Unit::TestCase
def run_getopts(arg_str)
str = ""
cmd = File.dirname(File.dirname(__FILE__))
cmd = File.join(cmd,"./test")
IO.popen(cmd + " " + arg_str + " 2>&1") { |io| str += io.read }
puts "<--" + str + "-->... | Ruby |
require "test/unit"
require "../../src/wrapper.rb"
#foo = gets
#puts foo
class TestCBlocks < Test::Unit::TestCase
def set_acfg
config = Hash.new
config[:compression] = "lzo"
config[:page_size] = 4096
config[:block_size] = 64*1024
config[:xip_size] = 64*1024*1024
config[:max_nodes] = 1024
... | Ruby |
require 'rubygems'
require 'ffi'
class String
def hexdump
i = 1
rr = ""
while (self.length > 16*(i-1))
a=self.slice(16*(i-1)..(16*i)-1)
rr += sprintf("%06x: %4.4x %4.4x %4.4x %4.4x %4.4x %4.4x %4.4x %4.4x ", (i-1)*16, *a.unpack("n16"))
rr += sprintf("|%s|\n", a.tr("^\040-\176","."))
... | Ruby |
require "fileutils"
a = ARGV[0]
if (a == "link")
FileUtils.mkdir_p("./tovtf")
f = File.new("./tovtf/file1", "w+")
f.puts("foo")
f.close
pwd = Dir.pwd
Dir.chdir("./tovtf")
FileUtils.ln_s("file1","link1")
Dir.chdir(pwd)
elsif (a == "node")
FileUtils.mkdir_p("./tovtf")
`mknod ./tovtf/node1 c 5 7`
els... | Ruby |
exec "fakeroot ./test_special" | Ruby |
require "fileutils"
a = ARGV[0]
if (a == "link")
FileUtils.mkdir_p("./tovtf")
f = File.new("./tovtf/file1", "w+")
f.puts("foo")
f.close
pwd = Dir.pwd
Dir.chdir("./tovtf")
FileUtils.ln_s("file1","link1")
Dir.chdir(pwd)
elsif (a == "node")
FileUtils.mkdir_p("./tovtf")
`mknod ./tovtf/node1 c 5 7`
els... | Ruby |
require 'rubygems'
require 'open4'
rootdir = Dir.pwd
def draw_line(mark, len, label = "")
str = ""
if label.length > 0
str += mark * (len/2 - label.length - 2) + " #{label} "
end
str += mark * (len - str.length)
puts str
end
task :unit_compile_test, :unit do |t, args|
args.with_defaults(:unit => ni... | Ruby |
require 'rubygems'
require 'jenkins_api_client'
@client = JenkinsApi::Client.new(:server_ip => ARGV[0], :server_port => '8080', :username => '', :password => '', :jenkins_path => "/jenkins-axfs", :debug => true)
puts @client.job.list_all
bd = File.expand_path(File.dirname(__FILE__) + '/jobs')
Dir.entries(bd).sort.each... | Ruby |
require 'rubygems'
require 'jenkins_api_client'
require 'yaml'
@client = JenkinsApi::Client.new(YAML.load_file(File.expand_path("~/.jenkins_api_login.yaml")))
puts @client.job.list("")
unittests = ["MkfsUnitTest__astrings.m","MkfsUnitTest__image_builder.m","MkfsUnitTest__axfs_helper.m","MkfsUnitTest__inodes.m","Mkfs... | Ruby |
arch = "x86_64"
port = "5511"
qemu_system_binary = "/opt/poky/usr/bin/qemu-system-" + arch
qemu_extra = "-m 256 -nographic -no-reboot -redir tcp:#{port}::22"
append = "root=/dev/hda rw init=/sbin/init.sh panic=1 console=ttyS0"
a={}
a["kernel"] = "bzImage-qemux86-64.bin"
a["hda"] = "hda.ext2"
a["hdb"] = "hdb.ext2"
a[:... | Ruby |
arch = "ppc"
port = "5533"
qemu_system_binary = "/opt/poky/usr/bin/qemu-system-" + arch
qemu_extra = "-m 256 -nographic -no-reboot -redir tcp:#{port}::22"
append = "root=/dev/hda rw init=/sbin/init.sh panic=1 console=ttyS0"
a={}
a["kernel"] = "vmlinux-qemuppc.bin"
a["hda"] = "hda.ext2"
a["hdb"] = "hdb.ext2"
a[:KERNEL... | Ruby |
arch = "i386"
port = "5522"
qemu_system_binary = "/opt/poky/usr/bin/qemu-system-" + arch
qemu_extra = "-m 256 -nographic -no-reboot -redir tcp:#{port}::22"
append = "root=/dev/hda rw init=/sbin/init.sh panic=1 console=ttyS0"
a={}
a["kernel"] = "bzImage-qemux86.bin"
a["hda"] = "hda.ext2"
a["hdb"] = "hdb.ext2"
a[:KERNE... | Ruby |
arch = "arm"
port = "5555"
qemu_system_binary = "/opt/poky/usr/bin/qemu-system-" + arch
qemu_extra = "-m 256 -nographic -no-reboot -M versatilepb -redir tcp:#{port}::22"
append = "root=/dev/sda rw init=/sbin/init.sh panic=1 console=ttyAMA0"
a={}
a["kernel"] = "zImage-qemuarm.bin"
a["hda"] = "hda.ext2"
a["hdb"] = "hdb... | Ruby |
arch = "mips"
port = "5544"
qemu_system_binary = "/opt/poky/usr/bin/qemu-system-" + arch
qemu_extra = "-m 256 -nographic -no-reboot -redir tcp:#{port}::22"
append = "root=/dev/hda rw init=/sbin/init.sh panic=1 console=ttyS0"
a={}
a["kernel"] = "vmlinux-qemumips.bin"
a["hda"] = "hda.ext2"
a["hdb"] = "hdb.ext2"
a[:KERN... | Ruby |
task :build do
inc = " -I../../libs/squashfs_compressor -I/usr/include/python2.7"
cflags = " -O2 -fPIC "
lib = "../../libs/squashfs_compressor/libsquashfs_compressor.a"
sh "swig -python ccompresser.i"
sh "gcc #{cflags} #{inc} -c ccompresser.c"
sh "gcc #{cflags} #{inc} -c ccompresser_wrap.c"
sh "gcc -shar... | Ruby |
rootdir = Dir.pwd
utfpath = File.join(rootdir,"tests","utf")
libpath = File.join(rootdir,"libs")
srcpath = File.join(rootdir,"src")
task :lib do
should_rebuild = `cd #{libpath}; rake check_if_should_rebuild`
if should_rebuild.length > 0
sh "cd #{libpath}; rake clobber"
sh "cd #{libpath}; rake configure"
... | Ruby |
require 'rake/clean'
CLEAN.include('dist/kmltree.css', 'dist/kmltree.min.js', 'dist/kmltree.js', 'dist/images', 'src/_sprites.sass', 'sprites-url')
CLOBBER.include('compiler')
SRC = FileList[ 'src/kmltreeManager.js', 'src/base64.js', 'src/tmpl.js', 'src/kmldom.js', 'src/URI.js', 'src/kmltree.js', 'src/googleLayers.js... | Ruby |
# coding: utf-8
# Title: LightPack API wrapper for Ruby
# Author: Mikhail S. Pobolovets
# License: GPL v3
# Date: 2011/08/15
# API Version: 5.5
require 'socket'
class LightPack
include Socket::Constants
# host = '127.0.0.1' # The remote host
# port = 3636 ... | Ruby |
require 'rake/clean'
CLEAN.include('dist/kmltree.css', 'dist/kmltree.min.js', 'dist/kmltree.js', 'dist/images', 'src/_sprites.sass', 'sprites-url')
CLOBBER.include('compiler')
SRC = FileList[ 'src/kmltreeManager.js', 'src/base64.js', 'src/tmpl.js', 'src/kmldom.js', 'src/URI.js', 'src/kmltree.js', 'src/googleLayers.js... | 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 'rake'
require 'rake/clean'
task :default => :spec
desc "Run all specs"
task :spec do
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |t|
#t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
t.pattern = 'spec/*_spec.rb'
end
end
def version
File.read(... | 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 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 :gemcutter
gem 'sinatra', :require => 'sinatra/base'
gem 'thin', '~> 1.3'
gem 'pg'
gem 'data_mapper', '~> 1.2'
gem 'dm-postgres-adapter'
gem 'google-api-client', '>= 0.4.3'
group :development do
gem 'dm-sqlite-adapter', '~> 1.2'
gem 'do_sqlite3', '~> 0.10'
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/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 'rake/clean'
CLEAN.include('dist/kmltree.css', 'dist/kmltree.min.js', 'dist/kmltree.js', 'dist/images', 'src/_sprites.sass', 'sprites-url')
CLOBBER.include('compiler')
SRC = FileList[ 'src/kmltreeManager.js', 'src/base64.js', 'src/tmpl.js', 'src/kmldom.js', 'src/URI.js', 'src/kmltree.js', 'src/googleLayers.js... | Ruby |
# Copyright 2008-2009 Nokia Siemens Networks Oyj
#
# 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... | Ruby |
#!/usr/bin/env ruby
class ExampleRemoteLibrary
def count_items_in_directory(path)
Dir.entries(path).find_all{|i| not i.match('^\.')}.length
end
def strings_should_be_equal(str1, str2)
puts "Comparing '#{str1}' to '#{str2}'"
if str1 != str2
raise RuntimeError, "Given strings are not equal"
... | Ruby |
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
require 'optparse'
XML2CSP = 'jp.ac.kobe_u.cs.sugar.XML2CSP'
if $0 == __FILE__
outfile = '/dev/stdout'
verbose = false
jopt = ''
jar = File.dirname($0)+'/../bin/azucar-v0.2.4.jar'
opt = ARGV.options{ |o|
o.banner = "Usage: #{File.basename $0} [options] xml"
o.... | Ruby |
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
require 'optparse'
class Operation
attr_reader :stime, :ptime, :number
def initialize(s, pt, num)
@stime = s
@ptime = pt
@number = num
end
def to_s
"Operation(stime: #{@stime}, ptime: #{@ptime}, number: #{@number})"
end
end
def calc_lower_bound(ops, j... | 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 |
#1
firstarray = [3, 5, 1, 2, 7, 9, 8, 13, 25, 32]
puts firstarray.inject(0) { |result, element| result + element} #sum
puts firstarray.find_all{|i| i > 10}
#2
secondarray = %w[john kb oliver cory matthew christopher]
secondarray.shuffle
puts secondarray.find_all{|i| i.length > 5}
#3
... | Ruby |
monster1 = {:health => 500}
monster2 = {:health => 500}
for i in (1..5)
k = rand(100)
puts "monster1 attacks monster2 with #{k} damage"
monster2[:health] = monster2[:health] - k;
puts "monster2's health is now #{monster2[:health]}/500"
j = rand(100)
puts "monster2 attacks monster1 with #{j... | Ruby |
a = {:first_name => "Michael", :last_name => "Choi"}
b = {:first_name => "John", :last_name => "Supsupin"}
c = {:first_name => "KB", :last_name => "Tonel"}
d = {:first_name => "Mikee", :last_name => "Buyco"}
e = {:first_name => "Diana", :last_name => "Manlulu"}
names = [a, b, c, d, e]
puts "you have... | Ruby |
def randomoperation(number1, number2)
operation = 1 + rand(3);
case operation
when 1
answer = number1 * number2
whatOp = "multiplication"
when 2
answer = number1 + number2
whatOp = "addition"
when 3
answer = number1 - number2
whatOp = "subtraction"
whe... | Ruby |
class MathDojo
attr_reader :sum
def initialize()
@sum = 0;
end
def add(*rest)
rest.flatten!
rest.each{|number| @sum += number}
self
end
def subtract(*rest)
rest.flatten!
rest.each{|number| @sum -= number}
self
en... | 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: 'Emanuel... | Ruby |
class CreateComments < ActiveRecord::Migration
def change
create_table :comments do |t|
t.string :name
t.text :content
t.timestamps
end
end
end
| Ruby |
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :first_name
t.string :last_name
t.string :email
t.string :password
t.timestamps
end
end
end
| 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 |
#!/usr/bin/env rake
# 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.expand_path('../config/application', __FILE__)
Project::Application.load_tasks
| Ruby |
source 'https://rubygems.org'
gem 'rails', '3.2.13'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> ... | 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 |
#!/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 UsersHelper
end
| Ruby |
module PostsHelper
end
| Ruby |
class Comment < ActiveRecord::Base
attr_accessible :content, :name
end
| Ruby |
class User < ActiveRecord::Base
attr_accessible :email, :first_name, :last_name, :password
validates :email, :first_name, :last_name, :password, presence: true
end
| Ruby |
class PostsController < ApplicationController
def index
end
def new
end
end
| Ruby |
class ApplicationController < ActionController::Base
protect_from_forgery
end
| Ruby |
class UsersController < ApplicationController
def index
@user = User.all
end
def new
@user = User.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @user }
end
end
def create
@user = User.new(params[:user])
respond_to do |format|
if @user.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 |
# Be sure to restart your server when you modify this file.
#
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters ... | Ruby |
# Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attac... | Ruby |
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
# Wrappers are used by the form builder to generate a
# complete input. You can remove any component from the
# wrapper, change the order or even add your own to the
# stack. The options given below are used to... | Ruby |
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
| Ruby |
# Be sure to restart your server when you modify this file.
Project::Application.config.session_store :cookie_store, key: '_project_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails g... | Ruby |
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
config.wrappers :foundation, :class => :input, :hint_class => :field_with_hint, :error_class => :error do |b|
b.use :html5
b.use :placeholder
b.optional :maxlength
b.optional :pattern
b.optional :... | Ruby |
Project::Application.routes.draw do
resources :users
resources :posts
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# S... | Ruby |
require 'rubygems'
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
| Ruby |
require File.expand_path('../boot', __FILE__)
require 'rails/all'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.requi... | Ruby |
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
Project::Application.initialize!
| Ruby |
Project::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action... | Ruby |
Project::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web se... | Ruby |
Project::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test su... | Ruby |
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Project::Application
| Ruby |
#!/usr/bin/env rake
# 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.expand_path('../config/application', __FILE__)
Project::Application.load_tasks
| 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: 'Emanuel... | Ruby |
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :first_name
t.string :last_name
t.string :email_address
t.string :password
t.timestamps
end
end
end
| Ruby |
ENV["RAILS_ENV"] ||= "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
ActiveRecord::Migration.check_pending!
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
#
# Note: You'll currently still have to de... | Ruby |
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Us... | Ruby |
module ApplicationHelper
end
| Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.