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
javanthropus/archive-zip
https://github.com/javanthropus/archive-zip
lib/archive/zip/codec/traditional_encryption.rb
Ruby
mit
85
master
2,095
# encoding: UTF-8 require 'archive/zip/codec/traditional_encryption/reader' require 'archive/zip/codec/traditional_encryption/writer' module Archive; class Zip; module Codec # Archive::Zip::Codec::TraditionalEncryption is a handle for the traditional # encryption codec. class TraditionalEncryption # The las...
github
javanthropus/archive-zip
https://github.com/javanthropus/archive-zip
lib/archive/zip/codec/null_encryption.rb
Ruby
mit
85
master
1,878
# encoding: UTF-8 require 'archive/zip/codec' module Archive; class Zip; module Codec # Archive::Zip::Codec::NullEncryption is a handle for an encryption codec # which passes data through itself unchanged. class NullEncryption # This method signature is part of the interface contract expected by # Archi...
github
javanthropus/archive-zip
https://github.com/javanthropus/archive-zip
lib/archive/zip/codec/store.rb
Ruby
mit
85
master
2,327
# encoding: UTF-8 require 'archive/zip/codec/store/reader' require 'archive/zip/codec/store/writer' module Archive; class Zip; module Codec # Archive::Zip::Codec::Store is a handle for the store-unstore (no # compression) codec. class Store # The numeric identifier assigned to this compresion codec by the Z...
github
javanthropus/archive-zip
https://github.com/javanthropus/archive-zip
lib/archive/zip/codec/deflate.rb
Ruby
mit
85
master
3,909
# encoding: UTF-8 require 'archive/zip/codec' require 'archive/zip/codec/deflate/reader' require 'archive/zip/codec/deflate/writer' module Archive; class Zip; module Codec # Archive::Zip::Codec::Deflate is a handle for the deflate-inflate codec # as defined in Zlib which provides convenient interfaces for writing and...
github
javanthropus/archive-zip
https://github.com/javanthropus/archive-zip
lib/archive/zip/codec/traditional_encryption/reader.rb
Ruby
mit
85
master
1,754
# encoding: UTF-8 require 'archive/zip/codec/traditional_encryption/base' module Archive; class Zip; module Codec; class TraditionalEncryption # Archive::Zip::Codec::TraditionalEncryption::Reader is a readable, IO-like # object which decrypts data data it reads from a delegate IO object using # the traditional encryp...
github
javanthropus/archive-zip
https://github.com/javanthropus/archive-zip
lib/archive/zip/codec/traditional_encryption/base.rb
Ruby
mit
85
master
2,795
# encoding: UTF-8 require 'io/like_helpers/delegated_io' require 'archive/support/zlib' module Archive; class Zip; module Codec; class TraditionalEncryption # Archive::Zip::Codec::TraditionalEncryption::Base provides some basic # methods which are shared between # Archive::Zip::Codec::TraditionalEncryption::Writer a...
github
javanthropus/archive-zip
https://github.com/javanthropus/archive-zip
lib/archive/zip/codec/traditional_encryption/writer.rb
Ruby
mit
85
master
2,102
# encoding: UTF-8 require 'archive/zip/codec/traditional_encryption/base' require 'archive/zip/dos_time' module Archive; class Zip; module Codec; class TraditionalEncryption # Archive::Zip::Codec::TraditionalEncryption::Writer is a writable, IO-like # object which encrypts data written to it using the traditional enc...
github
javanthropus/archive-zip
https://github.com/javanthropus/archive-zip
lib/archive/zip/codec/store/reader.rb
Ruby
mit
85
master
3,626
# encoding: UTF-8 require 'io/like_helpers/delegated_io' require 'archive/support/zlib' require 'archive/zip/data_descriptor' module Archive; class Zip; module Codec; class Store # Archive::Zip::Codec::Store::Reader is a readable, IO-like wrapper # around a readable, IO-like object which provides a CRC32 checksum of...
github
javanthropus/archive-zip
https://github.com/javanthropus/archive-zip
lib/archive/zip/codec/store/writer.rb
Ruby
mit
85
master
2,801
# encoding: UTF-8 require 'io/like_helpers/delegated_io' require 'archive/support/zlib' require 'archive/zip/data_descriptor' module Archive; class Zip; module Codec; class Store # Archive::Zip::Codec::Store::Writer is simply a writable, IO-like wrapper # around a writable, IO-like object which provides a CRC32 chec...
github
javanthropus/archive-zip
https://github.com/javanthropus/archive-zip
lib/archive/zip/codec/deflate/reader.rb
Ruby
mit
85
master
6,729
# encoding: UTF-8 require 'io/like_helpers/delegated_io' require 'archive/support/zlib' require 'archive/zip/data_descriptor' module Archive; class Zip; module Codec; class Deflate # Archive::Zip::Codec::Deflate::Reader extends Zlib::ZReader in order to # specify the standard Zlib options required by ZIP archives an...
github
javanthropus/archive-zip
https://github.com/javanthropus/archive-zip
lib/archive/zip/codec/deflate/writer.rb
Ruby
mit
85
master
8,178
# encoding: UTF-8 require 'io/like_helpers/delegated_io' require 'archive/support/zlib' require 'archive/zip/data_descriptor' module Archive; class Zip; module Codec; class Deflate # Archive::Zip::Codec::Deflate::Writer extends Zlib::ZWriter in order to # specify the standard Zlib options required by ZIP archives an...
github
javanthropus/archive-zip
https://github.com/javanthropus/archive-zip
lib/archive/zip/extra_field/raw.rb
Ruby
mit
85
master
3,074
# encoding: UTF-8 module Archive; class Zip; module ExtraField # Archive::Zip::Entry::ExtraField::Raw represents an unknown extra field. It # is used to store extra fields the Archive::Zip library does not directly # support. # # Do not use this class directly. Define a new class which supports the extra ...
github
javanthropus/archive-zip
https://github.com/javanthropus/archive-zip
lib/archive/zip/extra_field/unix.rb
Ruby
mit
85
master
4,840
# encoding: UTF-8 require 'archive/zip/error' module Archive; class Zip; module ExtraField # Archive::Zip::Entry::ExtraField::Unix represents an extra field which # contains the last modified time, last accessed time, user name, and group # name for a ZIP archive entry. Times are in Unix time format (seconds s...
github
javanthropus/archive-zip
https://github.com/javanthropus/archive-zip
lib/archive/zip/extra_field/extended_timestamp.rb
Ruby
mit
85
master
6,895
# encoding: UTF-8 require 'archive/zip/error' module Archive; class Zip; module ExtraField # Archive::Zip::Entry::ExtraField::ExtendedTimestamp represents an extra field # which optionally contains the last modified time, last accessed time, and # file creation time for a ZIP archive entry and stored in a Unix ...
github
krasnoukhov/octodmin
https://github.com/krasnoukhov/octodmin
Rakefile
Ruby
mit
85
master
909
require "bundler/setup" require "fileutils" require "rspec/core/rake_task" require "bundler/gem_tasks" require "sprockets/standalone" # Test tasks RSpec::Core::RakeTask.new(:spec) namespace :spec do task coverage: :"assets:remove" do ENV["COVERAGE"] = "true" Rake::Task["spec"].invoke end end task default...
github
krasnoukhov/octodmin
https://github.com/krasnoukhov/octodmin
Gemfile
Ruby
mit
85
master
497
source "https://rubygems.org" gemspec gem "rake", "~> 10.0" gem "sprockets", "~> 3.0.0.beta" gem "bower", "~> 0.0.2" gem "sprockets-standalone", github: "krasnoukhov/sprockets-standalone" gem "coffee-react", "~> 2.4.0" group :test do gem "simplecov", "~...
github
krasnoukhov/octodmin
https://github.com/krasnoukhov/octodmin
octodmin.gemspec
Ruby
mit
85
master
994
# coding: utf-8 lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "octodmin/version" Gem::Specification.new do |spec| spec.name = "octodmin" spec.version = Octodmin::VERSION spec.authors = ["Dmitry Krasnoukhov"] spec.email = ...
github
krasnoukhov/octodmin
https://github.com/krasnoukhov/octodmin
spec/spec_helper.rb
Ruby
mit
85
master
595
ENV["RACK_ENV"] = ENV["LOTUS_ENV"] = "test" require "rubygems" require "bundler/setup" Bundler.require(:test) require "rack/test" if ENV["COVERAGE"] == "true" require "simplecov" require "coveralls" SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ SimpleCov::Formatter::HTMLFormatter, Covera...
github
krasnoukhov/octodmin
https://github.com/krasnoukhov/octodmin
spec/api/posts_spec.rb
Ruby
mit
85
master
12,903
require "spec_helper" shared_examples_for "existing post" do it "has post" do expect(subject["identifier"]).to eql("2015-01-30-test") expect(subject["added"]).to eql(false) expect(subject["changed"]).to eql(false) expect(subject["deleted"]).to eql(false) expect(subject["title"]).to eql("Test") ...
github
krasnoukhov/octodmin
https://github.com/krasnoukhov/octodmin
spec/api/version_spec.rb
Ruby
mit
85
master
325
require "spec_helper" describe "version" do let(:app) { Octodmin::App.new(File.expand_path("../..", __dir__)) } describe "show" do before { get "/api/version" } subject { parse_json(last_response.body)["versions"] } it "returns version" do expect(subject).to eql(Octodmin::VERSION) end end...
github
krasnoukhov/octodmin
https://github.com/krasnoukhov/octodmin
spec/api/syncs_spec.rb
Ruby
mit
85
master
3,051
require "spec_helper" describe "syncs" do let(:date) { Date.today.strftime("%Y-%m-%d") } let(:app) { Octodmin::App.new(File.expand_path("../..", __dir__)) } before do allow_any_instance_of(Git::Base).to receive(:pull).and_return(nil) allow_any_instance_of(Git::Base).to receive(:push).and_return(nil) end...
github
krasnoukhov/octodmin
https://github.com/krasnoukhov/octodmin
spec/api/site_spec.rb
Ruby
mit
85
master
478
require "spec_helper" describe "site" do let(:app) { Octodmin::App.new(File.expand_path("../..", __dir__)) } describe "show" do before { get "/api/site" } subject { parse_json(last_response.body)["sites"] } it "returns site" do expect(subject["title"]).to eql("Your awesome title") end ...
github
krasnoukhov/octodmin
https://github.com/krasnoukhov/octodmin
spec/api/deploys_spec.rb
Ruby
mit
85
master
899
require "spec_helper" describe "deploys" do let(:app) { Octodmin::App.new(File.expand_path("../..", __dir__)) } before do expect(Octopress::Deploy).to receive(:push).once end describe "create" do context "invalid" do before do allow(Octopress::Deploy).to receive(:push).and_raise(SystemE...
github
krasnoukhov/octodmin
https://github.com/krasnoukhov/octodmin
spec/frontend/assets_spec.rb
Ruby
mit
85
master
484
require "spec_helper" describe "assets" do let(:app) { Octodmin::App.new(File.expand_path("../..", __dir__)) } describe "css" do before { get "/assets/app.css" } subject { last_response.body } it "returns css" do expect(subject).to include("@charset") end end describe "js" do befor...
github
krasnoukhov/octodmin
https://github.com/krasnoukhov/octodmin
spec/frontend/home_spec.rb
Ruby
mit
85
master
391
require "spec_helper" describe "home" do let(:app) { Octodmin::App.new(File.expand_path("../..", __dir__)) } describe "home" do before { get "/" } subject { last_response.body } it "returns home" do expect(subject).to include("<!DOCTYPE html>") expect(subject).to include("/assets/app.css"...
github
krasnoukhov/octodmin
https://github.com/krasnoukhov/octodmin
app/octodmin.rb
Ruby
mit
85
master
1,044
ENV["RACK_ENV"] = ENV["LOTUS_ENV"] ||= "production" require "octodmin" require "lotus" require "git" require "json" require "octopress-deploy" begin require_relative "./config/sprockets" rescue LoadError end module Octodmin class App < Lotus::Application class << self attr_accessor :dir end co...
github
krasnoukhov/octodmin
https://github.com/krasnoukhov/octodmin
app/controllers/deploys/create.rb
Ruby
mit
85
master
432
module Octodmin::Controllers::Deploys class Create include Octodmin::Action expose :message def call(params) self.format = :json site = Octodmin::Site.new site.process options = site.config["octodmin"]["deploys"].first Octopress::Deploy.push(options) @message = "Dep...
github
krasnoukhov/octodmin
https://github.com/krasnoukhov/octodmin
app/controllers/syncs/create.rb
Ruby
mit
85
master
1,598
module Octodmin::Controllers::Syncs class Create include Octodmin::Action expose :message def call(params) self.format = :json site = Octodmin::Site.new git = Git.open(Octodmin::App.dir) # Add files to commit stage stage(site, git) # Pull changes git.pull ...
github
krasnoukhov/octodmin
https://github.com/krasnoukhov/octodmin
app/controllers/version/show.rb
Ruby
mit
85
master
202
module Octodmin::Controllers::Version class Show include Octodmin::Action expose :version def call(params) self.format = :json @version = Octodmin::VERSION end end end
github
krasnoukhov/octodmin
https://github.com/krasnoukhov/octodmin
app/controllers/posts/index.rb
Ruby
mit
85
master
222
module Octodmin::Controllers::Posts class Index include Octodmin::Action expose :posts def call(params) self.format = :json site = Octodmin::Site.new @posts = site.posts end end end
github
krasnoukhov/octodmin
https://github.com/krasnoukhov/octodmin
app/controllers/posts/update.rb
Ruby
mit
85
master
658
module Octodmin::Controllers::Posts class Update include Octodmin::Action expose :post params do param :layout, presence: true param :title, presence: true param :slug, presence: true param :date, presence: true param :content, presence: true end def call(params) ...
github
krasnoukhov/octodmin
https://github.com/krasnoukhov/octodmin
app/controllers/posts/restore.rb
Ruby
mit
85
master
207
require_relative "manage" module Octodmin::Controllers::Posts class Restore < Manage include Octodmin::Action expose :post def call(params) super @post.restore end end end
github
krasnoukhov/octodmin
https://github.com/krasnoukhov/octodmin
app/controllers/posts/upload.rb
Ruby
mit
85
master
480
require_relative "manage" module Octodmin::Controllers::Posts class Upload < Manage include Octodmin::Action expose :upload def call(params) super site = Octodmin::Site.new file = params[:file] dir = File.join(site.source, "octodmin", @post.identifier) path = File.join(di...
github
krasnoukhov/octodmin
https://github.com/krasnoukhov/octodmin
app/controllers/posts/revert.rb
Ruby
mit
85
master
205
require_relative "manage" module Octodmin::Controllers::Posts class Revert < Manage include Octodmin::Action expose :post def call(params) super @post.revert end end end
github
krasnoukhov/octodmin
https://github.com/krasnoukhov/octodmin
app/controllers/posts/manage.rb
Ruby
mit
85
master
235
module Octodmin::Controllers::Posts class Manage def call(params) self.format = :json @post = Octodmin::Post.find(params[:id]) halt 400, JSON.dump(errors: ["Could not find post"]) unless @post end end end
github
krasnoukhov/octodmin
https://github.com/krasnoukhov/octodmin
app/controllers/posts/create.rb
Ruby
mit
85
master
476
module Octodmin::Controllers::Posts class Create include Octodmin::Action expose :post params do param :title, presence: true end def call(params) self.format = :json halt 400, JSON.dump(errors: ["Required param `title` is not specified"]) unless params.valid? @post = Oc...
github
krasnoukhov/octodmin
https://github.com/krasnoukhov/octodmin
app/controllers/posts/destroy.rb
Ruby
mit
85
master
206
require_relative "manage" module Octodmin::Controllers::Posts class Destroy < Manage include Octodmin::Action expose :post def call(params) super @post.delete end end end
github
krasnoukhov/octodmin
https://github.com/krasnoukhov/octodmin
app/config/sprockets.rb
Ruby
mit
85
master
1,018
require "sprockets" require "coffee_script" require "coffee-react" require "bower" module Octodmin module CjsxProcessor VERSION = '1' SOURCE_VERSION = ::CoffeeScript::Source.version def self.cache_key @cache_key ||= [name, SOURCE_VERSION, VERSION].freeze end def self.call(input) dat...
github
krasnoukhov/octodmin
https://github.com/krasnoukhov/octodmin
app/config/routes.rb
Ruby
mit
85
master
438
namespace "api" do resource :version, only: [:show] resource :site, only: [:show] resources :posts do member do patch :restore patch :revert post :upload end end resources :syncs, only: [:create] resources :deploys, only: [:create] end if ENV["LOTUS_ENV"] != "production" moun...
github
krasnoukhov/octodmin
https://github.com/krasnoukhov/octodmin
lib/octodmin/post.rb
Ruby
mit
85
master
3,721
module Octodmin class Post attr_accessor :post ATTRIBUTES_FOR_SERIALIZAION = Jekyll::Post::ATTRIBUTES_FOR_LIQUID - %w[ previous next ] def self.find(id) site = Octodmin::Site.new site.posts.find { |post| post.identifier == id } end def self.create(options = {}) ...
github
krasnoukhov/octodmin
https://github.com/krasnoukhov/octodmin
lib/octodmin/site.rb
Ruby
mit
85
master
1,071
module Octodmin class Site attr_accessor :site DEFAULT_CONFIG = { "octodmin" => { "transliterate" => "latin", "front_matter" => { "layout" => { "type" => "text", }, "title" => { "type" => "text", }, "slug" => { ...
github
marcoroth/boxdrop
https://github.com/marcoroth/boxdrop
Gemfile
Ruby
mit
85
main
2,293
# frozen_string_literal: true source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '3.1.4' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 7.0.0' # Use postgresql as the database for Active Record gem 'pg', '>= 0.18', '< 2.0' # Use Puma...
github
marcoroth/boxdrop
https://github.com/marcoroth/boxdrop
test/test_helper.rb
Ruby
mit
85
main
441
# frozen_string_literal: true ENV['RAILS_ENV'] ||= 'test' require_relative '../config/environment' require 'rails/test_help' module ActiveSupport class TestCase # Run tests in parallel with specified workers parallelize(workers: :number_of_processors) # Setup all fixtures in test/fixtures/*.yml for all...
github
marcoroth/boxdrop
https://github.com/marcoroth/boxdrop
test/controllers/home_controller_test.rb
Ruby
mit
85
main
204
# frozen_string_literal: true require 'test_helper' class HomeControllerTest < ActionDispatch::IntegrationTest test 'should get index' do get home_index_url assert_response :success end end
github
marcoroth/boxdrop
https://github.com/marcoroth/boxdrop
test/controllers/folder_controller_test.rb
Ruby
mit
85
main
296
# frozen_string_literal: true require 'test_helper' class FolderControllerTest < ActionDispatch::IntegrationTest test 'should get index' do get folder_index_url assert_response :success end test 'should get show' do get folder_show_url assert_response :success end end
github
marcoroth/boxdrop
https://github.com/marcoroth/boxdrop
db/seeds.rb
Ruby
mit
85
main
2,063
# frozen_string_literal: true Folder.destroy_all Document.destroy_all Document.create(name: 'Unsorted.png') Document.create(name: 'drag_and_drop.me') Document.create(name: 'rename.me') Document.create(name: 'delete.me') pictures = Folder.create(name: 'Pictures') pictures.folders.create(name: 'Holidays') pictures.fol...
github
marcoroth/boxdrop
https://github.com/marcoroth/boxdrop
db/schema.rb
Ruby
mit
85
main
1,256
# 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. # # This file is the source Rails uses to define your schema when running `bin/rai...
github
marcoroth/boxdrop
https://github.com/marcoroth/boxdrop
db/migrate/20200513214219_create_documents.rb
Ruby
mit
85
main
236
# frozen_string_literal: true class CreateDocuments < ActiveRecord::Migration[6.0] def change create_table :documents do |t| t.string :name t.bigint :folder_id, foreign_key: true t.timestamps end end end
github
marcoroth/boxdrop
https://github.com/marcoroth/boxdrop
db/migrate/20200513214114_create_folders.rb
Ruby
mit
85
main
232
# frozen_string_literal: true class CreateFolders < ActiveRecord::Migration[6.0] def change create_table :folders do |t| t.string :name t.bigint :parent_id, foreign_key: true t.timestamps end end end
github
marcoroth/boxdrop
https://github.com/marcoroth/boxdrop
db/migrate/20241223161647_create_active_storage_variant_records.active_storage.rb
Ruby
mit
85
main
1,115
# frozen_string_literal: true # This migration comes from active_storage (originally 20191206030411) class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0] def change return unless table_exists?(:active_storage_blobs) # Use Active Record's configured type for primary key create_table :ac...
github
marcoroth/boxdrop
https://github.com/marcoroth/boxdrop
db/migrate/20241223161646_add_service_name_to_active_storage_blobs.active_storage.rb
Ruby
mit
85
main
783
# frozen_string_literal: true # This migration comes from active_storage (originally 20190112182829) class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0] def up return unless table_exists?(:active_storage_blobs) return if column_exists?(:active_storage_blobs, :service_name) add_colum...
github
marcoroth/boxdrop
https://github.com/marcoroth/boxdrop
config/application.rb
Ruby
mit
85
main
735
# frozen_string_literal: true 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 Boxdrop class Application < Rails::Application # Initialize configuration defaults f...
github
marcoroth/boxdrop
https://github.com/marcoroth/boxdrop
config/initializers/new_framework_defaults_7_0.rb
Ruby
mit
85
main
7,610
# frozen_string_literal: true # Be sure to restart your server when you modify this file. # # This file eases your Rails 7.0 framework defaults upgrade. # # Uncomment each configuration one by one to switch to the new default. # Once your application is ready to run with all new defaults, you can remove # this file an...
github
marcoroth/boxdrop
https://github.com/marcoroth/boxdrop
config/environments/production.rb
Ruby
mit
85
main
4,204
# frozen_string_literal: true require 'active_support/core_ext/integer/time' Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads mos...
github
marcoroth/boxdrop
https://github.com/marcoroth/boxdrop
config/environments/development.rb
Ruby
mit
85
main
2,478
# frozen_string_literal: true require 'active_support/core_ext/integer/time' Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. config.session_store :cache_store # In the development environment your application's code is reloaded any time # it...
github
marcoroth/boxdrop
https://github.com/marcoroth/boxdrop
config/environments/test.rb
Ruby
mit
85
main
2,418
# frozen_string_literal: true require 'active_support/core_ext/integer/time' # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between test r...
github
marcoroth/boxdrop
https://github.com/marcoroth/boxdrop
app/models/folder.rb
Ruby
mit
85
main
396
# frozen_string_literal: true class Folder < ApplicationRecord belongs_to :parent, class_name: 'Folder', optional: true has_many :folders, class_name: 'Folder', foreign_key: 'parent_id', dependent: :delete_all, inverse_of: :parent has_many :documents, dependent: :delete_all default_scope { order(name: :asc) }...
github
marcoroth/boxdrop
https://github.com/marcoroth/boxdrop
app/models/document.rb
Ruby
mit
85
main
217
# frozen_string_literal: true class Document < ApplicationRecord belongs_to :folder, optional: true default_scope { order(name: :asc) } scope :root, -> { where(folder_id: nil) } def to_s name end end
github
marcoroth/boxdrop
https://github.com/marcoroth/boxdrop
app/reflexes/element_reflex.rb
Ruby
mit
85
main
293
# frozen_string_literal: true class ElementReflex < ApplicationReflex def unselect_all session[:selected_elements] = [] end def bulk_delete return unless session[:selected_elements] session[:selected_elements].each(&:delete) session[:selected_elements] = [] end end
github
marcoroth/boxdrop
https://github.com/marcoroth/boxdrop
app/reflexes/folder_reflex.rb
Ruby
mit
85
main
1,120
# frozen_string_literal: true class FolderReflex < ApplicationReflex def select folder = Folder.find(element.data_folder_id) if session[:selected_elements].include?(folder) session[:selected_elements] -= [folder] else session[:selected_elements] << folder end end def edit folder...
github
marcoroth/boxdrop
https://github.com/marcoroth/boxdrop
app/reflexes/document_reflex.rb
Ruby
mit
85
main
1,175
# frozen_string_literal: true class DocumentReflex < ApplicationReflex def select document = Document.find(element.data_document_id) if session[:selected_elements].include?(document) session[:selected_elements] -= [document] else session[:selected_elements] << document end end def e...
github
marcoroth/boxdrop
https://github.com/marcoroth/boxdrop
app/helpers/layout_helper.rb
Ruby
mit
85
main
385
# frozen_string_literal: true module LayoutHelper def layout_button(layout, current_layout, icon) active = layout == current_layout tag.button( tag.i(class: "fa fa-#{icon}"), type: 'button', data: { reflex: 'click->LayoutReflex#set_layout', layout: }, class: class_names('btn', 'btn-p...
github
marcoroth/boxdrop
https://github.com/marcoroth/boxdrop
app/helpers/folder_helper.rb
Ruby
mit
85
main
434
# frozen_string_literal: true module FolderHelper def get_items_of_folder(folder) elements = [] loop do break if folder.nil? elements << folder folder = folder.parent end elements.reverse end def grid_item_classes(layout) case layout when 'grid-small' 'col-6 co...
github
marcoroth/boxdrop
https://github.com/marcoroth/boxdrop
app/controllers/folders_controller.rb
Ruby
mit
85
main
740
# frozen_string_literal: true class FoldersController < ApplicationController before_action :set_folders_and_documents def index @folders = Folder.root @documents = Document.root end def show @folder = Folder.find(params[:id]) @folders = @folder.folders @documents = @folder.documents re...
github
marcoroth/boxdrop
https://github.com/marcoroth/boxdrop
app/controllers/documents_controller.rb
Ruby
mit
85
main
276
# frozen_string_literal: true class DocumentsController < ApplicationController helper FolderHelper def show @document = Document.find(params[:id]) @editing_document = session[:editing_document] ||= nil rescue StandardError redirect_to root_path end end
github
marcoroth/boxdrop
https://github.com/marcoroth/boxdrop
app/channels/application_cable/connection.rb
Ruby
mit
85
main
214
# frozen_string_literal: true module ApplicationCable class Connection < ActionCable::Connection::Base identified_by :session_id def connect self.session_id = request.session.id end end end
github
hexorx/currencies
https://github.com/hexorx/currencies
currencies.gemspec
Ruby
mit
85
master
1,542
# -*- encoding: utf-8 -*- require File.expand_path('../lib/currencies/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["hexorx", "pr0d1r2"] gem.email = ["hexorx@gmail.com", "pr0d1r2@gmail.com"] gem.description = %q{If you are tracking any kind of assets the currencies gem is for...
github
hexorx/currencies
https://github.com/hexorx/currencies
Rakefile
Ruby
mit
85
master
219
#!/usr/bin/env rake require "bundler/gem_tasks" require 'rake' require 'rspec/core/rake_task' desc "Run all examples" RSpec::Core::RakeTask.new(:spec) do |t| t.rspec_opts = %w[--color] end task :default => [:spec]
github
hexorx/currencies
https://github.com/hexorx/currencies
lib/iso4217.rb
Ruby
mit
85
master
204
$LOAD_PATH << File.expand_path(File.dirname(__FILE__)) require 'YAML' unless defined?(YAML) require 'net/http' unless defined?(Net::HTTP) require 'currencies/currency' require 'currencies/exchange_bank'
github
hexorx/currencies
https://github.com/hexorx/currencies
lib/currencies/exchange_bank.rb
Ruby
mit
85
master
1,314
require 'thread' class ISO4217::Currency class UnknownRate < StandardError end class ExchangeBank def self.instance @@singleton end def initialize @rates = {} @mutex = Mutex.new end def add_rate(from, to, rate) @mutex.synchronize do @rates["#{from}_TO_#{to}"...
github
hexorx/currencies
https://github.com/hexorx/currencies
lib/currencies/currency.rb
Ruby
mit
85
master
2,903
module ISO4217 end class ISO4217::Currency class << self attr_accessor :currencies attr_accessor :base_currency attr_accessor :major_codes attr_accessor :import_exchange_rates end attr_reader :code, :symbol, :name, :full_name, :exchange_currency def initialize(iso_code,opts={}) @code = is...
github
hexorx/currencies
https://github.com/hexorx/currencies
spec/exchange_bank_spec.rb
Ruby
mit
85
master
1,761
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe ISO4217::Currency::ExchangeBank do before :each do @bank = ISO4217::Currency::ExchangeBank.new end it "returns the previously specified conversion rate" do @bank.add_rate("USD", "EUR", 0.788332676) @bank.add_rate("EUR", "YE...
github
hexorx/currencies
https://github.com/hexorx/currencies
spec/currency_spec.rb
Ruby
mit
85
master
10,763
# encoding: utf-8 require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe ISO4217::Currency do before(:all) do @usd = ISO4217::Currency.from_code(:USD) @gbp = ISO4217::Currency.from_code(:GBP) end it 'should return code' do @usd.code.should == 'USD' @gbp.code.should == 'GBP' ...
github
xiewenwei/redis_scanner
https://github.com/xiewenwei/redis_scanner
redis_scanner.gemspec
Ruby
mit
85
master
1,230
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'redis_scanner/version' Gem::Specification.new do |spec| spec.name = "redis_scanner" spec.version = RedisScanner::VERSION spec.authors = ["Vincent Xie"] spec.email ...
github
xiewenwei/redis_scanner
https://github.com/xiewenwei/redis_scanner
test/redis_scanner_test.rb
Ruby
mit
85
master
540
# -*- encoding : utf-8 -*- require 'test_helper' class RedisScannerTest < Minitest::Test def setup @options = {host: '127.0.0.1', port: 6379, db: 9} @redis = RedisScanner::Redis.new @options @engine = RedisScanner::Engine.new(@redis, @options) @redis.client.flushdb end def teardown @redis.c...
github
xiewenwei/redis_scanner
https://github.com/xiewenwei/redis_scanner
test/pattern_test.rb
Ruby
mit
85
master
689
# -*- encoding : utf-8 -*- require 'test_helper' class PatternTest < Minitest::Test def test_increment pt = RedisScanner::Pattern.new("test") pt.increment assert_equal 1, pt.total pt.increment assert_equal 2, pt.total end def test_increment_with_type_and_size pt = RedisScanner::Pattern....
github
xiewenwei/redis_scanner
https://github.com/xiewenwei/redis_scanner
test/test_helper.rb
Ruby
mit
85
master
610
# -*- encoding : utf-8 -*- $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'redis_scanner' require 'minitest/autorun' class Minitest::Test def setup_redis_data(client) client.set "u:1:name", "vincent" client.set "u:12:name", "susu" client.set "u:2016-08-12", "ok" client.set "u:dd...
github
xiewenwei/redis_scanner
https://github.com/xiewenwei/redis_scanner
test/formatter_test.rb
Ruby
mit
85
master
497
# -*- encoding : utf-8 -*- require 'test_helper' class FormatterTest < Minitest::Test def test_format_simple formatter = RedisScanner::Formatter.new format: "simple" result = formatter.format(setup_patterns) assert_match /b\s1/, result end def test_format_table formatter = RedisScanner::Formatt...
github
xiewenwei/redis_scanner
https://github.com/xiewenwei/redis_scanner
test/redis_test.rb
Ruby
mit
85
master
381
# -*- encoding : utf-8 -*- require 'test_helper' class RedisTest < Minitest::Test def setup options = {host: '127.0.0.1', port: 6379, db: 9} @redis = RedisScanner::Redis.new(options) @redis.client.flushdb end def teardown @redis.client.flushdb end def test_total_keys setup_redis_data(@...
github
xiewenwei/redis_scanner
https://github.com/xiewenwei/redis_scanner
test/engine_test.rb
Ruby
mit
85
master
811
# -*- encoding : utf-8 -*- require 'test_helper' class EngineTest < Minitest::Test def setup @options = {host: '127.0.0.1', port: 6379, db: 9} @redis = RedisScanner::Redis.new @options @redis.client.flushdb end def teardown @redis.client.flushdb end def test_run_without_match setup_red...
github
xiewenwei/redis_scanner
https://github.com/xiewenwei/redis_scanner
test/rule_test.rb
Ruby
mit
85
master
1,746
# -*- encoding : utf-8 -*- require 'test_helper' class RuleTest < Minitest::Test def setup @rule = RedisScanner::Rule.new end def test_pattern_id [ ["user:123:name", "user:<id>:name"], ["user:1", "user:<id>"], ["user:1:a:4:ok", "user:<id>:a:<id>:ok"], ["user:1:2", "user:<id>:<id...
github
xiewenwei/redis_scanner
https://github.com/xiewenwei/redis_scanner
lib/redis_scanner.rb
Ruby
mit
85
master
689
# -*- encoding : utf-8 -*- require "redis_scanner/version" require "redis_scanner/rule" require "redis_scanner/pattern" require "redis_scanner/redis" require "redis_scanner/engine" require "redis_scanner/formatter" require "redis" module RedisScanner def self.scan(options) redis = Redis.new options engine =...
github
xiewenwei/redis_scanner
https://github.com/xiewenwei/redis_scanner
lib/redis_scanner/formatter.rb
Ruby
mit
85
master
1,468
# -*- encoding : utf-8 -*- require "terminal-table" module RedisScanner class Formatter def initialize(options) @options = options end def format(patterns) if @options[:format] == "simple" simple patterns else table patterns end end private def touc...
github
xiewenwei/redis_scanner
https://github.com/xiewenwei/redis_scanner
lib/redis_scanner/redis.rb
Ruby
mit
85
master
1,123
# -*- encoding : utf-8 -*- module RedisScanner class Redis attr_reader :client def initialize(options) @options = options @client = ::Redis.new extract_redis_options(options) end def scan(*args) @client.scan *args end # total keys for given db(default 0) def total_key...
github
xiewenwei/redis_scanner
https://github.com/xiewenwei/redis_scanner
lib/redis_scanner/pattern.rb
Ruby
mit
85
master
1,355
# -*- encoding : utf-8 -*- module RedisScanner class PatternItem attr_reader :type, :count, :size def initialize(type) @type = type @count = 0 @size = 0 end def increment(size) @count += 1 @size += size end def <=>(other) if @count == other.count ...
github
xiewenwei/redis_scanner
https://github.com/xiewenwei/redis_scanner
lib/redis_scanner/engine.rb
Ruby
mit
85
master
1,357
# -*- encoding : utf-8 -*- require "ruby-progressbar" module RedisScanner class Engine def initialize(redis, options) @redis = redis @options = options @rule = Rule.new end def run result = scan result.values.sort end private def create_progress_bar tot...
github
xiewenwei/redis_scanner
https://github.com/xiewenwei/redis_scanner
lib/redis_scanner/rule.rb
Ruby
mit
85
master
889
# -*- encoding : utf-8 -*- module RedisScanner class Rule PRESET_RULES = [ [/(:\d+:)/, ":<id>:"], [/(:\w{8}-\w{4}-\w{4}-\w{4}-\w{12}:)/, ":<uuid>:"], [/(:\d{4}-\d{2}-\d{2}:)/, ":<date>:"], [/(:\d+)$/, ":<id>"], [/(:\w{8}-\w{4}-\w{4}-\w{4}-\w{12})$/, ":<uuid>"], [/(:\d{4}-\d{2}...
github
vergilet/repost
https://github.com/vergilet/repost
repost.gemspec
Ruby
mit
85
master
1,476
lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "repost/version" Gem::Specification.new do |spec| spec.name = "repost" spec.version = Repost::VERSION spec.authors = ["YaroslavO"] spec.email = ["osyaroslav@gmail.com"] spe...
github
vergilet/repost
https://github.com/vergilet/repost
lib/repost/senpai.rb
Ruby
mit
85
master
3,070
require 'cgi' module Repost class Senpai < Action DEFAULT_SUBMIT_BUTTON_TEXT = 'Continue' DEFAULT_CHARSET = 'UTF-8' def initialize(url, params: {}, options: {}) @url = url @params = params @options = options @method = options.fetc...
github
vergilet/repost
https://github.com/vergilet/repost
lib/repost/extend_controller.rb
Ruby
mit
85
master
1,100
if defined?(Rails) && defined?(ActiveSupport) ActiveSupport.on_load(:action_controller) do class ::ActionController::Base def repost(url, params: {}, options: {}) status = options.delete(:status) || :ok authenticity_token = if ['auto', :auto].include?(options[:authenticity_token]) ...
github
vergilet/repost
https://github.com/vergilet/repost
spec/senpai_spec.rb
Ruby
mit
85
master
4,666
require 'spec_helper' RSpec.describe Repost::Senpai do let(:url) { 'http://example.com/endpoint' } let(:html) { described_class.perform(url) } it 'generates post form' do aggregate_failures do expect(html).to include('form') expect(html).to include(url) expect(html).to include("type=\"subm...
github
vergilet/repost
https://github.com/vergilet/repost
spec/spec_helper.rb
Ruby
mit
85
master
237
require "bundler/setup" require 'repost' RSpec.configure do |config| config.example_status_persistence_file_path = ".rspec_status" config.disable_monkey_patching! config.expect_with :rspec do |c| c.syntax = :expect end end
github
technicalpickles/capistrano-spec
https://github.com/technicalpickles/capistrano-spec
capistrano-spec.gemspec
Ruby
mit
85
master
1,639
# Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = "capistrano-spec" s.version = "0.6.3" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_...
github
technicalpickles/capistrano-spec
https://github.com/technicalpickles/capistrano-spec
Rakefile
Ruby
mit
85
master
1,420
require 'rubygems' require 'rake' begin require 'jeweler' Jeweler::Tasks.new do |gem| gem.name = "capistrano-spec" gem.version = '0.6.3' gem.summary = %Q{Test your capistrano recipes} gem.description = %Q{Helpers and matchers for testing capistrano} gem.email = "josh@technicalpickles.com" ...
github
technicalpickles/capistrano-spec
https://github.com/technicalpickles/capistrano-spec
spec/stub_commands_spec.rb
Ruby
mit
85
master
2,323
require 'spec_helper' require 'capistrano' describe 'Command stubbing' do before do @configuration = Capistrano::Configuration.new @configuration.extend Capistrano::Spec::ConfigurationExtension @configuration.load do def remote_pwd capture 'pwd' end def remote_sudo_pwd ...
github
technicalpickles/capistrano-spec
https://github.com/technicalpickles/capistrano-spec
spec/spec_helper.rb
Ruby
mit
85
master
376
$LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'capistrano' require 'capistrano-spec' require 'rspec' require 'rspec/autorun' Dir["./spec/support/**/*.rb"].sort.each { |f| require f } RSpec.configure do |config| config.include Capistrano::Spec::...
github
technicalpickles/capistrano-spec
https://github.com/technicalpickles/capistrano-spec
spec/capistrano-spec_spec.rb
Ruby
mit
85
master
6,561
require 'spec_helper' require 'capistrano' require File.expand_path('../recipe/fakerecipe', __FILE__) describe Capistrano::Spec do before do @configuration = Capistrano::Configuration.new @configuration.extend(Capistrano::Spec::ConfigurationExtension) @configuration.extend(Capistrano::Fakerecipe) Ca...
github
technicalpickles/capistrano-spec
https://github.com/technicalpickles/capistrano-spec
spec/downloaded_spec.rb
Ruby
mit
85
master
1,251
require 'spec_helper' require 'capistrano' describe 'Capistrano has downloaded' do include Capistrano::Spec::Matchers before do @configuration = Capistrano::Configuration.new @configuration.extend Capistrano::Spec::ConfigurationExtension @configuration.load do def download_from_to downlo...
github
technicalpickles/capistrano-spec
https://github.com/technicalpickles/capistrano-spec
spec/uploaded_spec.rb
Ruby
mit
85
master
1,175
require 'spec_helper' require 'capistrano' describe 'Capistrano has uploaded' do include Capistrano::Spec::Matchers before do @configuration = Capistrano::Configuration.new @configuration.extend Capistrano::Spec::ConfigurationExtension @configuration.load do def upload_from_to upload 'so...
github
technicalpickles/capistrano-spec
https://github.com/technicalpickles/capistrano-spec
spec/recipe/fakerecipe.rb
Ruby
mit
85
master
1,648
require 'capistrano' module Capistrano module Fakerecipe def self.load_into(configuration) configuration.load do before "fake:before_this_execute_thing", "fake:thing" before "fake:before_this_also_execute_thing", "fake:thing" before "outside:undefined_task", "fake:thing...