Skip to content

Instantly share code, notes, and snippets.

View mayra-cabrera's full-sized avatar
💃
Nothing to do here. Go to https://gitlab.com/mayra-cabrera instead

Mayra Cabrera mayra-cabrera

💃
Nothing to do here. Go to https://gitlab.com/mayra-cabrera instead
View GitHub Profile
@mayra-cabrera
mayra-cabrera / go_meetup.md
Last active February 4, 2016 15:56
Resumen Go Meetup: Construyendo un API en Beego
{:line_item=>
{:start_date_time=>{:date=>{:year=>2016, :month=>1, :day=>27}, :hour=>17, :minute=>57, :second=>0, :time_zone_id=>"America/Mexico_City"},
:end_date_time=>{:date=>{:year=>2016, :month=>1, :day=>28}, :hour=>23, :minute=>59, :second=>0, :time_zone_id=>"America/Mexico_City"},
:line_item_type=>"STANDARD",
:cost_type=>"CPM",
:delivery_rate_type=>"EVENLY",
:primary_goal=>{:goal_type=>"LIFETIME", :unit_type=>"IMPRESSIONS", :units=>10},
:creative_rotation_type=>"EVEN",
:frequency_caps=>[{:max_impressions=>3, :num_time_units=>24, :time_unit=>"HOUR"}],
:creative_placeholders=>[{:size=>{:width=>728, :height=>90, :is_aspect_ratio=>false}, :creative_size_type=>"PIXEL"}],
@mayra-cabrera
mayra-cabrera / ruby_model_example.md
Created January 22, 2016 02:19
ruby_model_example
class Project < ActiveRecord::Base
  belongs_to :portfolio
  has_one :project_manager
  has_many :milestones
  has_many :deliverables, through: milestones
  validates :name, :description, presence: true
  validates :non_disclosure_agreement, acceptance: true
  validates :short_name, uniqueness: true
end
@mayra-cabrera
mayra-cabrera / ruby_irb.md
Last active January 22, 2016 02:10
ruby_irb

Ruby

$ irb
$ irb(main):001:0> exit
$ irb
$ irb(main):001:0&gt; quit
@mayra-cabrera
mayra-cabrera / gist:8326980
Last active January 2, 2016 15:59
IPO Homepage comparison using Refinery
Header:
-Normal http://i1.minus.com/iYdsNVNWE5ZYf.png
-Refinery http://i1.minus.com/ibcoXsj3gzy4bc.png
Customized internships:
http://i5.minus.com/i98qAQS76VfJl.png
Search project
http://i5.minus.com/ib25kzZVs1FXEW.png
Con refinery
<article class='box box-green' id='search_projects'>
<div class='container'>
<h2 class='center medium'><p>Don’t see your field?<br />Search all of our projects. Boom, its that easy.</p></h2>
<button class=" button button-orange" id="search-projects"> <span class="sprite search"
title=""
style="background:
url(/assets/spritesheet.png) no-repeat -0px -72px;
width: 32px;
Con refinery
<article class='motto box box-light-yellow'>
<div class='container'>
<img alt="Lightbulbs" id="lightbulbs" src="/assets/lightbulbs.png" />
<h2><span class="centered text-align-center">Customized, Missional Internships</span>
</h2>
<p class="centered">70% of Christ’s followers live in the Global South.<br />70% of Christ’s followers live in the Global South.<br />70% of Christ’s followers live in the Global South.</p>
</div>
</article>
=> myLayout
=> #<Rfm::Layout:0x007fc2cd0d67a8
@db=
#<Rfm::Database:0x007fc2cd0dd940
@account_name="",
@layout={"starsv2"=>#<Rfm::Layout:0x007fc2cd0d67a8 ...>},
@name="STARSv2",
@name="STARSv2",
@password="tGr5^M%34s",
@script={},
#Product, Variants & Parts
Spree::Product.find(42)
=> #<Spree::Product id: 42, name: "Manager & Supervisor Due Diligence", course_id: 3....>
Spree::Product.find(42).parts
=> [#<Spree::Variant id: 14, sku: "C3", .. is_master: true, product_id: 12, course_id: nil...>,
#<Spree::Variant id: 46, sku: "Confined-2", ... is_master: false, product_id: 11, course_id: nil...>
Spree::AssembliesPart.where(assemblie_id: 42)
=> [#<Spree::AssembliesPart assembly_id: 42, part_id: 14, count: 2>,
#<Spree::AssembliesPart assembly_id: 42, part_id: 46, count: 2>]
@mayra-cabrera
mayra-cabrera / gist:7586523
Last active December 29, 2015 00:29
Parts!
Spree::Product.find(10).assembly?
Spree::Product Load (0.9ms) SELECT "spree_products".* FROM "spree_products" WHERE "spree_products"."id" = $1 LIMIT 1 [["id", 10]]
Spree::Variant Load (0.9ms) SELECT "spree_variants".* FROM "spree_variants" INNER JOIN "spree_assemblies_parts" ON "spree_variants"."id" = "spree_assemblies_parts"."part_id" WHERE "spree_assemblies_parts"."assembly_id" = 10
=> true
Spree::Product.find(10).parts
Spree::Product Load (1.1ms) SELECT "spree_products".* FROM "spree_products" WHERE "spree_products"."id" = $1 LIMIT 1 [["id", 10]]
Spree::Variant Load (0.7ms) SELECT "spree_variants".* FROM "spree_variants" INNER JOIN "spree_assemblies_parts" ON "spree_variants"."id" = "spree_assemblies_parts"."part_id" WHERE "spree_assemblies_parts"."assembly_id" = 10
=> [#<Spree::Variant id: 14, sku: "C3", price: #<BigDecimal:7fd289b39148,'0.7495E2',18(18)>, weight: nil, height: nil, width: nil, depth: nil, deleted_at: nil, is_master: true, product_id: 12, count_on_hand: -425, cost_price: