Skip to content

Instantly share code, notes, and snippets.

View swanson's full-sized avatar
😈

matt swanson swanson

😈
View GitHub Profile
import { Controller } from "stimulus";
export default class extends Controller {
static targets = ["count"];
connect() {
this.setCount();
}
checkAll() {
//
<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>
//
:plain
var existingModal = document.querySelector("[data-controller='modal']");
if (existingModal) {
document.body.removeChild(existingModal);
}
document.body.insertAdjacentHTML("beforeend", "#{j render partial: template.to_s}");
"id": "MqdKxNWfuUSj0wAERp0G6p9qDAIZ",
"jerseyNumber": 59,
"name": {
"familyName": "Okine",
"givenName": "Earl"
},
"position": "DEFENSIVE_END"
},
"stats": {
"assistedTackles": 1,
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 July 20, 2016 20:43
my dumb elixir/phoenix questions
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`?
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/
> ruby -v
ruby 2.2.5p319 (2016-04-26 revision 54774) [x86_64-darwin13]
> irb
irb(main):001:0> require 'csv'; CSV
=> CSV
> ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin13]
> irb
irb(main):001:0> require 'csv'; CSV
Hey there, I'm Ben, one of the developers working on FormKeep: the form backend for designers and developers.
Over the next few months, we're going to be investing heavily in the product and I want to make sure we're building the features that *you* want. To ensure that happens, would you please take this 5-minute survey?
I'm only sending this to a handful of our active users, so every response counts. I know it won't be the highlight of your week but it'll mean that future FormKeep changes will make it even better for you.
Side bonus: the entire survey is keyboard-navigable. No mouse required!
Thank you to the hundredth power :)
@swanson
swanson / text.js
Created February 15, 2016 14:46
pixi wordbreak
Text.prototype.wordWrapWordBreak = function(text) {
var result = '';
var lines = text.split('\n');
var wordWrapWidth = this._style.wordWrapWidth;
for (var i = 0; i < lines.length; i++) {
var spaceLeft = wordWrapWidth;
var characters = lines[i].split('');
for (var j = 0; j < characters.length; j++) {
var characterWidth = this.context.measureText(characters[j]).width;
if (j === 0 || characterWidth > spaceLeft) {