View proxy-config.md
View mongo.js
// Filter all URL's that have "/blogs/" in it AND don't have "em-foca". Result limited and pretty
db.assets.find({
$and:[
{ url: /\/blogs\// },
{ url: {$not: /em-foca/}},
]
}).limit(2).pretty()
// Filter and count all URL's that have "/blogs/" in it
db.assets.find({url: /^http:\/\/(.*)\/blogs\//}).count()
View index.js
$('#form').data('serialize',$('#form').serialize()); // On load save form current state
$(window).bind('beforeunload', function(e){
if($('#form').serialize()!=$('#form').data('serialize'))return true;
else e=null; // i.e; if form state change show box not.
});
// *******
var initial_form_state = $('#myform').serialize();
View php_curl_authorization.php
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $urlAuthComentarios,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_USERAGENT=>'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)',
View post_json_curl.php
$data = array("name" => "Hagrid", "age" => "36");
$data_string = json_encode($data);
$ch = curl_init('http://api.local/rest/users');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
View file_get_contents_post_json_cookie.php
$urlC = "http://test.com/api/v1/graph/ql";
$jsonData = '{"query": "query CoralAdmin_Dashboard($from: Date!, $to: Date!) {\n assetsByActivity: assetMetrics(from: $from, to: $to, sortBy: ACTIVITY) {\n ...CoralAdmin_Metrics\n }\n}\n\nfragment CoralAdmin_Metrics on Asset {\n id\n title\n url\n created_at\n commentCount\n }\n","variables": { "from": "2017-09-18T10:01:58.350Z", "to": "2017-09-21T18:06:58.350Z" }, "operationName": "CoralAdmin_Dashboard" }';
$options = array(
'http' => array(
'method' => 'POST',
'content' => $jsonData,
'header'=> "Content-Type: application/json\r\n" .
"Accept: application/json\r\n" .
View index.html
<iframe id="iframe" src="//example.com"></iframe>
<div id="message"></div>
View gist:7e0e2c99384b2c034894c2af1a549aa1
var myConfObj = {
iframeMouseOver : false
}
window.addEventListener('blur',function(){
if(myConfObj.iframeMouseOver){
console.log('Wow! Iframe Click!');
}
});
document.getElementById('YOUR_CONTAINER_ID').addEventListener('mouseover',function(){
View wwd.js
var saveToDisk = function (fileURL, fileName) {
// for non-IE
if (!window.ActiveXObject) {
var save = document.createElement('a');
save.href = fileURL;
save.target = '_blank';
save.download = fileName || 'unknown';
var event = document.createEvent('Event');
event.initEvent('click', true, true);