This file contains hidden or 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
let isoCapitals: any = { | |
"ru": { | |
address: 'Москва', | |
latitude: 55.755826, | |
longitude: 37.617300 | |
}, | |
"ca": { | |
address: 'Ottawa', | |
latitude: 45.421530, | |
longitude: -75.697193 |
This file contains hidden or 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
var docCookies = { | |
getItem: function (sKey) { | |
return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1")) || null; | |
}, | |
setItem: function (sKey, sValue, vEnd, sPath, sDomain, bSecure) { | |
if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) { return false; } | |
var sExpires = ""; | |
if (vEnd) { | |
switch (vEnd.constructor) { | |
case Number: |
This file contains hidden or 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://blog.derakkilgo.com/2009/06/07/send-a-file-via-post-with-curl-and-php/ | |
$file_name_with_full_path = realpath('./sample.jpeg'); | |
$post = array('extra_info' => '123456','file_contents'=>'@'.$file_name_with_full_path); | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL,$target_url); | |
curl_setopt($ch, CURLOPT_POST,1); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $post); | |
$result=curl_exec ($ch); | |
curl_close ($ch); |
This file contains hidden or 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
/tppabs=".+[.]css"/ig |
This file contains hidden or 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
Transparent 1x1 PNG: | |
header('Content-Type: image/png'); | |
echo base64_decode('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII='); | |
////// | |
Transparent 1x1 GIF: | |
header('Content-Type: image/gif'); |
This file contains hidden or 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
Point: https://www.instagram.com/USER_LOGIN/media/ | |
Return: JSON format |
This file contains hidden or 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
/** | |
* Overwrites obj1's values with obj2's and adds obj2's if non existent in obj1 | |
* @param obj1 | |
* @param obj2 | |
* @returns obj3 a new object based on obj1 and obj2 | |
*/ | |
function merge_options(obj1,obj2){ | |
var obj3 = {}; | |
for (var attrname in obj1) { obj3[attrname] = obj1[attrname]; } | |
for (var attrname in obj2) { obj3[attrname] = obj2[attrname]; } |
This file contains hidden or 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
/** | |
* | |
* Base64 encode / decode | |
* http://www.webtoolkit.info/ | |
* | |
**/ | |
var Base64 = { | |
// private property |
This file contains hidden or 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
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
This file contains hidden or 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
down vote | |
accepted | |
Thanks RASG for http://stackoverflow.com/a/3211647/982924 | |
Async function with callback: | |
function async(u, c) { | |
var d = document, t = 'script', | |
o = d.createElement(t), |