Skip to content

Instantly share code, notes, and snippets.

View maecha's full-sized avatar
🏠
Working from home

Maechan maecha

🏠
Working from home
View GitHub Profile
@maecha
maecha / get_datetime_from_time.rb
Last active March 29, 2018 07:17
Get the datetime from time. / E.g. From request params
def get_datetime_converted_from_time
time = Time.zone.now
splited_time = params[:object][:time].split(':')
local_time = Time.local(
time.year,
time.month,
time.day,
splited_time.first.to_i,
splited_time.last.to_i,)
@maecha
maecha / seattleWeather_1948-2017.ipynb
Created February 28, 2018 02:16
anaconda3/py_learning/seattleWeather_1948-2017.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maecha
maecha / hello.mat
Created March 2, 2018 06:08
.mat シンタックスコードハイライト確認
# Created by Octave 3.8.0, Fri Mar 02 15:06:33 2018 JST <seiyamaeda@SeiyanoMacBook-Pro.local>
# name: A
# type: matrix
# rows: 3
# columns: 2
1 2
2 4
5 6
@maecha
maecha / check_isnull_data.ipynb
Last active March 3, 2018 07:53
anaconda3/ml_learning/kaggle/check_isnull_data.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maecha
maecha / titanic.ipynb
Last active March 5, 2018 11:45
The first attack Titanic: Machine Learning from Disaster for Competition
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maecha
maecha / CLI
Last active April 6, 2018 06:44
Update select box when another one is updated. / E.g. Hoge and Fuga are 'one-to-many relationship', and use a controller 'Piyo' without this association .
$ ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
$ bundle exec rails -v
Rails 5.1.4
@maecha
maecha / app|views|hoges|new.html.slim
Last active March 29, 2018 07:02
Open modal view on AdminLTE ver2 (with Bootstrap 3.3.6)
/ the way it uses font awesome
= link_to '#', data: { toggle: 'modal', target: '#hoge-modal' } do
i.fa.fa-question-circle
end
== render partial: 'layouts/shared/modals/hoge'
@maecha
maecha / Gemfile
Last active March 31, 2018 03:29
Kaminari on 'Ruby on Rails 5.1.4'
gem 'kaminari'
@maecha
maecha / app|assets|javascripts|hoge.coffee
Last active April 2, 2018 07:34
How to make the disabled-link with CoffeeScript / for Ruby on Rails 5.1.4
$(document).on 'turbolinks:load', ->
do ->
$('.disabled-link').click (e) ->
e.preventDefault()
return
@maecha
maecha / Gemfile
Last active April 3, 2018 06:58
How to use 'Cocoon' | Ruby on Rails 5.1.4 | AdminLTE ver2 (with Bootstrap 3.3.6) | Model 'Hoge' and 'Model 'Fuga' are 'one-to-many relationship'
gem 'cocoon'
gem 'jquery-rails'