An introduction to curl
using GitHub's API.
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
Includes HTTP-Header information in the output
nodeValue is a little more confusing to use, but faster than innerHTML. | |
innerHTML parses content as HTML and takes longer. | |
textContent uses straight text, does not parse HTML, and is faster. | |
innerText is IE specific and also takes styles into consideration. It won't get hidden text for instance. | |
http://stackoverflow.com/questions/21311299/nodevalue-vs-innerhtml-and-textcontent-how-to-choose |
An introduction to curl
using GitHub's API.
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
Includes HTTP-Header information in the output
/* (320x480) iPhone (Original, 3G, 3GS) */ | |
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) { | |
/* insert styles here */ | |
} | |
/* (320x480) Smartphone, Portrait */ | |
@media only screen and (device-width: 320px) and (orientation: portrait) { | |
/* insert styles here */ | |
} | |
// @credit: http://stackoverflow.com/questions/8609289/convert-a-binary-nodejs-buffer-to-javascript-arraybuffer | |
// From Buffer to ArrayBuffer: | |
function toArrayBuffer(buffer) { | |
var ab = new ArrayBuffer(buffer.length); | |
var view = new Uint8Array(ab); | |
for (var i = 0; i < buffer.length; ++i) { | |
view[i] = buffer[i]; | |
} |
Copyright (c) 4-digit year, Company or Person's Name
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
$.post(url, { comment: text }, function(data) { | |
alert(data); | |
}); | |
//or | |
$.ajax(url, { data: { title: text1, comment: text2 }, | |
type: "POST", | |
beforeSend: function() { | |
alert("before send"); |
#Express - Logging The express.js node.js web application framework comes with a built-in logging module called logger which is the connect.js logger. It is really handy to enable and you can use it just like any other Express module. app.use(express.logger());
Without any configuration, the logger middleware will generate a detailed log using what is called the default format. The logger actually supports four predefined log formats: default, short ,tiny, and dev. Each of these predefined formats show various amounts of detail. You can specify one of them this way:
app.use(express.logger('dev'));
If you prefer, you can customize the precise details to be logged using the the following options to format the output of the logger:
package main | |
import ( | |
"os" | |
"log" | |
"net" | |
"strconv" | |
"strings" | |
) |