code
stringlengths
1
1.73M
language
stringclasses
1 value
--- !ruby/object:SnippetSet package: unixshell snips: "!env": - "#!/usr/bin/env (!env)" - "#!/usr/bin/env ${1:${TM_SCOPE/(?:source|.*)\\.(\\w+).*/$1/}}" if: - if .. then (if) - "if [[ ${1:condition} ]]; then\n\t$0\nfi" elif: - elif .. (elif) - "elif [[ ${1:condition} ]]; then\n\t$0" ...
Ruby
--- !ruby/object:SnippetSet package: rails snips: mrnt: - Migration Rename Table (mrnt) - "rename_table \"${1:old_table_name}\", \"${2:new_table_name}\"" rfu: - render (file,use_full_path)… (rfu) - "render :file => \"${1:filepath}\", :use_full_path => ${2:false}" rns: - render (nothing,st...
Ruby
--- !ruby/object:SnippetSet package: perl snips: sub: - Function (sub) - "sub ${1:function_name} {\n\t${2:# body...}\n}\n" class: - Package (class) - "package ${1:ClassName};\n\n${2:use base qw(${3:ParentClass});\n\n}sub new {\n\tmy \\$class = shift;\n\t\\$class = ref \\$class if ref \\$cl...
Ruby
--- !ruby/object:SnippetSet package: eruby snips: ec: - <%= %> - "<%= $0 %>" dy: - <% %> - "<% $0 %>" link: - <%= link_to %> - "<%= link_to \"${1:link text}\", { :action => \"${2:action}\" } %>" form: - <%= start_form_tag %> - "<%= start_form_tag :action=> \"${1:action}\", :i...
Ruby
--- !ruby/object:SnippetSet package: latex snips: sub: - Sub Section (sub) - "\\subsection{${1:subsection name}}\\label{sub:${2:${1/(\\w+)|\\W+/(?1:\\L$0:_)/g}}} " "$$": - Displaymath ($$) - "\\[\n\t$TM_SELECTED_TEXT$1\n\\]" ssub: - Sub Sub Section (ssub) - "\\subsubsecti...
Ruby
--- !ruby/object:SnippetSet package: java snips: meth: - method - | // {{{ ${1:METHOD} /** * $0 */ public ${2:RETURN} ${1:METHOD}() { $0 } // }}} jps: - const def - private static final ${1:String} $2 = "$0"; jtc: - try/catch/finally ...
Ruby
--- !ruby/object:SnippetSet package: ocaml snips: Queue.: - Queue.fold - Queue.fold ${1:(fun b v -> )} ${2:base} ${3:q} Nativeint.: - Nativeint.abs - Nativeint.abs ${1:ni} Printexc.: - Printexc.print - Printexc.print ${1:fn} ${2:x} Sys.: - Sys.Signal_ignore - Sys.Signal_ign...
Ruby
--- !ruby/object:SnippetSet package: xhtml snips: doctype: - DocType XHTML 1.0 Strict (doctype) - |- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> $0 aref: - " <a href> (aref)" - "<a href=\"$1\" id=\"${2:i...
Ruby
--- !ruby/object:SnippetSet package: javascript snips: proto: - Prototype (proto) - "${1:class_name}.prototype.${2:method_name} = function(${3:first_argument})\n{\n\t${0:// body...}\n};\n" fun: - Function (fun) - "function ${1:function_name} (${2:first_argument})\n{\n\t${0:// body...}\n}" ...
Ruby
--- !ruby/object:SnippetSet package: symfony snips: image_tag: - "template - image_tag" - "image_tag('${1:image_name}'${2:, array(${3})})" get: - basic getter - |- public function get$1 () { return \$this->$2; } $0 link_to: - "template - link_to" - "li...
Ruby
--- !ruby/object:SnippetSet package: c snips: do: - do .. while (do) - "do\n{\n\t$0\n} while( $1 );" readfile: - Read File Into Vector (readfile) - "std::vector<uint8_t> v;\nif(FILE* fp = fopen(${1:\"filename\"}, \"r\"))\n{\n\tuint8_t buf[1024];\n\twhile(size_t len = fread(buf, 1, si...
Ruby
--- !ruby/object:SnippetSet package: gri snips: con: - Contour (con) - >2 # `date` # ${1:`niutil -readprop / /users/\\$USER realname`} # Read columnar data (x,y,z), convert to a grid, then contour. # Data from figure 5 of Koch et al., 1983, J. Climate # Appl. Met., volum...
Ruby
--- !ruby/object:SnippetSet package: python snips: get: - New Get Method (get) - "def get$1(self): return self._$1" class: - New Class (class) - "class ${1:ClassName} (${2:object}):\n\n\tdef __init__(self${3/([^,])?.*/(?1:, )/}${3:arg}):\n${3/([a-zA-Z0-9_]+)\\s*(=[^,]*)?(,\\s*|$)/\\t\\tsel...
Ruby
--- !ruby/object:SnippetSet package: text snips: lorem: - Lorem ipsum (lorem) - "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea ...
Ruby
--- !ruby/object:SnippetSet package: markdown snips: img: - Image (img) - "![${1:alt text}](${2:SRC}) " link: - Link (link) - "[${1:description}](${2:HREF}) "
Ruby
--- !ruby/object:SnippetSet package: markdown snips: img: - Image (img) - "![${1:alt text}](${2:SRC}) " link: - Link (link) - "[${1:description}](${2:HREF}) "
Ruby
--- !ruby/object:SnippetSet package: css snips: visibility: - "visibility: type (visibility)" - "visibility: ${1:visible/hidden/collapse};$0" list: - "list-style-image: url (list)" - "list-style-image: url($1);$0" text: - "text-shadow: color-rgb x y blur (text)" - "text-shadow: rgb($...
Ruby
--- !ruby/object:SnippetSet package: django snips: "{{": - "templatetag: openvariable" - "{% templatetag openvariable %}" "}}": - "templatetag: closevariable" - "{% templatetag closevariable %}" now: - now - "{% now \"$1\" %}" firstof: - firstof - "{% firstof $1 %}" ifequ...
Ruby
--- !ruby/object:SnippetSet package: propel snips: "<i": - "xml - index" - "<index name=\"${1:key}_index\">\n\t<index-column name=\"${1:key}\" />\n</index>" "<t": - "xml - table" - "<table name=\"${1:name}\"${2: phpName=\"${3:php_name}\"}>\n\t$0\n</table>" "<u": - "xml - unique" - "<u...
Ruby
--- !ruby/object:SnippetSet package: php snips: elseif: - elseif .. (elseif) - "elseif (${1:condition}) {\n\t${0:# code...}\n}" do: - do .. while .. (do) - "do {\n\t${1:# code...}\n\t\n} while (${2: \\$$a <= 10});${0:}" req1: - require_once(..) (req1) - "require_once( '${1:file}' );$0...
Ruby
--- !ruby/object:SnippetSet package: slate snips: do: - do (do) - "do: [| :${1:each}| $0]" proto: - define prototype (proto) - | define: #${1:NewName} &parents: {${2:parents}} &slots: {${3:slotSpecs}}. ifte: - If-then-else (ifte) - "${1:condition} ifTrue: [$2:then] ifFal...
Ruby
--- !ruby/object:SnippetSet package: xml snips: "<a": - Long Attribute Tag (<a) - >- <${1:name} ${2:attr="value"}>$0 </${1:name}> "<": - Long Tag (<) - "<${1:name}>$0</${1/([^ ]+).*/$1/}>" ">": - Short Tag (>) - "<${1:name} />"
Ruby
#!/usr/bin/env ruby require 'rexml/document' require 'rexml/streamlistener' require 'yaml' require 'snippet_set' include REXML # A class to parse textmate style bundles. Currently this will only # grab the snippet definitions from either xml property lists or what I'm # guessing is an older format of plain-text li...
Ruby
require 'yaml' class SnippetSet @@all_sets = {} attr_reader :package, :snips def SnippetSet.all @@all_sets end # The default yaml parser should work. YAML.add_domain_type("rosejn.net,2006-29-02", "snippetSet") do |type, val| YAML.object_maker(SnippetSet, val) end def SnippetSet.load(filenam...
Ruby
#!/usr/bin/env ruby require 'rexml/document' require 'rexml/streamlistener' require 'yaml' require 'snippet_set' include REXML # A class to parse textmate style bundles. Currently this will only # grab the snippet definitions from either xml property lists or what I'm # guessing is an older format of plain-text li...
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 '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 '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
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
# -*- encoding: utf-8 -*- require 'anemone' opts = { :user_agent => "AnemoneRobot/0.00", :delay => 1, :depth_limit => 0, } Anemone.crawl("http://www.meiwaku.com/") do |anemone| anemone.storage = Anemone::Storage.MongoDB anemone.on_pages_like(/number\/[0-9]+/) do |page| puts page.url end ...
Ruby
# -*- encoding: utf-8 -*- require 'mongo' require "csv" require "nokogiri" m = Mongo::Connection.new('localhost', 27017) odb = m.db('anemone') writer = CSV.open("comment.csv", "wb") odb['pages'].find().map do |page| #puts page.keys() puts "url :" + page['url'].to_s if /number\/[0-9]+/ =~ page['url'].to...
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 CreateRegistrations < ActiveRecord::Migration def change create_table :registrations do |t| t.timestamps end end end
Ruby
class CreateDomains < ActiveRecord::Migration def change create_table :domains do |t| t.timestamps end end end
Ruby
ENV["RAILS_ENV"] = "test" require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. # # Note: You'll currently still have to declare fixtures explicitly in integrati...
Ruby
#!/usr/bin/env rake # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require File.expand_path('../config/application', __FILE__) General::Application.load_tasks
Ruby
source 'https://rubygems.org' gem 'rails', '3.2.8' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'mysql2' # Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3....
Ruby
#!/usr/bin/env ruby # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. APP_PATH = File.expand_path('../../config/application', __FILE__) require File.expand_path('../../config/boot', __FILE__) require 'rails/commands'
Ruby
#!/usr/bin/env ruby # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. APP_PATH = File.expand_path('../../config/application', __FILE__) require File.expand_path('../../config/boot', __FILE__) require 'rails/commands'
Ruby
module ApplicationHelper #リファラがあったら前にリダイレクト def redirect_back(msg) if request.referer != nil redirect_to (:back), :notice => msg else redirect_to ({:controller => "domains", :action => "index"}), :notice => msg end end end
Ruby
module DomainsHelper include ApplicationHelper #ソートのリクエストがあれば、orderの引数を返す def get_page_sort(args) sort = "id DESC" sort = "#{args[:sort]} #{args[:direct]}" if args.key?(:sort) sort end #デフォルトのソート方向を取得。リクエストがある #ものは逆を返す def get_order_direct(args) order = { :page_rank => "DESC", :ref...
Ruby
class Registration < ActiveRecord::Base # attr_accessible :title, :body end
Ruby
class Domain < ActiveRecord::Base attr_accessible :status paginates_per 10 has_one :registration, :foreign_key => 'id', :dependent => :destroy STATUS_NONE_EVALUATED = 0 #まだページランクなどの評価がされていない STATUS_INVALID = -1 #無効ドメイン一覧 STATUS_VALID = 1 #評価済の有効ドメイン STATUS_APPLICA...
Ruby
class ApplicationController < ActionController::Base protect_from_forgery end
Ruby
class DomainsController < ApplicationController include DomainsHelper def index #ドメイン申請されたものと評価済の通常のドメインリストを表示 values = {:status => [Domain::STATUS_APPLICATION, Domain::STATUS_VALID]} @domains = Domain.order(get_page_sort(params)) .where(values) .page params[:p...
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. General::Application.config.session_store :cookie_store, key: '_general_session' # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information # (create the session table with "rails g...
Ruby
General::Application.routes.draw do get 'domains/index' => 'domains#index' get 'domains/' => 'domains#index' get 'domains/change_status' => 'domains#change_status' get 'domains/applist' => 'domains#applist' # The priority is based upon order of creation: # first created -> highest priority. # Sample ...
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 General::Application.initialize!
Ruby
General::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
General::Application.configure do # Settings specified here will take precedence over those in config/application.rb # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web se...
Ruby
General::Application.configure do # Settings specified here will take precedence over those in config/application.rb # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test su...
Ruby
# This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) run General::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__) General::Application.load_tasks
Ruby
class Analysis def initialize(statuses) @statuses = statuses fill_hour_map() end attr_reader :hour_map private def fill_hour_map() @hour_map = {} @statuses.each do |s| hour = s.created_at.hour @hour_map[hour] = @hour_map.key?(hour) ? @hour_ma...
Ruby
require "mysql" require "singleton" module Tama class Configure def initialize(host, user, passward, database) @host = host @user = user @passward = passward @database = database end attr_reader :host, :user, :passward, :database end ...
Ruby
require "./model/tama/data-source" require "pp" module Tama class Model def initialize(name) @source = DataSource.instance @name = name @data = [] end def query(sql) @source.query_result(sql) end def count(where) ...
Ruby
require "./model/tama/model" require 'date' class AutoTaskModel < Tama::Model def initialize() super "auto_tasks" end def done?(id) options = { 'values' => {"date"=>Date.today.to_s,"id"=>id} } res = select(options) res != nil && res.length != 0 ? true :...
Ruby
require "./model/tama/model" class UserModel < Tama::Model def initialize() super "users" end end
Ruby
require "./model/tama/data-source" host = "172.21.160.97" user = "root" passward = "adte" database = "twimaker" config = Tama::Configure.new(host, user, passward, database) Tama::DataSource.set_config(config)
Ruby
# -*- encoding: utf-8 -*- require "./php/twimaker-dummy" require "./model/setup" require "./model/user-model" require "./model/auto-task-model" require "./twimaker-api" require "./main_thread" require "./analysis" require "./config" require "./netstat.rb" require 'resolv' require 'json' # Output File Format # [ # {"...
Ruby
# -*- encoding: utf-8 -*- require "./model/setup" require "./model/user-model" require "./model/auto-task-model" require "./bot" require "./twimaker-api" require "./analysis" require "./config" require "./netstat.rb" require 'resolv' class AutoTwitter include AutoTwimakerConfig TWIMAKER_URL = "http://172.21.16...
Ruby
require "twitter" require "pp" class Bot CONSUMER_KEY = "exkMBLL6XXthThI12hcuOw" CONSUMER_SECRET = "d6cbNBC2cJ1cVXestcfjzT3rqDzo6EfQPkMjh3JuOcA" def initialize(access_token_key, access_token_secret) Twitter.configure do |config| config.consumer_key = CONSUMER_KEY config.cons...
Ruby
require "net/http" require "uri" require "json" class TwimakerApi def initialize(url) @url = url end def create_image(param) uri = URI.parse(@url + "users/create_image/") response = nil Net::HTTP.start(uri.host, uri.port){|http| request = Net::HTTP::Post.new(uri...
Ruby
# -*- encoding: utf-8 -*- require 'json' require "mysql" class TwimakerDummy HOST = "172.21.160.97" USER = "root" PASS = "adte" DATABASE = "twimaker" def initialize @db = Mysql.connect(HOST, USER, PASS, DATABASE) ObjectSpace.define_finalizer(self) { @db.close } ...
Ruby
# -*- encoding: utf-8 -*- module Netstat PROC_NET_TCP = "/proc/net/tcp" # States from http://snippets.dzone.com/posts/show/12653 TCP_STATES = { '00' => 'UNKNOWN', # Bad state ... Impossible to achieve ... 'FF' => 'UNKNOWN', # Bad state ... Impossible to achieve ... '01' => 'ESTABLISHED', '02'...
Ruby
# -*- encoding: utf-8 -*- require 'yaml' require 'date' require 'json' module AutoTwimakerConfig def read_config() data = nil begin File.open('config.json') do |f| text = f.read data = JSON.parse(text) end rescue => evar pu...
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 CreateHomelesses < ActiveRecord::Migration def change create_table :homelesses do |t| t.float :latitude t.float :longitude t.integer :nearby t.string :address t.string :district t.string :representative t.string :email t.string :gender t.string :office ...
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.8' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'sqlite3' gem 'savon', '~> 2.2.0' gem 'json' gem 'ym4r' gem 'sunlight' gem 'geocoder' gem 'gmaps4rails' # Gems used only for assets and not required # in production environm...
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
json.homelesses @homelesses.each do |json, homeless| json.(homeless, :id, :latitude, :longitude, :address, :district, :representative, :email, :gender, :office, :phone, :twitter) end
Ruby
json.(@homeless, :id, :latitude, :longitude, :address, :district, :representative, :email, :nearby, :gender, :office, :phone, :twitter)
Ruby
json.homelesses @homelesses.each do |json, homeless| json.(homeless, :id, :latitude, :longitude, :address, :district, :representative, :email, :gender, :office, :phone, :twitter) end
Ruby
module ApplicationHelper end
Ruby