repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
michenriksen/nmunch | spec/spec_helper.rb | require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts 'Run `bundle install` to install missing gems'
exit e.status_code
end
require 'pcap'
require 'ipaddr'
require 'paint'
require 'nmunch'
RSpec.configure do |config|
config.filter... |
michenriksen/nmunch | lib/nmunch/dissectors/ip.rb | <reponame>michenriksen/nmunch
module Nmunch
module Dissectors
# Public: Internet Protocol dissector
#
# Extracts IP and MAC address from IP packet
#
# See http://en.wikipedia.org/wiki/Internet_Protocol for protocol details
class Ip < Nmunch::Dissectors::Base
# Public: Get sender IP add... |
michenriksen/nmunch | spec/lib/nmunch/dissectors/arp_spec.rb | require 'spec_helper'
describe Nmunch::Dissectors::Arp do
let(:arp_pcap_packet) do
packet = stub(Pcap::Packet)
packet.stub(:raw_data).and_return(ARP_PACKET_DATA)
packet.stub(:ip?).and_return(false)
packet
end
subject { Nmunch::Dissectors::Arp.new(arp_pcap_packet) }
describe '#ip_address' do
... |
michenriksen/nmunch | lib/nmunch/node.rb | module Nmunch
# Public: A class to represent a network node
#
# For now it is a simple wrapper around IP and MAC address information but might
# contain more information in the future.
class Node
attr_reader :ip_address, :mac_address
# Public: Initialize a new node
#
# options - A hash that ... |
michenriksen/nmunch | lib/nmunch/version.rb | module Nmunch
# Public: Current version of Nmunch
VERSION = "0.1.0"
end
|
theresamorelli/refood-with-js | app/models/request.rb | <reponame>theresamorelli/refood-with-js
class Request < ApplicationRecord
belongs_to :requestor
belongs_to :offer
has_one :user, through: :requestor
has_one :giver, through: :offer
validates :message, presence: true
validate :email_or_phone
# def self.recently_completed
# Request.where("completed_r... |
theresamorelli/refood-with-js | app/models/requestor.rb | <gh_stars>0
class Requestor < ApplicationRecord
belongs_to :user
has_many :requests
has_many :offers, through: :requests
has_many :givers, through: :offers
end
|
theresamorelli/refood-with-js | app/controllers/users_controller.rb | <gh_stars>0
class UsersController < ApplicationController
layout "application_no_login_link", only: [:new, :create]
before_action :require_login, except: [:new, :create, :user]
before_action only: [:update, :destroy] do
redirect_to_index_if_not_authorized('id', 'profile')
end
before_action :redirect_to_in... |
theresamorelli/refood-with-js | db/seeds.rb | <reponame>theresamorelli/refood-with-js<filename>db/seeds.rb<gh_stars>0
# 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 = Mov... |
theresamorelli/refood-with-js | app/models/user.rb | require 'uri'
class User < ApplicationRecord
has_one :giver
has_one :requestor
has_many :offers, through: :giver
has_many :requests, through: :requestor
has_secure_password
# accepts_nested_attributes_for :requests
validates :name, presence: true
validates :email, presence: true, uniqueness: true, for... |
theresamorelli/refood-with-js | app/controllers/sessions_controller.rb | <reponame>theresamorelli/refood-with-js
class SessionsController < ApplicationController
layout "application_no_login_link"
before_action :require_login, only: [:destroy]
before_action :redirect_to_index_if_logged_in, only: [:new, :create]
def new
end
def create
user = User.find_by(email: params[:emai... |
theresamorelli/refood-with-js | app/controllers/application_controller.rb | <gh_stars>0
class ApplicationController < ActionController::Base
private
def current_user
@current_user ||= User.find_by(id: session[:user_id])
end
def logged_in
!!current_user
end
def require_login
if !logged_in
flash[:error] = ["Please sign up or log in"]
redirect_to signup... |
theresamorelli/refood-with-js | config/routes.rb | <reponame>theresamorelli/refood-with-js
Rails.application.routes.draw do
root 'welcome#home'
resources :users, only: [:update, :show, :destroy]
get '/add-info' => 'users#add_info'
get '/edit-profile' => 'users#edit'
get '/signup' => 'users#new'
post '/signup' => 'users#create'
get '/user' => 'users#use... |
theresamorelli/refood-with-js | app/serializers/request_serializer.rb | class RequestSerializer < ActiveModel::Serializer
attributes :id, :offer_id, :requestor_id, :requestor_name, :message, :requestor_email, :requestor_phone, :completed_giver, :completed_requestor, :formatted_phone, :created_date
end
|
theresamorelli/refood-with-js | db/migrate/20180915142832_create_offers.rb | <gh_stars>0
class CreateOffers < ActiveRecord::Migration[5.2]
def change
create_table :offers do |t|
t.integer :giver_id
t.string :headline
t.string :city
t.string :state
t.text :description
t.string :availability
t.boolean :closed, :default => false
t.boolean :dele... |
theresamorelli/refood-with-js | app/helpers/offers_helper.rb | <reponame>theresamorelli/refood-with-js
module OffersHelper
def has_request(user, offer)
# loop through user's requests to see if matches offer
user.requests.any? do |request|
offer.requests.include?(request)
end
end
def number_of_items(collection, thing_string)
if collection.count == 0
... |
theresamorelli/refood-with-js | app/models/comment.rb | class Comment < ApplicationRecord
belongs_to :request
has_one :requestor, through: :request
has_one :offer, through: :request
has_one :giver, through: :offer
end
|
theresamorelli/refood-with-js | app/controllers/welcome_controller.rb | class WelcomeController < ApplicationController
layout "application_login_link", only: [:home]
before_action :require_login, only: [:index]
before_action :redirect_to_index_if_logged_in, only: [:home]
def home
end
def index
@offers = current_user.offers.select { |o| !o.closed && !o.deleted }
@req... |
theresamorelli/refood-with-js | app/controllers/comments_controller.rb | class CommentsController < ApplicationController
# def new
# @comment = Comment.new
# end
def create
end
end
|
theresamorelli/refood-with-js | app/serializers/offer_serializer.rb | <filename>app/serializers/offer_serializer.rb
class OfferSerializer < ActiveModel::Serializer
attributes :id, :giver_id, :giver_name, :headline, :description, :city, :state, :city_state, :availability, :closed, :deleted, :created_ago, :created_date
has_many :requests, serializer: RequestSerializer
end
|
theresamorelli/refood-with-js | app/models/giver.rb | <reponame>theresamorelli/refood-with-js
class Giver < ApplicationRecord
belongs_to :user
has_many :offers
has_many :requests, through: :offers
has_many :requestors, through: :requests
end
|
theresamorelli/refood-with-js | test/decorators/welcome_decorator_test.rb | <filename>test/decorators/welcome_decorator_test.rb<gh_stars>0
require 'test_helper'
class WelcomeDecoratorTest < Draper::TestCase
end
|
theresamorelli/refood-with-js | app/helpers/application_helper.rb | <filename>app/helpers/application_helper.rb
module ApplicationHelper
def format_phone(string)
phone = string.insert 3, "-"
phone.insert 7, "-"
end
def time_units_string(time_ago, unit)
# convert number to string and pluralize unit if multiple
if time_ago == 1
time_ago.to_s + " #{unit} "
... |
theresamorelli/refood-with-js | app/models/offer.rb | class Offer < ApplicationRecord
belongs_to :giver
has_one :user, through: :giver
has_many :requests
has_many :requestors, through: :requests
validates :headline, presence: true
scope :group_by_location, -> { where(closed: false).order(state: :asc).order(city: :asc) }
def giver_name
self.user.name
... |
theresamorelli/refood-with-js | db/migrate/20180915151021_create_requests.rb | <reponame>theresamorelli/refood-with-js<filename>db/migrate/20180915151021_create_requests.rb
class CreateRequests < ActiveRecord::Migration[5.2]
def change
create_table :requests do |t|
t.integer :offer_id
t.integer :requestor_id
t.text :message
t.string :requestor_email
t.string :r... |
theresamorelli/refood-with-js | app/controllers/offers_controller.rb | class OffersController < ApplicationController
layout 'application_no_login_link', only: [:current_offers]
before_action :require_login, except: [:current_offers]
before_action :redirect_to_index_if_not_authorized_to_edit_offer, only: [:edit, :update, :destroy]
def new
@offer = current_user.giver.offers.bu... |
theresamorelli/refood-with-js | config/environment.rb | # Load the Rails application.
require_relative 'application'
require 'active_support/core_ext/string/conversions'
require 'time'
# Initialize the Rails application.
Rails.application.initialize!
|
theresamorelli/refood-with-js | app/decorators/offer_decorator.rb | class OfferDecorator < ApplicationDecorator
delegate_all
# decorates :offer, :welcome
def expired
Time.strptime(f.expiration, '%m/%d/%Y %H:%M %p').past?
end
end
|
theresamorelli/refood-with-js | app/controllers/requests_controller.rb | <filename>app/controllers/requests_controller.rb<gh_stars>0
class RequestsController < ApplicationController
before_action :require_login
before_action :redirect_to_index_if_not_authorized_to_edit_request, only: [:show, :edit, :update, :destroy]
before_action :redirect_to_index_if_not_authorized_to_edit_offer, on... |
paulradzkov-heaven/paulradzkov.com-nanoc | lib/file_changes.rb | <reponame>paulradzkov-heaven/paulradzkov.com-nanoc<filename>lib/file_changes.rb<gh_stars>1-10
require 'yaml'
require 'digest/sha1'
module MGutz
# Tracks a file's last content change using SHA1 digest algorithm.
#
# File.mtime is not sufficient to detect if content has been updated. This
# class will set `upda... |
paulradzkov-heaven/paulradzkov.com-nanoc | lib/default.rb | <filename>lib/default.rb
# All files in the 'lib' directory will be loaded
# before nanoc starts compiling.
def keywords
if is_front_page?
tag_set.join(', ')
else
tags = @item[:tags].nil? ? '' : @item[:tags].join(', ')
keywords = @item[:keywords] || ''
[keywords, tags].join(', ')
... |
paulradzkov-heaven/paulradzkov.com-nanoc | lib/extensions.rb | <gh_stars>1-10
class Array
def to_hash_keys(&block)
Hash[*self.collect { |v|
[v, block.call(v)]
}.flatten]
end
def to_hash_values(&block)
Hash[*self.collect { |v|
[block.call(v), v]
}.flatten]
end
end
|
paulradzkov-heaven/paulradzkov.com-nanoc | lib/helpers.rb | <gh_stars>0
include Nanoc::Helpers::Rendering
include Nanoc::Helpers::Blogging
include Nanoc::Helpers::XMLSitemap
include Nanoc::Helpers::Filtering
require 'builder'
require 'fileutils'
require 'time'
# Hyphens are converted to sub-directories in the output folder.
#
# If a file has two extensions like Rails... |
geezify/Geezify-rb | lib/geezify-rb/geezify.rb | <filename>lib/geezify-rb/geezify.rb
#!/usr/bin/ruby
# coding: utf-8
# frozen_string_literal:true
module GeezifyRb
# This class contains the processing tools to convert arabic numbers to Geeze.
class Geezify
ERROR_MSG_CONSTRUCTOR = 'invalid input the input is not a number'
ERROR_MSG1 = 'invalid input to met... |
geezify/Geezify-rb | lib/geezify-rb/arabify.rb | <reponame>geezify/Geezify-rb
#!/usr/bin/ruby
# coding: utf-8
# frozen_string_literal:true
module GeezifyRb
# processing tools to convert Geeze numbers to arabic.
class Arabify
ERROR_MSG_CONSTRUCTOR = 'invalid input the string is not a geez number'
ERROR_MSG1 = 'invalid input to method convert_2digit'
... |
geezify/Geezify-rb | test/geezify_test.rb | <filename>test/geezify_test.rb
# coding: utf-8
require 'minitest/autorun'
require_relative '../lib/geezify-rb.rb'
require_relative 'test_case'
class GeezifyTest < Minitest::Test
include GeezifyRb
def test_geezify_for_all_test_cases
TESTDATA
.map { |x| assert_equal x[1], GeezifyRb::Geezify.geezify(x[0]) }... |
geezify/Geezify-rb | test/test_case.rb | <filename>test/test_case.rb<gh_stars>1-10
#!/usr/bin/ruby
# coding: utf-8
TESTDATA = [
[1, '፩'],
[10, '፲'],
[100, '፻'],
[1000, '፲፻'],
[10000, '፼'], # (እልፍ)
[100000, '፲፼'], # (አእላፍ)
[1000000, '፻፼'], # (አእላፋት)
[10000000, '፲፻፼'], # (ትእልፊት)
[100000000, '፼፼'], # (ትእልፊታት)
[1000000000, '፲፼፼'],
[10000000... |
geezify/Geezify-rb | test/arabify_test.rb | <reponame>geezify/Geezify-rb<filename>test/arabify_test.rb<gh_stars>1-10
# coding: utf-8
require 'minitest/autorun'
require_relative '../lib/geezify-rb'
require_relative 'test_case'
class ArabifyTest < Minitest::Test
include GeezifyRb
def test_geezify_for_all_test_cases
TESTDATA
.map { |x| assert_equal x... |
geezify/Geezify-rb | lib/geezify-rb.rb | require_relative './geezify-rb/geezify.rb'
require_relative './geezify-rb/arabify.rb'
require_relative './geezify-rb/version.rb'
module GeezifyRb
end
|
marcocarvalho/ffi-talib | spec/ffi/talib/methods/stddev_spec.rb | <filename>spec/ffi/talib/methods/stddev_spec.rb
require 'spec_helper'
describe Talib do
subject { Talib }
it 'should call simple moving average' do
expect(subject.ta_stddev([0,0,14,14])).to eq [7.0]
end
it 'should be possible to pass optional value for deviation' do
expect(subject.ta_stddev([0,0,14,14... |
marcocarvalho/ffi-talib | spec/ffi/talib/methods/sar_parabolic_spec.rb | <reponame>marcocarvalho/ffi-talib<gh_stars>1-10
require 'spec_helper'
describe Talib do
subject { Talib }
let(:high) { [18.88, 18.82, 18.71, 18.86, 19.16, 19.35, 19.35, 19.55, 19.38, 19.20, 19.14, 18.97, 19.32, 19.58, 18.27, 16.76, 17.10, 17.02, 16.85] }
let(:low) { [18.48, 18.42, 18.46, 18.49, 18.68, 18.83, 18... |
marcocarvalho/ffi-talib | spec/spec_helper.rb | <filename>spec/spec_helper.rb
require 'talib'
|
marcocarvalho/ffi-talib | spec/ffi/talib/methods/var_spec.rb | <gh_stars>1-10
require 'spec_helper'
describe Talib do
subject { Talib }
it 'should call simple moving average' do
expect(subject.ta_var([0,0,14,14])).to eq [49.0]
end
it 'should be possible to pass optional value for deviation' do
expect(subject.ta_var([1,2,3,4])).to eq [1.25]
end
it 'should ret... |
marcocarvalho/ffi-talib | lib/talib/methods/var.rb | <reponame>marcocarvalho/ffi-talib
module Talib::Methods
# TA_RetCode TA_VAR( int startIdx,
# int endIdx,
# const double inReal[],
# int optInTimePeriod, /* From 1 to 100000 */
# double optInNbDev, /* From TA_REAL_MIN to ... |
marcocarvalho/ffi-talib | lib/talib/methods/atr.rb | <filename>lib/talib/methods/atr.rb
# TA_RetCode TA_ATR( int startIdx,
# int endIdx,
# const double inHigh[],
# const double inLow[],
# const double inClose[],
# int optInTimePeriod, /* From 1 to 100000 */
# ... |
marcocarvalho/ffi-talib | lib/talib/methods/floor.rb | <gh_stars>1-10
module Talib::Methods
def ta_floor(prices, opts = {})
raise ArgumentError.new('prices must be an array') unless prices.is_a?(Array)
return [] if prices.empty?
# 8 is size of double in GCC linux, other SO got other sizes. For now it will be like this
inReal = Talib::LibC.malloc(8 *... |
marcocarvalho/ffi-talib | lib/talib.rb | <reponame>marcocarvalho/ffi-talib<filename>lib/talib.rb<gh_stars>1-10
require 'ffi'
module Talib
module LibC
extend FFI::Library
ffi_lib FFI::Library::LIBC
# memory allocators
attach_function :malloc, [:size_t], :pointer
attach_function :calloc, [:size_t], :pointer
attach_function :valloc, [... |
marcocarvalho/ffi-talib | lib/talib/methods/sma.rb | module Talib::Methods
def ta_sma(prices, period, opts = {})
raise ArgumentError.new('prices must be an array') unless prices.is_a?(Array)
raise ArgumentError.new('period must be a Fixnum and greater than 1') if !period.is_a?(Fixnum) or period < 2
return [] if prices.empty?
inReal = Talib::LibC.... |
marcocarvalho/ffi-talib | spec/ffi/talib/methods/floor_spec.rb | require 'spec_helper'
describe Talib do
subject { Talib }
it 'should call floor' do
expect(subject.ta_floor([1.2,2.3,3.6,4.4,5.5,6.8,7.2,8.1,9.1234,10.40])).to eq [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]
end
it 'should return empty array if an empty one is given' do
expect(subject.ta_floor(... |
marcocarvalho/ffi-talib | lib/talib/methods/macd.rb | <gh_stars>1-10
# TA_RetCode TA_MACD( int startIdx,
# int endIdx,
# const double inReal[],
# int optInFastPeriod, /* From 2 to 100000 */
# int optInSlowPeriod, /* From 2 to 100000 */
# int ... |
marcocarvalho/ffi-talib | talib-ffi-wrapper.gemspec | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'talib/version'
Gem::Specification.new do |spec|
spec.name = "ffi-talib"
spec.version = Talib::VERSION
spec.authors = ["<NAME>"]
spec.email = ["<EMAIL>"]
spe... |
marcocarvalho/ffi-talib | spec/ffi/talib/talib_spec.rb | <filename>spec/ffi/talib/talib_spec.rb
require 'spec_helper'
describe Talib do
subject { Talib }
it 'should now all TALib methods implemented' do
expect(subject.respond_to?(:implemented_talib_methods)).to eq(true)
expect(subject.implemented_talib_methods.is_a?(Array)).to eq(true)
end
end
|
marcocarvalho/ffi-talib | lib/talib/methods/sar_parabolic.rb | <reponame>marcocarvalho/ffi-talib<filename>lib/talib/methods/sar_parabolic.rb<gh_stars>1-10
# TA_RetCode TA_SAR( int startIdx,
# int endIdx,
# const double inHigh[],
# const double inLow[],
# double optInAcceleration, /* From 0 to ... |
marcocarvalho/ffi-talib | spec/ffi/talib/methods/sma_spec.rb | require 'spec_helper'
describe Talib do
subject { Talib }
it 'should call simple moving average' do
expect(subject.ta_sma([1,2,3,4,5,6,7,8,9,10], 3)).to eq [2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0]
end
it 'should return empty array if an empty one is given' do
expect(subject.ta_sma([], 2)).to eq []
e... |
marcocarvalho/ffi-talib | lib/talib/methods.rb | Dir[ File.join(File.dirname(__FILE__), 'methods/*.rb' )].each { |file| require file } |
lbriais/dir_glob_ignore | spec/spec_helper.rb | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'dir_glob_ignore'
|
lbriais/dir_glob_ignore | spec/dir_glob_ignore_spec.rb | <filename>spec/dir_glob_ignore_spec.rb
require 'spec_helper'
describe DirGlobIgnore do
it 'has a version number' do
expect(DirGlobIgnore::VERSION).not_to be nil
end
end
|
lbriais/dir_glob_ignore | spec/ignore_file_lists_spec.rb | <reponame>lbriais/dir_glob_ignore
require 'spec_helper'
describe DirGlobIgnore::IgnoreFileLists do
let(:test_root) { File.expand_path File.join('..', '..', 'test'), __FILE__ }
let(:an_ignored_file) { File.join test_root, 'file1.txt'}
let(:a_non_ignored_file) { File.join test_root, 'file2.rb'}
subject { desc... |
lbriais/dir_glob_ignore | lib/dir_glob_ignore/ignore_file_lists.rb | module DirGlobIgnore
class IgnoreFileLists
DEFAULT_FILE_NAME = '.ignore'.freeze
attr_writer :ignore_file_name, :base_dir
def initialize(base_dir = nil)
self.base_dir = base_dir
end
def ignore_file_name
@ignore_file_name ||= DEFAULT_FILE_NAME
end
def base_dir
@base_d... |
lbriais/dir_glob_ignore | lib/dir_glob_ignore.rb | require 'dir_glob_ignore/version'
require 'dir_glob_ignore/ignore_file_lists'
require 'dir_glob_ignore/dir_patch'
|
lbriais/dir_glob_ignore | lib/dir_glob_ignore/dir_patch.rb | class Dir
def self.glob_with_ignore_file(ignore_file, base_dir, *glob_args, &block)
filter = DirGlobIgnore::IgnoreFileLists.new base_dir
filter.ignore_file_name = ignore_file
filter.load_ignore_files
Dir.glob(*glob_args).reject do |file|
if filter.ignore_file? file
true
else
... |
lbriais/dir_glob_ignore | spec/dir_patch_spec.rb | <reponame>lbriais/dir_glob_ignore
require 'spec_helper'
describe Dir do
let(:base_dir) { File.expand_path File.join('..', '..', 'test'), __FILE__ }
let(:ignore_file) { DirGlobIgnore::IgnoreFileLists::DEFAULT_FILE_NAME }
subject { described_class }
it 'should provide a list of files without the ignored ones'... |
djberg96/notation | lib/notation.rb | # encoding: utf-8
# Run with -Ku if using Ruby 1.8.
module Kernel
# Version of the notation library
NOTATION_VERSION = '0.2.1'.freeze
# Make lambda a true lambda
#
# Example:
# λ { puts 'Hello' }.call => 'Hello'
#
alias λ proc
# Sigma, i.e. the sum of all elements.
#
# Example:
# ∑ [1,2,... |
djberg96/notation | spec/notation_spec.rb | <filename>spec/notation_spec.rb
# encoding: utf-8
################################################################
# notation_spec.rb
#
# Specs for the notation library. This should be run via the
# 'rake spec' (or just 'rake') task.
################################################################
require 'rspec'
requi... |
chukitow/blogo | db/migrate/20140218134620_create_blogo_taggings.rb | <reponame>chukitow/blogo
class CreateBlogoTaggings < ActiveRecord::Migration
def change
taggings_table = "#{Blogo.table_name_prefix}taggings"
create_table(taggings_table) do |t|
t.integer :post_id, null: false
t.integer :tag_id , null: false
end
add_index taggings_table, [:tag_id, :post_... |
NoUseFreak/lig-test | Formula/.rb | # This file was generated by LetItGo.
class < Formula
desc ""
homepage "https://github.com/NoUseFreak/lig-test"
version "0.1.17"
url "https://github.com/NoUseFreak/lig-test/releases/download/0.1.17/lig-test"
sha256 "aaddca1e81609f71ca199022020f65d65feae33a12e5599b08e49dbfa58e56a5"
def install
bin.ins... |
NoUseFreak/lig-test | Formula/lig-test.rb | <reponame>NoUseFreak/lig-test<filename>Formula/lig-test.rb
# This file was generated by LetItGo.
class Lig-test < Formula
desc "lig-test testing."
homepage "https://github.com/NoUseFreak/lig-test"
version "0.1.18"
url "https://github.com/NoUseFreak/lig-test/releases/download/0.1.18/lig-test"
sha256 "aaddca1e... |
fsateler/webpacker | lib/webpacker/configuration.rb | # Loads webpacker configuration from config/webpack/paths.yml
require "webpacker/file_loader"
class Webpacker::Configuration < Webpacker::FileLoader
class << self
def config_path
Rails.root.join(paths.fetch(:config, "config/webpack"))
end
def entry_path
Rails.root.join(source_path, paths.fet... |
fsateler/webpacker | lib/install/template.rb | # Install webpacker
puts "Creating javascript app source directory"
directory "#{__dir__}/javascript", "app/javascript"
puts "Copying binstubs"
directory "#{__dir__}/bin", "bin"
chmod "bin", 0755 & ~File.umask, verbose: false
puts "Copying webpack core config and loaders"
directory "#{__dir__}/config/webpack", "confi... |
fsateler/webpacker | lib/install/vue.rb | require "webpacker/configuration"
puts "Copying vue loader to #{Webpacker::Configuration.config_path}/loaders"
copy_file "#{__dir__}/config/loaders/installers/vue.js", "config/webpack/loaders/vue.js"
puts "Copying the example entry file to #{Webpacker::Configuration.entry_path}"
copy_file "#{__dir__}/examples/vue/hel... |
fsateler/webpacker | lib/tasks/webpacker/yarn_install.rake | namespace :webpacker do
desc "Support for older Rails versions.Install all JavaScript dependencies as specified via Yarn"
task :yarn_install do
system("./bin/yarn")
end
end
|
fsateler/webpacker | lib/webpacker/manifest.rb | # Singleton registry for accessing the packs path using generated manifest.
# This allows javascript_pack_tag, stylesheet_pack_tag, asset_pack_path to take a reference to,
# say, "calendar.js" or "calendar.css" and turn it into "/packs/calendar.js" or
# "/packs/calendar.css" in development. In production mode, it retur... |
fsateler/webpacker | lib/install/angular.rb | require "webpacker/configuration"
puts "Copying angular loader to #{Webpacker::Configuration.config_path}/loaders"
copy_file "#{__dir__}/config/loaders/installers/angular.js", "config/webpack/loaders/angular.js"
puts "Copying angular example entry file to #{Webpacker::Configuration.entry_path}"
copy_file "#{__dir__}/... |
fsateler/webpacker | lib/install/react.rb | require "webpacker/configuration"
puts "Copying react loader to #{Webpacker::Configuration.config_path}/loaders"
copy_file "#{__dir__}/config/loaders/installers/react.js", "config/webpack/loaders/react.js"
puts "Copying .babelrc to app root directory"
copy_file "#{__dir__}/examples/react/.babelrc", ".babelrc"
puts "... |
fsateler/webpacker | lib/tasks/webpacker/compile.rake | <filename>lib/tasks/webpacker/compile.rake<gh_stars>0
require "webpacker/configuration"
REGEX_MAP = /\A.*\.map\z/
namespace :webpacker do
desc "Compile javascript packs using webpack for production with digests"
task compile: ["webpacker:verify_install", :environment] do
puts "Compiling webpacker assets 🎉"
... |
fsateler/webpacker | lib/webpacker/railtie.rb | require "rails/railtie"
require "webpacker/helper"
class Webpacker::Engine < ::Rails::Engine
initializer :webpacker do |app|
ActiveSupport.on_load :action_controller do
ActionController::Base.helper Webpacker::Helper
end
# Loads webpacker config data from config/webpack/paths.yml
Webpacker::C... |
fsateler/webpacker | lib/tasks/webpacker/install.rake | <gh_stars>0
WEBPACKER_APP_TEMPLATE_PATH = File.expand_path("../../install/template.rb", __dir__)
namespace :webpacker do
desc "Install webpacker in this application"
task :install do
if Rails::VERSION::MAJOR >= 5
exec "./bin/rails app:template LOCATION=#{WEBPACKER_APP_TEMPLATE_PATH}"
else
exec ... |
fsateler/webpacker | lib/webpacker/helper.rb | <reponame>fsateler/webpacker
require "webpacker/manifest"
module Webpacker::Helper
# Computes the full path for a given webpacker asset.
# Return relative path using manifest.json and passes it to asset_url helper
# This will use asset_path internally, so most of their behaviors will be the same.
# Examples:
... |
fsateler/webpacker | lib/webpacker/version.rb | module Webpacker
VERSION = "1.1".freeze
end
|
eliotjordan/geoserver-worker | lib/geoserver/worker/event_handler.rb | # frozen_string_literal: true
module Geoserver
module Worker
class EventHandler
include Sneakers::Worker
from_queue :geoserver
def work(msg)
msg = JSON.parse(msg)
result = Worker::EventProcessor.new(msg).process
if result
ack!
else
reject!
... |
eliotjordan/geoserver-worker | lib/geoserver/worker.rb | <gh_stars>1-10
# frozen_string_literal: true
require "erb"
require "geoserver/publish"
require "json"
require "sneakers"
require "yaml"
module Geoserver
module Worker
require "geoserver/worker/config"
require "geoserver/worker/event_handler"
require "geoserver/worker/event_processor"
require "geoserv... |
eliotjordan/geoserver-worker | lib/geoserver/worker/event_processor/update_processor.rb | # frozen_string_literal: true
module Geoserver
module Worker
class EventProcessor
class UpdateProcessor < Processor
def create_method
return :geotiff if layer_type == "geotiff"
return :shapefile if layer_type == "shapefile"
end
def create_params
{
... |
eliotjordan/geoserver-worker | spec/spec_helper.rb | # frozen_string_literal: true
require "simplecov"
require "coveralls"
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
)
SimpleCov.start do
add_filter "spec"
add_filter "vendor"
end
$LOAD_PATH.unshift File.expand_pat... |
eliotjordan/geoserver-worker | lib/geoserver/worker/config.rb | # frozen_string_literal: true
module Geoserver
module Worker
def config
@config ||= config_yaml
end
private
def config_yaml
file_path = File.join(Geoserver::Worker.root, "config", "config.yml")
YAML.safe_load(ERB.new(File.read(file_path)).result, [], [], true)
end
... |
eliotjordan/geoserver-worker | lib/geoserver/worker/version.rb | <gh_stars>1-10
# frozen_string_literal: true
module Geoserver
module Worker
VERSION = "0.1.0"
end
end
|
eliotjordan/geoserver-worker | spec/geoserver/worker/config_spec.rb | <gh_stars>1-10
# frozen_string_literal: true
require "spec_helper"
RSpec.describe Geoserver::Worker do
subject(:config) { described_class.config }
it "loads a config object" do
expect(config["events"]["server"]).not_to be_empty
expect(config["events"]["exchange"]).not_to be_empty
end
end
|
eliotjordan/geoserver-worker | lib/geoserver/worker/event_processor/create_processor.rb | # frozen_string_literal: true
module Geoserver
module Worker
class EventProcessor
class CreateProcessor < Processor
def params
{
workspace_name: workspace,
file_path: path,
id: id,
title: title
}
end
def publish_met... |
eliotjordan/geoserver-worker | spec/geoserver/worker/event_processor_spec.rb | # frozen_string_literal: true
require "spec_helper"
RSpec.describe Geoserver::Worker::EventProcessor do
subject(:processor) { described_class.new(event) }
let(:id) { "c2d14b8-0563c4a18b8a-2d0ae0d91-8b66" }
let(:layer_type) { "geotiff" }
let(:title) { "Title" }
let(:workspace) { "Public" }
let(:path) { "fil... |
eliotjordan/geoserver-worker | geoserver-worker.gemspec | # frozen_string_literal: true
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "geoserver/worker/version"
Gem::Specification.new do |spec|
spec.name = "geoserver-worker"
spec.version = Geoserver::Worker::VERSION
spec.authors = ["<NAME... |
eliotjordan/geoserver-worker | spec/geoserver/worker_spec.rb | # frozen_string_literal: true
RSpec.describe Geoserver::Worker do
it "has a version number" do
expect(Geoserver::Worker::VERSION).not_to be nil
end
end
|
eliotjordan/geoserver-worker | lib/geoserver/worker/event_processor/processor.rb | # frozen_string_literal: true
module Geoserver
module Worker
class EventProcessor
class Processor
attr_reader :event
def initialize(event)
@event = event
end
private
def id
event["id"]
end
def layer_type
event... |
eliotjordan/geoserver-worker | lib/geoserver/worker/event_processor/unknown_event.rb | # frozen_string_literal: true
module Geoserver
module Worker
class EventProcessor
class UnknownEvent < Processor
attr_reader :event
def initialize(event)
@event = event
end
def process
false
end
end
end
end
end
|
eliotjordan/geoserver-worker | lib/geoserver/worker/event_processor/delete_processor.rb | <gh_stars>1-10
# frozen_string_literal: true
module Geoserver
module Worker
class EventProcessor
class DeleteProcessor < Processor
def params
{
workspace_name: workspace,
id: id
}
end
def publish_method
return :delete_geotiff if ... |
krzyzak/rpg | lib/rpg.rb | require "rpg/version"
require "rpg/pesel"
module Rpg
end
|
krzyzak/rpg | test/pesel_test.rb | <reponame>krzyzak/rpg
require "test_helper"
require "date"
class PeselTest < MiniTest::Unit::TestCase
def test_should_generate_valid_pesel_for_19th_century
date = Date.parse("1803-10-20")
pesel = Rpg::Pesel.new(date: date).generate
@pesel = Yapv::Pesel.new(pesel)
assert @pesel.valid?
assert_equal... |
krzyzak/rpg | lib/rpg/pesel.rb | module Rpg
class Pesel
def initialize(options = {})
@date = options[:date].is_a?(Date) ? options[:date] : Date.parse(options[:date])
if [:male, :female].include?(options[:gender])
@gender = options[:gender]
else
@gender = [:male, :female].sample
end
end
def generat... |
krzyzak/rpg | test/test_helper.rb | <gh_stars>1-10
require "minitest/unit"
require "minitest/autorun"
require "active_model"
require "active_model/validations"
require "yapv/pesel"
require "rpg"
require "rpg/pesel" |
dcuadraq/tic_tac_doh | lib/tic_tac_doh.rb | require 'tic_tac_doh/version'
module TicTacDoh
class Game
attr_reader :players, :grid
def initialize(args={})
@players = []
@turn = 0
args.fetch(:board_size, 3).times do
@grid = Array.new(3) {}
end
end
def reset
prepare_grid
@turn = rand(0..players.count... |
delba/SwiftyOAuth | SwiftyOAuth.podspec | Pod::Spec.new do |s|
s.name = 'SwiftyOAuth'
s.version = '2.0'
s.license = { :type => 'MIT' }
s.homepage = 'https://github.com/delba/SwiftyOAuth'
s.author = { 'Damien' => '<EMAIL>' }
s.summary = "A small OAuth library with a built-in set of providers"
s.source ... |
Youshu31415926/igetui-ruby | lib/igetui/client.rb | <reponame>Youshu31415926/igetui-ruby
module IGeTui
class Client
attr_accessor :client_id, :alias_name
def initialize(client_id=nil, alias_name=nil)
@client_id = client_id
@alias_name = alias_name
end
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.