Skip to content

Instantly share code, notes, and snippets.

View swanson's full-sized avatar
😈

matt swanson swanson

😈
View GitHub Profile
: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) {
@swanson
swanson / gist:3d706bfa9271d2a45df9
Created January 26, 2016 02:15
Segment users based on github account
Auth with Github -> github username
github username -> https://api.github.com/users/swanson/repos
Repos have a `language` field -> find most occuring language
Segment users based on most occurring language:
* ObjC/Swift -> iOS trail
* Ruby -> Rails trail
* Javascript -> React trail
@swanson
swanson / gist:a1c4bd7f5c01750f3af5
Created September 21, 2015 22:43
hacks and happenings
http://www.panozzaj.com/blog/2015/09/19/github-pull-request-workflow-labels/
http://aimeeault.com/2015/09/21/disabling-superhero-mode-at-night-or-how-to-properly-turn-off-work-notifications-after-work/