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
<?php | |
$parameters = [ | |
'proxy_host' => "127.0.0.1", | |
'proxy_port' => 8888, | |
'stream_context' => stream_context_create( | |
array( | |
'ssl' => array( | |
'verify_peer' => false, | |
'verify_peer_name' => false, |
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 Admin::Api::BaseController < Admin::BaseController | |
after_filter :set_csrf_cookie | |
# For client side js applications needing to qualify for Rails CSRF protection | |
# Normally rails will return its csrf token in the body of the request for html rendering | |
# | |
# In the case of client side apps, we return the token in a cookie | |
# See: https://technpol.wordpress.com/2014/04/17/rails4-angularjs-csrf-and-devise/ | |
def set_csrf_cookie | |
cookies['X-CSRF-TOKEN'] = form_authenticity_token if protect_against_forgery? |
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://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query | |
http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails | |
#payload: [{"kind"=>"person"}] | |
Segment.where("payload @> ?", [{kind: "person"}].to_json) | |
#data: {"interest"=>["music", "movies", "programming"]} | |
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json) | |
Segment.where("data #>> '{interest, 1}' = 'movies' ") | |
Segment.where("jsonb_array_length(data->'interest') > 1") |
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
openssl s_client -crlf -connect imap.gmail.com:993 | |
tag login [email protected] passwordhere | |
tag list "" "*" | |
tag select "inbox" | |
tag fetch 1:3 body[header] | |
tag fetch 3 body[header] | |
tag fetch 3 body[text] | |
tag fetch 2 all | |
tag fetch 2 fast | |
tag fetch 2 full |