repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
Youshu31415926/igetui-ruby | lib/igetui.rb | require 'forwardable'
require 'net/http'
require 'uri'
require 'json'
require 'digest/md5'
require 'base64'
module IGeTui
class << self
extend Forwardable
API_URL = "http://sdk.open.api.igexin.com/apiex.htm"
attr_reader :pusher
def_delegators :pusher, :push_message_to_single
def_delegators :pu... |
snanda85/snanda85.github.io | generate.rb | <gh_stars>0
require 'date'
require 'optparse'
options = {}
opts = OptionParser.new do |opts|
opts.banner = "Usage:\n\tgenerate.rb title category " +
"\n\nOptions:\n\tcategory\tblog, writeup"
end
opts.parse!
if ARGV.empty?
puts opts.banner
exit
end
options[:title] = ARGV.shift
options[:category] = ARGV.shi... |
wonko9/pg_trigger_count | lib/pg_trigger_count/scope_reflection.rb | class PgTriggerCount
class ScopeReflection
attr_accessor :reflection, :scope
def initialize(reflection,options)
@reflection = reflection
@scope = options[:scope]
@scope_tables[k][:table] ||= options[:table]
@scope_tables[k][:foreign_key] ||= "#{options[:table].singularize}_... |
wonko9/pg_trigger_count | lib/pg_trigger_count/generator.rb | require 'forwardable'
class PgTriggerCount
class Generator
attr_accessor :reflections
def initialize(reflections)
@reflections = [reflections].flatten.collect{|r|PgTriggerCount::Generator::Reflection.new(r)}
end
def counts_classes
reflections.collect{|reflection| reflection.coun... |
wonko9/pg_trigger_count | tasks/pg_trigger_count_tasks.rake | <reponame>wonko9/pg_trigger_count<filename>tasks/pg_trigger_count_tasks.rake
require 'rubygems'
require 'rake'
require 'active_record'
# require "#{File.dirname(__FILE__)}/../../config/environment.rb"
namespace :pgtc do
desc 'Generate Functions'
task :generate_functions do
end
end |
wonko9/pg_trigger_count | lib/active_record_extensions.rb | class PgTriggerCountError < StandardError; end
module ActiveRecord
class Base
def self.pg_trigger_count(count_column,options={})
options[:count_column] ||= count_column
options[:counted_class] ||= options[:class_name] if options[:class_name]
options[:counter_class] = self
reflection ... |
wonko9/pg_trigger_count | test/generator_test.rb | <gh_stars>1-10
require File.dirname(__FILE__) + '/test_helper'
require 'active_record'
require 'rails_generator'
require 'rails_generator/scripts/generate'
require "#{File.dirname(__FILE__)}/../generators/pg_trigger_count/pg_trigger_count_generator"
class GeneratorTest < Test::Unit::TestCase
# should "probably renam... |
wonko9/pg_trigger_count | lib/pg_trigger_count/old_generator.rb | <gh_stars>1-10
class PgTriggerCount::Generator
attr_accessor :by, :scope, :counts_table, :trig_name, :recalc_name,
:table_name, :invalidate_cache, :options, :count_column, :name
def initialize(table_name, options)
@table_name = table_name
@options = options
@by ... |
wonko9/pg_trigger_count | generators/pg_trigger_count/pg_trigger_count_generator.rb | <gh_stars>1-10
require 'rails_generator'
class PgTriggerCountGenerator < Rails::Generator::NamedBase
def initialize(runtime_args, runtime_options = {})
super
end
def banner
"Usage: #{$0}"
end
def manifest
@generator = PgTriggerCount.generator
record do |m|
now = Ti... |
wonko9/pg_trigger_count | test/pg_trigger_count_test.rb | <reponame>wonko9/pg_trigger_count
require File.dirname(__FILE__) + '/test_helper'
require 'ostruct'
class PgTriggerCountTest < Test::Unit::TestCase
# context "Basic Reflection" do
#
# setup do
# @reflection = PgTriggerCount::Reflection.new(:count_column => :messages, :counter_class => "User")
# e... |
wonko9/pg_trigger_count | lib/pg_trigger_count/generator/counted_table.rb | <reponame>wonko9/pg_trigger_count<gh_stars>1-10
class PgTriggerCount::Generator
class CountedTable
attr_accessor :reflections
def initialize(reflections)
@reflections = [reflections].flatten.collect{|r|PgTriggerCount::Generator::Reflection.new(r)}
end
def add(reflection)
@reflect... |
wonko9/pg_trigger_count | generators/pg_trigger_count/templates/migration.rb | <filename>generators/pg_trigger_count/templates/migration.rb<gh_stars>1-10
class <%= migration_name %> < ActiveRecord::Migration
def self.up
ActiveRecord::Base.connection.execute("create language 'plpgsql'") rescue ActiveRecord::StatementInvalid
<%- new_tables.each do |table_name, columns| -%>
crea... |
wonko9/pg_trigger_count | lib/pg_trigger_count/generator/reflection.rb | <reponame>wonko9/pg_trigger_count<gh_stars>1-10
require 'forwardable'
class PgTriggerCount::Generator
class Reflection
attr_accessor :reflection
def initialize(reflection)
@reflection = reflection
end
def quote(val)
ActiveRecord::Base.connection.quote(val)
end
def select_cou... |
wonko9/pg_trigger_count | lib/pg_trigger_count/reflection.rb | <filename>lib/pg_trigger_count/reflection.rb
class PgTriggerCount
class PgtcCallbacks
attr_accessor :reflection
def initialize(reflection)
@reflection = reflection
end
def after_save(record)
reflection.counts_class.cached_index("by_#{reflection.counts_keys.keys.first}").invali... |
wonko9/pg_trigger_count | test/test_helper.rb | <reponame>wonko9/pg_trigger_count
require 'rubygems'
require 'pp'
require 'test/unit'
require 'shoulda'
require 'mocha'
require 'erb'
require 'ostruct'
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.dirname(__FILE__) + "/../lib")
# $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../... |
wonko9/pg_trigger_count | lib/pg_trigger_count.rb | $:.unshift(File.dirname(__FILE__))
require 'active_record'
require 'active_support'
require 'active_record_extensions'
require 'pg_trigger_count/reflection'
require 'pg_trigger_count/generator'
require 'pg_trigger_count/generator/reflection'
require 'pg_trigger_count/generator/counted_table'
class PgTriggerCount
d... |
ivan1993br/autoproj-docker-enviroment | image/autoproj.buildconf/autoproj/overrides.rb | <gh_stars>0
# Under MIT License
#author <NAME>
# Write in this file customization code that will get executed after all the
# soures have beenloaded.
Autoproj.manifest.each_autobuild_package do |pkg|
pkg.define "CMAKE_EXPORT_COMPILE_COMMANDS", "ON" if pkg.kind_of?(Autobuild::CMake)
end
|
ivan1993br/autoproj-docker-enviroment | image/autoproj.buildconf/autoproj/init.rb | <reponame>ivan1993br/autoproj-docker-enviroment
# Under MIT License
#author <NAME>
# Write in this file customization code that will get executed before
# autoproj is loaded.
# Set the path to 'make'
# Autobuild.commands['make'] = '/path/to/ccmake'
# Set the parallel build level (defaults to the n... |
twe4ked/terminal_game_engine | lib/terminal_game_engine/frame.rb | <filename>lib/terminal_game_engine/frame.rb
require 'io/console'
module TerminalGameEngine
class Frame
attr_reader :rows
def initialize(width, height)
@rows = height.times.map { ' ' * width }
end
def width
@rows.first.size
end
def height
@rows.size
end
def draw(x... |
xLeachimx/NeuralNetworks | ruby/neural_net.rb | <reponame>xLeachimx/NeuralNetworks
class Neuron
attr_reader :activation
attr_accessor :error
attr_accessor :connections
attr_accessor :bias
def initialize
@inputs = []
@connections = []
@bias = 0.0
@error = 0.0
end
def addInput input
@inputs.push(input)
end
def calcActivation
... |
xLeachimx/NeuralNetworks | ruby/test.rb | <filename>ruby/test.rb
require_relative 'neural_net'
class TestCase
attr_accessor :input
attr_accessor :expectation
def initialize input, expectation
@input = input
@expectation = expectation
end
def expectationMatched output
return false if output.length != @expectation.length
output.each_... |
bethesque/pact-consumer-minitest | spec/lib/pact/consumer/minitest_spec.rb | require "minitest/autorun"
require 'minitest'
require 'pact/consumer/minitest'
require 'mocha/mini_test'
require './spec/support/test'
describe Pact::Consumer::Minitest do
it "does not load RSpec" do
assert_equal(nil, defined?(::RSpec))
end
describe "hooks" do
before do
pact_test.reset
pact... |
bethesque/pact-consumer-minitest | spec/support/client.rb | require 'httparty'
class Something
attr_reader :name
def initialize name
@name = name
end
def == other
other.is_a?(Something) && other.name == name
end
end
class MyServiceProviderClient
include HTTParty
base_uri 'http://my-service'
def get_something
name = JSON.parse(self.class.get("... |
bethesque/pact-consumer-minitest | example/zoo-app/spec/service_providers/animal_service_client_spec.rb | require_relative 'pact_helper'
require 'zoo_app/animal_service_client'
module ZooApp
describe AnimalServiceClient do
include Pact::Consumer::Minitest
before do
AnimalServiceClient.base_uri animal_service.mock_service_base_url
end
describe ".find_alligator_by_name" do
describe "when an ... |
bethesque/pact-consumer-minitest | spec/support/test.rb | module BaseTest
# Need this to support the 'super' calls
def before_setup; end
def after_teardown; end
end
module Pact
module Consumer
module Minitest
def reset
# Dirty hack to clear @@before_suite_hook_ran flag
# for tests
@@before_suite_hook_ran = false
end
end
... |
bethesque/pact-consumer-minitest | spec/integration/minitest_unit.rb | <gh_stars>1-10
require './spec/support/client.rb'
require 'minitest/autorun'
require 'minitest'
require 'pact/consumer/minitest'
Pact.service_consumer "My Other Service Consumer" do
has_pact_with "My Other Service Provider" do
mock_service :my_other_service_provider do
port 1235
end
end
end
class M... |
bethesque/pact-consumer-minitest | lib/pact/consumer/minitest/version.rb | module Pact
module Consumer
module Minitest
VERSION = "1.0.1"
end
end
end
|
bethesque/pact-consumer-minitest | tasks/test.rake | <filename>tasks/test.rake
require 'rake/testtask'
Rake::TestTask.new(:test) do |t|
t.pattern = "spec/lib/**/*_spec.rb"
end
Rake::TestTask.new (:integration) do |t|
t.pattern = "spec/integration/**/*.rb"
end
namespace :pact do
desc "Ensure pact file is written"
task 'test:pactfile' do
pact_path = './spec... |
bethesque/pact-consumer-minitest | lib/pact/consumer/minitest.rb | <filename>lib/pact/consumer/minitest.rb
require 'minitest'
require 'pact/consumer/minitest/version'
require 'pact/consumer'
require 'pact/consumer/spec_hooks'
module Pact
module Consumer
module Minitest
include Pact::Consumer::ConsumerContractBuilders
def pact_spec_hooks
@@pact_spec_hooks |... |
bethesque/pact-consumer-minitest | spec/integration/minitest_spec.rb | <reponame>bethesque/pact-consumer-minitest
require './spec/support/client.rb'
require 'minitest/autorun'
require 'minitest'
require 'pact/consumer/minitest'
Pact.service_consumer "My Service Consumer" do
has_pact_with "My Service Provider" do
mock_service :my_service_provider do
port 1234
end
end
en... |
bethesque/pact-consumer-minitest | example/zoo-app/lib/zoo_app/animal_service_client.rb | <filename>example/zoo-app/lib/zoo_app/animal_service_client.rb
require 'httparty'
require 'zoo_app/models/alligator'
module ZooApp
class AnimalServiceError < StandardError; end
class AnimalServiceClient
include HTTParty
base_uri 'animal-service.com'
def self.find_alligators
response = get("/a... |
worldline-spain/T21Mapping | T21Mapping.podspec | Pod::Spec.new do |s|
s.name = "T21Mapping"
s.version = "2.1.0"
s.summary = "T21Mapping is a simple class which wraps a generic mapping function."
s.author = "<NAME>"
s.platform = :ios
s.ios.deployment_target = "10.0"
s.source = { :git => "https://github.com/worldline-spain/T21Mapping.git... |
positronicninja/gnr_authorized_users | recipes/configure.rb | #
# Cookbook Name:: gnr_authorized_users
# Recipe:: configure
#
# Copyright 2016, Gryphon & Rook Inc
#
users = data_bag_item('ssh', 'users')
users.delete('id')
users.each do |name, ssh_key|
ssh_authorize_key name do
key ssh_key['key']
user ssh_key['user']
end
end
|
positronicninja/gnr_authorized_users | metadata.rb | name 'gnr_authorized_users'
maintainer '<NAME> Inc'
license 'All rights reserved'
description 'Configures authorized users'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0'
depends 'ssh_authorized_keys'
|
johngallagher/example-middleman-netlify-cms | config.rb | #Bootstrap is used to style bits of the demo. Remove it from the config, gemfile and stylesheets to stop using bootstrap
require "uglifier"
# Activate and configure extensions
# https://middlemanapp.com/advanced/configuration/#configuring-extensions
# Use '#id' and '.classname' as div shortcuts in slim
# http://slim-... |
Betterment/site_prism | test_site/sections/people.rb | class People < SitePrism::Section
element :headline, 'h1'
element :dinosaur, '.dinosaur' #doesn't exist on the page
elements :individuals, '.person'
end
|
Betterment/site_prism | lib/site_prism/exceptions.rb | module SitePrism
class NoUrlForPage < StandardError; end
class NoUrlMatcherForPage < StandardError; end
class InvalidUrlMatcher < StandardError; end
class NoSelectorForElement < StandardError; end
class TimeoutException < StandardError; end
class TimeOutWaitingForElementVisibility < StandardError; end
cla... |
Betterment/site_prism | spec/page_spec.rb | require 'spec_helper'
describe SitePrism::Page do
before do
allow(SitePrism::Waiter).to receive(:default_wait_time).and_return 0
end
it "should respond to load" do
expect(SitePrism::Page.new).to respond_to :load
end
it "should respond to set_url" do
expect(SitePrism::Page).to respond_to :set_u... |
Betterment/site_prism | spec/sections_spec.rb | require 'spec_helper'
describe SitePrism::Page do
it "should respond to sections" do
expect(SitePrism::Page).to respond_to :sections
end
it "should create a matching existence method for sections" do
class SomePageWithSectionsThatNeedsTestingForExistence < SitePrism::Section
end
class YetAnothe... |
Betterment/site_prism | features/support/env.rb | <reponame>Betterment/site_prism
unless ENV['CI']
require 'simplecov'
SimpleCov.start
end
require 'capybara'
require 'capybara/dsl'
require 'capybara/cucumber'
require 'selenium-webdriver'
require 'rspec/collection_matchers'
$: << './test_site'
$: << './lib'
require 'site_prism'
require 'test_site'
require 'secti... |
Betterment/site_prism | test_site/pages/section_experiments.rb | class TestSectionExperiments < SitePrism::Page
set_url '/section_experiments.htm'
section :parent_section, Parent, '.parent-div'
sections :search_results, SearchResult, '.search-results .search-result'
section :anonymous_section, '.anonymous-section' do
element :title, 'h1'
def upcase_title_text
... |
Betterment/site_prism | test_site/pages/my_iframe.rb | class MyIframe < SitePrism::Page
element :some_text, 'span#some_text_in_an_iframe'
end
|
Betterment/site_prism | features/step_definitions/page_element_interaction_steps.rb | <gh_stars>0
Then /^I can get the page title$/ do
expect(@test_site.home.title).to eq "Home Page"
end
Then /^the page has no title$/ do
expect(@test_site.no_title.title).to eq ""
end
Then /^the page does not have element$/ do
@test_site.home.has_no_nonexistent_element?
expect(@test_site.home).to have_no_nonexi... |
Betterment/site_prism | lib/site_prism/waiter.rb | module SitePrism
class Waiter
def self.wait_until_true(wait_time_seconds=default_wait_time)
start_time = Time.now
loop do
return true if yield
break unless Time.now - start_time <= wait_time_seconds
sleep(0.05)
end
raise SitePrism::TimeoutException.new, "Timed out w... |
Betterment/site_prism | spec/spec_helper.rb | <gh_stars>1-10
require 'capybara'
require 'capybara/dsl'
require 'selenium-webdriver'
$: << './test_site'
$: << './lib'
require 'site_prism'
require 'test_site'
require 'sections/people'
require 'sections/no_element_within_section'
require 'sections/container_with_element'
require 'pages/my_iframe'
require 'pages/hom... |
Betterment/site_prism | lib/site_prism/version.rb | module SitePrism
VERSION = "2.6"
end
|
Betterment/site_prism | spec/element_spec.rb | <filename>spec/element_spec.rb
require 'spec_helper'
describe SitePrism::Page do
it "should respond to element" do
expect(SitePrism::Page).to respond_to :element
end
it "element method should generate existence check method" do
class PageWithElement < SitePrism::Page
element :bob, 'a.b c.d'
en... |
Betterment/site_prism | features/step_definitions/wait_steps.rb | <reponame>Betterment/site_prism
Then /^when I wait for the element that takes a while to appear$/ do
@test_site.home.wait_for_some_slow_element
end
Then /^I successfully wait for it to appear$/ do
expect(@test_site.home).to have_some_slow_element
end
When /^I wait for a specifically short amount of time for an el... |
Betterment/site_prism | lib/site_prism/page.rb | module SitePrism
class Page
include Capybara::DSL
include ElementChecker
extend ElementContainer
def page
@page || Capybara.current_session
end
def load(expansion_or_html = {})
if expansion_or_html.is_a? String
@page = Capybara.string(expansion_or_html)
else
... |
diasks2/pragmatic_segmenter_gui | pragmatic_segmenter.rb | # encoding: utf-8
Shoes.setup do
gem 'pragmatic_segmenter', '0.3.3'
end
require 'pragmatic_segmenter'
LANGUAGE_CODES = {
'en' => 'English',
'de' => 'German',
'es' => 'Spanish',
'fr' => 'French',
'it' => 'Italian',
'ja' => 'Japanese',
'el' => 'Greek',
'ru' => 'Russian',
'ar' => 'Arabic',
'am' =>... |
citrusbyte/openshift-sinatra-redis | app.rb | <filename>app.rb
require 'sinatra'
require 'redis'
configure do
REDIS_HOST = ENV['OPENSHIFT_REDIS_HOST']
REDIS_PORT = ENV['OPENSHIFT_REDIS_PORT']
REDIS_PW = ENV['REDIS_PASSWORD']
REDIS = Redis.new(:host => REDIS_HOST, :port => REDIS_PORT, :password => <PASSWORD>)
end
get '/' do
"the time where this... |
asfktz/rails-sample-app | app/helpers/application_helper.rb | <filename>app/helpers/application_helper.rb
module ApplicationHelper
def full_title(page_title = '')
base_title = 'Ruby on Rails Tutorial Sample App'
unless page_title.empty?
return page_title + ' | ' + base_title
end
return base_title
end
end
|
asfktz/rails-sample-app | test/models/user_test.rb | require 'test_helper'
class UserTest < ActiveSupport::TestCase
def setup
@user = User.new(
name: 'bob',
email: '<EMAIL>',
password: '<PASSWORD>',
password_confirmation: '<PASSWORD>'
)
end
test "should be valid" do
assert @user.valid?
end
test "password should be presen... |
asfktz/rails-sample-app | try.rb |
class Person
def greet
puts 'koko'
end
end
class Bob < Person
10.times do
greet
end
end |
KritR/Bitcoin-Spigot | main.rb | <gh_stars>0
#!/usr/bin/env ruby
#################################
# INCLUDING REQUIREMENTS #
#################################
require 'rubygems'
require 'watir-webdriver'
require 'io/console'
require 'open-uri'
require 'tmpdir'
require 'rmagick'
require 'base64'
require 'net/http'
require 'rtesseract'
require... |
MatheusFalcao/adm | lib/tasks/creat_admin.rake | <gh_stars>0
namespace :creat_admin do
@usr = User.new
@usr.email = "<EMAIL>"
@usr.password = "<PASSWORD>"
@usr.save
end
|
MatheusFalcao/adm | config/routes.rb | Rails.application.routes.draw do
# Back admin routes start
namespace :admin do
resources :users
# Admin root
root to: 'application#index'
end
# Back admin routes end
# Front routes start
devise_for :users, only: [:session, :registration], path: 'session',
path_names: { sign_in: 'l... |
bufferapp/buffer-ruby-deprecated | buffer.gemspec | # -*- encoding: utf-8 -*-
require File.expand_path('../lib/buffer/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ["<NAME>"]
gem.email = ["<EMAIL>"]
gem.description = "Buffer API wrapper for Ruby"
gem.summary = "Buffer API wrapper for Ruby"
gem.homepage = ""
ge... |
bufferapp/buffer-ruby-deprecated | spec/buffer_spec.rb | require 'helper'
describe Buffer::Client do
describe 'new' do
it 'accepts a token' do
client = Buffer::Client.new 'some_token'
client.token.should eq('some_token')
end
it 'rejects an integer token' do
lambda { client = Buffer::Client.new 123 }.should raise_error
end
it 're... |
bufferapp/buffer-ruby-deprecated | spec/helper.rb | <gh_stars>0
require 'simplecov'
SimpleCov.start do
add_filter 'spec'
end
require 'rspec'
require 'webmock/rspec'
require 'multi_json'
require 'buffer'
# Taken from https://github.com/sferik/twitter/blob/master/spec/helper.rb
# for stubbing & mocking HTTP requests
def endpoint
'https://api.bufferapp.com/1/'
end
d... |
bufferapp/buffer-ruby-deprecated | lib/buffer.rb | <reponame>bufferapp/buffer-ruby-deprecated<gh_stars>0
require 'buffer/version'
require 'faraday'
require 'multi_json'
require 'addressable/uri'
require 'active_support/core_ext'
module Buffer
class Client
attr_reader :token
# Initialize a new Buffer::Client
#
# Also sets up a Faraday connection obj... |
wardhus/puppet-caddy | spec/classes/package_spec.rb | <gh_stars>0
require 'spec_helper'
describe 'caddy::package' do
context 'with default values for all parameters' do
let(:facts) do
{
os: {
family: 'RedHat',
name: 'RedHat',
release: { major: '6' },
architecture: 'x86_64'
}
}
end
it { is_e... |
robst/thread_watcher | lib/thread_watcher.rb | require "thread_watcher/version"
require "thread_watcher/thread_formatter"
require "thread_watcher/thread_holder"
require "thread_watcher/process_watch"
module ThreadWatcher
require 'singleton'
class Monitor
include Singleton
def initialize
@process_watch = ThreadWatcher::ProcessWatch.new
end
... |
robst/thread_watcher | lib/thread_watcher/process_watch.rb | module ThreadWatcher
class ProcessWatch
attr_accessor :threads
def initialize
@threads = {}
@current_id = 1
start_cleaning_job
end
def run options = {}, &block
options = options.merge(id: next_id)
thread_holder = ThreadHolder.new(block, options)
thread_holder.star... |
robst/thread_watcher | lib/thread_watcher/thread_holder.rb | module ThreadWatcher
class ThreadHolder
attr_accessor :thread, :id, :options, :block, :start_time
def initialize block, options
@block = block
@options = available_options.merge options
set_id
end
def start!
initialize_starttime
@thread = Thread.new{ block.call }
end... |
robst/thread_watcher | lib/thread_watcher/thread_formatter.rb | <gh_stars>1-10
module ThreadWatcher
class ThreadFormatter
def self.headline
self.output "|ID\t\t|Running?\t|Runtime in Seconds\t|Name"
end
def self.data thread
self.output "|#{thread.id}\t|#{thread.alive?}\t\t|\t#{thread.runtime}\t\t|#{thread.options[:name]}"
end
def self.output cont... |
komagata/mycask | Casks/imote.rb | <gh_stars>1-10
class Imote < Cask
url 'http://www.mkdsoftware.com/downloads/iMote_2.3.2.dmg'
homepage 'http://www.mkdsoftware.com/imote/'
version 'latest'
app 'iMote.app'
uninstall 'iMote.app'
sha256 :no_check
end
|
komagata/mycask | brew-mycask.rb | <gh_stars>1-10
require 'formula'
class BrewMycask < Formula
homepage 'https://github.com/komagata/mycask/'
url 'https://github.com/komagata/mycask.git'
def install
end
end
|
jsantos/relative_time | test/indonesian_relative_time_test.rb | <reponame>jsantos/relative_time
require 'test_helper'
describe RelativeTime do
let(:date) { Time.now }
let(:minute) { 60 }
let(:hour) { 60 * minute }
let(:day) { 24 * hour }
let(:week) { 7 * day }
let(:month) { 4 * week }
let(:year) { 12 * month }
describe '#in_words' do
describe 'w... |
jsantos/relative_time | test/turkish_relative_time_test.rb | require 'test_helper'
describe RelativeTime do
let(:date) { Time.now }
let(:minute) { 60 }
let(:hour) { 60 * minute }
let(:day) { 24 * hour }
let(:week) { 7 * day }
let(:month) { 4 * week }
let(:year) { 12 * month }
describe '#in_words' do
describe 'with from date' do
let(:dat... |
jsantos/relative_time | lib/relative_time.rb | require 'relative_time/in_words'
require 'relative_time/version'
module RelativeTime
def self.in_words(date_to, date_from = Time.now, locale: :en)
InWords.new(locale: locale).(date_to, date_from)
end
end
|
jsantos/relative_time | lib/relative_time/in_words.rb | require 'i18n'
require 'i18n/backend/pluralization'
module RelativeTime
class InWords
def self.setup
return if @setup
I18n.load_path << Dir[File.expand_path("#{__dir__}/../../config/locales") + '/*.yml']
I18n.load_path << Dir[File.expand_path("#{__dir__}/../../config/locales") + '/*.rb']
... |
jsantos/relative_time | test/russian_relative_time_test.rb | require 'test_helper'
describe RelativeTime do
let(:date) { Time.now }
let(:minute) { 60 }
let(:hour) { 60 * minute }
let(:day) { 24 * hour }
let(:week) { 7 * day }
let(:month) { 4 * week }
let(:year) { 12 * month }
describe '#in_words' do
describe 'with from date' do
let(:dat... |
jsantos/relative_time | test/relative_time_test.rb | require 'test_helper'
describe RelativeTime do
let(:date) { Time.now }
let(:minute) { 60 }
let(:hour) { 60 * minute }
let(:day) { 24 * hour }
let(:week) { 7 * day }
let(:month) { 4 * week }
let(:year) { 12 * month }
describe '#in_words' do
describe 'with from date' do
let(:dat... |
jsantos/relative_time | test/version_test.rb | <filename>test/version_test.rb
require 'test_helper'
describe RelativeTime do
it { refute_nil ::RelativeTime::VERSION }
end
|
tektite-software/ruby_utils | lib/tektite_ruby_utils/present.rb | # PresentClass should behave just as NilClass, but the opposite. It represents
# that a value exists but does not represent any specific vallue or type; it
# is ambiguous. present should be seen as the opposite of nil.
class PresentClass
attr_accessor :type
# +type+ should be either nil (for ambiguous) or
# th... |
tektite-software/ruby_utils | test/present_test.rb | require 'test_helper'
describe 'Global methods and constants' do
it 'must have the PRESENT constant' do
PRESENT.wont_be_nil
end
it 'must have PRESENT be a PresentClass' do
PRESENT.must_be_instance_of PresentClass
end
it 'must have a `present` method which equals PRESENT' do
present.must_be_same... |
tektite-software/ruby_utils | lib/tektite_ruby_utils.rb | require 'tektite_ruby_utils/version'
require 'tektite_ruby_utils/present'
# See above files.
module TektiteRubyUtils
# See above files
end
|
tektite-software/ruby_utils | test/test_helper.rb | <filename>test/test_helper.rb
require 'codeclimate-test-reporter'
CodeClimate::TestReporter.start
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'tektite_ruby_utils'
require 'minitest/autorun'
# require 'minitest/spec'
# require 'minitest/mock'
require 'minitest/pride'
|
tektite-software/ruby_utils | lib/tektite_ruby_utils/version.rb | module TektiteRubyUtils
# Uses semantic versioning
VERSION = '0.1.0'.freeze
end
|
tektite-software/ruby_utils | tektite_ruby_utils.gemspec | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'tektite_ruby_utils/version'
Gem::Specification.new do |spec|
spec.name = 'tektite_ruby_utils'
spec.version = TektiteRubyUtils::VERSION
spec.authors = ['Tektite Software... |
thoughtbot/wrapped | spec/wrapped_spec.rb | <filename>spec/wrapped_spec.rb
require 'spec_helper'
require 'delegate'
describe Wrapped, 'conversion' do
let(:value) { 1 }
let(:just) { 1.wrapped }
let(:nothing) { nil.wrapped }
let(:delegator) { SimpleDelegator.new(value).wrapped }
it "converts the value to a Present" do
expect(just).to be_... |
thoughtbot/wrapped | lib/wrapped/present.rb | <filename>lib/wrapped/present.rb
# A class that represents a wrapped value. This class holds something that is
# not nil.
class Present
include Enumerable
# Use Object#wrapped and NilClass#wrapped instead.
def initialize(value) # :nodoc:
@value = value
end
# Produce the value, unwrapped.
#
# If a bl... |
thoughtbot/wrapped | wrapped.gemspec | # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "wrapped/version"
Gem::Specification.new do |s|
s.name = "wrapped"
s.version = Wrapped::VERSION
s.authors = ["<NAME>"]
s.email = ["<EMAIL>"]
s.homepage = "http://github.com/mike-burns/wrapped"
s.license ... |
thoughtbot/wrapped | lib/wrapped.rb | require 'wrapped/version'
require 'wrapped/injection'
|
thoughtbot/wrapped | spec/spec_helper.rb | require 'wrapped'
RSpec::Matchers.define :be_alias_of do |source_method|
match do |target_method|
block = lambda { |n| n + 1 }
target_method.call(&block) == source_method.call(&block)
end
end
|
thoughtbot/wrapped | lib/wrapped/blank.rb | <filename>lib/wrapped/blank.rb
# The class represents a lack of something.
class Blank
include Enumerable
# It is an error (specifically, an IndexError) to use this method.
def unwrap
raise IndexError.new("Blank has no value")
end
# Produce the value that is passed in.
#
# > w.unwrap_or(0)
def unw... |
thoughtbot/wrapped | lib/wrapped/injection.rb | <gh_stars>10-100
require 'wrapped/present'
require 'wrapped/blank'
class BasicObject
# Wrap the object, forcing the user to be aware of the potential for a nil
# value by unwrapping it.
#
# See the Present class for details on how to unwrap it.
def wrapped
::Present.new(self)
end
end
class NilClass
... |
GrapeColor/telechannel | telechannel.rb | require 'bundler/setup'
require 'stringio'
require 'yaml'
require 'discordrb'
require 'discordrb/webhooks'
class Telechannel
MESSAGES_FILE = File.expand_path('../messages.yml', __FILE__)
MESSAGES_LIST = File.open(MESSAGES_FILE, 'r') { |f| YAML.load(f) }
REQUIRE_PERMIT = {
manage_webhooks: "ウェブフックの管理",
re... |
GrapeColor/telechannel | execution.rb | require 'dotenv/load'
require './telechannel'
telechannel = Telechannel.new(ENV['TELECHANNEL_TOKEN'])
telechannel.run
|
GrapeColor/telechannel | telechannel_old.rb | require 'bundler/setup'
require 'discordrb'
require 'discordrb/webhooks/client'
class Telechannel
WEBHOOK_NAME_REG = /^Telehook<(\d+)>$/
EMBED_COLOR = 0xea596e
def initialize(bot_token)
@bot = Discordrb::Commands::CommandBot.new(
token: bot_token,
prefix: "/",
help_command: false,
we... |
githubteacher/example-githubapiscripts | gh_unsub.rb | #!/usr/bin/env ruby
require 'octokit'
pass_re = /^password: "(.*)"$/
token = '***** GET A TOKEN *****'
c = Octokit::Client.new(:access_token => token)
user_login = c.user.login
puts "Finding your mentions...\n"
notifications = 50.times.map {|x| c.notifications(:page => x+1)}.take_while {|x| x.count > 1}.inject([]) ... |
githubteacher/example-githubapiscripts | migrate_repo.rb | <reponame>githubteacher/example-githubapiscripts
require "json"
require "typhoeus"
require "pp"
# MigrateRepo usage instructions:
#
# The way this is used at REDACTEDBYREQUEST for migrating from GitHub to GHE is by
# creating a separate organization with no members called "migration",
# adding that as the target organ... |
githubteacher/example-githubapiscripts | get-user.rb | <filename>get-user.rb<gh_stars>1-10
require 'Octokit'
# Fetch a user
user = Octokit.user 'githubteacher'
puts user.name
# => "<NAME>"
puts user.fields
puts user.id
puts user.email
# => <Set: {:login, :id, :gravatar_id, :type, :name, :company, :blog, :location, :email, :hireable, :bio, :public_repos, :followers, :follo... |
ericboehs/to_slug | spec/to_slug_spec.rb | # coding: utf-8
require 'to_slug'
describe String, "to_slug" do
it "as an option can use space as a delimiter preserving spaces" do
"This is a string".to_slug(:delimiter=>" ").should == "this is a string"
end
it "replaces spaces with dashes" do
"This is a string".to_slug.should == "this-is-a-string"
... |
ericboehs/to_slug | lib/to_slug.rb | # coding: utf-8
class String # This reopns the string class
# Define a new method to convert the string to be url friendly
def to_slug(options={})
# This is the input as there are no arguments passed.
string = self
delimiter = options[:delimiter].nil? ? "-" : options[:delimiter]
# Define which ac... |
ericboehs/to_slug | to_slug.gemspec | # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "to_slug/version"
Gem::Specification.new do |s|
s.name = "to_slug"
s.version = ToSlug::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["<NAME>"]
s.email = ["<EMAIL>"]
s.homepage = "https://github... |
cervinka/jira-worklog | lib/jira/worklog/cli.rb | <gh_stars>0
require 'commander/import'
program :name, 'jira-worklog'
program :version, '0.0.1'
program :description, 'Add worklog to JIRA using REST API'
# program :help_formatter, :compact
global_option '-u', '--user USERNAME', 'JIRA login username'
global_option '-p', '--password PASSWORD', 'JIRA login password'
gl... |
cervinka/jira-worklog | lib/jira/worklog.rb | <reponame>cervinka/jira-worklog
require 'rubygems'
require 'json'
require 'rest-client'
require 'simple_xlsx_reader'
require 'jira/worklog/version'
require 'jira/worklog/api_client'
module Jira
module Worklog
# Your code goes here...
end
end
|
cervinka/jira-worklog | lib/jira/worklog/version.rb | <filename>lib/jira/worklog/version.rb
module Jira
module Worklog
VERSION = '0.1.1'
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.