PHP assumption is a static code analysis tool doing checks for weak assumptions. It helps us to convert our weak assumptions to assertions
sudo apt-get update
| <?php | |
| /** | |
| * Created by PhpStorm. | |
| * User: Computer Source | |
| * Date: 12/12/14 | |
| * Time: 3:56 PM | |
| */ | |
| $array = array( | |
| array(554 => "a"), |
| reference : http://php.net/manual/en/features.commandline.webserver.php | |
| PHP has a Built-in web server since 5.4.0: | |
| Linux: | |
| ====== | |
| /path/to/php -S 127.0.0.1:8080 | |
| Windows: | |
| ======= |
| function escapeJsonString($value) { | |
| # list from www.json.org: (\b backspace, \f formfeed) | |
| $escapers = array("\\", "/", "\"", "\n", "\r", "\t", "\x08", "\x0c"); | |
| $replacements = array("\\\\", "\\/", "\\\"", "\\n", "\\r", "\\t", "\\f", "\\b"); | |
| $result = str_replace($escapers, $replacements, $value); | |
| return $result; | |
| } | |
| $mongo = array('d','48na03af'); | |
| echo escapeJsonString(json_encode($ary)); |
| $.ajax({ | |
| dataType : "text/plain", | |
| contentType: "application/json;", | |
| type: "post", | |
| url: "http://172.16.8.22/AgroRuralMovil/SvcAsistencia.svc/ConsultaAsistencia", | |
| data: {"cDni":"44069967","dFechaInicio":"2012-01-01","dFechaFin":"2017-07-04","iOpcion":1}, | |
| success: function(e){ | |
| console.log(e); | |
| }, | |
| error: function(e){ |
| https://stackoverflow.com/questions/503093/how-to-redirect-to-another-webpage-in-javascript-jquery | |
| One does not simply redirect using jQuery | |
| jQuery is not necessary, and window.location.replace(...) will best simulate an HTTP redirect. | |
| window.location.replace(...) is better than using window.location.href, because replace() does not keep the originating page in the session history, meaning the user won't get stuck in a never-ending back-button fiasco. | |
| If you want to simulate someone clicking on a link, use location.href |
| Authorization Code Grant Flow | |
| ============================= | |
| Step 1 : Created a Live SDK application at https://apps.dev.microsoft.com/, and login with your Microsoft Account credentials when prompted. | |
| Got client_id e.g XXXXXXXXXXXXXXXXX | |
| Step 2 : Request for CODE with response_type=code at https://login.live.com/oauth20_authorize.srf?client_id=XXXXXXXXXXXXXXXXX&scope=bingads.manage&response_type=code&redirect_uri=https://login.live.com/oauth20_desktop.srf&state=ClientStateGoesHere |
This text now lives at https://github.com/MarcDiethelm/contributing/blob/master/README.md. I turned it into a Github repo so you can, you know, contribute to it by making pull requests.
If you want to contribute to a project and make it better, your help is very welcome. Contributing is also a great way to learn more about social coding on Github, new technologies and and their ecosystems and how to make constructive, helpful bug reports, feature requests and the noblest of all contributions: a good, clean pull request.
| The MIT License (MIT) | |
| Copyright (c) 2015 Justin Perry | |
| Permission is hereby granted, free of charge, to any person obtaining a copy of | |
| this software and associated documentation files (the "Software"), to deal in | |
| the Software without restriction, including without limitation the rights to | |
| use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | |
| the Software, and to permit persons to whom the Software is furnished to do so, | |
| subject to the following conditions: |
| Source: https://www.daveperrett.com/articles/2007/04/05/format-xml-with-php/ | |
| function formatXmlString($xml) { | |
| // add marker linefeeds to aid the pretty-tokeniser (adds a linefeed between all tag-end boundaries) | |
| $xml = preg_replace('/(>)(<)(\/*)/', "$1\n$2$3", $xml); | |
| // now indent the tags | |
| $token = strtok($xml, "\n"); | |
| $result = ''; // holds formatted version as it is built |