repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
willrax/motion-giphy | lib/motion-giphy/client.rb | <reponame>willrax/motion-giphy
module MotionGiphy
class Client
def self.search(query, options = {}, &block)
options = { q: query }.merge(options)
request.get("search", options) do |response|
response.process_data_as_batch if response.success?
block.call response
end
end
... |
willrax/motion-giphy | lib/motion-giphy/error.rb | module MotionGiphy
class Error
attr_reader :message, :error
def initialize(error)
@error = error
@message = error.localizedDescription
end
end
end
|
willrax/motion-giphy | lib/motion-giphy/configuration.rb | <reponame>willrax/motion-giphy<gh_stars>1-10
module MotionGiphy
class Configuration
class << self
attr_writer :api_key
def configure(&block)
yield self
self
end
def api_key
@api_key
end
end
end
end
|
willrax/motion-giphy | lib/motion-giphy/image.rb | <gh_stars>1-10
module MotionGiphy
class Image
attr_reader :url, :width, :height, :frames, :size, :mp4
def initialize(image_hash)
@url = image_hash["url"]
@width = image_hash["width"].to_i
@height = image_hash["height"].to_i
@frames = image_hash["frames"].to_i
@size = image_hash[... |
willrax/motion-giphy | motion-giphy.gemspec | <filename>motion-giphy.gemspec
# -*- encoding: utf-8 -*-
VERSION = "1.2.3"
Gem::Specification.new do |spec|
spec.name = "motion-giphy"
spec.version = VERSION
spec.authors = ["<NAME>"]
spec.email = ["<EMAIL>"]
spec.description = %q{Giphy API wrapper for RubyMotion}
spec.summar... |
willrax/motion-giphy | lib/motion-giphy/gif.rb | <reponame>willrax/motion-giphy
module MotionGiphy
class Gif
def self.process_batch(data)
data.map { |gif_hash| new(gif_hash) }
end
attr_reader :hash
def initialize(hash)
@hash = hash
end
def id
hash["id"]
end
def giphy_url
hash["url"]
end
def bitly_... |
willrax/motion-giphy | lib/motion-giphy/request.rb | <filename>lib/motion-giphy/request.rb<gh_stars>1-10
module MotionGiphy
class Request
def get(path, options = {}, &block)
client.get(path, create_options(options)) do |result|
block.call response.build_with_result(result)
end
end
private
def client
AFMotion::SessionClient.bui... |
willrax/motion-giphy | lib/motion-giphy/response.rb | <reponame>willrax/motion-giphy<filename>lib/motion-giphy/response.rb
module MotionGiphy
class Response
def self.build_with_result(result)
response = self.new
if result.success?
response.success = true
response.json = result.object
else
response.success = false
re... |
XcooBee/payment-sdk-swift | XcooBeePaymentSdk.podspec | Pod::Spec.new do |spec|
spec.name = "XcooBeePaymentSdk"
spec.version = "1.0.1"
spec.summary = "XcooBee Payment SDK for Swift and iOS"
spec.description = <<-DESC
The XcooBee payment SDK allows you to quickly create contactless payments QR and URL that can be processed in your app. You can us... |
patrick204nqh/ptk-erp-backend | app/controllers/erp/backend/accounts_controller.rb | module Erp
module Backend
class AccountsController < Erp::Backend::BackendController
before_action :set_profile, only: [:profile, :update_profile]
def profile
end
def gallery
end
# Update profile of user but not update user table
# ==> Because email, password,... is im... |
patrick204nqh/ptk-erp-backend | app/controllers/erp/application_controller.rb | module Erp
class ApplicationController < ActionController::Base
include Pundit # from 'app/policies'
protect_from_forgery with: :exception
end
end
|
patrick204nqh/ptk-erp-backend | app/models/erp/user_group.rb | <gh_stars>0
module Erp
class UserGroup < ApplicationRecord
has_many :rooms, class_name: "Erp::UserRoom", foreign_key: "group_id"
has_many :users, through: :rooms, foreign_key: "user_id"
end
end
|
patrick204nqh/ptk-erp-backend | app/controllers/erp/backend/backend_controller.rb | module Erp
module Backend
class BackendController < Erp::ApplicationController
layout "erp/backend/index" # When 'url: https://.../backend/...' => accesst to backend
include Erp::BackendHelper
before_action :set_view # Apply for login/logout layout
before_action :authenticate_user!, :backe... |
patrick204nqh/ptk-erp-backend | app/models/erp/user_profile.rb | <gh_stars>0
module Erp
class UserProfile < ApplicationRecord
# Relations
belongs_to :user, class_name: "Erp::User"
# Mount upload
mount_uploader :avatar, Erp::AvatarUploader
end
end
|
patrick204nqh/ptk-erp-backend | app/helpers/erp/backend_helper.rb | <gh_stars>0
module Erp
module BackendHelper
def check_controller_action(controller: "", action: "")
if params[:controller] == controller && params[:action] == action
return true
else
return false
end
end
def profile_avatar(profile:)
if profile.avatar.present?
... |
patrick204nqh/ptk-erp-backend | app/models/erp/user.rb | module Erp
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
# Validates
validates :user... |
patrick204nqh/ptk-erp-backend | config/routes.rb | <filename>config/routes.rb
Erp::Backend::Engine.routes.draw do
devise_for :users,
class_name: "Erp::User",
module: :devise,
:controllers => {
:sessions => "erp/users/sessions",
:registrations => "erp/users/registrations",
:passwords => "erp/users/passwords",
:confirmation... |
patrick204nqh/ptk-erp-backend | app/models/erp/backend/application_record.rb | <filename>app/models/erp/backend/application_record.rb
module Erp
module Backend
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
end
end
|
patrick204nqh/ptk-erp-backend | lib/erp/backend/engine.rb | <reponame>patrick204nqh/ptk-erp-backend<gh_stars>0
module Erp
module Backend
class Engine < ::Rails::Engine
# require 'jquery-rails'
isolate_namespace Erp
initializer :append_migrations do |app|
unless app.root.to_s.match(root.to_s)
config.paths["db/migrate"].expanded.each do ... |
patrick204nqh/ptk-erp-backend | app/controllers/erp/users/confirmations_controller.rb | <gh_stars>0
module Erp
class Users::ConfirmationsController < Devise::ConfirmationsController
layout :set_layout
# GET /resource/confirmation?confirmation_token=abcdef
def show
self.resource = resource_class.confirm_by_token(params[:confirmation_token])
yield resource if block_given?
... |
patrick204nqh/ptk-erp-backend | lib/erp/backend/version.rb | module Erp
module Backend
VERSION = '0.1.0'
end
end
|
patrick204nqh/ptk-erp-backend | lib/erp/backend.rb | require 'devise'
require 'pundit'
require 'carrierwave' # require gem in scope Erp module
require "erp/backend/version"
require "erp/backend/engine"
module Erp
module Backend
def self.available?(engine_name)
Object.const_defined?("Erp::#{engine_name.to_s.camelize}") # Check engine in available?
end
e... |
patrick204nqh/ptk-erp-backend | db/migrate/20210313191529_add_columns_to_erp_users.rb | <gh_stars>0
class AddColumnsToErpUsers < ActiveRecord::Migration[6.1]
def change
add_column :erp_users, :username, :string
add_column :erp_users, :status, :string, default: "ACTIVE"
add_reference :erp_users, :creator, index: true, references: :erp_users
end
end
|
patrick204nqh/ptk-erp-backend | app/models/erp/user_room.rb | <filename>app/models/erp/user_room.rb
module Erp
class UserRoom < ApplicationRecord
belongs_to :user, class_name: "Erp::User", foreign_key: "user_id"
belongs_to :group, class_name: "Erp::UserGroup", foreign_key: "group_id"
end
end
|
patrick204nqh/ptk-erp-backend | db/migrate/20210316034137_add_user_role_to_users.rb | <gh_stars>0
class AddUserRoleToUsers < ActiveRecord::Migration[6.1]
def change
add_reference :erp_users, :role, references: :erp_user_roles, index: true
end
end
|
patrick204nqh/ptk-erp-backend | app/controllers/erp/frontend/frontend_controller.rb | module Erp
module Frontend
class FrontendController < Erp::ApplicationController
# include Erp::ApplicationHelper # Used in controllers, views of frontend
layout 'erp/frontend/index' # Set frontend layout
before_action :set_view # Apply for login/logout layout
private
def set_view... |
patrick204nqh/ptk-erp-backend | db/migrate/20210316024538_add_user_to_erp_user_profiles.rb | <gh_stars>0
class AddUserToErpUserProfiles < ActiveRecord::Migration[6.1]
def change
add_reference :erp_user_profiles, :user, references: :erp_users, index: { unique: true } # one user just has one profile
end
end
|
patrick204nqh/ptk-erp-backend | lib/erp_backend.rb | require "erp/backend"
require "erp/backend/version"
|
patrick204nqh/ptk-erp-backend | app/policies/erp/backend/dashboard_policy.rb | <reponame>patrick204nqh/ptk-erp-backend
module Erp
module Backend
class DashboardPolicy < Erp::Backend::BackendPolicy
end
end
end |
patrick204nqh/ptk-erp-backend | db/migrate/20210313184503_create_erp_user_roles.rb | class CreateErpUserRoles < ActiveRecord::Migration[6.1]
def change
create_table :erp_user_roles do |t|
t.string :name, default: "DEFAULT"
t.integer :level, default: 100
t.timestamps
end
end
end
|
patrick204nqh/ptk-erp-backend | app/policies/erp/backend/backend_policy.rb | module Erp
module Backend
class BackendPolicy < ApplicationPolicy
def index?
end
def backend_access? # Access to backend if user is super admin or admin
if user.role.present?
user.role.name == Erp::UserRole::ROLE_AS_SUPER_ADMIN || user.role.name == Erp::UserRole::ROLE_AS_ADMIN... |
patrick204nqh/ptk-erp-backend | db/seeds.rb | # Clean database
Erp::User.destroy_all
Erp::UserRole.destroy_all
Erp::UserProfile.destroy_all
# Defined roles
ROLE_AS_SUPER_ADMIN = "SUPER_ADMIN"
ROLE_AS_ADMIN = "ADMIN"
ROLE_AS_DEFAULT = "DEFAULT"
ROLE_AS_PREMIUM = "PREMIUM"
# Create default roles of user
Erp::UserRole.create(name: ROLE_AS_DEFAULT, level: 100)
Erp::... |
patrick204nqh/ptk-erp-backend | app/helpers/erp/application_helper.rb | <gh_stars>0
module Erp
module ApplicationHelper
# Get custom uniquess id
def unique_id
return [*5000..300000].sample.to_s
end
# Format date
def format_date(date)
date.nil? ? '' : date.strftime(t('date_format'))
end
# Format date
def format_datetime(date)
date.nil? ... |
patrick204nqh/ptk-erp-backend | app/models/erp/user_role.rb | <filename>app/models/erp/user_role.rb<gh_stars>0
module Erp
class UserRole < ApplicationRecord
# Roles defined
ROLE_AS_SUPER_ADMIN = "SUPER_ADMIN"
ROLE_AS_ADMIN = "ADMIN"
ROLE_AS_PREMIUM = "PREMIUM"
ROLE_AS_DEFAULT = "DEFAULT"
# Levels defined
LEVEL_OF_SUPER_ADMIN = 400
LEVEL_OF_ADMIN ... |
patrick204nqh/ptk-erp-backend | app/controllers/erp/backend/dashboard_controller.rb | <filename>app/controllers/erp/backend/dashboard_controller.rb<gh_stars>0
module Erp
module Backend
class DashboardController < Erp::Backend::BackendController # Extend all mothods from backend controller
def index
end
end
end
end |
analog-analytics/shortener | app/helpers/shortener/shortener_helper.rb | <gh_stars>0
module Shortener::ShortenerHelper
# generate a url from a url string
def short_url(url, owner=nil, options={})
short_url = Shortener::ShortenedUrl.generate(url, owner)
url_for_options = {
:controller => :"shortener/shortened_urls",
:action => :show,
:id => short_url.uniq... |
analog-analytics/shortener | spec/helpers/shortener_helper_spec.rb | <reponame>analog-analytics/shortener<gh_stars>0
# -*- coding: utf-8 -*-
require 'spec_helper'
describe Shortener::ShortenerHelper do
before { @short_url = Shortener::ShortenedUrl.generate("www.doorkeeperhq.com") }
describe "short_url" do
it "should shorten the url" do
helper.short_url("www.doorkeeperhq.... |
analog-analytics/shortener | spec/models/shortened_url_spec.rb | # -*- coding: utf-8 -*-
require 'spec_helper'
describe Shortener::ShortenedUrl do
it { should belong_to :owner }
it { should validate_presence_of :url }
shared_examples_for "shortened url" do
let(:short_url) { Shortener::ShortenedUrl.generate!(long_url, owner) }
it "should be shortened" do
short_u... |
lanejr/outgain | default_ai.rb | def run(player, world)
cx = 10
cy = 10
[-(player.y - cy), (player.x - cx)]
end
|
lingshengjx/LSHtmlLabel | LSHtmlLabel.podspec |
Pod::Spec.new do |spec|
spec.name = "LSHtmlLabel"
spec.version = "1.0.1"
spec.summary = "custom UILabel"
spec.description = <<-DESC
一个点击文字跳链的UIlabel子类
DESC
spec.homepage = "https://github.com/lingshengjx/LSHtmlLabel"
#spec.license = "MIT (example)"
spe... |
brunoleon/puppet-openvpn | spec/classes/openvpn_init_spec.rb | <gh_stars>0
require 'spec_helper'
describe 'openvpn', :type => :class do
context 'non-systemd systems' do
let(:facts) { {
:concat_basedir => '/var/lib/puppet/concat',
:osfamily => 'Debian',
:lsbdistid => 'Ubuntu',
:lsbdistrelease => '12.04',
} }
it { should create_cla... |
kolide/slack_transformer | spec/slack_transformer/slack/quote_spec.rb | require 'slack_transformer/slack/quote'
RSpec.describe SlackTransformer::Slack::Quote do
let(:transformation) { described_class.new(input) }
describe '#to_html' do
let(:input) { '>blockquote' }
it 'replaces > with <blockquote> and </blockquote>' do
expect(transformation.to_html).to eq('<blockquote>... |
kolide/slack_transformer | spec/slack_transformer/slack_spec.rb | require 'slack_transformer/slack'
RSpec.describe SlackTransformer::Slack do
let(:transformation) { described_class.new(input) }
let(:input) { double('input') }
describe '#to_html' do
let(:bold_transformation) { instance_double('SlackTransformer::Slack::Bold', to_html: bold) }
let(:bold) { double('bold')... |
kolide/slack_transformer | lib/slack_transformer/html.rb | require 'slack_transformer/html/bold'
require 'slack_transformer/html/code'
require 'slack_transformer/html/italics'
require 'slack_transformer/html/lists'
require 'slack_transformer/html/paragraph'
require 'slack_transformer/html/preformatted'
require 'slack_transformer/html/strikethrough'
require 'slack_transformer/h... |
kolide/slack_transformer | spec/slack_transformer/html/code_spec.rb | <reponame>kolide/slack_transformer
require 'slack_transformer/html/code'
RSpec.describe SlackTransformer::Html::Code do
let(:transformation) { described_class.new('<code>code</code>') }
describe '#to_slack' do
it 'replaces <code> and </code> with `' do
expect(transformation.to_slack).to eq('`code`')
... |
kolide/slack_transformer | lib/slack_transformer/html/links.rb | <gh_stars>0
module SlackTransformer
class Html
class Links
attr_reader :input
HTML_PATTERN = %r{
<a
(?:.*?)
href=['"](.+?)['"]
(?:.*?)>
(.+?)
</a>
}x
def initialize(input)
@input = input
end
def to_slack
sub_htm... |
kolide/slack_transformer | spec/slack_transformer/html/lists_spec.rb | require 'slack_transformer/html/lists'
RSpec.describe SlackTransformer::Html::Lists do
let(:transformation) { described_class.new(input) }
describe '#to_slack' do
context 'when a list is unordered' do
let(:input) { '<ul><li>foo</li><li>bar</li><li>baz</li></ul>' }
it 'replaces the list' do
... |
kolide/slack_transformer | spec/slack_transformer/html/bold_spec.rb | require 'slack_transformer/html/bold'
RSpec.describe SlackTransformer::Html::Bold do
let(:transformation) { described_class.new('<b>bold</b>') }
describe '#to_slack' do
it 'replaces <b> and </b> with *' do
expect(transformation.to_slack).to eq('*bold*')
end
end
end
|
kolide/slack_transformer | lib/slack_transformer/slack/italics.rb | module SlackTransformer
class Slack
class Italics
attr_reader :input
PATTERN = /
(?<=^|\W)
# preceded by start of line or non-word character
(?<![*~`])
# but not *, ~, or `, which are mrkdwn delimiters
# Note: _ is also a mrkdwn delimiter, but it's included ... |
kolide/slack_transformer | lib/slack_transformer/slack/quote.rb | <gh_stars>1-10
module SlackTransformer
class Slack
class Quote
attr_reader :input
PATTERN = /
^
# start of line
([*_~]?)
# optionally preceded by *, _, or ~
>(.+?)
# one or more of anything preceded by >
\1
# followed by *, _, or ... |
kolide/slack_transformer | spec/slack_transformer/slack/blockquote_spec.rb | require 'slack_transformer/slack/blockquote'
RSpec.describe SlackTransformer::Slack::Blockquote do
let(:transformation) { described_class.new(input) }
describe '#to_html' do
let(:input) { ">>>blockquote\nblockquote" }
it 'replaces >>> with <blockquote> and </blockquote>' do
expect(transformation.to... |
kolide/slack_transformer | lib/slack_transformer/date.rb | require 'set'
require 'time'
module SlackTransformer
class Date
attr_reader :input, :format, :link, :fallback
class InvalidTokenError < StandardError; end
# See https://api.slack.com/docs/message-formatting#formatting_dates
DATE_FORMAT_TOKENS = Set.new(%w[
{date_num}
{date}
{date_... |
kolide/slack_transformer | spec/slack_transformer/slack/preformatted_spec.rb | require 'slack_transformer/slack/preformatted'
RSpec.describe SlackTransformer::Slack::Preformatted do
let(:transformation) { described_class.new(input) }
describe '#to_html' do
let(:input) { '```preformatted```' }
it 'replaces ``` with <pre> and </pre>' do
expect(transformation.to_html).to eq('<pr... |
kolide/slack_transformer | spec/slack_transformer/html_spec.rb | <gh_stars>1-10
require 'slack_transformer/html'
RSpec.describe SlackTransformer::Html do
let(:transformation) { described_class.new(input) }
let(:input) { double('input') }
describe '#to_slack' do
let(:bold_transformation) { instance_double('SlackTransformer::Html::Bold', to_slack: bold) }
let(:bold) { ... |
kolide/slack_transformer | lib/slack_transformer/slack/blockquote.rb | module SlackTransformer
class Slack
class Blockquote
attr_reader :input
PATTERN = /
^
# start of line
([*_~]?)
# optionally preceded by *, _, or ~
>{3}(.+)
# one or more of anything preceded by >
\1
# followed by *, _, or ~ if pre... |
kolide/slack_transformer | lib/slack_transformer/entities.rb | <gh_stars>1-10
module SlackTransformer
class Entities
attr_reader :input
def initialize(input)
@input = input
end
# See https://api.slack.com/docs/message-formatting#how_to_escape_characters
# NB: The order matters here. If you were to replace < with < first, for
# example, you'd ... |
kolide/slack_transformer | spec/slack_transformer/entities_spec.rb | <filename>spec/slack_transformer/entities_spec.rb
require 'slack_transformer/entities'
RSpec.describe SlackTransformer::Entities do
describe '#to_slack' do
it 'replaces & with &' do
expect(described_class.new('&').to_slack).to eq('&')
end
it 'replaces < with <' do
expect(described... |
kolide/slack_transformer | lib/slack_transformer/slack.rb | require 'slack_transformer/slack/blockquote'
require 'slack_transformer/slack/bold'
require 'slack_transformer/slack/code'
require 'slack_transformer/slack/italics'
require 'slack_transformer/slack/preformatted'
require 'slack_transformer/slack/quote'
require 'slack_transformer/slack/strikethrough'
module SlackTransfo... |
kolide/slack_transformer | lib/slack_transformer/html/paragraph.rb | module SlackTransformer
class Html
class Paragraph
attr_reader :input
def initialize(input)
@input = input
end
def to_slack
input.gsub(/<\/?p>/, "")
end
end
end
end
|
jomz/radiant-mailer-extension | spec/models/mail_spec.rb | require File.dirname(__FILE__) + "/../spec_helper"
describe Mail do
dataset :mailer_page
before :each do
@page = pages(:mail_form)
@page.request = ActionController::TestRequest.new
@page.last_mail = @mail = Mail.new(@page, {:recipients => ['<EMAIL>'], :from => '<EMAIL>'}, {'body' => 'Hello, world!'})
... |
karsonhatch/this_is_a_gem | lib/this_is_a_gem.rb | <gh_stars>0
require "this_is_a_gem/version"
module ThisIsAGem
def self.reversify(str)
str.split('').reverse.join('')
end
def self.casify(str)
to_case = [:upcase, :downcase]
arr = str.split("")
arr.each_with_index do |letter, i|
this_case = to_case[rand(2)]
arr[i] = letter.send(this_case)
end
end
... |
bsxfun/pffdtd | ruby_SU/RoomExporter.rb | # encoding: UTF-8
require 'sketchup.rb'
require 'extensions.rb'
module RoomExportExtension
extension = SketchupExtension.new("Room Exporter", #name
"RoomExporter/RoomExport") #import file
extension.version = "1.0.0"
extension.creator = "<NAME>"
extension.copyright = "© <NAM... |
bsxfun/pffdtd | ruby_SU/RoomExporter/RoomExport.rb | # vim: set expandtab
# vim: set tabstop=2
##############################################################################
# This file is a part of PFFDTD.
#
# PFFTD is released under the MIT License.
# For details see the LICENSE file.
#
# Copyright 2021 <NAME>.
#
# File name: RoomExport.rb
#
# Description: Function... |
armandfardeau/metabase_cli | lib/metabase_cli.rb | <gh_stars>0
# frozen_string_literal: true
require_relative "metabase_cli/version"
require_relative "metabase_cli/cli"
module MetabaseCli
class Error < StandardError; end
# Your code goes here...
end
|
armandfardeau/metabase_cli | lib/metabase_cli/database_service.rb | <gh_stars>0
# frozen_string_literal: true
require "metabase"
require "hash_deep_merge"
require_relative "api"
module MetabaseCli
class DatabaseService
include MetabaseCli::Api
def initialize(client_name:, dbname:, engine:, host:, port:, dbusername:, password:)
@client_name = client_name
@dbname... |
armandfardeau/metabase_cli | lib/metabase_cli/cli.rb | # frozen_string_literal: true
require "thor"
require "metabase_cli/database_service"
require "metabase_cli/user_service"
require "metabase_cli/group_service"
module MetabaseCli
class CLI < Thor
desc "version", "Prints the version"
def version
puts "MetabaseApi version #{MetabaseCli::VERSION}"
end... |
armandfardeau/metabase_cli | lib/metabase_cli/user_service.rb | <gh_stars>0
# frozen_string_literal: true
require "metabase"
require "hash_deep_merge"
require "securerandom"
require_relative "api"
module MetabaseCli
class UserService
def initialize(last_name:, first_name:, email:, group_wanted:)
@last_name = last_name
@first_name = first_name
@email = emai... |
armandfardeau/metabase_cli | lib/metabase_cli/api.rb | # frozen_string_literal: true
require "metabase"
require "hash_deep_merge"
module MetabaseCli
module Api
def self.client
raise "Missing url" unless ENV["METABASE_URL"]
raise "Missing username" unless ENV["METABASE_USERNAME"]
raise "Missing password" unless ENV["METABASE_PASSWORD"]
@clie... |
armandfardeau/metabase_cli | lib/metabase_cli/group_service.rb | # frozen_string_literal: true
require "metabase"
require "hash_deep_merge"
require_relative "api"
module MetabaseCli
class GroupService
include MetabaseCli::Api
def initialize(name:)
@name = name
@group_id = nil
end
def create_group
response = MetabaseCli::Api.client.post("/api/p... |
egotter/timeout_job | lib/timeout_job.rb | <reponame>egotter/timeout_job<filename>lib/timeout_job.rb
require 'timeout'
require 'logger'
require "timeout_job/version"
module TimeoutJob
class Middleware
def call(worker, msg, queue, &block)
if worker.respond_to?(:timeout_in)
result = yield_with_timeout(worker.timeout_in, &block)
if t... |
egotter/timeout_job | test/timeout_job_test.rb | <gh_stars>0
require "test_helper"
class TimeoutJobTest < Minitest::Test
class Worker
end
class TimeoutWorker
def timeout_in(*args)
10
end
def after_timeout(*args)
'callback'
end
end
def test_call
msg = {'args' => 'args'}
result = TimeoutJob::Middleware.new.call(Worker... |
egotter/timeout_job | test/test_helper.rb | $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
require "timeout_job"
require "minitest/autorun"
|
pankajso/markdown_editor | app/models/page.rb | class Page < ActiveRecord::Base
require 'kramdown'
def transformed_md
Kramdown::Document.new(self.content).to_html
end
end
|
wynandpieterse/StickyRay | automation/vagrant/SetUpProvisionLogging.rb | #
# The MIT License (MIT)
#
# Copyright (c) 2014 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modif... |
wynandpieterse/StickyRay | automation/vagrant/SetUpCoreOSClusterToken.rb | <filename>automation/vagrant/SetUpCoreOSClusterToken.rb
#
# The MIT License (MIT)
#
# Copyright (c) 2014 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, inclu... |
wynandpieterse/StickyRay | automation/vagrant/DefineControlVM.rb | <reponame>wynandpieterse/StickyRay
#
# The MIT License (MIT)
#
# Copyright (c) 2014 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitati... |
wynandpieterse/StickyRay | automation/vagrant/SetUpSerialLogging.rb | #
# The MIT License (MIT)
#
# Copyright (c) 2014 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modif... |
wynandpieterse/StickyRay | configuration/vagrant/Configuration.rb | <gh_stars>0
#
# The MIT License (MIT)
#
# Copyright (c) 2014 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use,... |
wynandpieterse/StickyRay | automation/vagrant/DefineCommonVM.rb | #
# The MIT License (MIT)
#
# Copyright (c) 2014 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modif... |
wynandpieterse/StickyRay | automation/vagrant/DefineCoreOSVM.rb | #
# The MIT License (MIT)
#
# Copyright (c) 2014 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modif... |
VidAngel/react-native-video-with-ads | react-native-video.podspec | <gh_stars>0
require "json"
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
Pod::Spec.new do |s|
s.name = 'react-native-video'
s.version = package['version']
s.summary = package['description']
s.description = package['description']
s.license = package['li... |
dringoen/audited | lib/audited-activerecord.rb | require 'audited'
require 'audited/adapters/active_record'
|
dringoen/audited | spec/support/mongo_mapper/connection.rb | <gh_stars>10-100
require 'mongo_mapper'
MongoMapper.connection = Mongo::Connection.new
MongoMapper.database = 'audited_test'
|
dringoen/audited | spec/audited/adapters/mongo_mapper/mongo_mapper_spec_helper.rb | require 'spec_helper'
require 'support/mongo_mapper/connection'
require 'audited/adapters/mongo_mapper'
require 'support/mongo_mapper/models'
load "audited/sweeper.rb" # force to reload sweeper
|
dringoen/audited | lib/audited/active_record/version.rb | module Audited
module ActiveRecord
VERSION = "4.2.0"
end
end |
dringoen/audited | audited-mongo_mapper.gemspec | # encoding: utf-8
$:.push File.expand_path("../lib", __FILE__)
require "audited/version"
require "audited/mongo_mapper/version"
Gem::Specification.new do |gem|
gem.name = 'audited-mongo_mapper'
gem.version = Audited::MongoMapper::VERSION
gem.authors = ['<NAME>', '<NAME>', '<NAME>', '<NAME>', '<NAME>', '... |
dringoen/audited | lib/audited-mongo_mapper.rb | require 'audited'
require 'audited/adapters/mongo_mapper'
|
dringoen/audited | spec/support/active_record/schema.rb | require 'active_record'
require 'logger'
ActiveRecord::Base.establish_connection
ActiveRecord::Base.logger = Logger.new(SPEC_ROOT.join('debug.log'))
ActiveRecord::Migration.verbose = false
ActiveRecord::Schema.define do
create_table :users, :force => true do |t|
t.column :name, :string
t.column :username, :... |
dringoen/audited | lib/audited/sweeper.rb | require "rails/observers/activerecord/active_record"
require "rails/observers/action_controller/caching"
module Audited
class Sweeper < ActionController::Caching::Sweeper
observe Audited.audit_class
attr_accessor :controller
def before(controller)
self.controller = controller
true
end
... |
dringoen/audited | lib/audited/adapters/active_record/audit.rb | require 'set'
require 'audited/audit'
module Audited
module Adapters
module ActiveRecord
# Audit saves the changes to ActiveRecord models. It has the following attributes:
#
# * <tt>auditable</tt>: the ActiveRecord model that was changed
# * <tt>user</tt>: the user that performed the cha... |
dringoen/audited | spec/audited/adapters/active_record/active_record_spec_helper.rb | require 'spec_helper'
require 'support/active_record/schema'
require 'audited/adapters/active_record'
require 'support/active_record/models'
load "audited/sweeper.rb" # force to reload sweeper
|
dringoen/audited | lib/audited/adapters/active_record.rb | <reponame>dringoen/audited<gh_stars>10-100
require 'active_record'
require 'audited/auditor'
require 'audited/adapters/active_record/audit'
module Audited::Auditor::ClassMethods
def default_ignored_attributes
[self.primary_key, inheritance_column]
end
end
::ActiveRecord::Base.send :include, Audited::Auditor
... |
dringoen/audited | lib/audited/mongo_mapper/version.rb | module Audited
module MongoMapper
VERSION = "4.2.0"
end
end |
dringoen/audited | lib/audited/adapters/mongo_mapper/audited_changes.rb | <gh_stars>10-100
module Audited
module Adapters
module MongoMapper
class AuditedChanges < ::Hash
def self.from_mongo(changes)
changes.is_a?(Hash) ? new.replace(changes) : changes
end
def self.to_mongo(changes)
if changes.is_a?(Hash)
changes.inject({})... |
rubrikinc/ruby-delete-relics | lib/parseoptions.rb | <filename>lib/parseoptions.rb
require 'optparse'
require 'optparse/time'
require 'ostruct'
class ParseOptions
CODES = %w[iso-2022-jp shift_jis euc-jp utf8 binary]
CODE_ALIASES = { "jis" => "iso-2022-jp", "sjis" => "shift_jis" }
def self.parse(args)
options = OpenStruct.new
opt_parser = OptionParser.new do ... |
rubrikinc/ruby-delete-relics | rubrik.rb | <gh_stars>0
$LOAD_PATH.unshift File.expand_path('../lib/', __FILE__)
require 'parseoptions.rb'
require 'pp'
require 'getCreds.rb'
require 'json'
require 'csv'
require 'uri'
require 'restCall.rb'
require 'getToken.rb'
date = DateTime.now.strftime('%Y-%m-%d.%H-%M-%S')
# BEGIN
Creds = getCreds();
Begintime=Time.now
Log... |
rubrikinc/ruby-delete-relics | lib/restCall.rb | <filename>lib/restCall.rb<gh_stars>0
require 'net/https'
require 'getToken.rb'
def restCall(server,endpoint,l,type,header)
begin
endpoint = URI.encode(endpoint)
if header.to_s.empty? # Rubrik and Basic Auth
(u,pw,sv) = get_token(server)
conn = Faraday.new(:url => 'https://' + sv.sample(1)[0], req... |
rubrikinc/ruby-delete-relics | lib/getCreds.rb | # Simple Parser for Credential File, normally ~/.rubrik/creds.json
# Format of creds.json :
# {
# "server": "[cluster_address]",
# "username": "[username]",
# "password": "[password]"
#}
# Most routines will accept login info as arguments (arg1 arg2 node username password)
require 'json'
def getCre... |
yans67/yanOptionBarController | yanOptionBarController.podspec | <gh_stars>1-10
Pod::Spec.new do |s|
s.name = "yanOptionBarController"
s.version = "0.0.4"
s.summary = "OptionBarController for iOS"
s.description = "OptionBarController is iPad and iPhone compatible. Supports landscape and portrait orientations and can be used inside UITabbarController."
s.... |
ight/bazzar | app/controllers/user_sessions_controller.rb | class UserSessionsController < Devise::SessionsController
skip_before_action :verify_authenticity_token, :verify_signed_out_user
skip_before_action :authenticate_user!, only: [:create]
respond_to :json
swagger_controller :user_sessions, "User Login Management"
swagger_api :create do
summary 'Sign in a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.