- register a new project here
- set the followings under APIs & auth:
- Consent screen: fill out the requires fields
- APIs: Contacts API & Google+ API
- Creditentials: create a new OAuth client ID
- AUTHORIZED JAVASCRIPT ORIGINS: HOST (your app host) (protocol prefixed!)
- AUTHORIZED REDIRECT URI: HOST/auth/google/callback (protocol prefixed!)
- sign in url is user_omniauth_authorize_path(:google)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'time' | |
class Human | |
attr_reader :birth_date | |
def initialize(birth_date) | |
@birth_date = birth_date | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'venice' | |
data = %{ewoJInNpZ25hdHVyZSIgPSAiQXBNVUJDODZBbHpOaWtWNVl0clpBTWlKUWJLOEVkZVhrNjNrV0JBWHpsQzhkWEd1anE0N1puSVlLb0ZFMW9OL0ZTOGNYbEZmcDlZWHQ5aU1CZEwyNTBsUlJtaU5HYnloaXRyeVlWQVFvcmkzMlc5YVIwVDhML2FZVkJkZlcrT3kvUXlQWkVtb05LeGhudDJXTlNVRG9VaFo4Wis0cFA3MHBlNWtVUWxiZElWaEFBQURWekNDQTFNd2dnSTdvQU1DQVFJQ0NHVVVrVTNaV0FTMU1BMEdDU3FHU0liM0RRRUJCUVVBTUg4eEN6QUpCZ05WQkFZVEFsVlRNUk13RVFZRFZRUUtEQXBCY0hCc1pTQkpibU11TVNZd0pBWURWUVFMREIxQmNIQnNaU0JEWlhKMGFXWnBZMkYwYVc5dUlFRjFkR2h2Y21sMGVURXpNREVHQTFVRUF3d3FRWEJ3YkdVZ2FWUjFibVZ6SUZOMGIzSmxJRU5sY25ScFptbGpZWFJwYjI0Z1FYVjBhRzl5YVhSNU1CNFhEVEE1TURZeE5USXlNRFUxTmxvWERURTBNRFl4TkRJeU1EVTFObG93WkRFak1DRUdBMVVFQXd3YVVIVnlZMmhoYzJWU1pXTmxhWEIwUTJWeWRHbG1hV05oZEdVeEd6QVpCZ05WQkFzTUVrRndjR3hsSUdsVWRXNWxjeUJUZEc5eVpURVRNQkVHQTFVRUNnd0tRWEJ3YkdVZ1NXNWpMakVMTUFrR0ExVUVCaE1DVlZNd2daOHdEUVlKS29aSWh2Y05BUUVCQlFBRGdZMEFNSUdKQW9HQkFNclJqRjJjdDRJclNkaVRDaGFJMGc4cHd2L2NtSHM4cC9Sd1YvcnQvOTFYS1ZoTmw0WElCaW1LalFRTmZnSHNEczZ5anUrK0RyS0pFN3VLc3BoTWRkS1lmRkU1ckdYc0FkQkVqQndSSXhleFRldngzS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git log --graph --pretty=format:'%C(auto)%h -%d %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- cards are what you review. easy! | |
CREATE TABLE cards ( | |
id integer primary key, | |
-- the epoch milliseconds of when the card was created | |
nid integer not null, | |
-- notes.id | |
did integer not null, | |
-- deck id (available in col table) | |
ord integer not null, | |
-- ordinal, seems like. for when a model has multiple templates, or thereabouts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# using the awesome squeel gem | |
has_many :shares, dependent: :destroy | |
has_many :stories, through: :shares | |
has_many( | |
:stories_this_month, -> do | |
where do | |
date_part('month', created_at).eq(Date.today.month) & | |
date_part('year', created_at).eq(Date.today.year) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mechanize' | |
require 'kuromoji' | |
dom = Mechanize.new.get("http://tatoeba.org/eng/sentences/show/jpn") | |
jp_sentence = dom.parser.at("//div[@lang = 'ja']").text | |
# => "万一に備えて傘を持っていった方がいいだろうな。" | |
jp_sentence_w_furigana = dom.parser.at("//div[@lang = 'ja-Latn']").text | |
# => "万一[まんいち] に[] 備え[そなえ] て[] 傘[かさ] を[] 持っ[もっ] て[] いっ[] た[] 方[ほう] が[] いい[] だろ[] う[] な[] 。[]" | |
en_sentence = dom.parser.at("//div[@lang = 'en']").text | |
# => "Perhaps I should take an umbrella with me just in case." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class InstagramRealTimeUpdatesController < ActionController::Base | |
def callback | |
case request.method_symbol | |
when :get | |
render text: Instagram.meet_challenge(params, ENV['INSTAGRAM_VERIFY_TOKEN']) | |
when :post | |
Instagram.process_subscription(request.body.read) do |handler| | |
handler.on_user_changed do |user_id, data| | |
media_id = (data['data'] || {})['media_id'] | |
InstagramJob.perform_later user_id, media_id |
git config --global init.templatedir '~/.git-templates'
mkdir -p ~/.git-templates/hooks
-
create ~/.tig-brother/checkouts.db (sqlite3) from the dump
-
copy the hook script
-
git init
in the git repo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- - "お前" | |
- :count: 325 | |
:readings: | |
- "オマエ" | |
- - "木" | |
- :count: 285 | |
:readings: | |
- "キ" | |
- - "言う" | |
- :count: 279 |
OlderNewer