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
# cf_url is http://dSomething.cloudfront.net/path | |
# video_name is test.mp4 | |
def signed_html5 | |
parsed_uri = URI.parse(cf_url) | |
url = "#{parsed_uri.scheme}://#{parsed_uri.host}#{parsed_uri.path}/#{video_name}" | |
signed_url = sign(url) | |
end | |
# cf_url is http://dSomething.cloudfront.net/path | |
# video_name is test.mp4 |
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
<script type='text/javascript'> | |
jwplayer('my-video').setup({ | |
primary: "flash", | |
sources: [ | |
{file: <%= sanitize(@video.signed_html5.inspect) %>}, | |
{file: <%= sanitize(@video.signed_flash.inspect) %>} | |
], | |
skin: 'someSkin', | |
flashplayer: <%= sanitize(asset_path('swf/jwplayer.flash.swf').inspect) %>, |
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
def show | |
respond_with @user.as_json | |
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
HTTP/1.1 200 OK | |
Content-Type: application/json; charset=utf-8 | |
X-UA-Compatible: IE=Edge | |
ETag: "6b4caf343a20865de174b2b530b945dd" | |
Cache-Control: max-age=0, private, must-revalidate | |
X-Request-Id: c3b0a57861087c0b827aab231747ef0c | |
X-Runtime: 0.051734 | |
Connection: close | |
{"admin":false,"created_at":"2014-01-23T16:17:10Z","email": |
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
def as_json | |
super(only: [:user_id, :email, :first_name, :last_name]) | |
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
HTTP/1.1 200 OK | |
Content-Type: application/json; charset=utf-8 | |
X-UA-Compatible: IE=Edge | |
ETag: "2333488e856669ac637e37cb4cf09cb6" | |
Cache-Control: max-age=0, private, must-revalidate | |
X-Request-Id: baa6a1c90004838793614e4c61633767 | |
X-Runtime: 0.092768 | |
Connection: close | |
{"email":"[email protected]","first_name":"Jack","last_name":"Mannino","user_id":2} |
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 'base64' | |
require 'cgi' | |
orig_session_id = "BAh7CEkiD3Nlc3Npb25faWQGOgZFVEkiJWViYTgyMTMwYjE3ZmJkMDVmOTI4MTYzYzhjMWI1YTcwBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMVhJblpXL2NQNERnQVZZT0NTeWs5RXJzb2JpNzFOSlJwZ0NVQjlnNWplc3c9BjsARkkiDHVzZXJfaWQGOwBGaQo%3D--be5328b6089949b1a5da6eb3b21e220744705ab8" | |
new_session_id = CGI::unescape(orig_session_id).split('--').first | |
decoded = Marshal.load(Base64.decode64(new_session_id)) | |
puts "Deobfuscated cookie: #{decoded}" |
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
import re | |
import zlib | |
import base64 | |
import pickle | |
orig_session_id = ".eJxrYKotZNQIFYpPLC3JiC8tTi2KT0pMzk7NSylkCtVMyUrMS8_XS87PKynKTNIDqdGDShfr-eanpOY4QRUzh_IiGZGZUsjizVyqBwA9cCGB:1WrtB4:7bnqeUSJ2mJCPeyPA0FcskLq0m0" | |
def b64_decode(s): | |
number = (-len(s) % 4) | |
pad = number * "=" |
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
<script type="text/javascript"> | |
function someThing(){ | |
$("#someDiv").append("someUserContent"); | |
} | |
</script> |
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
if defined?(ActionMailer) | |
class Devise::Mailer < Devise.parent_mailer.constantize | |
include Devise::Mailers::Helpers | |
def confirmation_instructions(record, token, opts={}) | |
@token = token | |
devise_mail(record, :confirmation_instructions, opts) | |
end | |
def reset_password_instructions(record, token, opts={}) |