Skip to content

Instantly share code, notes, and snippets.

View mmichael0413's full-sized avatar
:shipit:
They don't think it be like it is, but it do.

Michael Michaelevich mmichael0413

:shipit:
They don't think it be like it is, but it do.
View GitHub Profile

Keybase proof

I hereby claim:

  • I am mmichael0413 on github.
  • I am vich (https://keybase.io/vich) on keybase.
  • I have a public key ASBo0ptX8oL8roHxBxquVQ32ALDAZ2KEfJZpEvABtdWvpQo

To claim this, I am signing this object:

@mmichael0413
mmichael0413 / gist:c5bdd57805a612a942827a6a23f32143
Last active August 3, 2017 02:53
bash command for deleting files created from changing branches (from master to staging) in the kubernetes-thirdchannel repo
rm -r services/defenestration && rm -r services/delayed-jobs && rm -r services/erudition && rm -r services/procrastination && rm -r services/rabbit-monitor && rm -r services/stores && rm -r services/supplication && rm -r third-party/memcached && rm -r third-party/postgres && rm -r third-party/rabbitmq && rm -r third-party/redis
@mmichael0413
mmichael0413 / checkin_images_geo_data.rake
Created May 16, 2017 16:25
ThirdChannel - lookup how many Checkins for the last month have at least one image with geolocation data
namespace :calculate do
task checkin_images_geo_data: :environment do
headers_success = ['Checkin ID']
headers_error = ['Checkin ID', 'Error']
checkins_with_geo_images = []
other_checkins = []
checkins = Checkin.includes(:submissions, { submissions: :images })
.where('created_at >= ?', (1.month + 1.day).ago.to_datetime)
@mmichael0413
mmichael0413 / mysql_patch.rb
Created October 17, 2016 15:33
Initializer to fix Mysql2::Error: Specified key was too long; max key length is 767 bytes
require 'active_record/connection_adapters/abstract_mysql_adapter'
module ActiveRecord
module ConnectionAdapters
class AbstractMysqlAdapter
NATIVE_DATABASE_TYPES[:string] = { :name => "varchar", :limit => 191 }
end
end
end
@mmichael0413
mmichael0413 / tmdb_api_data_load.rb
Created October 17, 2014 03:59
Use TMDB API to create local movie objects
# Code for creating a list of 400 movie ids (most popular)
# And then creating a local movie object (along with genres and movie_genres)
api_ids = []
20.times do |i|
resp = HTTParty.get("http://api.themoviedb.org/3/movie/popular?api_key=#{ENV['TMDB_API_KEY']}&page=#{i+1}")
data = JSON.parse(resp.body)
data['results'].each do |movie|
api_ids << movie['id']
@mmichael0413
mmichael0413 / _payments.html.erb
Last active January 4, 2016 09:09
Stripe custom Checkout form and corresponding controller action and Payment model method
<!-- STRIPE CUSTOM CHECKOUT FORM -->
<div>
<script src="https://checkout.stripe.com/checkout.js"></script>
<a class="cta-red-copy" id="customButton">Pay with Card</a>
<script>
var amountValue;
var handler = StripeCheckout.configure({
key: '<%= Rails.configuration.stripe[:publishable_key] %>',
@mmichael0413
mmichael0413 / gist:2821681
Created May 28, 2012 23:37
Add new column to table
rails add NewModelNameToUsers new_model_name:string
@mmichael0413
mmichael0413 / gist:2821673
Created May 28, 2012 23:36
Set up home controller for new rails app
rails generate controller home index