Last major update: 25.08.2020
- Что такое авторизация/аутентификация
- Где хранить токены
- Как ставить куки ?
- Процесс логина
- Процесс рефреш токенов
- Кража токенов/Механизм контроля токенов
# | |
# Proof of concept - import maps with JSX transpilation. Can trivially | |
# be extended to TypeScript and all the languages currently supported | |
# with Sprockets. | |
# | |
# There are two parts to this: | |
# * Have `find_javascript_files_in_tree` in importmap-rails to not only | |
# find JS files, but also files that can be transpiled to JS. | |
# * Add sprockets JSX transformer, making use of esbuild | |
# |
app = Rpush::Apns2::App.new | |
app.name = "ios_app" | |
app.certificate = File.read("/path/to/cert/cert.pem") | |
app.environment = "production" | |
app.connections = 1 | |
app.save! | |
Rpush.embed # to deliver in console on notification save | |
n = Rpush::Apns2::Notification.new |
/** | |
* | |
* Usage: | |
* Create/Update: Cookie.set("username", "John", 90); | |
* Read: Cookie.get("username"); | |
* Destroy: Cookie.delete("username"); | |
* | |
*/ | |
var Cookie = { | |
set: function (name,value,days) { |
# -*- encoding : utf-8 -*- | |
class Domain < ActiveRecord::Base | |
after_save :reload_routes | |
def reload_routes | |
if self.domain_changed? | |
REDIS.set("rails_routes_ts", "expired") | |
end | |
end |
#!/bin/env ruby | |
# lazy hack from Robert Klemme | |
module Memory | |
# sizes are guessed, I was too lazy to look | |
# them up and then they are also platform | |
# dependent | |
REF_SIZE = 4 # ? | |
OBJ_OVERHEAD = 4 # ? |
POSSIBLE_OPTIONS = "[misxp]" | |
def rubify_regexp(l) | |
re = l.gsub(/\(\?(#{POSSIBLE_OPTIONS}*)(?:-(#{POSSIBLE_OPTIONS}*))?:/) do |_| | |
enabled = $1 | |
disabled = $2 | |
# Perl's `s` option is `m` in Ruby | |
if enabled.include?('s') && !enabled.include?('m') | |
enabled.sub!('s', 'm') | |
else |
/*! | |
* toggleAttr() jQuery plugin | |
* @link http://github.com/mathiasbynens/toggleAttr-jQuery-Plugin | |
* @description Used to toggle selected="selected", disabled="disabled", checked="checked" etc… | |
* @author Mathias Bynens <http://mathiasbynens.be/> | |
*/ | |
jQuery.fn.toggleAttr = function(attr) { | |
return this.each(function() { | |
var $this = $(this); | |
$this.attr(attr) ? $this.removeAttr(attr) : $this.attr(attr, attr); |