Skip to content

Instantly share code, notes, and snippets.

Avatar
🤔

matt swanson swanson

🤔
View GitHub Profile
View 00_html.erb
<div
class="inline-block"
data-controller="hovercard"
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" %>
</div>
<span>
<%= 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">
Copy
</button>
</div>
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>
<div class="flex space-x-4 mt-4">
<button class="btn" data-action="counter#increment">+</button>
<button class="btn" data-action="counter#decrement">-</button>
</div>
</div>
View checkbox_list_controller.js
import { Controller } from "stimulus";
export default class extends Controller {
static targets = ["count"];
connect() {
this.setCount();
}
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>
<div data-controller="required-field" data-required-field-message="Password is required">
<input name="password" data-target="required-field.field">
</div>
//
View as_modal.js.haml
:plain
var existingModal = document.querySelector("[data-controller='modal']");
if (existingModal) {
document.body.removeChild(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
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
http://www.meetup.com/Open-Indy-Brigade/events/230315754/
http://www.kizan.com/events/
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 http://www.kizan.com/events/ Please let me know if you have any questions and thank you in advance for sharing this opportunity with your group.
https://twitter.com/CircleCityCon
For next month: http://www.meetup.com/High-Fives-Happy-Hour/events/231546188/
You can’t perform that action at this time.