Skip to content

Instantly share code, notes, and snippets.

View elfassy's full-sized avatar

Michael Elfassy elfassy

View GitHub Profile
@elfassy
elfassy / github-project-issues.rb
Last active June 3, 2024 13:39
Github Project Issues
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'csv'
gem 'graphql-client'
gem 'progressbar'
gem 'pry'
gem 'pry-byebug'
end
require 'graphql/client/http'
function applePayButtonClicked(event)
{
var paymentRequest = {
// countryCode: The merchant’s ISO country code.
countryCode: 'US',
// currencyCode: The ISO currency code for the payment.
currencyCode: 'USD',
// total: The total amount for the payment.
total: {
label: 'Canine Clothing',
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'activerecord', '4.2.0'
#=Navigating=
visit('/projects')
visit(post_comments_path(post))
#=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click_on('Button Value')
@elfassy
elfassy / hstore_getter_setter.rb
Created September 5, 2012 18:55
hstore meta programming
module HstoreSetterGetter
# To use simply add to your models:
#
# include HstoreSetterGetter
# hstore_attributes :test1, :test2, type: :integer #assumes column_name: :data
# hstore_attributes :test3, :test4, column_name: :properties #assumes type: :string
#
# Written by Michael Elfassy
# http://napps.ca
#
#!/usr/bin/env ruby
require "rubygems" # ruby1.9 doesn't "require" it though
require "thor"
class CloneRails < Thor
include Thor::Actions
desc "new NAME, TEMPLATE", "Create a new rails app based on a template app"
method_options :template => "template"
def new(name)
puts "Copying the template..."
# Setup a template that can be cloned later
# Command:
# rails new NAME -m setup_template.rb
# (by default you should use "template" as NAME)
plugin("Rename", :git => "git@github.com:get/Rename.git")
# See http://everydayrails.com/2011/02/28/rails-3-application-templates.html if you need more customization of the template generator
@elfassy
elfassy / image_tag_helper.rb
Created September 24, 2011 15:40
better image_tag
#Orverwrite the image_tag based on the idea from Designer Wall (http://webdesignerwall.com/tutorials/css3-image-styles)
def image_tag(source, options = {})
image_width = image_height = nil
image_width_css = image_height_css = ""
options.symbolize_keys!
options[:class] = "image-wrap " + options[:class]