Skip to content

Instantly share code, notes, and snippets.

View sevenseacat's full-sized avatar
🏠
Working remotely

Rebecca Le sevenseacat

🏠
Working remotely
View GitHub Profile
[["GMK 3Run - Base Kit", "Price: 71", "Quantity: 1"],
["GMK 3Run - Extras Kit Add-on", "Price: 29", "Quantity: 1"],
["GMK 3Run - Hacker / Standard Kit Add-on", "Price: 29", "Quantity: 3"],
["GMK Carbon R1 - Community Kit", "Price: 38", "Quantity: 8"],
["GMK Carbon R1 - International Kit", "Price: 51", "Quantity: 7"],
["GMK Carbon - Novelty", "Price: 47", "Quantity: 1"],
["GMK Nautilus - Base Kit", "Price: 119", "Quantity: 1"],
["GMK Nautilus - Community Set", "Price: 27", "Quantity: 1"],
["GMK Nautilus - Ergodox Set", "Price: 107", "Quantity: 1"],
["GMK Nautilus - Norde Set", "Price: 45", "Quantity: 1"],
iex(40)> :ets.new(:foo3, [:set, :named_table])
:foo3
iex(41)> :ets.insert(:foo3, {"a", 1})
true
iex(42)> :ets.lookup(:foo3, "a")
[{"a", 1}]
iex(43)> :ets.update_counter(:foo3, "a", {0, -1, 0, 0})
** (ArgumentError) argument error
(stdlib) :ets.update_counter(:foo3, "a", {0, -1, 0, 0})
case TABLEFLIP:
SEND_STRING("(");
process_unicode((0x256F | QK_UNICODE), record); // Arm
process_unicode((0x00B0 | QK_UNICODE), record); // Eye
process_unicode((0x25A1 | QK_UNICODE), record); // Mouth
process_unicode((0x00B0 | QK_UNICODE), record); // Eye
SEND_STRING(")");
process_unicode((0x256F | QK_UNICODE), record); // Arm
SEND_STRING(" ");
process_unicode((0x0361 | QK_UNICODE), record); // Flippy
09:16:38 sidekiq_worker_large.1 | /usr/local/Cellar/asdf/0.5.1/installs/ruby/2.3.7/lib/ruby/2.3.0/digest.rb:6: warning: already initialized constant Digest::REQUIRE_MUTEX
09:16:38 sidekiq_worker.1 | /usr/local/Cellar/asdf/0.5.1/installs/ruby/2.3.7/lib/ruby/2.3.0/digest.rb:6: warning: already initialized constant Digest::REQUIRE_MUTEX
09:16:38 sidekiq_worker.1 | /usr/local/opt/asdf/installs/ruby/2.3.7/lib/ruby/2.3.0/digest.rb:6: warning: previous definition of REQUIRE_MUTEX was here
09:16:38 sidekiq_worker_large.1 | /usr/local/opt/asdf/installs/ruby/2.3.7/lib/ruby/2.3.0/digest.rb:6: warning: previous definition of REQUIRE_MUTEX was here
09:16:38 sidekiq_scheduler.1 | /usr/local/Cellar/asdf/0.5.1/installs/ruby/2.3.7/lib/ruby/2.3.0/digest.rb:6: warning: already initialized constant Digest::REQUIRE_MUTEX
09:16:38 sidekiq_scheduler.1 | /usr/local/opt/asdf/installs/ruby/2.3.7/lib/ruby/2.3.0/digest.rb:6: warning: previous definition of REQUIRE_MUTEX was here
irb(main):005:0> u = URI.parse("127.0.0.1")
=> #<URI::Generic 127.0.0.1>
irb(main):006:0> u.port = 6379
=> 6379
irb(main):007:0> u
=> #<URI::Generic :6379127.0.0.1>

For a super quick example, this is the default index controller action test in Phoenix:

describe "index" do
  test "lists all products", %{conn: conn} do
    conn = get(conn, product_path(conn, :index))
    assert html_response(conn, 200) =~ "Listing Products"
  end
end
def index
@todos = current_user.todos.all
if params.has_key?(:done)
@todos = @todos.where(done: params[:done])
end
end
class Tour < ApplicationRecord
# This is used when generating urls, ie. tour_path(@tour) will give you "/tours/#{@tour.to_param}"
def to_param
tour_id # The field name that gives you 'e4Hqh8jTTcCrvQ3kH26Mtd7a'
end
end
@sevenseacat
sevenseacat / gist:30e832d8db50212af26b476673578def
Created April 7, 2017 02:21
after running `drop index index_profiles_on_user_id;`
Column | Type | Modifiers
------------+-----------------------------+-------------------------------------------------------
id | integer | not null default nextval('profiles_id_seq'::regclass)
user_id | integer |
created_at | timestamp without time zone | not null
updated_at | timestamp without time zone | not null
Indexes:
"profiles_pkey" PRIMARY KEY, btree (id)
"profiles_user_id_idx" UNIQUE, btree (user_id)
Foreign-key constraints:
div
| This is
valid slim markup. What?