source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
catprintlabs/third-rail
https://github.com/catprintlabs/third-rail
example/Gemfile
Ruby
mit
19
master
1,585
source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '4.2.0' # Use sqlite3 as the database for Active Record gem 'sqlite3' # Use SCSS for stylesheets gem 'sass-rails', '~> 4.0.3' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # Use C...
github
catprintlabs/third-rail
https://github.com/catprintlabs/third-rail
example/app/controllers/application_controller.rb
Ruby
mit
19
master
257
class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception helper ThirdRail::Engine.helpers # layout 'volt' end
github
catprintlabs/third-rail
https://github.com/catprintlabs/third-rail
example/app/voltage/Gemfile
Ruby
mit
19
master
708
source 'https://rubygems.org' gem 'volt', '0.9.0.pre5' # The following gem's are optional for themeing # Twitter bootstrap gem 'volt-bootstrap', '~> 0.0.10' # Simple theme for bootstrap, remove to theme yourself. gem 'volt-bootstrap_jumbotron_theme', '~> 0.1.0' # User templates for login, signup, and logout menu. g...
github
catprintlabs/third-rail
https://github.com/catprintlabs/third-rail
example/app/voltage/config/app.rb
Ruby
mit
19
master
1,631
# Opal::Processor.source_map_enabled = true Volt.configure do |config| # Setup your global app config here. # Your app secret is used for signing things like the user cookie so it can't # be tampered with. A random value is generated on new projects that will work # without the need to customize. Make sure t...
github
catprintlabs/third-rail
https://github.com/catprintlabs/third-rail
example/app/voltage/app/main/config/routes.rb
Ruby
mit
19
master
415
# See https://github.com/voltrb/volt#routes for more info on routes client '/about', action: 'about' # Routes for login and signup, provided by user_templates component gem client '/signup', component: 'user_templates', controller: 'signup' client '/login', component: 'user_templates', controller: 'login' # The main...
github
catprintlabs/third-rail
https://github.com/catprintlabs/third-rail
example/app/voltage/app/main/controllers/main_controller.rb
Ruby
mit
19
master
2,293
# By default Volt generates this controller for your Main component module Main class MainController < Volt::ModelController def index # Add code for when the index view is loaded end def about # Add code for when the about view is loaded end def random # Add code for when the ...
github
catprintlabs/third-rail
https://github.com/catprintlabs/third-rail
example/config/application.rb
Ruby
mit
19
master
987
require File.expand_path('../boot', __FILE__) 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 ThirdRailTestApp class Application < Rails::Application # Settings in config/environments/* t...
github
catprintlabs/third-rail
https://github.com/catprintlabs/third-rail
example/config/routes.rb
Ruby
mit
19
master
1,496
Rails.application.routes.draw do root 'home#index' get "/about" => "about#index" get "/random" => "random#index" mount ThirdRail::Engine => "/" # Example of regular route: # get 'products/:id' => 'catalog#view' # Example of named route that can be invoked with purchase_url(id: product.id) # get '...
github
catprintlabs/third-rail
https://github.com/catprintlabs/third-rail
config/routes.rb
Ruby
mit
19
master
1,791
# require 'pry' # binding.pry # require_relative '/lib/third_rail/engine' ThirdRail::Engine.routes.draw do mount Rails.application.config.volt_server => "/volt" root "volt#volt" get "*path" => "volt#volt" # The priority is based upon order of creation: first created -> highest priority. # See how all ...
github
linyows/capistrano-withrsync
https://github.com/linyows/capistrano-withrsync
capistrano-withrsync.gemspec
Ruby
mit
19
master
941
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'capistrano/withrsync/version' Gem::Specification.new do |spec| spec.name = "capistrano-withrsync" spec.version = Capistrano::Withrsync::VERSION spec.authors = ["linyows...
github
linyows/capistrano-withrsync
https://github.com/linyows/capistrano-withrsync
spec/task_spec.rb
Ruby
mit
19
master
4,610
describe 'task' do let(:user) { 'deploy' } let(:escaped_user) { 'deploy' } let(:submodule) { false } before do Rake.application.rake_require 'capistrano/tasks/deploy' Rake.application.rake_require 'capistrano/tasks/git' Rake.application.rake_require 'capistrano/tasks/framework' Rake.application...
github
linyows/capistrano-withrsync
https://github.com/linyows/capistrano-withrsync
spec/helper.rb
Ruby
mit
19
master
211
require 'capistrano/all' require 'rspec' load 'capistrano/setup.rb' def run_task(name, *args) Rake.application.options.trace = !!ENV['DEBUG'] Rake::Task[name].reenable Rake::Task[name].invoke(*args) end
github
linyows/capistrano-withrsync
https://github.com/linyows/capistrano-withrsync
lib/capistrano/withrsync.rb
Ruby
mit
19
master
208
require 'capistrano/withrsync/version' require 'capistrano/withrsync/rake/task' require 'shellwords' load File.expand_path('../tasks/withrsync.rake', __FILE__) module Capistrano module Withrsync end end
github
linyows/capistrano-withrsync
https://github.com/linyows/capistrano-withrsync
lib/capistrano/tasks/withrsync.rake
Ruby
mit
19
master
3,358
Rake::Task[:'deploy:check'].enhance [:'rsync:override_scm'] Rake::Task[:'deploy:updating'].enhance [:'rsync:override_scm'] namespace :rsync do set :rsync_options, %w( --recursive --delete --delete-excluded --exclude .git* --exclude .svn* ) set :rsync_copy_options, %w( --archive --acl...
github
thinkcmf/hbuilder
https://github.com/thinkcmf/hbuilder
html_snippets.rb
Ruby
mit
19
master
12,354
# +---------------------------------------------------------------------- # | ThinkPHP ThinkCMF HBuilder代码块 # +---------------------------------------------------------------------- # | ThinkCMF[ WE CAN DO IT MORE SIMPLE ] # +---------------------------------------------------------------------- # | Copyright (c) 2013-...
github
textmaster/faraday_middleware-circuit_breaker
https://github.com/textmaster/faraday_middleware-circuit_breaker
faraday_middleware-circuit_breaker.gemspec
Ruby
mit
19
master
1,619
require_relative 'lib/faraday_middleware/circuit_breaker/version' Gem::Specification.new do |spec| spec.name = "faraday_middleware-circuit_breaker" spec.version = FaradayMiddleware::CircuitBreaker::VERSION spec.authors = ["Pierre-Louis Gottfrois"] spec.email = ["pierre-louis@textma...
github
textmaster/faraday_middleware-circuit_breaker
https://github.com/textmaster/faraday_middleware-circuit_breaker
spec/faraday_middleware/circuit_breaker_spec.rb
Ruby
mit
19
master
3,101
describe FaradayMiddleware::CircuitBreaker do before do Stoplight::Light.default_data_store = Stoplight::DataStore::Memory.new end def connection(options = {}) Faraday.new do |c| c.use :circuit_breaker, options c.adapter :test do |stub| stub.get('/success') do [200, {}, '']...
github
textmaster/faraday_middleware-circuit_breaker
https://github.com/textmaster/faraday_middleware-circuit_breaker
lib/faraday_middleware/circuit_breaker.rb
Ruby
mit
19
master
498
require 'faraday_middleware/circuit_breaker/version' require 'faraday_middleware/circuit_breaker/middleware' module FaradayMiddleware module CircuitBreaker if Faraday.respond_to?(:register_middleware) Faraday.register_middleware circuit_breaker: FaradayMiddleware::CircuitBreaker::Middleware elsif Fara...
github
textmaster/faraday_middleware-circuit_breaker
https://github.com/textmaster/faraday_middleware-circuit_breaker
lib/faraday_middleware/circuit_breaker/middleware.rb
Ruby
mit
19
master
1,958
require 'faraday' require 'stoplight' require 'faraday_middleware/circuit_breaker/option_set' module FaradayMiddleware module CircuitBreaker class Middleware < Faraday::Middleware def initialize(app, options = {}) super(app) assert_valid_options!(options) @option_set = OptionSet.n...
github
textmaster/faraday_middleware-circuit_breaker
https://github.com/textmaster/faraday_middleware-circuit_breaker
lib/faraday_middleware/circuit_breaker/option_set.rb
Ruby
mit
19
master
1,248
require 'faraday' require 'stoplight' require 'faraday_middleware/circuit_breaker/option_set' module FaradayMiddleware module CircuitBreaker class OptionSet VALID_OPTIONS = %w(timeout threshold fallback notifiers data_store error_handler cache_key_generator) attr_accessor :timeout, :threshold, :fal...
github
rosylilly/uninclude
https://github.com/rosylilly/uninclude
uninclude.gemspec
Ruby
mit
19
master
986
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'uninclude/version' Gem::Specification.new do |spec| spec.name = "uninclude" spec.version = Uninclude::VERSION spec.authors = ["Sho Kusano"] spec.email = ["ros...
github
rosylilly/uninclude
https://github.com/rosylilly/uninclude
Rakefile
Ruby
mit
19
master
668
require 'bundler/gem_tasks' require 'rspec/core/rake_task' require 'rake/clean' GEM_NAME = 'uninclude'.freeze DLEXT = RbConfig::CONFIG['DLEXT'] CLEAN.include("ext/**/*.{#{DLEXT},log,o}") CLEAN.include('ext/**/Makefile') CLEAN.include("lib/**/*.#{DLEXT}") CLOBBER.include("lib/**/*.#{DLEXT}") file "lib/#{GEM_NAME}/#{G...
github
rosylilly/uninclude
https://github.com/rosylilly/uninclude
spec/uninclude_spec.rb
Ruby
mit
19
master
1,683
require 'spec_helper' require 'timeout' module ExampleMod def mod; :mod; end end describe Uninclude do let(:klass) { Class.new do def singleton_class class << self self end end end } let(:instance) { klass.new } describe '.uninclude' do it 'should uninclude...
github
rosylilly/uninclude
https://github.com/rosylilly/uninclude
lib/uninclude/block.rb
Ruby
mit
19
master
788
# -*- coding: utf-8 -*- require 'uninclude' class Module alias_method :__include, :include alias_method :__uninclude, :uninclude def include(mod) __include(mod) if block_given? yield(self) __uninclude(mod) end end def uninclude(mod) return unless ancestors.include?(mod) __...
github
rosylilly/uninclude
https://github.com/rosylilly/uninclude
ext/uninclude/extconf.rb
Ruby
mit
19
master
287
require 'mkmf' RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC'] $CFLAGS << " #{ENV["CFLAGS"]}" if RUBY_VERSION >= '1.9.3' $CFLAGS << ' -DHAVE_RUBY_BACKWARD_CLASSEXT_H' end if RUBY_VERSION >= '2.1.0' $CFLAGS << ' -DRUBY_V2_1_0' end create_makefile('uninclude/uninclude')
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
Rakefile
Ruby
mit
19
main
290
# frozen_string_literal: true require "rake/testtask" require "bundler/gem_tasks" require "rubocop/rake_task" Rake::TestTask.new(:test) do |t| t.libs << "test" t.test_files = FileList["test/**/*_test.rb"] t.warning = false end RuboCop::RakeTask.new task default: %i[test rubocop]
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
svg_optimizer.gemspec
Ruby
mit
19
main
1,067
# frozen_string_literal: true require "./lib/svg_optimizer/version" Gem::Specification.new do |spec| spec.name = "svg_optimizer" spec.version = SvgOptimizer::VERSION spec.authors = ["Nando Vieira"] spec.email = ["fnando.vieira@gmail.com"] spec.description = "SVG optimization b...
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
test/test_helper.rb
Ruby
mit
19
main
2,065
# frozen_string_literal: true require "simplecov" SimpleCov.start require "bundler/setup" require "svg_optimizer" require "securerandom" require "minitest/utils" require "minitest/autorun" module InstanceHelpers SVG = <<~XML <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/...
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
test/svg_optimizer/issue_8_test.rb
Ruby
mit
19
main
955
# frozen_string_literal: true require "test_helper" class Issue8Test < Minitest::Test test "processes string when marked as trusted" do raw_svg = File.read("./test/fixtures/issue_8.svg") SvgOptimizer.optimize(raw_svg, trusted: true) end test "processes file when marked as trusted" do Dir.mktmpdir ...
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
test/svg_optimizer/svg_optimizer_test.rb
Ruby
mit
19
main
1,473
# frozen_string_literal: true require "test_helper" class SvgOptimizerTest class FileSavingTest < Minitest::Test let(:input) { "/tmp/#{SecureRandom.uuid}.svg" } let(:output) { "/tmp/#{SecureRandom.uuid}.svg" } let(:raw_svg) { build_svg("<!-- foo --><text>SVG</text>") } let(:output_svg) { SvgOptimize...
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
test/svg_optimizer/plugins/remove_unused_namespace_test.rb
Ruby
mit
19
main
670
# frozen_string_literal: true require "test_helper" module RemoveUnusedNamespaceTest class UnusedNamespaceTest < Minitest::Test plugin_class SvgOptimizer::Plugins::RemoveUnusedNamespace with_svg_plugin "unused_namespace.svg" let(:namespaces) do xml.root.namespace_definitions.each_with_object({}) ...
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
test/svg_optimizer/plugins/remove_title_test.rb
Ruby
mit
19
main
464
# frozen_string_literal: true require "test_helper" class RemoveTitleTest < Minitest::Test plugin_class SvgOptimizer::Plugins::RemoveTitle with_svg_plugin "title_and_desc.svg" test "applies plugin" do assert_empty xml.css("title") end end class RemoveTitleFromSpriteTest < Minitest::Test plugin_class S...
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
test/svg_optimizer/plugins/remove_editor_namespace_test.rb
Ruby
mit
19
main
1,084
# frozen_string_literal: true require "test_helper" module RemoveEditorNamespaceTest class RootNamespacesTest < Minitest::Test with_svg_plugin "namespaced_attribute.svg" plugin_class SvgOptimizer::Plugins::RemoveEditorNamespace test "applies plugin" do assert_includes xml.namespaces.values, "http...
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
test/svg_optimizer/plugins/remove_empty_text_node_test.rb
Ruby
mit
19
main
591
# frozen_string_literal: true require "test_helper" module RemoveEmptyTextNodeTests class GroupsWithEmptyTextNodesOnlyTest < Minitest::Test plugin_class SvgOptimizer::Plugins::RemoveEmptyTextNode with_svg_plugin %[<g> \n\t\r\n </g>] test "applies plugin" do assert_empty xml.css("g").children ...
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
test/svg_optimizer/plugins/remove_hidden_element_test.rb
Ruby
mit
19
main
2,382
# frozen_string_literal: true require "test_helper" module RemoveHiddenElementTest class DisplayNoneTest < Minitest::Test plugin_class SvgOptimizer::Plugins::RemoveHiddenElement with_svg_plugin <<-SVG <path display="none" d="..."/> SVG test "applies plugin" do assert_empty xml.css("path...
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
test/svg_optimizer/plugins/remove_comment_test.rb
Ruby
mit
19
main
305
# frozen_string_literal: true require "test_helper" class RemoveCommentTest < Minitest::Test plugin_class SvgOptimizer::Plugins::RemoveComment with_svg_plugin <<-SVG <!-- foo --> <g></g> <!-- bar --> SVG test "applies plugin" do assert_empty xml.xpath("//comment()") end end
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
test/svg_optimizer/plugins/remove_raster_image_test.rb
Ruby
mit
19
main
539
# frozen_string_literal: true require "test_helper" class RemoveRasterImageTest < Minitest::Test plugin_class SvgOptimizer::Plugins::RemoveRasterImage with_svg_plugin <<-SVG <g> <image xlink:href="raster.jpg" width="100" height="100"/> <image xlink:href="raster.png" width="100" height="100"/> ...
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
test/svg_optimizer/plugins/remove_empty_container_test.rb
Ruby
mit
19
main
326
# frozen_string_literal: true require "test_helper" module RemoveEmptyContainerTest class InnerElementsTest < Minitest::Test plugin_class SvgOptimizer::Plugins::RemoveEmptyContainer with_svg_plugin "<g><marker><a/></marker></g>" test "applies plugin" do assert_empty xml.root.css("*") end en...
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
test/svg_optimizer/plugins/cleanup_id_test.rb
Ruby
mit
19
main
914
# frozen_string_literal: true require "test_helper" module CleanupIdTest class CleanupIdWithXLinkNamespaceTest < Minitest::Test plugin_class SvgOptimizer::Plugins::CleanupId with_svg_plugin "cleanup_id.svg" test "applies plugin" do assert_equal "a", xml.css("linearGradient").first["id"] ass...
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
test/svg_optimizer/plugins/cleanup_attribute_test.rb
Ruby
mit
19
main
282
# frozen_string_literal: true require "test_helper" class CleanupAttributeTest < Minitest::Test plugin_class SvgOptimizer::Plugins::CleanupAttribute with_svg_plugin %[<g a="b \n\t\tc"/>] test "applies plugin" do assert_equal "b c", xml.css("g").first["a"] end end
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
test/svg_optimizer/plugins/remove_description_test.rb
Ruby
mit
19
main
265
# frozen_string_literal: true require "test_helper" class RemoveDescriptionTest < Minitest::Test plugin_class SvgOptimizer::Plugins::RemoveDescription with_svg_plugin "title_and_desc.svg" test "applies plugin" do assert_empty xml.css("desc") end end
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
test/svg_optimizer/plugins/remove_empty_attribute_test.rb
Ruby
mit
19
main
353
# frozen_string_literal: true require "test_helper" class RemoveEmptyAttributeTest < Minitest::Test plugin_class SvgOptimizer::Plugins::RemoveEmptyAttribute with_svg_plugin <<-SVG <g attr1="" attr2=""/> <g attr3="" attr4=""/> <g namespace:attr="" /> SVG test "applies plugin" do assert_empty x...
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
test/svg_optimizer/plugins/remove_useless_stroke_and_fill_test.rb
Ruby
mit
19
main
233
# frozen_string_literal: true require "test_helper" class RemoveUselessStrokeAndFillTest < Minitest::Test test_with_fixture_set( "remove_useless_stroke_and_fill", SvgOptimizer::Plugins::RemoveUselessStrokeAndFill ) end
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
test/svg_optimizer/plugins/remove_metadata_test.rb
Ruby
mit
19
main
324
# frozen_string_literal: true require "test_helper" class RemoveMetadataTest < Minitest::Test plugin_class SvgOptimizer::Plugins::RemoveMetadata with_svg_plugin <<-SVG <metadata></metadata> <!-- foo --> <metadata></metadata> SVG test "applies plugin" do assert_empty xml.css("metadata") end ...
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
lib/svg_optimizer.rb
Ruby
mit
19
main
1,740
# frozen_string_literal: true require "nokogiri" require "svg_optimizer/version" require "svg_optimizer/plugins/base" require "svg_optimizer/plugins/cleanup_attribute" require "svg_optimizer/plugins/cleanup_id" require "svg_optimizer/plugins/remove_comment" require "svg_optimizer/plugins/remove_metadata" require "svg...
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
lib/svg_optimizer/plugins/remove_empty_attribute.rb
Ruby
mit
19
main
423
# frozen_string_literal: true module SvgOptimizer module Plugins class RemoveEmptyAttribute < Base def process xml.xpath("//*[@*='']").each do |node| node.attributes.each_key do |name| remove_if_empty node, name end end end private def remove_if_...
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
lib/svg_optimizer/plugins/remove_empty_text_node.rb
Ruby
mit
19
main
319
# frozen_string_literal: true module SvgOptimizer module Plugins class RemoveEmptyTextNode < Base def process xml.xpath("//text()").each(&method(:remove_if_empty)) end private def remove_if_empty(node) node.remove if node.text.gsub(/\s/, "").empty? end end end end
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
lib/svg_optimizer/plugins/remove_useless_stroke_and_fill.rb
Ruby
mit
19
main
2,066
# frozen_string_literal: true module SvgOptimizer module Plugins class RemoveUselessStrokeAndFill < Base SELECTOR = %w[circle ellipse line path polygon polyline rect].join(",") STROKE_ATTRS = %w[ stroke stroke-opacity stroke-width stroke-dashoffset ].freeze ...
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
lib/svg_optimizer/plugins/cleanup_attribute.rb
Ruby
mit
19
main
421
# frozen_string_literal: true module SvgOptimizer module Plugins class CleanupAttribute < Base def process xml.xpath("//*[@*]").each do |node| node.attributes.each_value do |attribute| cleanup_attribute attribute end end end def cleanup_attribute...
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
lib/svg_optimizer/plugins/remove_unused_namespace.rb
Ruby
mit
19
main
569
# frozen_string_literal: true module SvgOptimizer module Plugins class RemoveUnusedNamespace < Base def process xml .root .namespace_definitions .select(&:prefix) .each(&method(:remove_unused_ns)) end def remove_unused_ns(ns) return if xm...
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
lib/svg_optimizer/plugins/cleanup_id.rb
Ruby
mit
19
main
2,251
# frozen_string_literal: true module SvgOptimizer module Plugins class CleanupId < Base LETTERS = %w[ a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ].freeze IDS = LETTERS.dup.concat(LETTERS.combination(2).to_a).freeze ...
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
lib/svg_optimizer/plugins/remove_hidden_element.rb
Ruby
mit
19
main
652
# frozen_string_literal: true module SvgOptimizer module Plugins class RemoveHiddenElement < Base SELECTOR = %w[ [display=none] [opacity='0'] circle[r='0'] ellipse[rx='0'] ellipse[ry='0'] rect[width='0'] rect[height='0'] pattern[width='0'] ...
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
lib/svg_optimizer/plugins/remove_empty_container.rb
Ruby
mit
19
main
634
# frozen_string_literal: true module SvgOptimizer module Plugins class RemoveEmptyContainer < Base ELEMENTS = %w[ a defs g marker mask missing-glyph pattern switch symbol ].freeze SELECTOR = ELEMENTS.map {|element| %[#{elem...
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
lib/svg_optimizer/plugins/remove_editor_namespace.rb
Ruby
mit
19
main
1,888
# frozen_string_literal: true module SvgOptimizer module Plugins class RemoveEditorNamespace < Base NAMESPACES = [ "http://ns.adobe.com/AdobeIllustrator/10.0/", "http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/", "http://ns.adobe.com/Extensibility/1.0/", "http://ns.adobe.co...
github
fnando/svg_optimizer
https://github.com/fnando/svg_optimizer
lib/svg_optimizer/plugins/remove_raster_image.rb
Ruby
mit
19
main
360
# frozen_string_literal: true module SvgOptimizer module Plugins class RemoveRasterImage < Base SELECTOR = %w[ image[xlink|href$='.jpg'] image[xlink|href$='.jpeg'] image[xlink|href$='.gif'] image[xlink|href$='.png'] ].join(", ") def process xml.css(SELEC...
github
mkristian/dm-ldap-adapter
https://github.com/mkristian/dm-ldap-adapter
Rakefile
Ruby
mit
19
master
970
# -*- ruby -*- require 'rubygems' require 'hoe' require './lib/ldap/version.rb' require 'spec' require 'spec/rake/spectask' require 'pathname' Hoe.spec('dm-ldap-adapter') do |p| p.version = "0.4.2" p.description = "ldap adapter for datamapper which uses either net-ldap or ruby-ldap" p.developer('mkristian', 'm...
github
mkristian/dm-ldap-adapter
https://github.com/mkristian/dm-ldap-adapter
dm-ldap-adapter.gemspec
Ruby
mit
19
master
1,339
# -*- mode: ruby -*- Gem::Specification.new do |s| s.name = %q{dm-ldap-adapter} s.version = "0.4.7" s.description = %q{ldap adapter for datamapper which uses either net-ldap or ruby-ldap} s.authors = ["mkristian", "xertres"] s.email = ["m.kristian@web.de", ""] s.extra_rdoc_files = ["History.txt", "README....
github
mkristian/dm-ldap-adapter
https://github.com/mkristian/dm-ldap-adapter
lib/dummy_ldap_resource.rb
Ruby
mit
19
master
1,700
require 'slf4r/logger' require 'ldap/digest' # dummy implementation which turns the extra ldap configuration noops module DataMapper module Resource module ClassMethods include ::Slf4r::Logger def ldap_properties(resource = nil, &block) if block @ldap_properties = block e...
github
mkristian/dm-ldap-adapter
https://github.com/mkristian/dm-ldap-adapter
lib/ldap_resource.rb
Ruby
mit
19
master
7,235
require 'ldap/digest' require 'dm-core' require 'ldap/array' module DataMapper module Model if DataMapper::VERSION =~ /^1.[0-1]/ Immutable = Resource::State::Immutable Clean = Resource::State::Clean else Immutable = Resource::PersistenceState::Immutable Clean = Resource::PersistenceS...
github
mkristian/dm-ldap-adapter
https://github.com/mkristian/dm-ldap-adapter
lib/ldap/ruby_ldap_facade.rb
Ruby
mit
19
master
6,924
require 'ldap' require 'slf4r' require 'ldap/conditions_2_filter' module Ldap class Connection < LDAP::Conn attr_reader :base, :host, :port def initialize(config) @ldap_config = config super(config[:host], config[:port]) @base = config[:base] @port = config[:port] @host = conf...
github
mkristian/dm-ldap-adapter
https://github.com/mkristian/dm-ldap-adapter
lib/ldap/unboundid_ldap_facade.rb
Ruby
mit
19
master
6,224
require 'ldap' require 'slf4r' require 'ldap/conditions_2_filter' module Ldap # class Connection < LDAP::Conn # attr_reader :base, :host, :port # def initialize(config) # super(config[:host], config[:port]) # @base = config[:base] # @port = config[:port] # @host = config[:host] # ...
github
mkristian/dm-ldap-adapter
https://github.com/mkristian/dm-ldap-adapter
lib/ldap/conditions_2_filter.rb
Ruby
mit
19
master
2,984
require 'net/ldap' module Ldap class Conditions2Filter @@logger = ::Slf4r::LoggerFacade.new(::Ldap::Conditions2Filter) # @param Array of conditions for the search # @return Array of Hashes with a name/values pair for each attribute def self.convert(conditions) @@logger.debug { "conditions #{c...
github
mkristian/dm-ldap-adapter
https://github.com/mkristian/dm-ldap-adapter
lib/ldap/array.rb
Ruby
mit
19
master
2,911
require 'dm-core' module Ldap class Array < ::Array def initialize(resource, property, *args) setup(resource, property) super(args) end def setup(resource, property) @resource = resource @property = property self end alias :push! :push def []=(k, v) ar ...
github
mkristian/dm-ldap-adapter
https://github.com/mkristian/dm-ldap-adapter
lib/ldap/digest.rb
Ruby
mit
19
master
781
begin require 'sha1' rescue LoadError # ruby1.9.x require 'digest/sha1' SHA1 = Digest::SHA1 end require 'base64' module Ldap class Digest # method from openldap faq which produces the userPassword attribute # for the ldap # @param secret String the password # @param salt String the salt for t...
github
mkristian/dm-ldap-adapter
https://github.com/mkristian/dm-ldap-adapter
lib/ldap/net_ldap_facade.rb
Ruby
mit
19
master
5,808
require 'net/ldap' require 'slf4r' require 'ldap/conditions_2_filter' module Ldap class NetLdapFacade # @param config Hash for the ldap connection def self.open(config) Net::LDAP.open( config ) do |ldap| yield ldap end end include ::Slf4r::Logger # @param config Hash for th...
github
mkristian/dm-ldap-adapter
https://github.com/mkristian/dm-ldap-adapter
lib/adapters/noop_transaction.rb
Ruby
mit
19
master
579
require "dm-core" module Ldap class NoopTransaction def close ; end def begin ; end def prepare ; end def commit ; end def rollback ; end def rollback_prepared ; end end end module DataMapper module Adapters class LdapAdapter def transaction_primitive ::Ldap::...
github
mkristian/dm-ldap-adapter
https://github.com/mkristian/dm-ldap-adapter
lib/adapters/ldap_adapter.rb
Ruby
mit
19
master
13,224
require "dm-core" require 'slf4r/logger' # require 'adapters/noop_transaction' module Ldap # the class provides two ways of getting a LdapFacade. either # one which is put on the current Thread or a new one class LdapConnection include ::Slf4r::Logger def initialize(options) if options[:facade]....
github
mkristian/dm-ldap-adapter
https://github.com/mkristian/dm-ldap-adapter
spec/multi_repository_spec.rb
Ruby
mit
19
master
1,568
require 'spec_helper' class Order include DataMapper::Resource property :id, Serial belongs_to :user, :required => false, :repository => :ldap end class Order2 include DataMapper::Resource def self.repository_name :default end property :id, Serial belongs_to :user, :required => false end cla...
github
mkristian/dm-ldap-adapter
https://github.com/mkristian/dm-ldap-adapter
spec/spec_helper.rb
Ruby
mit
19
master
1,029
#Require main environment require 'dm-ldap-adapter' #Require developer depdencies require 'dm-sqlite-adapter' require 'dm-migrations' print "datamapper version:" puts DataMapper::VERSION #Logging needs to be cleaned up... require 'slf4r/ruby_logger' Slf4r::LoggerFacade4RubyLogger.level = :warn require 'ldap_resourc...
github
mkristian/dm-ldap-adapter
https://github.com/mkristian/dm-ldap-adapter
spec/sorting_spec.rb
Ruby
mit
19
master
1,930
require 'spec_helper' describe DataMapper.repository(:ldap).adapter do describe 'belongs_to association' do before do DataMapper.repository(:ldap) do User.all.destroy! @user1 = User.create(:login => "black", :name => 'Black', :mail => ["blackmail@example.com"], :age => 100) @user2...
github
mkristian/dm-ldap-adapter
https://github.com/mkristian/dm-ldap-adapter
spec/assiociations_ldap_adapter_spec.rb
Ruby
mit
19
master
5,385
require 'spec_helper' describe DataMapper::Adapters::LdapAdapter do before do DataMapper.repository(:ldap) do User.all(:login.like => "b%").destroy! Group.all(:name.like => "test_%").destroy! #First we create some items. user1 = User.create(:login => "black", :name => 'Black', :ag...
github
mkristian/dm-ldap-adapter
https://github.com/mkristian/dm-ldap-adapter
spec/authentication_ldap_adapter_spec.rb
Ruby
mit
19
master
730
require 'spec_helper' describe DataMapper.repository(:ldap).adapter do describe 'user authentication' do before do DataMapper.repository(:ldap) do User.all.destroy! @user = User.new(:login => "beige", :name => 'Beige') @user.password = "asd123" @user.save end end...
github
mkristian/dm-ldap-adapter
https://github.com/mkristian/dm-ldap-adapter
spec/ldap_adapter_spec.rb
Ruby
mit
19
master
8,320
require 'spec_helper' require 'ldap/transactions' describe DataMapper::Adapters::LdapAdapter do before(:each) do DataMapper.repository(:ldap) do User.all.destroy! @user1 = User.create(:login => "black", :name => 'Black', :age => 0) @user2 = User.create(:login => "brown", :name => 'Brown', :age...
github
mkristian/dm-ldap-adapter
https://github.com/mkristian/dm-ldap-adapter
spec/ldap_array_spec.rb
Ruby
mit
19
master
3,205
require 'spec_helper' class A include DataMapper::Resource property :id, Serial property :list, ::Ldap::LdapArray, :accessor => :public property :hidden_list, ::Ldap::LdapArray, :accessor => :private property :write_list, ::Ldap::LdapArray, :reader => :private, :writer => :public prope...
github
mkristian/dm-ldap-adapter
https://github.com/mkristian/dm-ldap-adapter
spec/multi_value_attributes_spec.rb
Ruby
mit
19
master
3,998
require 'spec_helper' describe DataMapper.repository(:ldap).adapter.class do describe 'LdapArray' do before :each do DataMapper.repository(:ldap) do begin TestContact.all(:login.like => "b%").destroy! @contact = TestContact.new(:login => "beige", :name => 'Beige') @...
github
mkristian/dm-ldap-adapter
https://github.com/mkristian/dm-ldap-adapter
spec/support/test_contact.rb
Ruby
mit
19
master
922
class TestContact include DataMapper::Resource property :id, Serial, :field => "uidNumber" property :login, String, :field => "uid", :unique_index => true property :hashed_password, String, :field => "userPassword", :lazy => true property :name, String, :field => "cn" property :mail, ...
github
mkristian/dm-ldap-adapter
https://github.com/mkristian/dm-ldap-adapter
spec/support/role.rb
Ruby
mit
19
master
280
class Role include DataMapper::Resource property :id, Serial, :field => "gidNumber" property :name, String, :field => "cn" dn_prefix { |role| "cn=#{role.name}" } treebase "ou=groups" ldap_properties {{:objectclass => "posixGroup"}} belongs_to :user end
github
mkristian/dm-ldap-adapter
https://github.com/mkristian/dm-ldap-adapter
spec/support/user.rb
Ruby
mit
19
master
1,572
class User include DataMapper::Resource property :id, Serial, :field => "uidnumber" property :login, String, :field => "uid", :unique_index => true property :hashed_password, String, :field => "userPassword", :writer => :private property :name, String, :field => "cn" property :mail, St...
github
mkristian/dm-ldap-adapter
https://github.com/mkristian/dm-ldap-adapter
spec/support/group_user.rb
Ruby
mit
19
master
591
class GroupUser include DataMapper::Resource dn_prefix { |group_user| "cn=#{group_user.group.name}" } treebase "ou=groups" multivalue_field :memberUid ldap_properties do |group_user| {:cn=>"#{group_user.group.name}", :objectclass => "posixGroup"} end property :user_id, String, :key => true, :fie...
github
mkristian/dm-ldap-adapter
https://github.com/mkristian/dm-ldap-adapter
spec/support/group.rb
Ruby
mit
19
master
264
class Group include DataMapper::Resource property :id, Serial, :field => "gidNumber" property :name, String, :field => "cn" dn_prefix { |group| "cn=#{group.name}" } treebase "ou=groups" ldap_properties {{:objectclass => "posixGroup"}} end
github
mkristian/dm-ldap-adapter
https://github.com/mkristian/dm-ldap-adapter
example/posix.rb
Ruby
mit
19
master
4,115
require 'pathname' require 'rubygems' require 'slf4r/logger' require 'slf4r/ruby_logger' require 'dm-core' $LOAD_PATH << Pathname(__FILE__).dirname.parent.expand_path + 'lib' # Logging.init :debug, :info, :warn, :error # appender = Logging::Appender.stdout # appender.layout = Logging::Layouts::Pattern.new(:pattern =...
github
nmeans/phantomherd
https://github.com/nmeans/phantomherd
phantomherd.gemspec
Ruby
mit
19
master
965
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'phantomherd/version' Gem::Specification.new do |spec| spec.name = "phantomherd" spec.version = Phantomherd::VERSION spec.authors = ["Nickolas Means"] spec.email ...
github
nmeans/phantomherd
https://github.com/nmeans/phantomherd
lib/phantomherd/runner.rb
Ruby
mit
19
master
1,286
require "em-synchrony" require "em-synchrony/fiber_iterator" module Phantomherd class Runner attr_reader :sample_count, :concurrency, :casper_script attr_accessor :results def initialize(options) @sample_count = options[:sample_count] @concurrency = options[:concurrency] @casper_scrip...
github
AvnerCohen/http-headers-verifier
https://github.com/AvnerCohen/http-headers-verifier
http-headers-verifier.gemspec
Ruby
mit
19
master
1,803
lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require_relative "./lib/version" Gem::Specification.new do |spec| spec.name = "http-headers-verifier" spec.version = HttpHeadersVerifier::VERSION spec.platform = Gem::Platform::RUBY spec.autho...
github
AvnerCohen/http-headers-verifier
https://github.com/AvnerCohen/http-headers-verifier
lib/http_headers_validations.rb
Ruby
mit
19
master
2,481
require_relative './http_headers_utils' module HttpHeadersValidations def self.report(text, failed, status) if failed || HttpHeadersUtils.verbose puts "#{status} #{text}" end end def self.assert_expected_header(expected_header, expected_value, actual_value) if (!actual...
github
AvnerCohen/http-headers-verifier
https://github.com/AvnerCohen/http-headers-verifier
lib/naive_cookie.rb
Ruby
mit
19
master
1,796
class NaiveCookie # Super naive cookie implementation # It is not meant in any way to check the validity of the cookie # It is only meant to check specific properties of cookies that are assumed to be present. def initialize(cookie_str) @data = cookie_str.split("; ").map{ |s| s.inde...
github
AvnerCohen/http-headers-verifier
https://github.com/AvnerCohen/http-headers-verifier
exe/http-headers-verifier.rb
Ruby
mit
19
master
3,794
#!/usr/bin/env ruby require 'yaml' require 'typhoeus' require_relative '../lib/naive_cookie' require_relative '../lib/http_headers_validations' require_relative '../lib/http_headers_utils' FILE_NAME_PREFIX = 'headers-rules-' HTTP_TIMEOUT_IN_SECONDS = 3 SET_COOKIE_NAME = 'set-cookie' if ARGV.length != 3 && ARGV.leng...
github
AvnerCohen/http-headers-verifier
https://github.com/AvnerCohen/http-headers-verifier
spec/spec_helper.rb
Ruby
mit
19
master
260
require "bundler/setup" RSpec.configure do |config| config.example_status_persistence_file_path = ".rspec_status" config.disable_monkey_patching! config.expose_dsl_globally = true config.expect_with :rspec do |c| c.syntax = :expect end end
github
AvnerCohen/http-headers-verifier
https://github.com/AvnerCohen/http-headers-verifier
spec/http_headers_verifier/http-headers-verifier_spec.rb
Ruby
mit
19
master
2,649
require 'rspec' require './lib/http_headers_validations' describe HttpHeadersValidations do describe "HttpHeadersValidations.assert_expected_header" do it "errors when expected header is present with wrong" do results = HttpHeadersValidations.assert_expected_header("Path", "/", "\\") ...
github
AvnerCohen/http-headers-verifier
https://github.com/AvnerCohen/http-headers-verifier
spec/http_headers_verifier/naive_cookie_spec.rb
Ruby
mit
19
master
5,158
require 'rspec' require './lib/naive_cookie' SAME_SITE_CONFIG = 'test_cookie_name=session_value_here; path=/; expires=Tue, 11 Aug 2020 07:17:12 GMT; Secure; HttpOnly; SameSite=Lax' BASE_COOKIE_STR = "test_cookie_name=session_value_here; path=/; expires=Tue, 11 Aug 2020 07:17:12 GMT" describe NaiveCookie do des...
github
jorgegorka/siete-valles
https://github.com/jorgegorka/siete-valles
Gemfile
Ruby
mit
19
master
1,209
source 'https://rubygems.org' git_source(:github) { |repo| 'https://github.com/#{repo}.git' } ruby '3.0.2' gem 'graphql' gem 'importmap-rails', '>= 0.3.4' gem 'kaminari' gem 'mysql2' gem 'puma', '~> 5.0' gem 'rails', '~> 7.0.0.alpha2' gem 'redis', '~> 4.0' gem 'sidekiq' gem 'stimulus-rails', '>= 0.4.0' # Use Tailwind...
github
jorgegorka/siete-valles
https://github.com/jorgegorka/siete-valles
app/models/reward.rb
Ruby
mit
19
master
406
class Reward < ApplicationRecord enum category: { badge: 0, level: 1 } has_many :rules, dependent: :destroy has_many :achievements, dependent: :destroy validates :category, presence: true validates :name, presence: true scope :active, -> { where(active: true) } class << self def excluding_ids(ids)...
github
jorgegorka/siete-valles
https://github.com/jorgegorka/siete-valles
app/models/receiver.rb
Ruby
mit
19
master
230
class Receiver < ApplicationRecord has_many :achievements, dependent: :destroy has_many :activities, dependent: :destroy validates :external_id, presence: true def reward_ids achievements.pluck(:reward_id) end end
github
jorgegorka/siete-valles
https://github.com/jorgegorka/siete-valles
app/models/condition.rb
Ruby
mit
19
master
352
class Condition < ApplicationRecord enum operation: { points: 0, counter: 1 } enum expression: { gte: 0, gt: 1, eq: 2, lt: 3, lte: 4 } belongs_to :rule belongs_to :event, optional: true validates :operation, presence: true validates :expression, presence: true validates :value, presence: true, numerical...
github
jorgegorka/siete-valles
https://github.com/jorgegorka/siete-valles
app/models/rule.rb
Ruby
mit
19
master
394
class Rule < ApplicationRecord belongs_to :reward has_many :conditions, dependent: :destroy validates :reward_id, presence: true validates :name, presence: true class << self def within_period(activity_time) where('(starts_at >= :activity_time OR starts_at IS NULL) AND (ends_at <= :activity_time ...
github
jorgegorka/siete-valles
https://github.com/jorgegorka/siete-valles
app/models/activity.rb
Ruby
mit
19
master
628
class Activity < ApplicationRecord belongs_to :event belongs_to :receiver after_create :increase_receiver_points after_create :check_for_new_rewards after_destroy :decrease_receiver_points scope :within_period, ->(starts_at, ends_at) { where(created_at: starts_at..ends_at) } private def increase_rec...
github
jorgegorka/siete-valles
https://github.com/jorgegorka/siete-valles
app/models/concerns/uuidable.rb
Ruby
mit
19
master
322
# frozen_string_literal: true require 'active_support/concern' module Uuidable extend ActiveSupport::Concern included do validates :uuid, presence: true after_initialize :assign_uuid, if: :new_record? end private def assign_uuid self.uuid = SecureRandom.uuid end class_methods do end en...
github
jorgegorka/siete-valles
https://github.com/jorgegorka/siete-valles
app/middleware/receivers/persistence.rb
Ruby
mit
19
master
450
module Receivers class Persistence class << self def create(params) Receiver.create(external_id: params[:external_id]) end def update(params) receiver = Receiver.find_by(uuid: params.delete(:id)) receiver.update(params) receiver end def destroy(para...
github
jorgegorka/siete-valles
https://github.com/jorgegorka/siete-valles
app/middleware/rewards/checker.rb
Ruby
mit
19
master
636
module Rewards class Checker attr_reader :reward, :activity class << self def acquired(activity) Reward.active.excluding_ids(activity.receiver.reward_ids).all.map { |reward| new(reward, activity).achieved }.compact end end def initialize(reward, activity) @reward = reward ...
github
jorgegorka/siete-valles
https://github.com/jorgegorka/siete-valles
app/middleware/rewards/persistence.rb
Ruby
mit
19
master
408
module Rewards class Persistence class << self def create(params) Reward.create(params) end def update(params) reward = Reward.find_by(uuid: params.delete(:id)) reward.update(params) reward end def destroy(reward_uuid) reward = Reward.find_b...