Skip to content

Instantly share code, notes, and snippets.

@andrzj
andrzj / file_get_contents_post_json_cookie.php
Last active October 2, 2017 19:08
Posting JSON and Cookie via file_get_contents
$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" .
@andrzj
andrzj / index.html
Created July 3, 2017 18:10
Detect a click in a cross domain iframe
<iframe id="iframe" src="//example.com"></iframe>
<div id="message"></div>
@andrzj
andrzj / gist:7e0e2c99384b2c034894c2af1a549aa1
Created July 3, 2017 14:34 — forked from jaydson/gist:1780598
How to detect a click event on a cross domain iframe
var myConfObj = {
iframeMouseOver : false
}
window.addEventListener('blur',function(){
if(myConfObj.iframeMouseOver){
console.log('Wow! Iframe Click!');
}
});
document.getElementById('YOUR_CONTAINER_ID').addEventListener('mouseover',function(){
@andrzj
andrzj / wwd.js
Last active June 5, 2016 17:22
Windows wallpaper download script
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);