code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/benchmarker'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/profiler'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/request'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/benchmarker'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/performance/profiler'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
$LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info"
require 'commands/about' | Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/inspector'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/inspector'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/spawner'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/reaper'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/spawner'
| Ruby |
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../config/boot'
require 'commands/process/reaper'
| Ruby |
#!/usr/local/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 impai... | Ruby |
#!/usr/local/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 impai... | Ruby |
#!/usr/local/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 impai... | Ruby |
#!/usr/local/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.lo... | Ruby |
#!/usr/local/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.lo... | Ruby |
#!/usr/local/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 impai... | Ruby |
require 'net/http'
class VideoScraper
def initialize(url,file)
@watch_url=url
@dest_file=file
end
def save_video()
resp=fetch_simple()
fmt="18"
video_id=nil
t=nil
if resp =~ /swfArgs\s*=\s*(.*);.*/
arr=$1
arr.gsub!(":","=>").gsub!("null","\"\"")
arr=eval(arr)
video_id=arr["video_id"]
t=... | 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 where the ExtJS SDK is installed
# Generally this will be in a lib/extjs folder in your applications root
# <root>/lib/extjs
$ext_path = "../../lib/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... | 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 |
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 |
# -*- Ruby -*-
require 'fileutils'
def find_version
File.read("yasnippet.el") =~ /;; Package-version: *([0-9.]+[a-z]?) *$/
$version = $1
end
find_version
FileUtils.mkdir_p('pkg')
desc "generate bundle file for classic snippets."
task :bundle do
sh 'emacs --batch -l yasnippet.el --eval "(yas/compile-bundle)"'
... | Ruby |
# -*- Ruby -*-
require 'fileutils'
def find_version
File.read("yasnippet.el") =~ /;; Package-version: *([0-9.]+[a-z]?) *$/
$version = $1
end
find_version
FileUtils.mkdir_p('pkg')
desc "generate bundle file for classic snippets."
task :bundle do
sh 'emacs --batch -l yasnippet.el --eval "(yas/compile-bundle)"'
... | 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):
# output_styl... | Ruby |
$:.unshift(File.dirname(__FILE__) + "/../../rails_generators")
require "rubygems"
require "rails_generator"
require 'rails_generator/scripts/generate'
require "fileutils"
require "theme/theme_generator"
web_app_theme_root = File.join(File.dirname(__FILE__), "/../../")
tmp_rails_app_name = "tmp_rails_app"
tmp_rails_a... | Ruby |
Given /^I have a new rails app$/ do
generate_rails_app
end
Given /^I have no layouts$/ do
remove_layouts
end
Given /^I have no stylesheets$/ do
remove_stylesheets
end
Given /^I generate a theme$/ do
generate_layout
end
Given /^I generate a theme with name "([^\"]*)"$/ do |name|
generate_layout(name)
end... | Ruby |
Given /^a model "([^\"]*)"$/ do |model_name|
generate_model(model_name)
end
Given /^I generate views for controller "([^\"]*)"$/ do |controller_path|
generate_views(controller_path)
end
When /^I generate views for controller "([^\"]*)" and model "([^\"]*)"$/ do |controller_path, model_name|
generate_views(con... | Ruby |
require "rubygems"
# require "cucumber/rake/task"
# require "spec/rake/spectask"
#
# Cucumber::Rake::Task.new
# Spec::Rake::SpecTask.new do |t|
# t.spec_files = FileList['test/**/*_spec.rb']
# end
# task :default => [:spec, :cucumber]
begin
require 'jeweler'
Jeweler::Tasks.new do |gemspec|
gemspec.name = ... | Ruby |
module WebAppTheme
end | Ruby |
module WebAppTheme
class ThemeGenerator < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)
argument :layout_name, :type => :string, :default => 'application'
class_option :theme, :type => :string, :default => :default, :desc => 'Specify the layout theme'
... | Ruby |
require 'rails/generators/generated_attribute'
module WebAppTheme
class ThemedGenerator < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)
argument :controller_path, :type => :string
argument :model_name, :type => :string, :required => false
clas... | Ruby |
require "rubygems"
require "spec"
require "rails_generator"
require "rails_generator/scripts/generate"
require File.dirname(__FILE__) + "/../rails_generators/themed/themed_generator" | Ruby |
#!/usr/bin/ruby
#
# Tested with Ruby 1.9
#
# squid.conf:
# url_rewrite_program <path>/cache.rb
# url_rewrite_host_header off
# cache deny to_localhost
# header_access Server deny to_localhost
#
require "base64"
class SquidRequest
attr_accessor :url, :user
attr_reader :client_ip, :method
... | Ruby |
#!/usr/bin/ruby
#
# Tested with Ruby 1.9
#
# squid.conf:
# url_rewrite_program <path>/cache.rb
# url_rewrite_host_header off
# cache deny to_localhost
# header_access Server deny to_localhost
#
require "base64"
class SquidRequest
attr_accessor :url, :user
attr_reader :client_ip, :method
... | 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):
# output_styl... | Ruby |
require 'albacore'
require 'version_bumper'
bumper_file "version.txt"
# Read any atypical version bump type from environment/command-line.
# e.g., rake bumpType=minor
# bumpType=major -> 2.3.251.0 becomes 3.0.0.0
# bumpType=minor -> 2.3.251.0 becomes 2.4.0.0
# no bumpType specified -> 2.3.251.0 becomes 2.3.252... | Ruby |
module Blueprint
# Validates generated CSS against the W3 using Java
class Validator
attr_reader :error_count
def initialize
@error_count = 0
end
# Validates all three CSS files
def validate
java_path = `which java`.rstrip
raise "You do not have a Java installed, but it i... | Ruby |
module Blueprint
# Strips out most whitespace and can return a hash or string of parsed data
class CSSParser
attr_accessor :namespace
attr_reader :css_output, :raw_data
# ==== Options
# * <tt>css_string</tt> String of CSS data
# * <tt>options</tt>
# * <tt>:namespace</tt> -- Namespace ... | Ruby |
require 'yaml'
require 'optparse'
module Blueprint
class Compressor
TEST_FILES = ['index.html',
'parts/elements.html',
'parts/forms.html',
'parts/grid.html',
'parts/sample.html']
attr_accessor :namespace, :custom_css, :custom_lay... | Ruby |
require 'fileutils'
module Blueprint
# path to the root Blueprint directory
ROOT_PATH = File.join(File.expand_path(File.dirname(__FILE__)), "../../")
# path to where the Blueprint CSS files are stored
BLUEPRINT_ROOT_PATH = File.join(Blueprint::ROOT_PATH, 'blueprint')
# path to where the Blueprin... | Ruby |
module Blueprint
# parses a hash of key/value pairs, key being output CSS selectors, value being a list of CSS selectors to draw from
class SemanticClassNames
attr_accessor :class_assignments
attr_reader :namespace, :source_file
# ==== Options
# * <tt>options</tt>
# * <tt>:namespace</tt> ... | Ruby |
module Blueprint
class Namespace
# Read html to string, remove namespace if any,
# set the new namespace, and update the test file.
def initialize(path, namespace)
html = File.path_to_string(path)
remove_current_namespace(html)
add_namespace(html, namespace)
File.string_to_file(... | Ruby |
class String
# see if string has any content
def blank?; self.length.zero?; end
# strip space after :, remove newlines, replace multiple spaces with only one space, remove comments
def strip_space!
replace self.gsub(/:\s*/, ':').gsub(/\n/, '').gsub(/\s+/, ' ').gsub(/(\/\*).*?(\*\/)/, '')
end
# rem... | Ruby |
require 'erb'
module Blueprint
# Generates a custom grid file, using ERB to evaluate custom settings
class CustomLayout
# path to ERB file used for CSS template
CSS_ERB_FILE = File.join(Blueprint::LIB_PATH, 'grid.css.erb')
attr_writer :column_count, :column_width, :gutter_width
# Column count of... | Ruby |
begin
require 'rubygems'
gem 'rmagick'
require 'rvg/rvg'
rescue Exception => e
end
module Blueprint
# Uses ImageMagick and RMagick to generate grid.png file
class GridBuilder
begin
include Magick
rescue Exception => e
end
attr_reader :column_width, :gutter_width, :output_path, :able_to... | Ruby |
#!/usr/bin/env ruby
require 'blueprint/blueprint'
require 'blueprint/validator'
# This script will validate the core Blueprint files.
#
# The files are not completely valid. This has to do
# with a small number of CSS hacks needed to ensure
# consistent rendering across browsers.
#
# To add your own CSS files for... | Ruby |
#!/usr/bin/env ruby
require File.join(File.dirname(__FILE__), "blueprint", "blueprint")
# **Basic
#
# Calling this file by itself will pull files from blueprint/src and concatenate them into three files; ie.css, print.css, and screen.css.
#
# ruby compress.rb
#
# However, argument variables can be set to ch... | Ruby |
#!/usr/bin/env ruby
require 'blueprint/blueprint'
require 'blueprint/validator'
# This script will validate the core Blueprint files.
#
# The files are not completely valid. This has to do
# with a small number of CSS hacks needed to ensure
# consistent rendering across browsers.
#
# To add your own CSS files for... | Ruby |
#!/usr/bin/env ruby
require File.join(File.dirname(__FILE__), "blueprint", "blueprint")
# **Basic
#
# Calling this file by itself will pull files from blueprint/src and concatenate them into three files; ie.css, print.css, and screen.css.
#
# ruby compress.rb
#
# However, argument variables can be set to ch... | Ruby |
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "theme/css"
sass_dir = "theme/scss"
images_dir = "images"
javascripts_dir = "js"
# You can select your preferred output style here (can be overridden via the command line):
output_style = :co... | Ruby |
#!/usr/bin/env ruby
#
# Yubico.rb - yubikey authentication library
# Protected under the BSD License.
#
# Author: Jenecai 'Seven' Corvina <seven@ofhearts.org>
#
# Documentation: Jenecai 'Seven' Corvina
#
# == Overview
#
# The Yubikey is a simple tool to for which to authenticate users
# without the hassle of usernames ... | Ruby |
#!/usr/bin/env ruby
#
# Yubico.rb - yubikey authentication library
# Protected under the BSD License.
#
# Author: Jenecai 'Seven' Corvina <seven@ofhearts.org>
#
# Documentation: Jenecai 'Seven' Corvina
#
# == Overview
#
# The Yubikey is a simple tool to for which to authenticate users
# without the hassle of usernames ... | 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 |
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 |
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 |
# DSL for wmiirc configuration.
#--
# Copyright protects this work.
# See LICENSE file for details.
#++
require 'shellwords'
require 'pathname'
require 'yaml'
require 'rubygems'
gem 'rumai', '~> 3'
require 'rumai'
include Rumai
class Handler < Hash
def initialize
super {|h,k| h[k] = [] }
end
##
# If a ... | Ruby |
#!/usr/bin/env ruby
#
# Bootloader for wmii configuration.
#
#--
# Copyright protects this work.
# See LICENSE file for details.
#++
# create a logger to aid debugging
require 'logger'
LOG = Logger.new(__FILE__ + '.log', 5)
class << LOG
# emulate IO.write
alias write <<
def flush
# ignore
end
end
# capt... | Ruby |
require 'base64'
require 'cgi'
require 'digest/sha1'
require 'net/http'
require 'openssl'
# Ruby class for verifying YubiKey OTPs using HMAC signature verification on
# the request and the response.
# Sample uses:
# yubi = YubiSigned.new(otp)
# puts yubi.unique_id #-> 'ccccccccdefg'
# puts yubi... | Ruby |
#
# yuical4r.rb
# yuical4r
#
# Created by Aaron Longwell on 2007-09-15.
# Copyright 2007 New Media Logic, LLC. All rights reserved.
# License: See LICENSE.txt
#
require 'yuical4r_helper'
ActionView::Base.send :include, YUICal4RHelper
| Ruby |
#
# yuical4r.rb
# yuical4r
#
# Created by Aaron Longwell on 2007-09-15.
# Copyright 2007 New Media Logic, LLC. All rights reserved.
# License: See LICENSE.txt
#
module YUICal4RHelper
def yuical_tag
"TEST"
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 '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 |
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 |
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 '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 'rubygems'
require 'sinatra'
require 'haml'
require 'filemagic'
require 'sqlite3'
# 主页
get '/' do
@projects = Dir.entries('projects').select do |entry|
not (entry.include? 'svn' or entry =~ /^\.*$/)
end
haml :index
end
# project文件浏览
get '/projects/*' do
path = params[:splat].first
... | Ruby |
require 'sinatra'
get '/' do
"Hello world!"
end
| 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 '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 |
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 |
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 |
# $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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.