code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
=begin
= File
parsers/fdf.rb
= Info
Origami is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Origami is distributed in the... | Ruby |
=begin
= File
page.rb
= Info
This file is part of Origami, PDF manipulation framework for Ruby
Copyright (C) 2010 Guillaume Delugré <guillaume AT security-labs DOT org>
All right reserved.
Origami is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public Lice... | Ruby |
=begin
= File
xfa.rb
= Info
This file is part of Origami, PDF manipulation framework for Ruby
Copyright (C) 2010 Guillaume Delugré <guillaume AT security-labs DOT org>
All right reserved.
Origami is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public Lice... | Ruby |
=begin
= File
font.rb
= Info
This file is part of Origami, PDF manipulation framework for Ruby
Copyright (C) 2010 Guillaume Delugré <guillaume AT security-labs DOT org>
All right reserved.
Origami is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public Lic... | Ruby |
=begin
= File
xreftable.rb
= Info
This file is part of Origami, PDF manipulation framework for Ruby
Copyright (C) 2010 Guillaume Delugré <guillaume AT security-labs DOT org>
All right reserved.
Origami is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public... | Ruby |
=begin
= File
object.rb
= Info
This file is part of Origami, PDF manipulation framework for Ruby
Copyright (C) 2010 Guillaume Delugré <guillaume AT security-labs DOT org>
All right reserved.
Origami is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public Li... | Ruby |
require 'rake'
require 'spec/rake/spectask'
task :default => :spec
Spec::Rake::SpecTask.new(:spec) do |t|
#t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
t.spec_files = FileList['test/*_spec.rb']
end
desc "Run all specs"
task :spec
def templated_build(name, opts={})
# Create a rul... | 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 CreateMaps < ActiveRecord::Migration
def self.up
create_table :maps do |t|
t.integer :x
t.integer :y
t.integer :z
t.string :title
t.text :description
t.timestamps
end
end
def self.down
drop_table :maps
end
end
| Ruby |
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.string :email
t.string :forename
t.string :lastname
t.string :password_hash
t.string :password_salt
t.integer :age
t.boolean :admin
t.timestamps
end
end
def self.down
... | Ruby |
class CreateExits < ActiveRecord::Migration
def self.up
create_table :exits do |t|
t.integer :map_id
t.integer :direction_id
t.string :description
t.integer :destination_id
t.timestamps
end
end
def self.down
drop_table :exits
end
end
| Ruby |
class CreateDirections < ActiveRecord::Migration
def self.up
create_table :directions do |t|
t.string :title
t.timestamps
end
end
def self.down
drop_table :directions
end
end
| Ruby |
class CreateHeros < ActiveRecord::Migration
def self.up
create_table :heros do |t|
t.integer :user_id
t.string :name
t.text :history
t.integer :strength, :default => 0
t.integer :intelligence, :default => 0
t.integer :constitution, :default => 0
t.integer :life, :default ... | 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 'sqlite3-ruby', :require => 'sqlite3'
gem 'bcrypt-ruby', :require => 'bcrypt'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# ... | 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 ExitsHelper
end
| Ruby |
module GamePageHelper
end
| Ruby |
module SessionsHelper
end
| Ruby |
module UsersHelper
end
| Ruby |
module DirectionsHelper
end
| Ruby |
module MapsHelper
end
| Ruby |
module HomeHelper
end
| Ruby |
module HerosHelper
end
| Ruby |
class Map < ActiveRecord::Base
validates_x :presence => true
validates_y :presence => true
validates_z :presence => true
validates_z :uniqueness => true, :scope => [:x, :y]
validates_title :presence => true
has_many :heros
has_many :exits, :dependent => :destroy
def to_s
title
end
def c... | Ruby |
class Exit < ActiveRecord::Base
belongs_to :map
belongs_to :destination, :class_name => 'Map'
has_one :direction
validates_destination :presence => true
validates_direction :presence => true
def to_s
direction << ' to ' << destination.to_s
end
end
| Ruby |
class User < ActiveRecord::Base
attr_accessor :password
validates_confirmation_of :password
validates_presence_of :password, :on => :create
validates_presence_of :email
validates_uniqueness_of :email
before_save :encrypt_password
has_one :hero, :dependent => :destroy
def encrypt_password
if pa... | Ruby |
class Direction < ActiveRecord::Base
has_many :exits
end
| Ruby |
class Hero < ActiveRecord::Base
belongs_to :user
belongs_to :map
validates_name :uniqueness => true
validates_user_id :uniqueness => true, :message => 'already has a hero.'
def to_s
name
end
end
| Ruby |
class ApplicationController < ActionController::Base
protect_from_forgery
helper_method :current_user
private
def current_user
if session[:user_id]
@current_user ||= User.find(session[:user_id])
else
@current_user = nil
end
end
end
| Ruby |
class GamePageController < ApplicationController
def new
@queue ||= Queue.new
end
def add(message)
self.messages= "";
@queue << message
start_pushing_thread
end
private
def start_pushing_thread
return if @pushing_thread
@pushing_thread = Thread.new do
loop do
# pop will bl... | Ruby |
class DirectionsController < ApplicationController
# GET /directions
# GET /directions.xml
def index
@directions = Direction.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @directions }
end
end
# GET /directions/1
# GET /directions/1.xml
def ... | Ruby |
class HomeController < ApplicationController
def index
end
end
| Ruby |
class ExitsController < ApplicationController
# GET /exits
# GET /exits.xml
def index
@exits = Exit.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @exits }
end
end
# GET /exits/1
# GET /exits/1.xml
def show
@exit = Exit.find(params[:id])
... | Ruby |
class UsersController < ApplicationController
def new
@user ||= User.new
end
def create
@user = User.new(params[:user])
if @user.save
redirect_to root_url, :notice => "Signed up!"
else
render "new"
end
end
end
| Ruby |
class MapsController < ApplicationController
# GET /maps
# GET /maps.xml
def index
@maps = Map.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @maps }
end
end
# GET /maps/1
# GET /maps/1.xml
def show
@map = Map.find(params[:id])
respo... | Ruby |
class HerosController < ApplicationController
# GET /heros
# GET /heros.xml
def index
@heros = Hero.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @heros }
end
end
# GET /heros/1
# GET /heros/1.xml
def show
@hero = Hero.find(params[:id])
... | Ruby |
class SessionsController < ApplicationController
def new
end
def create
user = User.authenticate(params[:email], params[:password])
if user
session[:user_id] = user.id
redirect_to tales_of_eldeth_url, :notice => "Logged in!"
else
flash.now.alert = "Invalid email or password"
re... | 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.
# 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.
TalesOfEldeth::Application.config.session_store :cookie_store, :key => '_tales-of-eldeth_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 ta... | Ruby |
TalesOfEldeth::Application.routes.draw do
resources :directions
resources :exits
resources :maps
resources :heros
get "log_in" => "sessions#new", :as => "log_in"
get "log_out" => "sessions#destroy", :as => "log_out"
get "sign_up" => "users#new", :as => "sign_up"
get "tales_of_eldeth" => "game_page#n... | Ruby |
require 'rubygems'
# Set up gems listed in the Gemfile.
gemfile = File.expand_path('../../Gemfile', __FILE__)
begin
ENV['BUNDLE_GEMFILE'] = gemfile
require 'bundler'
Bundler.setup
rescue Bundler::GemNotFound => e
STDERR.puts e.message
STDERR.puts "Try running `bundle install`."
exit!
end if File.exist?(gem... | Ruby |
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler)
module TalesOfEldeth
class Application < Rails::Application... | Ruby |
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
TalesOfEldeth::Application.initialize!
| Ruby |
TalesOfEldeth::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is tur... | Ruby |
TalesOfEldeth::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... | Ruby |
TalesOfEldeth::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... | Ruby |
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run TalesOfEldeth::Application
| Ruby |
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
require 'rake'
TalesOfEldeth::Application.load_tasks
| Ruby |
#!/usr/bin/ruby
#
# Copyright 2009 Matthew Eernisse (mde@fleegix.org)
#
# 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 req... | Ruby |
#!/usr/bin/ruby
#
# Copyright 2009 Matthew Eernisse (mde@fleegix.org)
#
# 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 req... | 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 |
# $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 |
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 |
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 |
require 'dispatcher'
# The special :request benchmark. This tries to encompass everything that runs
# to handle a request.
BenchmarkForRails.watch(:request, ::Dispatcher, :dispatch)
# Processing the action itself (calling the controller method)
# This is what Rails' default benchmarks claim is the response time.
Bench... | Ruby |
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
desc 'Default: run unit tests.'
task :default => :test
desc 'Test the benchmark_for_rails plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
desc 'Generate documentation for the benchmark_... | Ruby |
# Bleh. Why isn't this already loaded? I need Symbol#& !
require 'active_support'
# Huh. It's as though autoloading doesn't work for rake tasks.
require File.dirname(__FILE__) + '/../lib/benchmark_for_rails'
require File.dirname(__FILE__) + '/../lib/benchmark_for_rails/report'
require File.dirname(__FILE__) + '/../lib/... | Ruby |
class BenchmarkForRails::Report
PADDING = 2
attr_accessor :rows
def initialize
self.rows = []
end
def render(*headers)
headers.each_index do |i|
print headers[i].to_s.ljust(width_of_column(i, headers[i].length + PADDING), ' ')
end
puts ""
headers.each_index do |i|
print '-' ... | Ruby |
module BenchmarkForRails
class LogParser
# The log file to be read.
attr_accessor :file
# If set to a Time, will limit the parsed responses to those *after*
# the threshold. This lets you parse the last hour's worth of data out
# of a log.
#
# Depends on the 'elif' gem.
attr_accessor ... | Ruby |
module BenchmarkForRails
class ResourcePath
attr_reader :path
attr_reader :requests
def initialize(path)
@path = path
@requests = []
end
def add_request(line)
measurements = {}
line.sub(/.*\]/, '').split(' | ').each do |measurement|
name, seconds = *measurement.sp... | Ruby |
module BenchmarkForRails
class << self
# Prints the benchmarks for the request into the log, with some
# basic ASCII formatting (yay). Uses a multi-line format for
# development mode, and a one-line format for production mode.
def report(request)
request_action = "#{request.method.to_s.upcase} #... | Ruby |
# BenchmarkForRails addresses a few issues with ActionController's benchmarking:
# * hidden query costs (ActiveRecord's cost of building a query)
# * no visibility on the cost of before/after filters
# * no visibility on cost of session management
#
# Other strengths:
# * very easy to benchmark new things without imple... | Ruby |
require 'test/unit'
require 'benchmark'
require 'rubygems'
require 'active_support'
$LOAD_PATH << File.dirname(__FILE__) + '/../lib/'
module BenchmarkForRails
module SomeModule
def foo; 'foo' end
def self.bar; 'bar' end
end
class SomeClass
include SomeModule
def hello; 'hello' end
def self.... | 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 |
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 'nokogiri'
string_to_remove = ['pref_cat_themes',
'theme_settings',
'theme_settings_summary',
'theme_settings_help']
string_files = []
Dir.glob('res/values*').each do |d|
file = d << "/strings.xml"
string_files << file if Fil... | 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 |
#!/usr/bin/env ruby
# encoding: utf-8
require 'nokogiri'
# read in convert.xml to see which how to convert the string-arrays
# for each strings.xml in res/values res/values-?? res/values-??-*
# find the string-arrays that match the ones in convert.xml and for each
# remove opening and closing string-array tag
#... | Ruby |
# name: twitter lucene
# (C) 2007 Benjamin Ferrari
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is... | Ruby |
scores = []
best_score = nil
best_file = nil
Dir.entries("logs").each do |file|
if file =~ /mebp-12.*log$/
score = File.new("logs/#{file}").readlines[-4].split(':')[1].strip.to_f
scores << score
if best_score.nil? || score < best_score
best_score = score
best_file = file
end
puts scor... | Ruby |
#!/usr/bin/env ruby
# convert - a simple unit converter
# Copyright (C) 2008 Benjamin Ferrari
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your o... | Ruby |
#!/usr/bin/env ruby
#(c) 2007 Benjamin Ferrari
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is dis... | Ruby |
#!/usr/bin/env ruby
# convert - a simple unit converter
# Copyright (C) 2008 Benjamin Ferrari
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your o... | Ruby |
# file: reddit_collect_votes.rb
# (C) 2008 Benjamin Ferrari
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This p... | Ruby |
#!/usr/bin/env ruby
#(c) 2007 Benjamin Ferrari
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is dis... | 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 |
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.