Skip to content

Instantly share code, notes, and snippets.

View ryujignh's full-sized avatar

Ryuji Ganaha ryujignh

  • San Francisco Bay Area
View GitHub Profile
class AvatarsController < ApplicationController
before_action :authenticate_user!
def show
end
def update
# to crop, need to assign crop attrs before assigning avatar file
current_user.assign_attributes(user_crop_params)
if current_user.update(user_params)
- @recommended_loggers && @recommended_loggers.each do |logger|
li salt
@ryujignh
ryujignh / file0.txt
Last active February 28, 2018 23:39
メモ:Swiftでテーブルを作る時のお作法 ref: https://qiita.com/ryujignh/items/cc8f6314426c134721c6
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return itemArray.count
}
var itemArray = []
let defaults = UserDefaults.standard
@ryujignh
ryujignh / file0.swift
Last active March 3, 2018 08:43
Swift: NSCoderを使ったデータの保存、ロード ref: https://qiita.com/ryujignh/items/3c03115d6b939ff87f3f
var itemArray = [Item]()
let dataFilePath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first?.appendingPathComponent("Items.plist")
"shift_tab_unindent": true,
"show_full_path": true,
"translate_tabs_to_spaces": true,
"word_separators": "./\\()\"'-:,.;<>~!#$%^&*|+=[]{}`~?",
"word_wrap": "true"
"trim_trailing_white_space_on_save": true,
@ryujignh
ryujignh / README.md
Created August 3, 2022 18:51 — forked from jesster2k10/README.md
Rails API Social Login

Rails API-Only Social Login

This is another piece of code I've extrapolated from a Ruby on Rails project I'm currently working on. The code implmenets social login with a RoR API-based application, targeted at API clients.

The setup does not involve any browser-redirects or sessions as you would have to use working with Omniauth. Instead, what it does is takes an access_token generated on client-side SDKs, retireves user info from the access token and creates a new user and Identity in the database.

This setup works with native applications as described in the Google iOS Sign In Docs (see Authenticating with a backend server)