code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
module AuthenticatedSystem
protected
# Returns true or false if the user is logged in.
# Preloads @current_user with the user model if they're logged in.
def logged_in?
current_user != :false
end
# Accesses the current user from the session.
def current_user
@current_user ||= ... | Ruby |
module AuthenticatedTestHelper
# Sets the current user in the session from the user fixtures.
def login_as(user)
@request.session[:user] = user ? users(user).id : nil
end
def content_type(type)
@request.env['Content-Type'] = type
end
def accept(accept)
@request.env["HTTP_ACCEPT"] = accept
en... | Ruby |
#!c:/ruby/bin/ruby
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired... | Ruby |
#!c:/ruby/bin/ruby
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired... | Ruby |
#!c:/ruby/bin/ruby
#
# You may specify the path to the FastCGI crash log (a log of unhandled
# exceptions which forced the FastCGI instance to exit, great for debugging)
# and the number of requests to process before running garbage collection.
#
# By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
#... | Ruby |
#!c:/ruby/bin/ruby
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired... | Ruby |
#!c:/ruby/bin/ruby
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired... | Ruby |
#!c:/ruby/bin/ruby
#
# You may specify the path to the FastCGI crash log (a log of unhandled
# exceptions which forced the FastCGI instance to exit, great for debugging)
# and the number of requests to process before running garbage collection.
#
# By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
#... | Ruby |
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
class Test::Unit::TestCase
# Transactional fixtures accelerate your tests by wrapping each test method
# in a transaction that's rolled back on completion. This ensures that the
# test datab... | Ruby |
# $ext_path: This should be the path of where the ExtJS SDK is installed
# Generally this will be in a lib/extjs folder in your applications root
# <root>/lib/extjs
$ext_path = "../../"
# sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder
# Generally this will be in a resource... | Ruby |
# include the utils rb file which has extra functionality for the ext theme
dir = File.dirname(__FILE__)
require File.join(dir, 'lib', 'utils.rb')
# register ext4 as a compass framework
Compass::Frameworks.register 'ext4', dir | Ruby |
# $ext_path: This should be the path of the Ext JS SDK relative to this file
$ext_path = "../../extjs"
# sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder
# Generally this will be in a resources/sass folder
# <root>/resources/sass
sass_path = File.dirname(__FILE__)
# css_pat... | Ruby |
module ExtJS4
module SassExtensions
module Functions
module Utils
def parsebox(list, n)
assert_type n, :Number
if !n.int?
raise ArgumentError.new("List index #{n} must be an integer")
elsif n.to_i < 1
raise ArgumentError.new("List index #{n} must... | Ruby |
require 'mkmf'
$CPPFLAGS = $CPPFLAGS + " -I../../include"
$LDFLAGS = $LDFLAGS + " -L../../"
$LIBS = $LIBS + " -lhpdf -lpng -lz"
create_makefile 'hpdf'
| Ruby |
#
# << Haru Free PDF Library 2.0.0 >> -- demo.rb
#
# Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice appea... | Ruby |
#
# << Haru Free PDF Library 2.0.0 >> -- encryption.rb
#
# Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice... | Ruby |
#
# << Haru Free PDF Library 2.0.0 >> -- font_example.rb
#
# Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright noti... | Ruby |
#
# << Haru Free PDF Library 2.0.2 >> -- arc_demo.rb
#
# http://libharu.org/
#
# Copyright (c) 1999-2006 Takeshi Kanno
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice appear ... | Ruby |
#
# << Haru Free PDF Library 2.0.6 >> -- ext_gstate_demo.rb
#
# http://libharu.org/
#
# Copyright (c) 1999-2006 Takeshi Kanno
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice ... | Ruby |
#
# << Haru Free PDF Library 2.0.2 >> -- ttfont_demo.rb
#
# http://libharu.org/
#
# Copyright (c) 1999-2006 Takeshi Kanno
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice appe... | Ruby |
#
# << Haru Free PDF Library 2.0.0 >> -- text_demo2.rb
#
# Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice... | Ruby |
#
# << Haru Free PDF Library 2.0.2 >> -- line_demo.rb
#
# http://libharu.org/
#
# Copyright (c) 1999-2006 Takeshi Kanno
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice appear... | Ruby |
#
# << Haru Free PDF Library 2.0.6 >> -- slideshow_demo.rb
#
# http://libharu.org/
#
# Copyright (c) 1999-2006 Takeshi Kanno
#
# Permission to use, copy, modify, distribute and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice a... | Ruby |
# $ext_path: This should be the path of where the ExtJS SDK is installed
# Generally this will be in a lib/extjs folder in your applications root
# <root>/lib/extjs
$ext_path = "../../"
# sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder
# Generally this will be in a resource... | Ruby |
# include the utils rb file which has extra functionality for the ext theme
dir = File.dirname(__FILE__)
require File.join(dir, 'lib', 'utils.rb')
# register ext4 as a compass framework
Compass::Frameworks.register 'ext4', dir | Ruby |
# $ext_path: This should be the path of the Ext JS SDK relative to this file
$ext_path = "../../extjs"
# sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder
# Generally this will be in a resources/sass folder
# <root>/resources/sass
sass_path = File.dirname(__FILE__)
# css_pat... | Ruby |
# Compass configurations
sass_path = File.dirname(__FILE__)
css_path = File.join(sass_path, "..", "css")
# Require any additional compass plugins here.
images_dir = File.join(sass_path, "..", "img")
output_style = :expanded
environment = :production | Ruby |
module ExtJS4
module SassExtensions
module Functions
module Utils
def parsebox(list, n)
assert_type n, :Number
if !n.int?
raise ArgumentError.new("List index #{n} must be an integer")
elsif n.to_i < 1
raise ArgumentError.new("List index #{n} must... | Ruby |
#
# To change this template, choose Tools | Templates
# and open the template in the editor.
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
| Ruby |
#
# To change this template, choose Tools | Templates
# and open the template in the editor.
puts "Hello World"
| Ruby |
require 'uri'
require 'net/http'
require 'net/https'
require 'rexml/document'
require 'xmlsimple'
include REXML
#
# TODO: Everything.
# Ideas: - Use XPath more instead of xmlsimple.
# - Generic method to turn result from get_records into simple hash.
#
=begin
Represents a field of type
(({<field name="name" va... | Ruby |
#!/usr/bin/ruby
require File.expand_path(ENV['MOSYNCDIR']+'/rules/mosync_exe.rb')
work = PipeExeWork.new
work.instance_eval do
@SOURCES = ["."]
@EXTRA_CPPFLAGS = " -Wno-shadow"
@LIBRARIES = ["mautil", "maui"]
@EXTRA_LINKFLAGS = standardMemorySettings(8) unless(USE_NEWLIB)
@NAME = "MAUIex"
end
work.... | Ruby |
#!/usr/bin/ruby
require File.expand_path(ENV['MOSYNCDIR']+'/rules/mosync_exe.rb')
work = PipeExeWork.new
work.instance_eval do
@SOURCES = ["."]
@EXTRA_CPPFLAGS = " -Wno-shadow"
@LIBRARIES = ["mautil", "maui"]
@EXTRA_LINKFLAGS = standardMemorySettings(8) unless(USE_NEWLIB)
@NAME = "MAUIex"
end
work.... | Ruby |
#!/usr/bin/ruby
require File.expand_path(ENV['MOSYNCDIR']+'/rules/mosync_exe.rb')
work = PipeExeWork.new
work.instance_eval do
@SOURCES = ["."]
@EXTRA_CPPFLAGS = " -Wno-shadow"
@LIBRARIES = ["mautil", "maui"]
@EXTRA_LINKFLAGS = standardMemorySettings(8) unless(USE_NEWLIB)
@NAME = "MAUIex"
end
work.... | Ruby |
#!/usr/bin/ruby
require File.expand_path(ENV['MOSYNCDIR']+'/rules/mosync_exe.rb')
work = PipeExeWork.new
work.instance_eval do
@SOURCES = ["."]
@EXTRA_CPPFLAGS = " -Wno-shadow"
@LIBRARIES = ["mautil", "maui"]
@EXTRA_LINKFLAGS = standardMemorySettings(8) unless(USE_NEWLIB)
@NAME = "MAUIex"
end
work.... | Ruby |
environment = :production
project_type = :stand_alone
http_path = "/"
css_dir = "../styles"
sass_dir = "."
images_dir = "images"
sass_options = {
:line_numbers => false,
:debug_info => false
}
# output_style = :compressed
# output_style = :compact
output_style = :expanded
| Ruby |
require 'webrick'
include WEBrick
s = HTTPServer.new(
:Port => 2010,
:DocumentRoot => Dir::pwd
)
s.mount('/sh/scripts', WEBrick::HTTPServlet::FileHandler, '../scripts')
s.mount('/sh/styles', WEBrick::HTTPServlet::FileHandler, '../styles')
trap('INT') { s.stop }
s.start
| Ruby |
#!/usr/bin/ruby
# Parser_0605.rb(适配RCalc.rb)
# Written by 龙第九子, 2009-06-05
# --------------------------------------------------------------------
# class Token (标记)
# ttype 标记类型,目前有 :op :pa :fun :num 等四种
# value 标记的词法值,是原始字符串的一个子串
# :op分为5种 + - * / ^
# :pa分为2种 ( )
# :fun分为5种 sin cos tan log ln... | Ruby |
require 'tk'
require 'Parser'
#------------------------------
root = TkRoot.new {
title 'Calculator'
}
#------------------------------
def about
info = "Ruby Calculator v0.1\n" +
"Implemented with Ruby 1.8.6 and Tcl/Tk 8.4.15\n" +
# "(c) Copyright by \xC1\xFA\xB5\xDA\xBE\xC5\xD7\xD3, 2009... | Ruby |
#!/usr/bin/ruby
require 'tk'
puts $0
puts __FILE__
if $0 == __FILE__
root = TkRoot.new {
title 'Test Ruby Tk'
}
TkLabel.new(root) {
text 'Hello, world!'
pack { padx 15; pady 15; side 'left' }
}
Tk.mainloop
end
| Ruby |
#!/usr/bin/ruby
# vi:ft=ruby
#require 'tk'
#------------------------------
#root = TkRoot.new {
# title 'Calculator'
#}
#------------------------------
#entry_in = TkEntry.new(root) {
# insert 0, 'expression'
# font '{Monospace} 10 {bold}'
# pack {padx 15; pady 15}
# grid('row'=>0,'column'=>0)
# g... | Ruby |
#!/usr/bin/ruby
# Parser_0605.rb(适配RCalc.rb)
# Written by 龙第九子, 2009-06-05
# --------------------------------------------------------------------
# class Token (标记)
# ttype 标记类型,目前有 :op :pa :fun :num 等四种
# value 标记的词法值,是原始字符串的一个子串
# :op分为5种 + - * / ^
# :pa分为2种 ( )
# :fun分为5种 sin cos tan log ln... | Ruby |
#!/usr/bin/ruby
# vi:ft=ruby
require 'tk'
require 'Parser'
#------------------------------
root = TkRoot.new {
title 'Calculator'
}
#------------------------------
def about
info = "Ruby Calculator v0.1\n" +
"Implemented with Ruby 1.8.6 and Tcl/Tk 8.4.15\n" +
# "(c) Copyright by \xC1\xFA... | Ruby |
#!/usr/bin/ruby
# vi:ft=ruby
require 'tk'
require 'Parser'
#------------------------------
root = TkRoot.new {
title 'Calculator'
}
#------------------------------
def about
info = "Ruby Calculator v0.1\n" +
"Implemented with Ruby 1.8.6 and Tcl/Tk 8.4.15\n" +
# "(c) Copyright by \xC1\xFA... | Ruby |
#!/usr/bin/ruby
# vi:ft=ruby
#require 'tk'
#------------------------------
#root = TkRoot.new {
# title 'Calculator'
#}
#------------------------------
#entry_in = TkEntry.new(root) {
# insert 0, 'expression'
# font '{Monospace} 10 {bold}'
# pack {padx 15; pady 15}
# grid('row'=>0,'column'=>0)
# g... | Ruby |
#!/usr/bin/ruby
require 'tk'
puts $0
puts __FILE__
if $0 == __FILE__
root = TkRoot.new {
title 'Test Ruby Tk'
}
TkLabel.new(root) {
text 'Hello, world!'
pack { padx 15; pady 15; side 'left' }
}
Tk.mainloop
end
| Ruby |
# $ext_path: This should be the path of where the ExtJS SDK is installed
# Generally this will be in a lib/extjs folder in your applications root
# <root>/lib/extjs
$ext_path = "../../"
# sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder
# Generally this will be in a resource... | Ruby |
# include the utils rb file which has extra functionality for the ext theme
dir = File.dirname(__FILE__)
require File.join(dir, 'lib', 'utils.rb')
# register ext4 as a compass framework
Compass::Frameworks.register 'ext4', dir | Ruby |
# $ext_path: This should be the path of the Ext JS SDK relative to this file
$ext_path = "../../extjs"
# sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder
# Generally this will be in a resources/sass folder
# <root>/resources/sass
sass_path = File.dirname(__FILE__)
# css_pat... | Ruby |
# Compass configurations
sass_path = File.dirname(__FILE__)
css_path = File.join(sass_path, "..", "css")
# Require any additional compass plugins here.
images_dir = File.join(sass_path, "..", "img")
output_style = :expanded
environment = :production | Ruby |
module ExtJS4
module SassExtensions
module Functions
module Utils
def parsebox(list, n)
assert_type n, :Number
if !n.int?
raise ArgumentError.new("List index #{n} must be an integer")
elsif n.to_i < 1
raise ArgumentError.new("List index #{n} must... | 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 '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 |
#!/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 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 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 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 any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "stylesheets"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "javascripts"
# You can select your preferred output style here (can be overridden via the command line):
# o... | Ruby |
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "stylesheets"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "javascripts"
# You can select your preferred output style here (can be overridden via the command line):
# o... | 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 |
# 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 CreatePosts < ActiveRecord::Migration
def change
create_table :posts do |t|
t.string :name
t.string :email
t.string :subject
t.text :content
t.timestamps
end
add_column :posts, :post_id, :integer, :null => true
end
end
| Ruby |
class Attachable < ActiveRecord::Migration
def self.up
change_table :posts do |t|
t.has_attached_file :picture
end
end
def self.down
drop_attached_file :posts, :picture
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 |
source 'https://rubygems.org'
gem 'rails', '3.2.3'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'decent_exposure'
gem 'haml-rails'
gem "paperclip", "~> 3.0"
gem 'heroku'
# Gems used only for assets and not required
# in production environments by default.... | 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 PostsHelper
def model(res = nil)
if res
Post.new(:post_id => res.id)
else
Post.new
end
end
end
| Ruby |
class Post < ActiveRecord::Base
attr_accessible :content, :email, :name, :post_id, :subject, :picture
before_save :set_name
before_save :sage
validates :content, :presence => true
validates_attachment :picture,
:content_type => { :content_type => ['image/jpeg', 'image/png']},
:size => { :in => ... | Ruby |
class PostsController < ApplicationController
def index
@posts = Post.threads
respond_to do |format|
format.html # index.html.erb
format.json { render json: @posts }
end
end
def show
@post = Post.find(params[:id])
respond_to do |format|
format.html # show.html.erb
... | Ruby |
class ApplicationController < ActionController::Base
protect_from_forgery
rescue_from ActiveRecord::RecordNotFound do
redirect_to root_url
end
end
| 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 |
# 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.
Zxc::Application.config.session_store :cookie_store, key: '_zxc_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 generate ... | Ruby |
Zxc::Application.routes.draw do
resources :posts, :path => "res", :except => [:update, :edit]
root :to => "posts#index"
# 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... | 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
Zxc::Application.initialize!
| Ruby |
Zxc::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_con... | Ruby |
Zxc::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 server... | Ruby |
Zxc::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 suite ... | Ruby |
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Zxc::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__)
Zxc::Application.load_tasks
| Ruby |
css_dir = "."
sass_dir = "."
images_dir = "."
fonts_dir = "fonts"
relative_assets = true
output_style = :compact
line_comments = false
preferred_syntax = :scss | Ruby |
css_dir = "."
sass_dir = "."
images_dir = "."
fonts_dir = "fonts"
relative_assets = true
output_style = :compact
line_comments = false
preferred_syntax = :scss | 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 |
class RubyLibraryExample
def get_server_language
'ruby'
end
# Basic communication
def passing
end
def failing(message)
raise message
end
def logging(message, level='INFO')
puts "*#{level}* #{message}"
end
def returning
'returned string'
end
# Logging
def one_message_w... | Ruby |
require 'net/http'
server = "msdl.microsoft.com"
pdb = "ntkrnlmp"
guid = "30092be745b24fe2a311a936e7b7486f2"
uri = "/download/symbols/#{pdb}.pdb/#{guid}/#{pdb}.pd_"
dest = "#{pdb}.pd_"
puts uri
Net::HTTP.start(server) { |http|
headers = {"User-Agent" => "Microsoft-Symbol-Server/6.6.0007.5"}
resp = http.get(u... | Ruby |
# This file is part of Virtdbg
# Copyright (C) 2010-2011 Damien AUMAITRE
#
# Licence is GPLv3, see LICENCE.txt in the top-level directory
require 'metasm'
require 'virtdbg'
require 'optparse'
$VERBOSE = false
# parse arguments
opts = { :device => 0 }
OptionParser.new { |opt|
opt.banner = 'Usage: virtdbg.... | Ruby |
# This file is part of Virtdbg
# Copyright (C) 2010-2011 Damien AUMAITRE
#
# Licence is GPLv3, see LICENCE.txt in the top-level directory
module VirtDbg
VIRTDBGDIR = File.dirname(__FILE__)
# add it to the ruby library path
$: << VIRTDBGDIR
end
%w[forensic1394 virtdbg util main system].each { |f|
require ... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
#
# this exemple illustrates the use of the cparser/preprocessor #factorize functionnality:
# we write some code using standard headers, and t... | Ruby |
# This file is part of Virtdbg
# Copyright (C) 2010-2011 Damien AUMAITRE
#
# Licence is GPLv3, see LICENCE.txt in the top-level directory
require 'metasm'
require 'metasm/dynldr'
include Metasm
module VirtDbg
class Forensic1394 < Metasm::DynLdr
new_api_c File.read(File.join(VIRTDBGDIR, "inc", ... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.