Skip to content

Instantly share code, notes, and snippets.

@ihatov08
ihatov08 / Gemfile
Created June 25, 2021 11:16 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
# -*- coding: utf-8 -*-
#
#
# http://qiita.com/takashibagura/items/8b49b8b02bb797210c5b
# 上記サイトを参考にAWS SDK for Ruby v2で作成
require 'aws-sdk-core'
require 'yaml'
require 'pp'
@ihatov08
ihatov08 / active_admin.rb
Created March 1, 2017 00:08 — forked from stereoscott/active_admin.rb
Stream CSV exports in ActiveAdmin in Rails 4
# if you want to monkey patch every controller, put this in initializers/active_admin.rb
ActiveAdmin::ResourceController.class_eval do
include ActiveAdmin::CSVStream
end
@ihatov08
ihatov08 / gist:8d4e6e36026d5b4d9602308f7b6e06df
Created February 16, 2017 01:30 — forked from jondahl/gist:91930
Rake task to anonymize data
#
# Copyright (c) 2009 Jonathan Dahl
#
# Released under the MIT license. See below for details.
#
namespace :db do
namespace :data do
desc "Anonymize sensitive information"
task :anonymize => :environment do
@ihatov08
ihatov08 / sessions_controller.rb
Created August 11, 2016 14:58 — forked from gonzalo-bulnes/sessions_controller.rb
A SimpleTokenAuthentication-compatible JSON version of Devise::SessionsController. (UPDATE: For a discussion about this gist and a better version of it, please see https://github.com/gonzalo-bulnes/simple_token_authentication/issues/48#issuecomment-42133939)
# app/controllers/sessions_controller.rb
class SessionsController < Devise::SessionsController
# This controller provides a JSON version of the Devise::SessionsController and
# is compatible with the use of SimpleTokenAuthentication.
# See https://github.com/gonzalo-bulnes/simple_token_authentication/issues/27
def create
# Fetch params
@ihatov08
ihatov08 / api_controller.rb
Created August 11, 2016 13:55 — forked from dnlserrano/api_controller.rb
Custom Authentication Controllers
class ApiController < ApplicationController
# define which model will act as token authenticatable
acts_as_token_authentication_handler_for Login
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :null_session
respond_to :json
skip_before_filter :verify_authenticity_token, if: :json_request?
@ihatov08
ihatov08 / uploads_controller.rb
Created August 9, 2016 07:16 — forked from longlostnick/uploads_controller.rb
Rails JSON file upload with carrierwave (from base64 string)
class Api::UploadsController < ApiController
def create
@upload = Upload.new(upload_params)
ensure
clean_tempfile
end
private