This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm') | |
begin | |
rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME'])) | |
rvm_lib_path = File.join(rvm_path, 'lib') | |
$LOAD_PATH.unshift rvm_lib_path | |
require 'rvm' | |
RVM.use_from_path! File.dirname(File.dirname(__FILE__)) | |
rescue LoadError | |
# RVM is unavailable at this point. | |
raise "RVM ruby lib is currently unavailable." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default_run_options[:pty] = true | |
set :deploy_via, :copy | |
set :copy_cache, true | |
set :copy_exclude, [".git", "config/database.yml", "config/deploy.rb", ".rvmrc"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def process_gateway_return | |
#Find the gateway payment method from the parameters we have received back from the gateway provider | |
gateway = PaymentMethod.find_by_id_and_type(ExternalGateway.parse_custom_data(params)["payment_method_id"], "ExternalGateway") | |
# Populate the @order variable and the payment_made variable with the variables returned from the process_response method on the gateway method | |
# This method returns an array, which is how these two variables get populated. | |
@order, payment_made = gateway.process_response(params) | |
# Only do the next bit if the order has been found, and the gateway tells us that the payment has been made successfully |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run this script on a fresh Ubuntu server installation as root | |
# copy public ssh key to server's authorized_keys keychain for simple ssh logins | |
mkdir -p ~/.ssh | |
echo -e '<your ssh public key here>' > ~/.ssh/authorized_keys | |
# setup .gemrc | |
echo -e '--- | |
:verbose: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Note: This goes inside your spec_helper.rb file - if using Spork, inside the Spork.prefork block | |
OmniAuth.config.test_mode = true | |
OmniAuth.config.add_mock(:twitter, { | |
:uid => '123456789' | |
}) | |
OmniAuth.config.add_mock(:facebook, { | |
:uid => '123456789' | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#region Calculations | |
/** <summary>A method to calculate Body-Mass Index (BMI) from a given weight and height</summary> | |
* <param name="weight">The person's weight in kilograms</param> | |
* <param name="height">The person's height in kilograms</param> | |
*/ | |
public decimal CalculateBMI(decimal weight, decimal height) { | |
bmi = Math.pow(weight / height, 2) | |
return Math.round(bmi, 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Drawing; | |
using System.Linq; | |
using System.Text; | |
using System.Windows.Forms; | |
namespace Alexander_Sean_McArthur_300229975 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a new div tag to contain our image | |
var busy = document.createElement('div'); | |
var body = document.getElementsByTagName('body')[0]; | |
var max_width_cache = body.style.maxWidth; | |
body.style.maxWidth = '100%'; | |
busy.setAttribute('id', 'lookbusy'); | |
// Add a background image, and position the div tag above all other content and make it fill the screen | |
busy.setAttribute('style', 'position: absolute; z-index: 1000; width: 100%; height: 100%; top: 0px; left: 0px; right: 0px; bottom: 0px; background: #FFF url(http://www.1-day.co.nz/images/2010_mission_critical_development_strategy.png) no-repeat 0 0;'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
### gem_to_command.rb ############################################################### | |
# Produce a command to install the gems you currently have installed (using gem list) | |
# Makes a simple Shell script that can be run on Linux or Mac OS X | |
# | |
# Author: @sudojosh | |
###################################################################################### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" add jbuilder syntax highlighting | |
au BufNewFile,BufRead *.json.jbuilder set ft=ruby |
OlderNewer