repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
dorianmariefr/activejob-limiter
lib/activejob/limiter.rb
<reponame>dorianmariefr/activejob-limiter # frozen_string_literal: true # This file allows Bundler to auto-require # the library without a separate :require arg require_relative '../active_job/limiter'
dorianmariefr/activejob-limiter
spec/spec_helper.rb
# frozen_string_literal: true require 'bundler/setup' require 'active_job' require 'active_job/limiter' require 'byebug' RSpec.configure do |config| config.include(ActiveJob::TestHelper) config.before(:all) do ActiveJob::Base.queue_adapter = :test ActiveJob::Base.queue_adapter.perform_enqueued_jobs = tru...
nlhkh/delay_message_on_rails_dockerized
app/views/messages/show.json.jbuilder
<gh_stars>0 json.extract! @message, :id, :recipient_email, :text, :delay_until_time, :timezone_offset, :sent, :created_at, :updated_at
nlhkh/delay_message_on_rails_dockerized
app/mailers/message_mailer.rb
<gh_stars>0 class MessageMailer < ApplicationMailer def default(recipient_email, content) @content = content mail to: recipient_email end end
nlhkh/delay_message_on_rails_dockerized
app/workers/delay_message_worker.rb
class DelayMessageWorker include Sidekiq::Worker def perform(message_id) # Get the message object message = Message.find(message_id) # Send an email MessageMailer.delay.default(message.recipient_email, message.text) # Change the status of the Message object to `sent` message.sent = true ...
nlhkh/delay_message_on_rails_dockerized
test/mailers/previews/message_mailer_preview.rb
<filename>test/mailers/previews/message_mailer_preview.rb # Preview all emails at http://localhost:3000/rails/mailers/message_mailer class MessageMailerPreview < ActionMailer::Preview # Preview this email at http://localhost:3000/rails/mailers/message_mailer/default def default MessageMailer.default end end...
nlhkh/delay_message_on_rails_dockerized
config/initializers/sidekiq.rb
<gh_stars>0 Sidekiq.configure_server do |config| config.redis = { url: 'redis://redis:6379/1', namespace: 'delay_message_dev', driver: :hiredis } end Sidekiq.configure_client do |config| config.redis = { url: 'redis://redis:6379/1', namespace: 'delay_message_dev', driver: :hiredis } end
nlhkh/delay_message_on_rails_dockerized
app/models/message.rb
class Message < ActiveRecord::Base validates :recipient_email, :text, :delay_until_time, :timezone_offset, presence: true VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i validates :recipient_email, format: { with: VALID_EMAIL_REGEX, message: 'is not valid' } end
nlhkh/delay_message_on_rails_dockerized
app/views/messages/index.json.jbuilder
json.array!(@messages) do |message| json.extract! message, :id, :recipient_email, :text, :delay_until_time, :timezone_offset, :sent json.url message_url(message, format: :json) end
nlhkh/delay_message_on_rails_dockerized
db/migrate/20150225040826_create_messages.rb
<reponame>nlhkh/delay_message_on_rails_dockerized class CreateMessages < ActiveRecord::Migration def change create_table :messages do |t| t.string :recipient_email t.text :text t.datetime :delay_until_time t.integer :timezone_offset t.boolean :sent, default: false # update this line ...
ShinRyubi/warnme
web/app/controllers/application_controller.rb
class ApplicationController < ActionController::Base before_action :configure_permitted_parameters, if: :devise_controller? before_action :set_locale protected def configure_permitted_parameters devise_parameter_sanitizer.permit(:sign_up, keys: [:email, :name, :city, :address, :photo, :password, :password...
ShinRyubi/warnme
web/db/migrate/20181017063711_create_posts.rb
<filename>web/db/migrate/20181017063711_create_posts.rb class CreatePosts < ActiveRecord::Migration[5.2] def change create_table :posts do |t| t.references :incident, index: true, foreign_key: {on_delete: :nullify} t.references :user, index: true, foreign_key: {on_delete: :nullify} t.string :us...
ShinRyubi/warnme
web/app/models/user.rb
class User < ApplicationRecord acts_as_taggable belongs_to :incident, optional: true validates_uniqueness_of :email devise :database_authenticatable, :registerable #, :recoverable, :rememberable, :trackable, :validatable #:recoverable, :rememberable, :validatable end
ShinRyubi/warnme
web/app/controllers/sessions_controller.rb
class SessionsController < Devise::SessionsController before_action :configure_permitted_parameters #, if: :devise_controller? protected def configure_permitted_parameters devise_parameter_sanitizer.permit(:sign_in, keys: [:name, :email, :password, :<PASSWORD>, :city, :address, :photo, :info...
ShinRyubi/warnme
web/app/views/incidents/_incident.json.jbuilder
json.extract! incident, :id, :created_at, :updated_at json.url incident_url(incident, format: :json)
ShinRyubi/warnme
web/app/controllers/users_controller.rb
class UsersController < ApplicationController before_action :authenticate_user!, only: [:new, :index, :edit, :update, :destroy, :male, :female, :featured] before_action :set_user, only: [:show, :edit, :update, :destroy, :upvote, :downvote, :cancel_account] def index @users = User.all @posts = Pos...
ShinRyubi/warnme
web/db/migrate/20181018083635_create_donations.rb
<reponame>ShinRyubi/warnme class CreateDonations < ActiveRecord::Migration[5.2] def change create_table :donations do |t| t.references :user, index: true, foreign_key: {on_delete: :nullify} t.integer :target_id t.string :name t.integer :amount t.timestamps end end end
ShinRyubi/warnme
web/app/models/incident.rb
<gh_stars>1-10 class Incident < ApplicationRecord has_many :posts has_many :users has_many_attached :images acts_as_taggable # Alias for acts_as_taggable_on :tags end
ShinRyubi/warnme
web/db/migrate/20181017010705_create_incidents.rb
<gh_stars>1-10 class CreateIncidents < ActiveRecord::Migration[5.2] def change create_table :incidents do |t| t.string :name t.string :address t.float :latitude t.float :longitude t.text :content t.text :content_local t.string :kind t.string :photo # for url ...
ShinRyubi/warnme
web/app/models/incident_user.rb
class IncidentUser < ApplicationRecord # has_many :users, dependent: :destroy, join_table: :syndications, optional: true has_many :users, dependent: :destroy, optional: true belongs_to :incident, optional: true end
ShinRyubi/warnme
web/config/application.rb
require_relative 'boot' require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module WarnMe class Application < Rails::Application # Initialize configuration defaults for originally generated Rails ve...
ShinRyubi/warnme
web/app/controllers/incidents_controller.rb
<filename>web/app/controllers/incidents_controller.rb class IncidentsController < ApplicationController before_action :set_incident, only: [:show, :edit, :update, :destroy] def index @incidents = Incident.all end def show @map_hash = Gmaps4rails.build_markers(@incident) do |location, marker| ...
ShinRyubi/warnme
web/db/seeds.rb
<filename>web/db/seeds.rb require 'open-uri' puts "Seeding incidents.." File.open("schema - incidents.csv", "r") do |f| f.each_with_index do |line, index| name, address, lat, long, content, content_local, kind, photo = line.chomp.split (",") Incident.create(name: name, address: address, latitude: lat, longitud...
ShinRyubi/warnme
web/app/models/post.rb
class Post < ApplicationRecord belongs_to :incident, optional: true end
ShinRyubi/warnme
web/config/routes.rb
<reponame>ShinRyubi/warnme<filename>web/config/routes.rb Rails.application.routes.draw do devise_for :users, controllers: { sessions: 'sessions', registrations: 'registrations' } scope "(:locale)", locale: /#{I18n.available_locales.join("|")}/, defaults: {locale: "en"} do root 'posts#index' ...
ShinRyubi/warnme
web/app/controllers/registrations_controller.rb
class RegistrationsController < Devise::RegistrationsController before_action :configure_permitted_parameters protected def after_inactive_sign_up_path_for(resource) posts_path(session[:registration_params]) end def update_resource(resource, params) resource.update_without_password(params) en...
pj4533/mixpanel_statusboard
mixpanel_statusboard.rb
<filename>mixpanel_statusboard.rb require 'sinatra' require 'mixpanel_client' require 'json' get '/mixpanel_html' do api_key = params[:api_key] api_secret = params[:api_secret] event = params[:event] event_type = 'general' if params[:event_type] event_type = params[:event_type] end title = params[:title] w...
pj4533/mixpanel_statusboard
lib/url_builder.rb
#!/usr/bin/env ruby require 'uri' require 'cgi' require 'commander/import' require 'version' module MixPanelSB class URLBuilder def build program :help_formatter, :compact program :name, 'Dolly' program :version, VERSION program :description, 'Clone and genetically modify premium apps.'...
pj4533/mixpanel_statusboard
mixpanel_statusboard.gemspec
<filename>mixpanel_statusboard.gemspec # coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'version' Gem::Specification.new do |spec| spec.name = "mixpanel_statusboard" spec.version = MixPanelSB::VERSION spec.authors = ["...
PierreR/puppetlabs-java
spec/classes/java_spec.rb
<gh_stars>0 require 'spec_helper' describe 'java', :type => :class do context 'select openjdk for Centos 5.8' do let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '5.8'} } it { should contain_package('java').with_name('java-1.6.0-openjdk-devel') } end contex...
yaauie/logstash-codec-es_bulk
lib/logstash/codecs/es_bulk.rb
<reponame>yaauie/logstash-codec-es_bulk # encoding: utf-8 require "logstash/codecs/base" require "logstash/codecs/line" require "logstash/json" require 'logstash/plugin_mixins/ecs_compatibility_support' require 'logstash/plugin_mixins/ecs_compatibility_support/target_check' require 'logstash/plugin_mixins/validator_sup...
UAlbanyArchives/arclight-UAlbany
lib/arclight/normalized_date.rb
<reponame>UAlbanyArchives/arclight-UAlbany # frozen_string_literal: true module Arclight ## # A utility class to normalize dates, typically by joining inclusive and bulk dates # e.g., "1990-2000, bulk 1990-1999" # @see http://www2.archivists.org/standards/DACS/part_I/chapter_2/4_date class NormalizedD...
UAlbanyArchives/arclight-UAlbany
config/initializers/licenses.rb
<gh_stars>0 LICENCES = YAML.load_file(Rails.root.join('config/licenses.yml'))
UAlbanyArchives/arclight-UAlbany
lib/arclight/repository.rb
<filename>lib/arclight/repository.rb # frozen_string_literal: true module Arclight # # Static information about a given repository identified by a unique `slug` # class Repository include ActiveModel::Conversion # for to_partial_path FIELDS = %i[name description ...
UAlbanyArchives/arclight-UAlbany
lib/arclight/shared_indexing_behavior.rb
# frozen_string_literal: true module Arclight ## # A mixin intended to share indexing behavior between # the CustomDocument and CustomComponent classes module SharedIndexingBehavior # @see http://eadiva.com/2/unitdate/ # @return [YearRange] all of the years between the given years def unit...
UAlbanyArchives/arclight-UAlbany
lib/arclight/solr_ead_indexer_ext.rb
# frozen_string_literal: true module Arclight ## # An module to extend SolrEad::Indexer behaviors to allow us to add # or override behaviors that require knowledge of the entire XML document. module SolrEadIndexerExt def additional_component_fields(node, addl_fields = {}) solr_doc = super ...
raymanoz/totally_lazy
lib/totally_lazy/lambda_block.rb
module LambdaBlock private def assert_funcs(fn, block_given) raise 'Cannot pass both lambda and block expressions' if !fn.nil? && block_given end end
raymanoz/totally_lazy
spec/totally_lazy/functions_spec.rb
<reponame>raymanoz/totally_lazy require_relative '../spec_helper' describe 'Functions' do it 'should allow function composition and method chaining' do add_2 = ->(value) { value+2 } divide_by_2 = ->(value) { value/2 } expect(sequence(10).map(divide_by_2 * add_2)).to eq(sequence(6)) expect(sequence(10...
raymanoz/totally_lazy
spec/totally_lazy/sequence_spec.rb
<filename>spec/totally_lazy/sequence_spec.rb require_relative '../spec_helper' describe 'Sequence' do it 'should create empty sequence when iterable is nil' do expect(sequence(nil)).to eq(empty) end it 'should support head' do expect(sequence(1, 2).head).to eq(1) end it 'should return same result ...
raymanoz/totally_lazy
lib/totally_lazy/numbers.rb
module Numbers private def sum monoid(->(a, b) { a + b }, 0) end def add(increment) -> (number) { number + increment } end def even remainder_is(2, 0) end def odd remainder_is(2, 1) end def divide(divisor) ->(dividend) { dividend / divisor } end def remainder_is(divisor,...
raymanoz/totally_lazy
spec/totally_lazy/option_spec.rb
require_relative '../spec_helper' describe 'Option' do it 'should support is_empty? & is_defined?' do expect(some(1).is_empty?).to eq(false) expect(some(1).is_defined?).to eq(true) expect(none.is_empty?).to eq(true) expect(none.is_defined?).to eq(false) end it 'should support contains?' do e...
raymanoz/totally_lazy
lib/totally_lazy/strings.rb
<reponame>raymanoz/totally_lazy module Strings private def join monoid(->(a, b) { "#{a}#{b}" }, '') end def join_with_sep(separator) ->(a, b) { "#{a}#{separator}#{b}" } end def to_characters ->(string) { Sequence.new(character_enumerator(string)) } end def to_string ->(value) { value....
raymanoz/totally_lazy
lib/totally_lazy/pair.rb
module Pairs private def pair(first, second) Pair.new(first, second) end def first ->(pair) { pair.first } end def second ->(pair) { pair.second } end end class Pair include Comparable def initialize(first, second) @first = -> { first } @second = -> { second } end def firs...
raymanoz/totally_lazy
lib/totally_lazy/functions.rb
<reponame>raymanoz/totally_lazy require 'concurrent/executors' require 'concurrent/promise' class Proc def self.compose(f, g) lambda { |*args| f[g[*args]] } end def *(g) Proc.compose(self, g) end def and_then(g) Proc.compose(g, self) end end module Functions private def monoid(fn, id) ...
raymanoz/totally_lazy
spec/totally_lazy/either_spec.rb
<reponame>raymanoz/totally_lazy require_relative '../spec_helper' describe 'Either' do it 'should support creating rights' do either = right(3) expect(either.is_right?).to eq(true) expect(either.is_left?).to eq(false) expect(either.right_value).to eq(3) end it 'should support creating lefts' do ...
raymanoz/totally_lazy
lib/totally_lazy/either.rb
require_relative 'lambda_block' class Proc def or_exception -> (value) { begin right(self.(value)) rescue Exception => e left(e) end } end end module Eithers private def left(value) Either.left(value) end def right(value) Either.right(value) end def ...
raymanoz/totally_lazy
spec/totally_lazy/maps_spec.rb
require_relative '../spec_helper' describe 'Maps' do it 'should allow maps to be merged' do expect(merge(empty)).to eq({}) expect(merge(sequence({1 => 2}, {3 => 4, 5 => 6}))).to eq({1 => 2, 3 => 4, 5 => 6}) expect(merge(sequence({1 => 2, 3 => 3}, {3 => 4, 5 => 6}))).to eq({1 => 2, 3 => 4, 5 => 6}) end ...
raymanoz/totally_lazy
lib/totally_lazy.rb
require_relative 'totally_lazy/comparators' require_relative 'totally_lazy/either' require_relative 'totally_lazy/enumerators' require_relative 'totally_lazy/functions' require_relative 'totally_lazy/maps' require_relative 'totally_lazy/numbers' require_relative 'totally_lazy/option' require_relative 'totally_lazy/pair...
raymanoz/totally_lazy
spec/totally_lazy/numbers_spec.rb
<reponame>raymanoz/totally_lazy<gh_stars>0 require_relative '../spec_helper' describe 'Numbers' do it 'should support arbitrary multiply' do expect(sequence(1, 2, 3, 4, 5).map(multiply(5))).to eq(sequence(5, 10, 15, 20, 25)) end it 'should treat multiply as a monoid' do expect(empty.reduce(multiply(5)))...
raymanoz/totally_lazy
lib/totally_lazy/comparators.rb
module Comparators private def ascending -> (a,b) { a <=> b } end def descending -> (a,b) { b <=> a } end end
raymanoz/totally_lazy
lib/totally_lazy/maps.rb
module Maps private def merge(sequence_of_maps) sequence_of_maps.fold({}){|a,b| a.merge(b) } end end
raymanoz/totally_lazy
lib/totally_lazy/predicates.rb
<reponame>raymanoz/totally_lazy module Predicates private def predicate(fn) def fn.and(other) -> (value) { self.(value) && other.(value) } end def fn.or(other) -> (value) { self.(value) || other.(value) } end fn end def is_not(pred) predicate(-> (bool) { !pred.(bool) }) en...
raymanoz/totally_lazy
lib/totally_lazy/option.rb
<filename>lib/totally_lazy/option.rb require_relative 'lambda_block' class Proc def optional ->(value) { begin Option.option(self.(value)) rescue Option.none end } end end module Options private def option(value) Option.option(value) end def some(value) O...
raymanoz/totally_lazy
lib/totally_lazy/enumerators.rb
<filename>lib/totally_lazy/enumerators.rb module Enumerators private def reverse_enumerator(e) e.reverse_each end def has_next(e) begin e.peek true rescue StopIteration false end end def enumerator_of(fn, init) Enumerator.new do |y| value = init y << value...
raymanoz/totally_lazy
spec/totally_lazy/predicates_spec.rb
require_relative '../spec_helper' describe 'Predicates' do it 'should allow regex matching' do expect(sequence('Stacy').find(matches(/Stac/))).to eq(some('Stacy')) expect(sequence('Raymond').find(matches(/NotAwesome/))).to eq(none) end it 'should allow is' do expect(sequence('Stuff').find(is('Stuff'...
raymanoz/totally_lazy
lib/totally_lazy/sequence.rb
require_relative 'lambda_block' class NoSuchElementException < RuntimeError end class Array def to_seq Sequence.new(self.lazy) end end module Sequences def empty Sequence.empty end def sequence(*items) Sequence.sequence(*items) end def drop(sequence, count) Sequence.drop(sequence, cou...
pushcx/rncurses
lib/ncurses.rb
<filename>lib/ncurses.rb # ncurses-ruby is a ruby module for accessing the FSF's ncurses library # (C) 2002, 2003, 2004 <NAME> <<EMAIL>> # (C) 2004 <NAME> <<EMAIL>> # (C) 2005 <NAME> # # This module is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License a...
pushcx/rncurses
test/test_define_key_fails.rb
#!/usr/bin/env ruby require "ncurses" # call should fail, but must not terminate the ruby interpreter begin Ncurses.define_key("Hi!", 22) rescue Ncurses::Exception, NoMethodError exit 0 else exit 1 end
pushcx/rncurses
test/test_keyok_fails.rb
<gh_stars>1-10 #!/usr/bin/env ruby require "ncurses" # call should fail, but must not terminate the ruby interpreter begin Ncurses.keyok(22, true) rescue Ncurses::Exception, NoMethodError exit 0 else exit 1 end
pushcx/rncurses
test/test_newterm_isinit.rb
<reponame>pushcx/rncurses<filename>test/test_newterm_isinit.rb<gh_stars>1-10 #!/usr/bin/env ruby require "ncurses" term = Ncurses.newterm(nil, 1, 0) Ncurses.start_color Ncurses.endwin
pushcx/rncurses
extconf.rb
#!/usr/bin/env ruby # ncurses-ruby is a ruby module for accessing the FSF's ncurses library # (C) 2002, 2004 <NAME> <<EMAIL>> # (C) 2005 <NAME> # # This module 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 Found...
pushcx/rncurses
test/test_start_color_fails.rb
<reponame>pushcx/rncurses #!/usr/bin/env ruby require "ncurses" # call should fail, but must not terminate the ruby interpreter begin Ncurses.start_color rescue Ncurses::Exception, NoMethodError exit 0 else exit 1 end
pushcx/rncurses
make_dist.rb
#!/usr/bin/env ruby # $Id: make_dist.rb,v 1.6 2003/08/29 22:50:12 t-peters Exp $ require "fileutils" def sys(i) puts("\"#{i}\"") system(i) end dir = File.dirname(__FILE__) base = File.basename(dir) base = "ncurses-ruby" if base == "." files = IO.readlines(dir + "/MANIFEST").collect{|filename|filename.chomp} ...
REDNBLACK/preferences
homebrew/Formula/lolcat-c.rb
<filename>homebrew/Formula/lolcat-c.rb class LolcatC < Formula desc "Faster lolcat implementation in CLang" homepage "https://github.com/jaseg/lolcat" url "https://github.com/jaseg/lolcat/archive/refs/tags/v1.2.tar.gz" sha256 "b6e1a0e24479fbdd4eb907531339e2cafc0c00b78d19caf70e8377b8b7546331" license "WTFPL" ...
REDNBLACK/preferences
homebrew/Casks/openjdk-jmc.rb
<reponame>REDNBLACK/preferences cask "openjdk-jmc" do version "8.1.0,07" sha256 "6719d9e9e22e3d456994e398c47b280090c2eff58dc4cb69f8b3d45713dfc29c" url "https://download.java.net/java/GA/jmc#{version.major}/#{version.after_comma}/binaries/jmc-#{version.before_comma}_osx-x64.tar.gz" name "JDK Mission Control" ...
REDNBLACK/preferences
homebrew/Casks/touchbar-nyancat.rb
cask "touchbar-nyancat" do version "0.3.0" sha256 "c4aff7fbf593860e76def6e8200390d96b3ad9076a38deb28cdfdfc1471d1c88" name "Touchbar Nyan Cat" url "https://github.com/avatsaev/touchbar_nyancat/releases/download/#{version}/touchbar_nyancat.app.zip" desc "Stupid Nyan Cat animation on your +$2k MacBook Pro's Tou...
robertdimarco/puzzles
stripe-ctf-2/level04-code/srv.rb
<reponame>robertdimarco/puzzles #!/usr/bin/env ruby require 'yaml' require 'set' require 'rubygems' require 'bundler/setup' require 'sequel' require 'sinatra' module KarmaTrader PASSWORD = File.read('password.txt').strip STARTING_KARMA = 500 KARMA_FOUNTAIN = '<PASSWORD>' # Only needed in production URL_RO...
robertdimarco/puzzles
spotify-puzzles/bestbefore/bestbefore.rb
<reponame>robertdimarco/puzzles<filename>spotify-puzzles/bestbefore/bestbefore.rb #!/usr/bin/env ruby -n require 'date' def best_before(str) valid_dates = [] input = str.split("/").map { |x| x.to_i } input.permutation { |perm| begin year, month, day = perm year = (year < 1000) ? year + 2000 : ye...
robertdimarco/puzzles
spotify-code-quest-2012/trollhunt/trollhunt.rb
#!/usr/bin/env ruby -n # b - the number of bridges # k - the number of knights # g - min knights per group b, k, g = $_.chop.split(" ").map { |i| i.to_f } groups = (k / g).floor days = ((b - 1) / groups).ceil puts days
robertdimarco/puzzles
spotify-code-quest-2012/collapse/collapse.rb
#!/usr/bin/env ruby # n - number of islands # t - island survival threshold # k - number of receiving islands # j - list of receiving islands with quantity Pair = Struct.new(:to, :amount) while input = gets n = input.chomp!.to_i surplus, from_to = Array.new(n + 1, 0), Array.new(n + 1) # initialize list of is...
robertdimarco/puzzles
spotify-puzzles/lottery/lottery.rb
<reponame>robertdimarco/puzzles #!/usr/bin/env ruby -n # binomial coefficient def nchoosek(n, k) if k < 0 or k > n return 0 elsif k > (n - k) k = n - k end c = 1 (0...k).each { |i| c = c * (n - (k - (i+1))) c = (c / (i+1)) } return c end # hypergeometric distribution def hypergeometric(r...
AndrewRLloyd88/sample-app
test/helpers/application_helper_test.rb
require 'test_helper' class ApplicationHelperTest < ActionView::TestCase def setup @base_title = "Ruby on Rails Tutorial Sample App" end test "full title helper" do assert_equal full_title("Contact"), "Contact | #{@base_title}" assert_equal full_title("Help"), "Help | #{@base_title}" assert_equal full_title...
AndrewRLloyd88/sample-app
app/helpers/application_helper.rb
module ApplicationHelper # Returns the full title on a per-page basis def full_title(page_title = "") base_title = "Ruby on Rails Tutorial Sample App" if page_title.empty? base_title else page_title + " | " + base_title end end # Checks to see if an input string is a palindrome def...
AndrewRLloyd88/sample-app
example_user.rb
<reponame>AndrewRLloyd88/sample-app<filename>example_user.rb class User #creates attribute accessors correspondin to users name + email address #getters and setters attr_accessor :name, :email # initialize is called when we execute User.new def initialize(attributes = {}) @name = attributes[:name] @email ...
akinomaeni-sandbox/yaffle
lib/yaffle.rb
require 'yaffle/core_ext' module Yaffle end
wolfeidau/aws-lambda-python-cfn
ec2_required_tags.rb
<reponame>wolfeidau/aws-lambda-python-cfn #!/usr/bin/env ruby require 'bundler/setup' require 'cloudformation-ruby-dsl/cfntemplate' require 'cloudformation-ruby-dsl/spotprice' require 'cloudformation-ruby-dsl/table' template do value AWSTemplateFormatVersion: '2010-09-09' value Description: 'AWS CloudFormation' ...
ccdcoe/alert-visualizer
proxy/aggregation_request.rb
<filename>proxy/aggregation_request.rb<gh_stars>0 require 'http' class AggregationRequest QUERY = { "query": { "bool": { "must": [ { "range": { "@timestamp": { "gte": 0 } } },...
ccdcoe/alert-visualizer
proxy/proxy.rb
require "bundler" Bundler.setup(:default) require "sinatra" require_relative 'aggregation_request' set :port, 4567 before do response.headers['Access-Control-Allow-Origin'] = '*' end get '/' do response.headers['Content-Type'] = "application/json" AggregationRequest.new.perform.to_json.tap do |result| st...
royhsu/tiny-kit
TinyKit.podspec
Pod::Spec.new do |spec| spec.name = 'TinyKit' spec.version = '0.11.0' spec.license = 'MIT' spec.summary = 'TinyKit provides practical functionalities that will help us to build apps much more quickly.' spec.homepage = 'https://github.com/royhsu/tiny-kit' spec.authors = { '<NAME>' => '<EMAIL>' } spec.sourc...
Guyutongxue/VSC_ProgrammingGrid
scripts/pause-console.rb
<filename>scripts/pause-console.rb #!/usr/bin/ruby ### # https://github.com/Guyutongxue/VSCodeConfigHelper3/blob/main/scripts/pause-console.rb # Modified for redirecting input require 'io/console' if ARGV.length == 0 then puts "Usage: #{__FILE__} <Executable> [<InputFile>]" exit end command_line = ARGV.map { |ar...
sagarkrkv/Closed-Social-Network
ClosedSocialNetwork/db/schema.rb
<filename>ClosedSocialNetwork/db/schema.rb<gh_stars>0 # encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note t...
sagarkrkv/Closed-Social-Network
ClosedSocialNetwork/db/migrate/20130513154647_sites_as_actor.social_stream_base_engine.rb
<filename>ClosedSocialNetwork/db/migrate/20130513154647_sites_as_actor.social_stream_base_engine.rb # This migration comes from social_stream_base_engine (originally 20130125100112) class SitesAsActor < ActiveRecord::Migration def change add_column :sites, :type, :string add_column :sites, :actor_id, :integer...
sagarkrkv/Closed-Social-Network
ClosedSocialNetwork/db/seeds.rb
def h s = Roo::Excelx.new("#{Dir.getwd}/db/students.xlsx") s.default_sheet = s.sheets.first s1 = 1 s2 = s.last_row (s1..s2).each do |line| attr_one = s.cell(line, 'A') attr_two = s.cell(line, 'B') attr_three = s.cell(line, 'C') attr_four = s.cell(line, 'D') user = User.create! :name => attr_one, :email ...
sagarkrkv/Closed-Social-Network
ClosedSocialNetwork/db/migrate/20130513154648_main_activity_object_properties.social_stream_base_engine.rb
<filename>ClosedSocialNetwork/db/migrate/20130513154648_main_activity_object_properties.social_stream_base_engine.rb # This migration comes from social_stream_base_engine (originally 20130212092035) class MainActivityObjectProperties < ActiveRecord::Migration class APMigration < ActiveRecord::Base self.table_name...
sagarkrkv/Closed-Social-Network
ClosedSocialNetwork/db/migrate/20130513154650_create_social_stream_documents.social_stream_documents_engine.rb
<gh_stars>0 # This migration comes from social_stream_documents_engine (originally 20120208143721) class CreateSocialStreamDocuments < ActiveRecord::Migration def change create_table "documents", :force => true do |t| t.string "type" t.integer "activity_object_id" t.datetime "created_at" ...
sagarkrkv/Closed-Social-Network
ClosedSocialNetwork/db/migrate/20130513154654_create_social_stream_ostatus.social_stream_ostatus_engine.rb
# This migration comes from social_stream_ostatus_engine (originally 20120905145030) class CreateSocialStreamOstatus < ActiveRecord::Migration def change create_table :actor_keys do |t| t.integer :actor_id t.binary :key_der t.timestamps end add_index "actor_keys", "actor_id" c...
mevansam/chef-cookbook-sysutils
recipes/default.rb
# # Cookbook Name:: sysutils # Recipe:: default # # Author: <NAME> # Email: <EMAIL> # # 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 # # Unle...
mevansam/chef-cookbook-sysutils
.chef/knife.rb
current_dir = File.dirname(__FILE__) log_level "info" chef_server_url "http://192.168.50.1:9999" node_name "cookbook_test" client_key "#{current_dir}/chef-zero_node.pem" validation_client_name "chef-zero_validator" validation_key "#{current_dir}/chef-zero_va...
mevansam/chef-cookbook-sysutils
providers/user_certs.rb
# # Author:: <NAME> (<<EMAIL>>) # Cookbook Name:: sysutils # Provider: user_certs # # Copyright 2014, <NAME> # # 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/lice...
mevansam/chef-cookbook-sysutils
libraries/helpers.rb
# # Author: <NAME> # Email: <EMAIL> # # 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 wr...
mevansam/chef-cookbook-sysutils
libraries/ssh_helper.rb
# # Author: <NAME> # Email: <EMAIL> # # 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 wr...
mevansam/chef-cookbook-sysutils
providers/config_file.rb
<reponame>mevansam/chef-cookbook-sysutils<filename>providers/config_file.rb # # Author:: <NAME> (<<EMAIL>>) # Cookbook Name:: sysutils # Provider: config_file # # Copyright 2014, <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License....
mevansam/chef-cookbook-sysutils
metadata.rb
name 'sysutils' maintainer '<NAME>' maintainer_email '<EMAIL>' license 'All rights reserved' description 'Installs/Configures sysutils' long_description 'Resources for common environment configurations such as sysctl, users, groups, ssh keys, etc.' version '1.0.0' depends ...
mevansam/chef-cookbook-sysutils
resources/user_certs.rb
# # Author:: <NAME> (<<EMAIL>>) # Cookbook Name:: sysutils # Resource: user_certs # # Copyright 2014, <NAME> # # 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/lice...
mevansam/chef-cookbook-sysutils
attributes/default.rb
# Default attributes for sysutils cookbook default["env"]["secret_file_path"] = nil # Array of network interfaces. Each interface hash must map to an attribute # of the network_interface resource of the network_interface cookbook. # https://github.com/redguide/network_interfaces/blob/master/resources/default.rb # # e...
mevansam/chef-cookbook-sysutils
providers/global_proxy.rb
<reponame>mevansam/chef-cookbook-sysutils # # Author:: <NAME> (<<EMAIL>>) # Cookbook Name:: sysutils # Provider: global_proxy # # Copyright 2014, <NAME> # # 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 L...
mevansam/chef-cookbook-sysutils
resources/global_proxy.rb
# # Author:: <NAME> (<<EMAIL>>) # Cookbook Name:: sysutils # Resource: global_proxy # # Copyright 2014, <NAME> # # 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/li...
mevansam/chef-cookbook-sysutils
libraries/config_file_helper.rb
<gh_stars>0 # # Author: <NAME> # Email: <EMAIL> # # 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 agr...
murny/jupiter
lib/jupiter/version.rb
module Jupiter VERSION = '1.2.7'.freeze end
murny/jupiter
db/seeds.rb
<reponame>murny/jupiter # 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 rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord ...