repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
PikachuEXE/memcached_cloud_gem
spec/memcached_cloud_spec.rb
require 'spec_helper' describe "Memcachier" do let(:memcached_cloud_file) { File.join(File.dirname(__FILE__), '..', 'lib', 'memcached_cloud.rb') } [ "MEMCACHE_SERVERS", "MEMCACHE_USERNAME", "MEMCACHE_PASSWORD" ].each do |var| context var do let(:memcached_cloud_var) { var.gsub "MEMCACHE", "MEMCACHEDCLOUD...
olleolleolle/async-http-cache
gems.rb
source "https://rubygems.org" # Specify your gem's dependencies in async-http-cache.gemspec gemspec # gem "async-http", path: "../async-http" # gem "protocol-http", path: "../protocol-http" # gem "protocol-http1", path: "../protocol-http1" group :maintenance, optional: true do gem "bake-modernize" gem "bake-bundle...
olleolleolle/async-http-cache
async-http-cache.gemspec
require_relative "lib/async/http/cache/version" Gem::Specification.new do |spec| spec.name = "async-http-cache" spec.version = Async::HTTP::Cache::VERSION spec.summary = "Standard-compliant cache for async-http." spec.authors = ["<NAME>"] spec.license = "MIT" spec.homepage = "https://github.com/socketry/asy...
olleolleolle/async-http-cache
lib/async/http/cache/general.rb
# frozen_string_literal: true # Copyright, 2020, by <NAME>. <http://www.codeotaku.com> # # 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 th...
olleolleolle/async-http-cache
lib/async/http/cache/body.rb
# frozen_string_literal: true # # Copyright, 2020, by <NAME>. <http://www.codeotaku.com> # # 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 t...
olleolleolle/async-http-cache
spec/async/http/cache/body_spec.rb
<gh_stars>1-10 # frozen_string_literal: true # Copyright, 2020, by <NAME>. <http://www.codeotaku.com> # # 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 withou...
olleolleolle/async-http-cache
spec/async/http/cache/server_context.rb
# Copyright, 2019, by <NAME>. <http://www.codeotaku.com> # # 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, modify...
olleolleolle/async-http-cache
lib/async/http/cache/store/vary.rb
# frozen_string_literal: true # Copyright, 2020, by <NAME>. <http://www.codeotaku.com> # # 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 th...
olleolleolle/async-http-cache
lib/async/http/cache/response.rb
<gh_stars>1-10 # frozen_string_literal: true # Copyright, 2020, by <NAME>. <http://www.codeotaku.com> # # 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 withou...
olleolleolle/async-http-cache
spec/async/http/cache_spec.rb
RSpec.describe Async::HTTP::Cache do it "has a version number" do expect(Async::HTTP::Cache::VERSION).not_to be nil end end
olleolleolle/async-http-cache
lib/async/http/cache/store/memory.rb
# frozen_string_literal: true # Copyright, 2020, by <NAME>. <http://www.codeotaku.com> # # 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 th...
olleolleolle/async-http-cache
spec/async/http/cache/general_spec.rb
<reponame>olleolleolle/async-http-cache # Copyright, 2017, by <NAME>. <http://www.codeotaku.com> # # 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 limi...
tablexi/txi_rails_hologram
lib/txi_rails_hologram/engine.rb
<filename>lib/txi_rails_hologram/engine.rb require "jquery-rails" require "hologram" require "txi_rails_hologram/template_variables_ext" module TxiRailsHologram # A mountable Rails engine that integrates Hologram with Rails. class Engine < ::Rails::Engine isolate_namespace TxiRailsHologram config.genera...
tablexi/txi_rails_hologram
spec/lib/txi_rails_hologram/template_variables_ext_spec.rb
<reponame>tablexi/txi_rails_hologram<gh_stars>1-10 require_relative "../../spec_helper" require "txi_rails_hologram/rendering_context" require "txi_rails_hologram/template_variables_ext" describe "TemplateVariables Extension" do let(:rendering_context) { spy } subject { Hologram::TemplateVariables.new({}) } b...
tablexi/txi_rails_hologram
lib/txi_rails_hologram/rendering_context.rb
require "haml" module TxiRailsHologram # Public: A context for rendering HAML that knows about helpers from Rails, # gems and the current application. class RenderingContext # Internal: Creates a new context into which we can render a chunk of HAML. # # Returns a properly-configured instance of Act...
tablexi/txi_rails_hologram
spec/lib/txi_rails_hologram/rendering_context_spec.rb
require_relative "../../spec_helper" require "txi_rails_hologram/rendering_context" describe TxiRailsHologram::RenderingContext do subject { described_class.instance } it "handles named routes" do expect(subject.root_path).to eq("/") end it "handles helper methods defined in application" do expect(s...
tablexi/txi_rails_hologram
lib/guard/txi_rails_hologram/version.rb
module Guard module TxiRailsHologramVersion VERSION = "1.0.0" end end
tablexi/txi_rails_hologram
lib/tasks/txi_rails_hologram_tasks.rake
require "txi_rails_hologram/builder" desc "Explaining what the task does" namespace :txi_rails_hologram do task build: :environment do config = YAML.load_file(Rails.root.join("hologram_config.yml")) TxiRailsHologram::Builder.new.build(config) end end
tablexi/txi_rails_hologram
lib/txi_rails_hologram/builder.rb
<reponame>tablexi/txi_rails_hologram<gh_stars>1-10 module TxiRailsHologram # Public: A thin wrapper around `Hologram::DocBuilder` that allows us to # specify our own set of renderers, templates, and documentation assets. class Builder # Internal: A set of default options to pass to `Hologram::DocuBuilder`. ...
tablexi/txi_rails_hologram
lib/txi_rails_hologram.rb
<gh_stars>1-10 require "txi_rails_hologram/engine" # Public: A namespace for this engine's functionality. module TxiRailsHologram end
tablexi/txi_rails_hologram
spec/lib/txi_rails_hologram/builder_spec.rb
require_relative "../../spec_helper" require "txi_rails_hologram/builder" describe TxiRailsHologram::Builder do subject { described_class.new } describe "#build" do context "with valid params" do let(:destination) { Dir.mktmpdir } before do config = { "source" => [Rails.root.joi...
tablexi/txi_rails_hologram
spec/dummy/app/helpers/application_helper.rb
# Public: A place to store small view-related functions. module ApplicationHelper # Public: Outputs the text in a `strong` tag. # # text - A String. # # Returns a String of HTML. def strong_text(text) content_tag(:strong, text) end end
tablexi/txi_rails_hologram
lib/renderers/coffee_renderer.rb
require "coffee-script" Hologram::CodeExampleRenderer::Factory.define("coffee") do example_template "coffee_example_template" lexer { Rouge::Lexer.find(:coffee) } rendered_example do |code| CoffeeScript.compile(code) end end
tablexi/txi_rails_hologram
lib/txi_rails_hologram/version.rb
# A namespace for this gem's functionality. module TxiRailsHologram # Public: The version of this gem. VERSION = "0.0.2" end
tablexi/txi_rails_hologram
txi_rails_hologram.gemspec
<gh_stars>1-10 $LOAD_PATH.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "txi_rails_hologram/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "txi_rails_hologram" s.version = TxiRailsHologram::VERSION s.authors = [...
tablexi/txi_rails_hologram
lib/txi_rails_hologram/template_variables_ext.rb
# The `Hologram::TemplateVariables` is used as the context object when # rendering ERb in the `DocBuilder`'s `write_docs` method. We monkey-patch it # to allow the usage of some general layout-related Rails helper methods in our # ERb documentation assets. Hologram::TemplateVariables.class_eval do extend Forwardable ...
tablexi/txi_rails_hologram
lib/renderers/haml_renderer.rb
<reponame>tablexi/txi_rails_hologram<filename>lib/renderers/haml_renderer.rb require "txi_rails_hologram/rendering_context" require "haml" # We overwrite the default "haml" handler from hologram to use our Rails-aware # version. Hologram::CodeExampleRenderer::Factory.define "haml" do example_template "markup_example...
tablexi/txi_rails_hologram
spec/dummy/config/initializers/helpers.rb
require "microformats_helper"
tablexi/txi_rails_hologram
lib/guard/txi_rails_hologram.rb
<reponame>tablexi/txi_rails_hologram<filename>lib/guard/txi_rails_hologram.rb require "guard/txi_rails_hologram/version" require "guard" require "guard/plugin" module Guard class TxiRailsHologram < Plugin include TxiRailsHologramVersion # Called when just `enter` is pressed # This method should be princi...
tablexi/txi_rails_hologram
spec/dummy/config/routes.rb
<gh_stars>1-10 Rails.application.routes.draw do mount TxiRailsHologram::Engine => "/txi_rails_hologram" root to: "examples#index" end
PhilippMatthes/FlyoverKit
FlyoverKit.podspec
Pod::Spec.new do |s| s.name = "FlyoverKit" s.version = "1.3.0" s.summary = "360° flyover on an MKMapView" s.homepage = "https://github.com/SvenTiigi/FlyoverKit" s.social_media_url = 'http://twitter.com/SvenTiigi' ...
mlavandero/git-autoremove
lib/git/autoremove/version.rb
module Git module Autoremove VERSION = "0.1.0" end end
mlavandero/git-autoremove
lib/git/autoremove.rb
require "git/autoremove/version" module Git module Autoremove end end
jfelchner/homebrew-shell
Formula/bats-assert.rb
class BatsAssert < Formula desc "Common assertions for Bats" homepage "https://github.com/ztombol/bats-assert" url "https://github.com/ztombol/bats-assert/archive/v0.3.0.tar.gz" sha256 "0d447e4efc488cf06ebed3dea5b55e1fb909e572fb3576434194a09485f8a7f3" head "https://github.com/ztombol/bats-assert.git" depend...
autumncollection/attentive_sidekiq
lib/attentive_sidekiq.rb
require 'set' require 'active_support/inflector' require 'active_support/core_ext/hash' require 'concurrent' require 'attentive_sidekiq/api' require 'attentive_sidekiq/middleware/server/attentionist' require 'attentive_sidekiq/middleware/client/attentionist' require 'attentive_sidekiq/updater_observer' require 'attenti...
autumncollection/attentive_sidekiq
lib/attentive_sidekiq/middleware/server/attentionist.rb
<reponame>autumncollection/attentive_sidekiq module AttentiveSidekiq module Middleware module Server class Attentionist def call(worker_instance, item, queue) Suspicious.add(item) yield ensure Suspicious.remove(item['jid']) end end end end en...
autumncollection/attentive_sidekiq
test/manager_test.rb
<filename>test/manager_test.rb require "test_helper" class ManagerTest < Minitest::Test describe "with real redis" do before do Sidekiq.redis = REDIS Sidekiq.redis{ |c| c.flushdb } common_hash = {'class' => 'UnexistantWorker', 'args' => [], 'created_at' => Time.now.to_i} @item_in_p...
autumncollection/attentive_sidekiq
lib/attentive_sidekiq/api.rb
module AttentiveSidekiq class RedisBasedHash class << self def jobs Sidekiq.redis{|conn| conn.hvals(hash_name)}.map{|i| JSON.parse(i)} end def job_ids jobs.map{|i| i["jid"]} end def get_job jid JSON.parse(Sidekiq.redis{|conn| conn.hget(hash_name, jid)}) ...
autumncollection/attentive_sidekiq
test/server_middleware_test.rb
require "test_helper" class ServerMiddlewareTest < Minitest::Test describe "with real redis" do before do Sidekiq.redis = REDIS Sidekiq.redis{ |c| c.flushdb } @mutex = Mutex.new @stopper = ConditionVariable.new end class HardWorker include Sidekiq::Worker def perfor...
autumncollection/attentive_sidekiq
test/web_test.rb
<reponame>autumncollection/attentive_sidekiq require "test_helper" require "rack/test" class WebTest < Minitest::Test include Rack::Test::Methods def setup Sidekiq.redis = REDIS Sidekiq.redis{ |c| c.flushdb } common_hash = {'class' => 'UnexistantWorker', 'args' => [], 'created_at' => Time.now.t...
autumncollection/attentive_sidekiq
lib/attentive_sidekiq/updater_observer.rb
<reponame>autumncollection/attentive_sidekiq module AttentiveSidekiq class UpdaterObserver def update time, result, ex if result AttentiveSidekiq.logger.info("#{time} [AttentiveSidekiq] Finished updating with result #{result}") elsif ex.is_a?(Concurrent::TimeoutError) AttentiveSidekiq....
autumncollection/attentive_sidekiq
lib/attentive_sidekiq/web.rb
<reponame>autumncollection/attentive_sidekiq<gh_stars>10-100 module AttentiveSidekiq module Web VIEW_PATH = File.expand_path("../web/views", __FILE__) def self.registered(app) app.get("/disappeared-jobs") do @disappeared_jobs = AttentiveSidekiq::Disappeared.jobs erb File.read(File.join(...
autumncollection/attentive_sidekiq
lib/attentive_sidekiq/manager.rb
<reponame>autumncollection/attentive_sidekiq<filename>lib/attentive_sidekiq/manager.rb module AttentiveSidekiq class Manager @@instance = AttentiveSidekiq::Manager.new def self.instance @@instance end def start! task = Concurrent::TimerTask.new(options) do AttentiveSidekiq::M...
autumncollection/attentive_sidekiq
attentive_sidekiq.gemspec
lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'attentive_sidekiq/version' Gem::Specification.new do |s| s.name = 'attentive_sidekiq' s.version = AttentiveSidekiq::VERSION s.summary = "Make your sidekiq to be attentive to lost jobs" s.d...
autumncollection/attentive_sidekiq
test/api_test.rb
require_relative "test_helper" class ApiTest < Minitest::Test describe "with real redis" do before do Sidekiq.redis = REDIS Sidekiq.redis { |c| c.flushdb } simple_hash = {'class' => 'ApiTest::SimpleWorker', 'args' => [], 'created_at' => Time.now.to_i} args_hash ...
autumncollection/attentive_sidekiq
test/test_helper.rb
ENV['RACK_ENV'] = ENV['RAILS_ENV'] = 'test' require 'pry' require 'sidekiq' require 'sidekiq/api' require 'sidekiq/cli' require 'sidekiq/processor' require 'sidekiq/manager' require 'sidekiq/util' require 'sidekiq/redis_connection' require 'redis-namespace' require 'attentive_sidekiq' require 'minitest/autorun' requir...
autumncollection/attentive_sidekiq
lib/attentive_sidekiq/middleware/client/attentionist.rb
module AttentiveSidekiq module Middleware module Client class Attentionist def call(worker_class, item, queue, redis_pool = nil) # TODO: we could backup job info here aswell # this would lead us to the need of more complex records filtering yield end end ...
makevoid/animeface-2009
animeface-ruby/eyecolor.rb
<reponame>makevoid/animeface-2009<filename>animeface-ruby/eyecolor.rb<gh_stars>100-1000 # coding: utf-8 # イラストの顔の目の色をクルクルするGIFアニメを作るコマンド # AnimeFace-Ruby.tar.gzの最新版(2011/4/11 21時以降)が必要 # # ruby eyecolor.rb homu.jpg homu.gif require "rubygems" require "rmagick" require_relative "AnimeFace" module AnimeFace module E...
makevoid/animeface-2009
animeface-ruby/sample.rb
require "pp" require "rmagick" require_relative "AnimeFace" if ARGV.size == 0 warn "Usage: #{$0} <input image>" exit(-1) end image = Magick::ImageList.new(ARGV[0]) output = File.basename(ARGV[0]).split(".").first + "_out.png" faces = AnimeFace::detect(image) # when you want to change parameter #faces = AnimeFace::...
makevoid/animeface-2009
animeface-ruby/face_collector.rb
<gh_stars>100-1000 require "pp" require "rmagick" require_relative "AnimeFace" require "optparse" require "fileutils" require "json" params = ARGV.getopts("", "src:", "dest:", "threshold:", "margin:") if params["src"].nil? || params["dest"].nil? warn "usage: #{$0} --src <image dir> --dest <output dir> --threshold <...
makevoid/animeface-2009
animeface-ruby/proc_folder.rb
<reponame>makevoid/animeface-2009 require "set" require 'json' require "rmagick" require_relative "AnimeFace" require "progress_bar" def get_box(thing) keys = Set["x", "y", "width", "height"] return thing.select { |key, value| keys.include? key } end if ARGV.size != 2 warn "Usage: #{$0} <dir_path> <output_file>...
makevoid/animeface-2009
animeface-ruby/proc_folder_parallel.rb
<filename>animeface-ruby/proc_folder_parallel.rb require "set" require 'json' require "rmagick" require_relative "AnimeFace" require "progress_bar" require "parallel" def get_box(thing) keys = Set["x", "y", "width", "height"] return thing.select { |key, value| keys.include? key } end if ARGV.size != 2 warn "Usa...
makevoid/animeface-2009
animeface-ruby/extconf_local.rb
require "mkmf" dir_config("nvxs", "../install/include", "../install/lib") rpath=File.expand_path(File.join(File.dirname(__FILE__), '../install/lib')) $LDFLAGS << " -Wl,-rpath,#{rpath}" unless ( have_header('nv_core.h') && have_library('nvxs', 'nv_matrix_alloc')) $stderr.puts("error: Can't locate libnvxs") exit(-1)...
makevoid/animeface-2009
animeface-ruby/extconf.rb
require "mkmf" dir_config("/usr/local/include", "/usr/local/lib") unless ( have_header('nv_core.h') && have_library('nvxs', 'nv_matrix_alloc')) $stderr.puts("error: Can't locate libnvxs") exit(-1) end create_makefile("AnimeFace")
makevoid/animeface-2009
animeface-ruby/face2xml.rb
<filename>animeface-ruby/face2xml.rb<gh_stars>100-1000 require 'rexml/document' require "optparse" params = ARGV.getopts("", "face:", "src:", "dest:") if params["face"].nil? || params["src"].nil? warn "usage: #{$0} --face <face image dir> --src <image dir> --dest out.xml " exit(-1) end dest = params["dest"] || "o...
swobspace/devise-remote-user
lib/devise_remote_user/controller_behavior.rb
module DeviseRemoteUser module ControllerBehavior def after_sign_out_path_for(resource_or_scope) return DeviseRemoteUser.logout_url if remote_user_authenticated? and DeviseRemoteUser.logout_url super end private def remote_user_authenticated? DeviseRemoteUser.remote_user_id(reque...
swobspace/devise-remote-user
lib/devise_remote_user/model.rb
<reponame>swobspace/devise-remote-user<gh_stars>1-10 require 'devise_remote_user/strategy' require 'devise_remote_user/manager' module Devise::Models module RemoteUserAuthenticatable extend ActiveSupport::Concern included do def self.find_for_remote_user_authentication(env) manager = DeviseRem...
swobspace/devise-remote-user
lib/devise_remote_user/manager.rb
<reponame>swobspace/devise-remote-user module DeviseRemoteUser # # The Manager class is responsible for connecting the appliation's User # class with remote user information in the request environment. # class Manager attr_reader :klass, :env def initialize(klass, env) @klass = klass @e...
swobspace/devise-remote-user
lib/devise_remote_user/strategy.rb
<filename>lib/devise_remote_user/strategy.rb<gh_stars>1-10 require 'devise/strategies/authenticatable' module Devise module Strategies class RemoteUserAuthenticatable < Authenticatable def valid? DeviseRemoteUser.remote_user_id(env).present? end def authenticate! resource = m...
swobspace/devise-remote-user
spec/dummy/config/routes.rb
Dummy::Application.routes.draw do root to: "application#index" devise_for :users end
swobspace/devise-remote-user
spec/lib/devise_remote_user_spec.rb
<reponame>swobspace/devise-remote-user require 'spec_helper' describe DeviseRemoteUser do context ".remote_user_id" do let(:mock_env) { { 'REMOTE_USER' => 'some-id' } } context "with a string for the env_key" do before do DeviseRemoteUser.env_key = "REMOTE_USER" end it "shoul...
swobspace/devise-remote-user
spec/dummy/app/models/user.rb
class User < ActiveRecord::Base devise :remote_user_authenticatable, :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable end
swobspace/devise-remote-user
spec/controllers/application_controller_spec.rb
<reponame>swobspace/devise-remote-user require 'spec_helper' describe ApplicationController do controller do def remote_user_name=(user_name) request.env[DeviseRemoteUser.env_key] = user_name end def remote_user_attributes=(attrs) attrs.each {|k, v| request.env[k] = v } end end aft...
swobspace/devise-remote-user
lib/devise_remote_user.rb
require 'devise' require 'devise_remote_user/engine' require 'devise_remote_user/controller_behavior' module DeviseRemoteUser # request.env key for remote user name # Set to 'HTTP_REMOTE_USER' in config/initializers/devise.rb if behind reverse proxy mattr_accessor :env_key @@env_key = 'REMOTE_USER' # Ena...
plainlystated/rvm
libraries/resource_rvm_ruby.rb
require 'chef/resource/lwrp_base' class Chef class Resource class RvmRuby < Chef::Resource::LWRPBase provides :rvm_ruby self.resource_name = :rvm_ruby actions :install default_action :install end end end
plainlystated/rvm
libraries/provider_rvm_ruby.rb
<reponame>plainlystated/rvm<gh_stars>0 require 'chef/provider/lwrp_base' class Chef class Provider class RvmRuby < Chef::Provider::LWRPBase provides :rvm_ruby if defined?(provides) use_inline_resources if defined?(use_inline_resources) def whyrun_supported? true end actio...
plainlystated/rvm
metadata.rb
name 'rvm' maintainer '<NAME>' maintainer_email '<EMAIL>' license 'Apache-2.0' description 'Manages system-wide and per-user RVMs and manages installed Rubies via Chef Resources.' long_description "Please refer to README.md (it's long)." version '0.10.1' source_url ...
jaico/Sttarter
Sttarter.podspec
<gh_stars>0 Pod::Spec.new do |s| s.name = 'Sttarter' s.version = '0.1.8' s.summary = 'By far the most Sttarter I have seen in my entire life. No joke.' s.description = <<-DESC This Sttarter changes its dependancy gradually makes your app look fantastic! ...
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
facebookBot/json_templates/quick_replies.rb
require_relative '../strings' require_relative '../bot' Dir[File.join(__dir__, './quick_replies_strings', '*')].each { |file| require file } class MessengerBot QUICK_REPLIES = { "en" => QUICK_REPLY_EN, "ta" => QUICK_REPLY_TA } end
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
subscription/subscription.rb
require 'facebook/messenger' require 'httparty' require 'json' require_relative './subscription_template' require_relative '../facebookBot/bot' require_relative '../models/vaccination_schedule' require_relative '../database_editors/vaccination_schedule_editor' require_relative './subscription_strings' class Subscript...
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
facebookBot/bot.rb
<reponame>Balaji-Ramasubramanian/Smart-Vaccine-Remainder require 'facebook/messenger' require 'httparty' require 'json' require 'date' require './models/default_vaccine_schedule' require './models/vaccination_schedule' require_relative '../utils' require_relative '../database_editors/vaccination_schedule_editor' requi...
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
facebookBot/json_templates/quick_replies_strings/quick_replies_ta.rb
class MessengerBot QUICK_REPLY_TA = [ { "content_type": 'text', "title": UPCOMING_VACCINATION_MESSAGE_TEXT["ta"] , "payload": "UPCOMING_VACCINATIONS" }, { "content_type": 'text', "title": PREVIOUS_VACCINATION_MESSAGE_TEXT["ta"], "payload": "PREVIOUS_VACCINATION...
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
subscription/subscription_template.rb
class SubscriptionClass SUBSCRIPTION_MESSAGE_OPTION = { "messaging_type": "RESPONSE", "recipient": { "id": "0" }, "message":{ "attachment":{ "type": 'template', "payload":{ "template_type": "generic", "elements":[ ...
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
facebookBot/display_vaccination_dates.rb
require 'facebook/messenger' require 'httparty' require 'json' require_relative './bot.rb' require_relative 'json_templates/template' require_relative '../utils' class MessengerBot #Display upcoming and previous vaccination dates and their details def display_vaccination_dates(id,vaccination_dates) template = G...
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
facebookBot/json_templates/quick_replies_strings/quick_replies_en.rb
class MessengerBot QUICK_REPLY_EN = [ { "content_type": 'text', "title": UPCOMING_VACCINATION_MESSAGE_TEXT["en"] , "payload": "UPCOMING_VACCINATIONS" }, { "content_type": 'text', "title": PREVIOUS_VACCINATION_MESSAGE_TEXT["en"], "payload": "PREVIOUS_VACCINATION...
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
database_editors/profile_editor.rb
<reponame>Balaji-Ramasubramanian/Smart-Vaccine-Remainder<filename>database_editors/profile_editor.rb require 'date' require 'sinatra/activerecord' require_relative '../facebookBot/display_vaccination_dates' require_relative './vaccination_schedule_editor' require_relative '../facebookBot/bot.rb' require_relative '../f...
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
facebookBot/json_templates/persistent_menu.rb
<reponame>Balaji-Ramasubramanian/Smart-Vaccine-Remainder<filename>facebookBot/json_templates/persistent_menu.rb require_relative "../strings" Dir[File.join(__dir__, './persistent_menu_strings', '*')].each { |file| require file } class MessengerBot PERSISTENT_MENU = { "persistent_menu": [ PERSISTENT_MENU_...
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
facebookBot/json_templates/persistent_menu_strings/persistent_menu_ta.rb
<gh_stars>1-10 require_relative "../../strings" class MessengerBot PERSISTENT_MENU_TA = { "locale": "ta_IN", "composer_input_disabled": false, "call_to_actions": [{ "title": "💉 #{UPCOMING_VACCINATION_DETAILS_BUTTON["ta"]}", "type": "postback", "payload": "UPCOMING_VACCINATI...
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
database_editors/vaccine_details.rb
require 'date' require 'sinatra/activerecord' require 'facebook/messenger' require_relative '../facebookBot/display_vaccination_dates' require './models/default_vaccine_schedule' require './models/vaccination_schedule' require_relative './db_strings' class VaccineDetails def get_vaccine_details(id,vaccine_name) @l...
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
facebookBot/display_profile.rb
require 'facebook/messenger' require 'httparty' require 'json' require_relative './bot.rb' require_relative 'json_templates/template' require_relative '../utils' class MessengerBot # Method to display user profile details def display_profile(id,parent_first_name,parent_last_name,kid_name,kid_dob,kid_gender) temp...
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
facebookBot/json_templates/template.rb
<reponame>Balaji-Ramasubramanian/Smart-Vaccine-Remainder class MessengerBot GENERIC_TEMPLATE_BODY = { "attachment": { "type": "template", "payload":{ "template_type": "generic", "elements":[{ "title": "", "subtitle": "", "buttons":[{ ...
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
app.rb
require 'sinatra' require 'sinatra/activerecord' require 'rake' require 'dotenv/load' # Talk to Facebook get '/webhook' do params['hub.challenge'] if ENV["VERIFY_TOKEN"] == params['hub.verify_token'] end #Show the home page get "/" do send_file 'index.html' end #Show the terms and conditions page get "/termsandc...
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
facebookBot/json_templates/get_started.rb
class MessengerBot GET_STARTED = { "get_started":{ "payload": "GET_STARTED" } } end
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
facebookBot/json_templates/persistent_menu_strings/persistent_menu_en.rb
<reponame>Balaji-Ramasubramanian/Smart-Vaccine-Remainder require_relative "../../strings" class MessengerBot PERSISTENT_MENU_DEFAULT = { "locale": "default", "composer_input_disabled": false, "call_to_actions": [{ "title": "💉 #{UPCOMING_VACCINATION_DETAILS_BUTTON["en"]}", "type": "p...
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
database_editors/fetch_vaccination_details.rb
<reponame>Balaji-Ramasubramanian/Smart-Vaccine-Remainder require 'date' require 'sinatra/activerecord' require 'facebook/messenger' require_relative '../facebookBot/display_vaccination_dates' require './models/default_vaccine_schedule' require './models/vaccination_schedule' require_relative './db_strings' class Fetc...
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
db/migrate/20180124144808_create_vaccination_schedule.rb
<reponame>Balaji-Ramasubramanian/Smart-Vaccine-Remainder #Database table to store the vaccination schedule class CreateVaccinationSchedule < ActiveRecord::Migration[5.1] def up create_table :vaccination_schedules do |t| # facebook profile details: t.string :parent_facebook_userid t.string :parent_fi...
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
models/vaccination_schedule.rb
#Model for Vaccination Schedule table: class VaccinationSchedule < ActiveRecord::Base end
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
facebookBot/strings.rb
class MessengerBot GREETING_MESSAGE_SALUTATION = { "en" => "Hey ", "ta" => "வணக்கம் " } GREETING_MESSAGE_CONTENT = { "en" => "Glad to have you on board. I will keep reminding you about the vaccination days for your kids.", "ta" => "விக்கிப்பீடியா உங்களை வரவேற்கிறது" } OLD_USER_GREETING_CONTENT = { "en"...
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
wit/get_wit_message.rb
<reponame>Balaji-Ramasubramanian/Smart-Vaccine-Remainder require 'wit' class Wit #Method to get entities from wit server def get_intent(word) client = Wit.new(access_token: ENV["WIT_ACCESS_TOKEN"]) response = client.message(word) if response["entities"]["intent"] != nil then if response["entities"].length...
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
database_editors/vaccination_schedule_editor.rb
<gh_stars>1-10 require 'date' require 'sinatra/activerecord' require './models/default_vaccine_schedule' require './models/vaccination_schedule' require_relative '../facebookBot/bot' require_relative '../utils' class VaccinationScheduleEditor VACCINE_COLUMNS_INDEX_STARTS_AT = 10 #Method to get user Facebook pro...
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
db/schema.rb
<filename>db/schema.rb # 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. # # Note that this schema.rb definition is the authoritativ...
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
database_editors/db_strings.rb
<gh_stars>1-10 LIST_OF_UPCOMING_VACCINES_TEXT = { "en" => "Here are the list of upcoming vaccines for your kid", "ta" => "உங்கள் பிள்ளையின் எதிர்வரும் தடுப்பூசிகளின் பட்டியல் இங்கே" } LIST_OF_PROVIDED_VACCINES_TEXT = { "en" => "Here are the list of provided vaccines for your kid", "ta" => "உங்கள் குழந்தைக்கு வழங்கப...
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
config.ru
require './app' require 'facebook/messenger' require_relative 'facebookBot/bot' require 'rake' # you may need this lines in order to test your server before you create bot.rb later # run regular sinatra for other paths (in case you ever need it) run Sinatra::Application # run both Sinatra and facebook-messenger on ...
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
subscription/subscription_strings.rb
<filename>subscription/subscription_strings.rb SHOW_SUBSCRIBE_SUBTITLE_TEXT = { "en" => "You are now Unsubscribed to Vaccine reminder. Do you want to Subscribe?", "ta" => "நீங்கள் இப்போது தடுப்பூசி நினைவூட்டலுக்கு குழு சேரவில்லை . நீங்கள் குழுசேர விரும்புகிறீர்களா?" } SHOW_UNSUBSCRIBE_SUBTITLE_TEXT = { "en" => "You...
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
database_editors/default_vaccine_schedule_filler.rb
<filename>database_editors/default_vaccine_schedule_filler.rb require 'sinatra/activerecord' require './models/default_vaccine_schedule' require './models/vaccination_schedule' #Fill Default vaccination table t = DefaultVaccineSchedule.new t.vaccine_name = "bcg_dose1" t.due_date =0 t.url ="https://en.wikipedia.org/wi...
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
models/default_vaccine_schedule.rb
#The Model for a table that holds the default values for Vaccine reminder class DefaultVaccineSchedule < ActiveRecord::Base end
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
db/migrate/20180124144830_create_default_vaccine_schedule.rb
<reponame>Balaji-Ramasubramanian/Smart-Vaccine-Remainder #Database table to store the default values for vaccine table class CreateDefaultVaccineSchedule < ActiveRecord::Migration[5.1] def up create_table :default_vaccine_schedules do |t| t.string :vaccine_name t.integer :due_date t.string :url ...
Balaji-Ramasubramanian/Smart-Vaccine-Remainder
facebookBot/json_templates/greeting.rb
class MessengerBot GREETING = { "greeting": [{ "locale": "default", "text": "Hey {{user_full_name}}, Welcome to Smart Vaccine reminder Bot. \nWe are here to help you on reminding the vaccination days for your kids." }] } end
willrax/motion-giphy
lib/motion-giphy/pagination.rb
class MotionGiphy module Pagination attr_reader :total, :count, :offset def initialize(pagination) @total = pagination["total_count"] @count = pagination["count"] @offset = pagination["offset"] end end end
willrax/motion-giphy
lib/motion-giphy/meta.rb
module MotionGiphy class Meta attr_reader :message, :status def initialize(meta) @message = meta["message"] @status = meta["status"] end end end