Skip to content

Instantly share code, notes, and snippets.


matt swanson swanson

View GitHub Profile
View 00_html.erb
data-hovercard-url-value="<%= hovercard_user_path(e.user) %>"
data-action="mouseenter->hovercard#show mouseleave->hovercard#hide"
<%= link_to e.user.username, e.user, class: "font-bold hover:text-gray-700" %>
<%= e.action %>
View 00_index.html.erb
<div data-controller="clipboard" class="mt-4 bg-gray-50 p-6">
<input type="text" class="form-input bg-grey-50" value="SeCrEtKeY-42!" data-clipboard-target="source" readonly />
<button class="btn" data-clipboard-target="button" data-action="clipboard#copy">
View 00_index.html.erb
<div data-controller="counter" data-counter-count-value="7" class="flex flex-col mt-3">
<div class="text-2xl">
The count is: <span data-counter-target="result"></span>
<div class="flex space-x-4 mt-4">
<button class="btn" data-action="counter#increment">+</button>
<button class="btn" data-action="counter#decrement">-</button>
View checkbox_list_controller.js
import { Controller } from "stimulus";
export default class extends Controller {
static targets = ["count"];
connect() {
checkAll() {
View gist:d6eb4f80b071538564a615f22882be3a
<div data-controller="required-field" data-required-field-message="Email is required">
<input name="email" data-target="required-field.field" ...>
<div data-controller="required-field" data-required-field-message="Password is required">
<input name="password" data-target="required-field.field">
View as_modal.js.haml
var existingModal = document.querySelector("[data-controller='modal']");
if (existingModal) {
document.body.insertAdjacentHTML("beforeend", "#{j render partial: template.to_s}");
View gist:2177df1a5bde7dc03424f1509619cc64
"id": "MqdKxNWfuUSj0wAERp0G6p9qDAIZ",
"jerseyNumber": 59,
"name": {
"familyName": "Okine",
"givenName": "Earl"
"position": "DEFENSIVE_END"
"stats": {
"assistedTackles": 1,
View gist:2081c9031ac9d5574e4e8d9ec9ae95d8
for position, min_limit, max_limit in POSITION_LIMITS:
position_cap = solver.Constraint(min_limit, max_limit)
for i, player in enumerate(all_players):
if position == player.position:
position_cap.SetCoefficient(variables[i], 1)
# add this section
flex_spot = solver.Constraint(1, 1)
for i, player in enumerate(all_players):
swanson / gist:1a5866f935954432763c807f52ef17ae
Last active Jul 20, 2016
my dumb elixir/phoenix questions
View gist:1a5866f935954432763c807f52ef17ae
what is `index/2` and why does elixir care about arity so much?
is mix like Rake or the Rails commands? both? neither?
what's the |> syntax? What's it called (ala hash-rocket)?
How do I do a `rails c` equivalent?
Is there something like `pry`?
View gist:86f2133bf84cb531cab8de652195e54e
Hello-A member of the Microsoft team and a partner of ours suggested that I share this free hands-on Azure/IoT workshop with your group. The workshop will take place in Indianapolis on 6/7. Participants will use a Raspberry Pi Starter Kit to build a compelling IoT/Azure/BI story. More details and registration link are here Please let me know if you have any questions and thank you in advance for sharing this opportunity with your group.
For next month:
You can’t perform that action at this time.