code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
# Assignment 2 (v1.0)
=begin doc
WGraph - A Graph is made up of vertices and edges between vertices.
In this class, to represent edges, we use an adjacency list to represent a graph.
=end
# Version 1.0 (preview) modified from v2.7 of Graph.rb
# -------------------------------------------------------
# ... | Ruby |
$remaining_vertices = []
$visited_vertices = {}
def get_random_vertex()
v = $remaining_vertices.sample
while $visited_vertices[v]
v = $remaining_vertices.sample
end
$visited_vertices[v] = true
return v
end
def greedy(vertices, s)
#puts "greedy algo"
return s if vertices.empty?
max = -1
v_ma... | Ruby |
# Assignment 2, Q3 and Q4 (v1.0)
# You may modify this file for testing purposes,
# but your final assignment2.rb must be able to run with the original main.rb.
load "utility.rb"
load "wgraph.rb"
load "assignment2.rb"
# load_graph reads from the CSV file and populates the graph in $g.
g = load_graph("data\\... | Ruby |
# assignment2.rb (v1.0)
# Fill this up:
# Section : G4 (Tue) (please specify correct day)
# Faculty : Lau Hoong Chuin (please delete one)
# Team ID : G4-T15
# Name of Team member 1: Seah Jun Zhi
# Name of Team member 2: Mohamed Safiullah
# Name of Team member 3 (if any):
#-----------------------... | Ruby |
def greedy_search(vertices, independent_set)
return independent_set if vertices.empty?
max_num_of_adjoinable_vertices = -1
selected_vertex_index = -1
i=0
vertices.each { |v|
num_adjoinable_vertices = vertices.size - (vertices & v.adjList).size - 1
if num_adjoinable_vertices > max_num_of_adjoinable_... | Ruby |
#!/usr/bin/ruby
require 'openssl'
require 'digest/sha2'
require 'pathname'
class String
def realpath() return Pathname(self).realpath.to_s end
def dirname() return Pathname(self).dirname.to_s end
end
require File.expand_path(__FILE__.realpath.dirname+'/genversion.rb')
KEY = %w(30 81 9F 30 0D 06 09 2A 86 48 86 F7 0... | Ruby |
#!/usr/bin/ruby
require 'pathname'
class String
def realpath() return Pathname(self).realpath.to_s end
def dirname() return Pathname(self).dirname.to_s end
end
require File.expand_path(__FILE__.realpath.dirname+'/genversion.rb')
a=[]
open(ARGV[0],'rb'){|f|
a=f.readlines
}
a.map!{|e|
if e=~/CFBundle.*Version/ the... | Ruby |
#!/usr/bin/ruby
#target.crx target.pem dir...
XAR=ENV['HOME']+'/bin/xar'
=begin
#SIGLEN=`</dev/null openssl dgst -sign pem/ctouch_safari.pem -binary | wc -c`
export SIGLEN=256
~/bin/xar -cf bin/ctouch.safariextz ctouch.safariextension/
~/bin/xar --sign -f bin/ctouch.safariextz --data-to-sign sha1_hash.dat --sig-size ... | Ruby |
#!/usr/bin/ruby
#target.crx target.pem dir...
#based on crxmake under MIT License.
#https://github.com/Constellation/crxmake
require 'rubygems'
require 'zipruby'
require 'openssl'
require 'digest/sha1'
require 'find'
require 'pathname'
# thx masover
MAGIC = 'Cr24'
# CERT_PUBLIC_KEY_INFO struct
KEY = %w(30 81 9F 30 ... | Ruby |
#!/usr/bin/ruby
# https://USER:PASS@code.google.com/p/PROJ/
# https://USER:PASS@PROJ.googlecode.com/hg/
# svn: use "svn info"
# git: .git/config url=
# hg: .hg/hgrc default=
open('.hg/hgrc','rb'){|f|
s=f.read
s=~/:\/\/(\w+):(\w+)@/
if ARGV[0]=='-googlecode'
print '-u '+$1+' -w '+$2
else
print $1+':'+$2
end... | Ruby |
#!/usr/bin/ruby
require 'pathname'
class String
def realpath() return Pathname(self).realpath.to_s end
def dirname() return Pathname(self).dirname.to_s end
end
require File.expand_path(__FILE__.realpath.dirname+'/genversion.rb')
a=[]
open(ARGV[0],'rb'){|f|
a=f.readlines
}
a.map!{|e|
if e=~/"version"/ then e.sub!... | Ruby |
#!/usr/bin/ruby
#this won't work if update_url is specified. lol...
open(ARGV[0],'rb'){|fin|
size=fin.size
fin.sysread(8)
key_size=fin.sysread(4).unpack('V')[0]
sig_size=fin.sysread(4).unpack('V')[0]
fin.sysread(key_size+sig_size)
open(ARGV[1],'wb'){|fout|
fout << fin.sysread(size-fin.pos)
}
}
| Ruby |
#!/usr/bin/ruby
DOMAIN='com.cielavenir'
DEVID='ZMS86BA3S8'
require 'pathname'
class String
def realpath() return Pathname(self).realpath.to_s end
def dirname() return Pathname(self).dirname.to_s end
end
require File.expand_path(__FILE__.realpath.dirname+'/genversion.rb')
print <<EOM
<?xml version='1.0' encoding='U... | Ruby |
#!/usr/bin/ruby
#target.crx target.pem dir...
require 'rubygems'
require 'zipruby'
require 'openssl'
require 'find'
require 'pathname'
def get_relative base, target
Pathname.new(target.to_s).relative_path_from(Pathname.new(base.to_s)).to_s
end
def run(argv)
crx=argv.shift
pkey=argv.shift
keybody=''
begin
open... | Ruby |
#!/usr/bin/ruby -Ku
#coding:utf-8
if RUBY_VERSION < '1.9.0' then $KCODE='u' end
BOUNDARY="///__BOUNDARY__///\n"
open(ARGV[0],'r+b'){|fout|
a=fout.read.split(BOUNDARY)
fout.rewind
open(ARGV[1],'rb'){|fin|
fout.write(a[0]+BOUNDARY+fin.read.gsub(BOUNDARY,'')+BOUNDARY+a[2])
fout.truncate(fout.pos)
}
}
| Ruby |
#!/usr/bin/ruby
T=Time.new
V='0.0.2.'+sprintf('%d%02d%02d',T.year%10,T.month,T.day)
#def getver
if __FILE__==$0
print V
end
| Ruby |
require 'psych'
filename = "weapons.yml"
hash = Psych.load_file(filename);
File.open("out.txt", "w") do |f|
hash.each_pair do |k, v|
f.puts k
end
end
| Ruby |
require 'psych'
filename = "weapons.yml"
h = Hash.new(0)
File.open(filename) do |f|
f.each_line do |line|
words = line.scan(/\s*([^\s]+)\s*:/)
words.each do |m|
m.each do |v|
h.store(v, h[v]+1)
end
end
end
end
cnt = 0
h.each_pair do |k, v|
if v > 1
put... | Ruby |
require 'psych'
filename = "weapons.yml"
hash = Psych.load_file(filename);
File.open("out.txt", "w") do |f|
hash.each_pair do |k, v|
f.puts k
end
end
| Ruby |
require 'psych'
filename = "weapons.yml"
h = Hash.new(0)
File.open(filename) do |f|
f.each_line do |line|
words = line.scan(/\s*([^\s]+)\s*:/)
words.each do |m|
m.each do |v|
h.store(v, h[v]+1)
end
end
end
end
cnt = 0
h.each_pair do |k, v|
if v > 1
puts "#{k} #{v}"
c... | Ruby |
#!/usr/bin/ruby
#How to generate smaller Windows executable:
#0. install RubyInstaller and install MinGW (for strip)
#1. install Ocra: gem install ocra
#2. strip ruby.exe/dll and libraries:
# strip C:\path\to\ruby\bin\msvcrt-ruby191.dll C:\path\to\ruby\bin\ruby.exe
# for /R C:\path\to\ruby\lib\ruby\1.9.1\i386-ming... | Ruby |
#!/usr/bin/env ruby
require 'openssl'
require 'digest/sha2'
require 'pathname'
class String
def realpath() return Pathname(self).realpath.to_s end
def dirname() return Pathname(self).dirname.to_s end
end
require File.expand_path(__FILE__.realpath.dirname+'/genversion.rb')
KEY = %w(30 81 9F 30 0D 06 09 2A 86 48 86 ... | Ruby |
#!/usr/bin/env ruby
T=Time.new
V='2.5.5.'+sprintf('%d%02d%02d',T.year%10,T.month,T.day)
#def getver
if __FILE__==$0
print V
end
| Ruby |
#!/usr/bin/env ruby -Ku
#coding:utf-8
if RUBY_VERSION < '1.9' then $KCODE='u' end
BOUNDARY="///__BOUNDARY__///\n"
open(ARGV[0],'r+b'){|fout|
a=fout.read.split(BOUNDARY)
fout.rewind
open(ARGV[1],'rb'){|fin|
fout.write(a[0]+BOUNDARY+fin.read.gsub(BOUNDARY,'')+BOUNDARY+a[2])
fout.truncate(fout.pos)
}
}
| Ruby |
#!/usr/bin/env ruby
#this won't work if update_url is specified. lol...
open(ARGV[0],'rb'){|fin|
size=fin.size
fin.sysread(8)
key_size=fin.sysread(4).unpack('V')[0]
sig_size=fin.sysread(4).unpack('V')[0]
fin.sysread(key_size+sig_size)
open(ARGV[1],'wb'){|fout|
fout << fin.sysread(size-fin.pos)
}
}
| Ruby |
#!/usr/bin/env ruby
DOMAIN='com.cielavenir'
DEVID='ZMS86BA3S8'
require 'pathname'
class String
def realpath() return Pathname(self).realpath.to_s end
def dirname() return Pathname(self).dirname.to_s end
end
require File.expand_path(__FILE__.realpath.dirname+'/genversion.rb')
print <<EOM
<?xml version='1.0' encodin... | Ruby |
#!/usr/bin/env ruby
#Convert PKCS1 to PKCS8
require 'rubygems'
require 'openssl_pkcs8'
if ARGV.size<1
$stderr.puts 'ruby pemconvert.rb pem_dir'
exit
end
Dir.glob(ARGV[0]+'/*.pem').each{|e|
key=OpenSSL::PKey::RSA.new(File.read(e))
File.open(e,'wb'){|f|f<<key.to_pem_pkcs8}
} | Ruby |
#!/usr/bin/env ruby
#target.crx target.pem dir...
require 'rubygems'
#require 'zipruby'
require 'zip'
require 'openssl'
require 'find'
require 'pathname'
begin
require 'openssl_pkcs8'
class OpenSSL::PKey::RSA
alias_method :to_pem, :to_pem_pkcs8
end
rescue LoadError
$pkcs8_warning=1
end
KEY_SIZE = 1024
def get... | Ruby |
#!/usr/bin/env ruby
require 'pathname'
class String
def realpath() return Pathname(self).realpath.to_s end
def dirname() return Pathname(self).dirname.to_s end
end
require File.expand_path(__FILE__.realpath.dirname+'/genversion.rb')
a=[]
open(ARGV[0],'rb'){|f|
a=f.readlines
}
a.map!{|e|
if e=~/"version"/ then e.... | Ruby |
#!/usr/bin/env ruby
if ARGV.size<2
puts 'ruby sourceforge_upload.rb VERSION files...'
exit
end
VERSION=ARGV.shift
Dir.chdir('bin')
system(%Q(rsync "#{ARGV.map{|e|File.basename(e)}.join('" "')}" cielavenir,ctouch@web.sourceforge.net:frs/#{VERSION}/)) | Ruby |
#!/usr/bin/env ruby
#target.crx target.pem dir...
XAR=ENV['HOME']+'/bin/xar'
=begin
#SIGLEN=`</dev/null openssl dgst -sign pem/ctouch_safari.pem -binary | wc -c`
export SIGLEN=256
~/bin/xar -cf bin/ctouch.safariextz ctouch.safariextension/
~/bin/xar --sign -f bin/ctouch.safariextz --data-to-sign sha1_hash.dat --sig-s... | Ruby |
#!/usr/bin/env ruby
# https://USER:PASS@code.google.com/p/PROJ/
# https://USER:PASS@PROJ.googlecode.com/hg/
# svn: use "svn info"
# git: .git/config url=
# hg: .hg/hgrc default=
open('.hg/hgrc','rb'){|f|
s=f.read
s=~/:\/\/(\w+):(\w+)@/
if ARGV[0]=='-googlecode'
print '-u '+$1+' -w '+$2
else
print $1+':'+$2
... | Ruby |
#!/usr/bin/env ruby
#target.crx target.pem dir...
#based on crxmake under MIT License.
#https://github.com/Constellation/crxmake
require 'rubygems'
#require 'zipruby'
require 'zip'
require 'openssl'
require 'digest/sha1'
require 'find'
require 'pathname'
begin
require 'openssl_pkcs8'
class OpenSSL::PKey::RSA
ali... | Ruby |
#!/usr/bin/env ruby
require 'pathname'
class String
def realpath() return Pathname(self).realpath.to_s end
def dirname() return Pathname(self).dirname.to_s end
end
require File.expand_path(__FILE__.realpath.dirname+'/genversion.rb')
a=[]
open(ARGV[0],'rb'){|f|
a=f.readlines
}
a.map!{|e|
if e=~/CFBundle.*Version/... | Ruby |
#!/usr/bin/env watchr
# config file for watchr http://github.com/mynyml/watchr
# install: gem install watchr
# run: watch watchr.rb
# note: make sure that you have jstd server running (server.sh) and a browser captured
log_file = File.expand_path(File.dirname(__FILE__) + '/../logs/jstd.log')
`cd ..`
`touch #{log_fil... | Ruby |
class Calculator
def push(n)
n += 2 if n == 0 # a really stupid bug
@args ||= []
@args << n
end
def add
@args.inject(0){|n,sum| sum+=n}
end
def divide
@args[0].to_f / @args[1].to_f
end
end | Ruby |
require 'spec'
require "#{File.dirname(__FILE__)}/calculator"
Before do
@calc = Calculator.new
end
After do
end
Given "I have entered $n into the calculator" do |n|
@calc.push n.to_i
end
When /I press (\w+)/ do |op|
@result = @calc.send op
end
Then /the result should be (.*) on the screen/ do |result|
@res... | Ruby |
require 'erb'
module Cucumber::Mingle::Formatters
class ErbFormmatter
BACKTRACE_FILTER_PATTERNS = [/vendor\/rails/, /vendor\/plugins\/cucumber/, /spec\/expectations/, /spec\/matchers/]
def initialize(template, step_mother, options)
input = File.read("#{File.dirname(__FILE__)}/#{template}.template"... | Ruby |
require 'rubygems'
require 'optparse'
require 'cucumber'
require "#{File.dirname(__FILE__)}/mingle"
require "#{File.dirname(__FILE__)}/erb_formatter"
module Cucumber::Mingle
class CLI
class << self
attr_writer :step_mother, :executor, :features
def execute
@execute_called = true
... | Ruby |
require 'activeresource'
module Cucumber::Mingle
class Card < ActiveResource::Base
end
end | Ruby |
require 'firewatir'
require 'spec'
World do
include Spec::Matchers
Watir::Browser.default = "firefox"
def browser
@browser ||= Watir::Browser.new
end
end
After do
@browser.close
@browser = nil
end | Ruby |
Given /^a potential email user$/ do
browser.goto('http://www.gmail.com')
end
When /^clicks sign-up link$/ do
begin
browser.link(:text, /Sign up/i).click
rescue
raise "YOU ARE ALREADY SIGNED UP AND IN FOR GMAIL: PLEASE SIGN OUT"
end
end
When /^enters first name of '(.+)'$/ do |first_name|
b... | Ruby |
# matching system for 2 programs
require_relative 'lib'
require_relative 'macrofunc'
require_relative 'scheduler'
p0 = 'ruby cdemon.rb 0'
p1 = 'ruby demon.rb 1'
pipe0 = IO.popen(p0, "w+")
pipe1 = IO.popen(p1, "w+")
$p0_score = 0
$p1_score = 0
def check_win
$p0_score = 0
$p1_score = 0
$my_slot... | Ruby |
require_relative 'lib'
require_relative 'slot'
$stdout.sync = true
$lr = 1
$card = 'I'
$slot = 0
def parse_enemy_step
$lr = $stdin.gets.chomp.to_i
case $lr
when 1
$card = $stdin.gets.chomp
$slot = $stdin.gets.to_i
when 2
$slot = $stdin.gets.chomp.to_i
$card = $stdin.gets.chomp
... | Ruby |
require_relative 'lib'
require_relative 'slot'
require_relative 'macrofunc'
require_relative 'scheduler'
$stdout.sync = true
def parse_enemy_step
$lr = $stdin.gets.chomp.to_i
case $lr
when 1
$card = $stdin.gets.chomp
$slot = $stdin.gets.to_i
when 2
$slot = $stdin.gets.chomp.to_i
$... | Ruby |
require_relative 'lib'
require_relative 'slot'
require_relative 'macrofunc'
require_relative 'scheduler'
$stdout.sync = true
def parse_enemy_step
$lr = $stdin.gets.chomp.to_i
case $lr
when 1
$card = $stdin.gets.chomp
$slot = $stdin.gets.to_i
when 2
$slot = $stdin.gets.chomp.to_i
$... | Ruby |
require_relative 'lib'
require_relative 'macrofunc'
$min_vitality = 10
$max_vitality = 65535
$is_reviving = false
$is_reviving_buffer = false
class Scheduler
def check_yammy_slots
i_slots = [0, 1]
i_slots.push [$registers[0][:slot].field] if (0..255).include? $registers[0][:slot].field
slot_to_st... | Ruby |
require_relative 'slot'
require_relative 'macrofunc'
$application_num = 0
$my_slots = Array.new(256)
for i in 0..255
$my_slots[i] = Slot.new i
end
$enemy_slots = Array.new(256)
for i in 0..255
$enemy_slots[i] = Slot.new i
end
def $my_slots.vitality
inject(0) { |sum, x| sum += x.vitality }
end
def $enemy_slots.... | Ruby |
require_relative 'lib'
require_relative 'slot'
require_relative 'macrofunc'
require_relative 'scheduler'
$stdout.sync = true
def parse_enemy_step
$lr = $stdin.gets.chomp.to_i
case $lr
when 1
$card = $stdin.gets.chomp
$slot = $stdin.gets.to_i
when 2
$slot = $stdin.gets.chomp.to_i
$... | Ruby |
require_relative 'func'
class Slot
attr_reader :vitality, :field, :index
attr_writer :vitality, :field
def initialize index
@vitality = 10000
@field = I.new
@index = index
end
def left_apply x
$application_num = 0
begin
@field = @field.apply x.new
rescue => e
@fie... | Ruby |
require_relative 'lib'
require_relative 'slot'
require_relative 'macrofunc'
require_relative 'scheduler'
puts "Start"
=begin
TODO
optimize get number - half of the Help command is getting numbers
recursive dec or inc as zomby
copy functions
=end
=begin
# f (f (x))
$my_slots[0].left_apply(S)
$my_slots[0].right_a... | Ruby |
class Func
attr_reader :args, :name
def initialize
@args = Array.new
end
def push x
@args.push x
end
def to_s
s = @name
@args.each do |i|
s += "(#{i.to_s})"
end
s
end
def to_i
raise 'Attempt to convert non-zero to integer ' + @name
end
def check_slot_number i
raise "Invalid slot nu... | Ruby |
require_relative 'lib'
require_relative 'slot'
$stdout.sync = true
$lr = 1
$card = 'I'
$slot = 0
def parse_enemy_step
$lr = $stdin.gets.chomp.to_i
case $lr
when 1
$card = $stdin.gets.chomp
$slot = $stdin.gets.to_i
when 2
$slot = $stdin.gets.chomp.to_i
$card = $stdin.gets.chomp
... | Ruby |
require_relative 'func'
require_relative 'slot'
require_relative 'lib'
$last_numbers = Array.new
def expand_build_number_macro queue, register, number
# get number path
# build the number in register
cur = 0
if (register.field.respond_to?("<") && register.field > number)
queue.push_command(register.index, Put... | Ruby |
require_relative 'lib'
require_relative 'slot'
require_relative 'macrofunc'
require_relative 'scheduler'
puts "Start"
=begin
# second example
$my_slots[0].left_apply(Attack)
$my_slots[0].left_apply(Zero)
$my_slots[0].right_apply(K)
$my_slots[0].right_apply(S)
$my_slots[0].left_apply(Succ)
$my_slots[0].left_apply(Zero... | Ruby |
require_relative 'lib'
require_relative 'slot'
require_relative 'macrofunc'
require_relative 'scheduler'
$stdout.sync = true
def parse_enemy_step
begin
$lr = $stdin.gets.chomp.to_i
case $lr
when 1
$card = $stdin.gets.chomp
$slot = $stdin.gets.to_i
when 2
$slot = $stdin.gets.chomp.to_i... | 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.
# 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.
# 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 |
# 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.
CukesPortal::Application.config.session_store :cookie_store, key: '_cukes_portal_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... | 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 |
CukesPortal::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.ac... | Ruby |
CukesPortal::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 we... | Ruby |
CukesPortal::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 tes... | Ruby |
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
CukesPortal::Application.initialize!
| 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 |
CukesPortal::Application.routes.draw do
get "settings/new"
# get "static_pages/test"
match "/test", to: 'static_pages#test'
match "/settings", to: "static_pages#settings"
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'product... | Ruby |
module ApplicationHelper
def make_side_link active_link, link_name, link_ref
ret = (active_link == link_name) ? "<li class=\"active\">" : "<li>"
ret += link_to link_name, link_ref
ret += "</li>"
ret
end
end
| Ruby |
module StaticPagesHelper
end
| Ruby |
module SettingsHelper
end
| Ruby |
class Setting < ActiveRecord::Base
attr_accessible :key, :value
validates :key, presence: true
validates :value, presence: true
end
| Ruby |
class SettingsController < ApplicationController
def new
end
end
| Ruby |
class StaticPagesController < ApplicationController
def test
end
def settings
end
end
| Ruby |
class ApplicationController < ActionController::Base
protect_from_forgery
end
| 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__)
CukesPortal::Application.load_tasks
| 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 |
#!/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__)
CukesPortal::Application.load_tasks
| Ruby |
source 'https://rubygems.org'
gem 'rails', '3.2.9'
gem 'bootstrap-sass'
group :development do
gem 'sqlite3'
end
group :production do
gem 'pg', '0.12.2' #postgres
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffe... | Ruby |
class AddIndexToSettingKey < ActiveRecord::Migration
def change
add_index :settings, :key
end
end
| Ruby |
class CreateSettings < ActiveRecord::Migration
def change
create_table :settings do |t|
t.string :key
t.string :value
t.timestamps
end
end
end
| 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 |
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run CukesPortal::Application
| 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 |
# $Id: find_password_files.rb 14034 2012-08-25 $
# $Revision: 1234 $
# Author: Shmuel Amar
# Version: 1.0.0
#set options
output = "/tmp/find_password_files#{rand(9999999)}.txt"
v = 'n'
@@exec_opts = Rex::Parser::Arguments.new(
"-h" => [ false, "Help menu." ],
"-q" => [ false, "quiet. no output.... | Ruby |
require 'albacore'
require 'version_bumper'
bumper_file "version.txt"
# Read variables from environment/command-line.
bumpType = ENV["bumptype"]
# Setup variables.
assemblyName = "SecuritySwitch"
targetFile = "Source/SecuritySwitch/bin/Release/#{assemblyName}.dll"
productName = "Security Switch"
productD... | 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 |
# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use yo... | 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 |
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
config.wrappers :bootstrap, :tag => 'div', :class => 'control-group', :error_class => 'error' do |b|
b.use :html5
b.use :placeholder
b.use :label
b.wrapper :tag => 'div', :class => 'controls' do |ba|
... | 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.
# 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 |
# 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.
Cupido::Application.config.session_store :cookie_store, key: '_cupido_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 gen... | 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 |
Cupido::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 |
Cupido::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 ser... | Ruby |
Cupido::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 sui... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.