Skip to content

Instantly share code, notes, and snippets.

class Architecture
def roof(architecture)
architecture.roof
end
end
class Tudor
def desc
@moh-alsheikh
moh-alsheikh / README.md
Created September 17, 2016 04:28 — forked from choonkeat/README.md
ActiveResource access to Shopify Discount API using email+password login

Usage

Provide SHOPIFY_SUBDOMAIN, SHOPIFY_EMAIL and SHOPIFY_PASSWORD environment variables, and discount.rb will configure itself.

Supported APIs are

  • Discount.find(:all)
  • Discount.find(:first)
  • Discount.create(...)
  • Discount#destroy
def generate_payfort_signature(p_amount, p_customer_email, p_merchant_reference)
#current_return_url = Rails.env.development? ? CONFIG[:PAYFORT_TEST_RETURN_URL] : CONFIG[:PAYFORT_PRODUCTION_RETURN_URL]
sig_params = "#{CONFIG[:PAYFORT_SHA_REQUEST_PHARSE]}access_code=#{CONFIG[:PAYFORT_ACCESS_CODE]}amount=#{p_amount}command=#{CONFIG[:PAYFORT_PURCHASE_COMMAND]}currency=#{CONFIG[:PAYFORT_CURRENCY]}customer_email=#{p_customer_email}language=#{CONFIG[:PAYFORT_LANGUAGE]}merchant_identifier=#{CONFIG[:PAYFORT_MERCHANT_IDENTIFIER]}merchant_reference=#{p_merchant_reference}return_url=#{current_return_url_h}#{CONFIG[:PAYFORT_SHA_REQUEST_PHARSE]}"
return Digest::SHA256.hexdigest(sig_params)
end
Share your rails app with world by using ngrok here is the steps ::
1- download ngrok from https://ngrok.com.
2- run your local server (thin - webrik)
rails -s -p 8080
OR
@moh-alsheikh
moh-alsheikh / gist:5659220
Last active December 17, 2015 19:19
rails-actionmailer-setting
config.action_mailer.default_url_options = {:host => 'localhost:3000'}
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default :charset => "utf-8"
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",

Screencasting Framework

The following document is a written account of the Code School screencasting framework. It should be used as a reference of the accompanying screencast on the topic.

Why you should care about screencasting?

You're probably aren't going to take the time to read this document if you're not interested, but there are a lot of nice side effects caused by learning how to create quality screencasts.

  1. Communicating more effectively - At Envy Labs we produce screencasts for our clients all the time. Whether it's demoing a new feature or for a presentation for an invester, they're often much more effective and pleasent than a phone call or screen sharing.
@moh-alsheikh
moh-alsheikh / gist:4058014
Created November 12, 2012 07:39
INSTALL MYSQL , PASSENGER , CONFIGURE APACHE WITH PASSENGER SETUP NOTES
:: INSTALL MYSQL , PASSENGER , CONFIGURE APACHE WITH PASSENGER FOR MAC OS SETUP NOTES ::
1 - To install mysql in mac os you will need to run the following command ::
___________________________________________________
brew install mysql
___________________________________________________
== AFTER INSTALLING FINSHED YOU NEED TO READ THE FOLLWING INSTRUCTION
@moh-alsheikh
moh-alsheikh / gist:4044141
Last active October 12, 2015 14:58
Rails 3 Heroku Asset Pipeline Notes
ERROR ::
if you get the following error message when you try to open your app in Heroku ::
ActionView::Template::Error (images/apple-touch-icon-144x144-precomposed.png isn't precompiled):
===============================================================================================================
SOLUTION ::
@moh-alsheikh
moh-alsheikh / Setup Deployment Enviroment Notes
Created October 29, 2012 19:16
Nginx and unicorn # Setup Deployment Enviroment Notes #
:::::::: Nginx and unicorn Deployment Enviroment ::::::::::
Nginx is a pure web server that's intended for serving up static content and/or redirecting the request to another socket to handle the request.
Unicorn is a Rack web server and only intended to host a 'Rack App' which is usually generating dynamic content. Rack apps can also serve up static content but it's less efficient than most other traditional web servers.
Most RoR setups use a combination of both traditional web servers and Rack servers to apply the best of both of their capabilities. Nginx is incredibly fast at request redirection through proxy balancing and serving up static content. Unicorn is quite capable of processing HTTP headers and balancing inbound requests to Ruby for processing.
http://nginx.org/en/docs/
@moh-alsheikh
moh-alsheikh / rails_rspec_setup
Created October 12, 2012 07:11
Steps to setup rails enviroment to work with RSpec TDD
Steps to setup rails enviroment to work with RSpec TDD
1- include the follwing gems in your gem file ::
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
group :development, :test do
gem 'rspec-rails'
gem 'factory_girl_rails'