Skip to content

Instantly share code, notes, and snippets.

View shamimevatix's full-sized avatar
🏠
Working from home

Asadujzaman Shamim shamimevatix

🏠
Working from home
View GitHub Profile
@giansalex
giansalex / ProxySoap.php
Last active September 27, 2023 06:49
Use SoapClient PHP with proxy for HTTP/HTTPS connections
<?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,
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?
@mankind
mankind / rails-jsonb-queries
Last active November 12, 2024 13:02
Ruby on Rails-5 postgresql-9.6 jsonb queries
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")
@gustavohenrique
gustavohenrique / telnet-imap
Created June 6, 2013 14:00
playing with gmail via telnet
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