Skip to content

Instantly share code, notes, and snippets.


Rystraum Gamonez rystraum

  • Loudcloud Inc. / Intelimina Systems Inc.
  • Philippines
View GitHub Profile
rystraum / app-graphql-mutations-upload_avatar.rb
Created Jun 30, 2021
File Upload using Rails ActiveStorage, GraphQL
View app-graphql-mutations-upload_avatar.rb
class Mutations::UploadAvatar < Mutations::BaseMutation
null true
field :success, Boolean, null: false
field :errors, [String], null: true
field :thing, Types::ThingType, null: true
# query:
# mutation requestResetPassword($input: UploadAvatarInput!) {
# uploadAvatar(input:$input) {
# success
View AB Testing


  • Mbox - referenced as "Location" in Target's web interface. You can think of this as the div that will house the Experience's Offer.
  • Offer - the actual content that will go in an Mbox. This can be plain text, HTML or Javascript. mbox.js does an JS.append of the entire content. at.js insertion is based on how React does the insertion upon render.


  • Use at.js if using this under React.

As far as I can tell, Target's AB testing model (using React) is as follows:

  1. Load the component
  2. The first time an `` component is encountered, send an AJAX request to Adobe which retrieves the Offer.
View mvc-with-api
# views/items/index.html.erb
<% @items.each do |item| %>
<dt><%= %><dt>
<dd><%= item.price %></dd>
<% end %>
# controllers/items_controller.rb
View params
# params
{"0"=>{"question_id"=>"13", "value"=>"E"},
"1"=>{"question_id"=>"14", "value"=>"E"},
"2"=>{"question_id"=>"15", "value"=>"ewrq"},
"3"=>{"question_id"=>"16", "value"=>""},
"4"=>{"question_id"=>"17", "value"=>""},
View forms_controller_test.rb
require "test_helper"
describe FormsController, "#show" do
extend CitizenHelper
def setup
@form = create :active_form
rystraum / gist:5586611
Created May 15, 2013
Ember polymorphic associations
View gist:5586611
# doctor.rb
class Doctor < ActiveRecord::Base
has_one :user, as: :profile
has_and_belongs_to_many :patients
# patient.rb
class Patient < ActiveRecord::Base
has_one :user, as: :profile
has_and_belongs_to_many :doctors
View Explaining Ember Process
Full disclosure: This is my understanding on how Ember works. Feel free to correct me on points where I'm wrong.
How I understand it is that Ember starts with the route (the actual url on the address bar).
From the url in the address bar, it tries to match a route from your App.Router.
Once a route is matched, it calls the corresponding Route class (extending Em.Route), here you set up the model.
This route is paired with a controller (even if you don't specify one, it's matched with a generic controller) and renders a template.
In concrete terms, if you have the following Route map:{
rystraum / affiliateadmin.php
Created Sep 27, 2012
Itemized list of Referrals
View affiliateadmin.php
// Administration side of the affiliate system
class affiliateadmin {
var $build = 6;
var $db;
var $mylocation = "";
rystraum / erepublik.user.js
Created Jun 6, 2012
eRepublik market scraper
View erepublik.user.js
// ==UserScript==
// @name Erepublik
// @namespace erep
// @include*
// @version 1
// ==/UserScript==
var console = unsafeWindow.console;
var url = window.location;