Skip to content

Instantly share code, notes, and snippets.

View lando2319's full-sized avatar

Mike Land lando2319

View GitHub Profile
<%= form_tag ({:controller => "position_game_stats", :action => "create"}), remote: true do %>
<%= file_field_tag "s3_image[image]" %>
<button class="btn fr" data-step="2" data-intro="Input your single game batting stats for your new Micard" data-position="left" type="submit"><i class="icon-check icon-white"></i> Submit</button>
<% end %>
<% raise (user.stackup.map { |friend| {tags: [:game]}.merge(PositionGameStat.formatted_total_row(PositionGameStat.where(user_id: friend.id), options.merge({override: {name: friend.full_name}}))) } +
user.mlb_stackup.map { |friend| {tags: [:game]}.merge(MlbBattingStat.formatted_total_row(MlbBattingStat.where(mlb_player_id: friend.id), options.merge({override: {name: friend.mlb_full_name}}))) } +
[{tags: [:highlight]}.merge(PositionGameStat.formatted_total_row(position_stats, options.merge({override: {name: user.full_name}})))]).inspect %>
=>
[{:tags=>[:game], :cells=>["kk kk", 37, 6, 0, 0, 0, 0, 0, 0, 0, ".162"]}, {:tags=>[:game], :cells=>["pp pp", 33, 16, 0, 0, 0, 0, 0, 0, 0, ".485"]}, {:tags=>[:game], :cells=>["Mike` Land", 0, 0, 0, 0, 0, 0, 0, 0, 0, "N/A"]}, {:tags=>[:game], :cells=>["Mike Adams", 0, 0, 0, 0, 0, 0, 0, 0, 0, "N/A"]}, {:tags=>[:game], :cells=>["Jeremy Affeldt", 0, 0, 0, 0, 0, 0, 0, 0, 0, "N/A"]}, {:tags=>[:high
@lando2319
lando2319 / gist:10203062
Last active August 29, 2015 13:58
Adding Mailers
1. goto apps/mailers and create mailer
2. create the template in Mailchimp
3. from MailChimp push to Mandrill through the browser
4. Add call ProStatsPullErrorReport.pro_stats_pull_error_report(mikepland).deliver
@lando2319
lando2319 / gist:11147099
Created April 21, 2014 16:02
ajax request
function ChangeStackupStatusPlayers(stackup_number) {
$.ajax({
type: "PUT",
url: "/stackups/" + stackup_number,
data: { stackup_status: false },
dataType: 'script'
})
// $('#stackup_button' + stackup_number).hide();
//$('#stackup_button')
$ git branch -u origin/local_8
Branch local_8 set up to track remote branch local_8 from origin.
# with just gamecard process - Motox under wifi
https://github.com/lando2319/micard/blob/5f20a64e8e7a541b5332e2a03a54bfdfd16989f4/app/uploaders/image_uploader.rb
2014-04-30T06:39:04.246845+00:00 heroku[router]: at=info method=POST path=/validate host=micard-staging.herokuapp.com request_id=d51b57c0-55af-4a6a-a678-3cb0eb63fe13 fwd="67.175.163.44" dyno=web.1 connect=2ms service=20ms status=200 bytes=589
2014-04-30T06:39:04.242858+00:00 app[web.1]: Parameters: {"position_game_stat"=>{"at_bats"=>"55"}}
2014-04-30T06:39:04.242853+00:00 app[web.1]: Processing by ValidateController#check as JSON
@lando2319
lando2319 / regex
Last active August 29, 2015 14:00
s = "Testing this to see how much space I can use Testing this to see how much space I can use"
#grabs beginning of string by n characters with word boundaries
s[/^.{,45}\b/]
=> "Testing this to see how much space I can use "
#grabs end of string by n characters with word boundaries
s[/\b.{0,45}$/]
=> " Testing this to see how much space I can use"
MIKEs-MacBook-Air:micard mikeland$ heroku addons:add pgbackups -a micard
Adding pgbackups on micard... failed
! That add-on plan is already installed on micard.
MIKEs-MacBook-Air:micard mikeland$ heroku addons:add heroku-postgresql:hobby-basic -a micard
Adding heroku-postgresql:hobby-basic on micard... done, v243 ($9/mo)
Attached as HEROKU_POSTGRESQL_COPPER_URL
Database has been created and is available
! This database is empty. If upgrading, you can transfer
! data from another database with pgbackups:restore.
Use `heroku addons:docs heroku-postgresql` to view documentation.
1.9.3p362 :107 > s[/^.{9,16}\b/]
=> "one two three "
1.9.3p362 :108 > s[/^.{9,16}\w+/]
=> "one two three four"
1.9.3p362 :109 > s[/\w+.{,16}$/]
=> "four five six seven"
1.9.3p362 :110 > s[/\b.{,16}$/]
=> " five six seven"
1.9.3p362 :111 > s
=> "one two three four five six seven"