Skip to content

Instantly share code, notes, and snippets.

Molly Struve mstruve

Block or report user

Report or block mstruve

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View yay.rb
respond_to do |format|
format.json { render :json => { :success => true, :message => 'yay' } }
mstruve / redis.rb
Created Nov 16, 2018
Redis Readonly Console
View redis.rb
if ENV['REDIS_ACCESS_MODE'] == 'readonly'
class Redis
class Client
WRITE_COMMANDS = { |a| a[0] if a[2].include?('write') }.compact.to_set.freeze
def process(commands)
if commands.flatten.any? { |c| WRITE_COMMANDS.include?(c.to_s) }
raise NotImplementedError, "REDIS_ACCESS_MODE is set to 'readonly', disallowing writes"
View api.rb
before do
client = headers["Auth-Token"])
error!('Unauthorized. Invalid token.', 401) unless client
error!('Unauthorized action.', 403) unless client.user_authorization_required? &&["X-Grpn-Email"]).authorized_action?(request.request_method)
mstruve / educations_controller.rb
Created Aug 24, 2012
Two Examples of methods that parse data from LinkedIn in order to get the Job and Education information for a user.
View educations_controller.rb
def linkedin
client ="API Key", "Secret Key")
client.authorize_from_access(current_user.link_token, current_user.link_secret)
#breakdown LinkedIn Hash into pieces in order to obtain data
@profile = client.profile
@school = client.profile(:fields => %w(educations))
@schools ={|t| t}
mstruve / payments_controller.rb
Created Aug 24, 2012
This is part of my payments_controller.rb which was used with the PayPal_Adaptive gem it order to preapprove payments that I want executed at a later time. It has a bit of code specific to my app but I struggled with PayPal so hopefully someone will find
View payments_controller.rb
def paypal
@meeting = Meeting.find_by_id(params[:id])
@user = current_user
return_url = schedule_meeting_path
if @meeting.price == nil && @meeting.donation == nil
redirect_to return_url
if @meeting.donation != nil
You can’t perform that action at this time.