// jQuery
$(document).ready(function() {
// code
})
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
| <!DOCTYPE html> | |
| <!-- | |
| Stuart Powers | |
| http://sente.cc/ | |
| http://twitter.com/stuartpowers | |
| --> | |
| <html> | |
| <head> |
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
| <!-- via stackoverflow: http://stackoverflow.com/questions/3963338/loading-inline-content-using-fancybox --> | |
| <!-- Question: How can I load inline (inner-page) content using fancybox? --> | |
| <!-- Answer [Oct 18 '10 at 20:59 by Marko]: The solution is very simple, but took me about 2 hours and half the hair on my head to find it. Simply wrap your content with a (redundant) div that has display: none and Bob is your uncle. --> | |
| <div style="display: none"> | |
| <div id="content-div">Some content here</div> | |
| </div> |
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
| javascript: javascript: (function() { | |
| var s = 'https://nytimes.github.io/svg-crowbar/svg-crowbar.js'; | |
| var e = document.createElement('script'); | |
| e.setAttribute('src', s); | |
| e.setAttribute('class', 'svg-crowbar'); | |
| document.body.appendChild(e); | |
| })(); |
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 winston = require('winston'); | |
| winston.add( | |
| winston.transports.File, { | |
| filename: 'node-log-file.json.log', | |
| level: 'info', | |
| json: true, | |
| eol: '\n', // for Windows, or `eol: '\n',` for *NIX OSs | |
| timestamp: true | |
| } | |
| ); |
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
| <?php | |
| /** | |
| * Output debug message to browser console | |
| */ | |
| function debug_to_console($data) { | |
| if(is_array($data) || is_object($data)) | |
| { | |
| echo("<script>console.log('PHP: ".json_encode($data)."');</script>"); | |
| } else { | |
| echo("<script>console.log('PHP: ".$data."');</script>"); |
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
| // Method used in Google Analytics: | |
| (function(d, script) { | |
| script = d.createElement('script'); | |
| script.type = 'text/javascript'; | |
| script.async = true; | |
| script.onload = function(){ | |
| // remote script has loaded | |
| }; | |
| script.src = 'http://www.google-analytics.com/ga.js'; |
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
| function elementToObject(element, o) { | |
| var el = $(element); | |
| var o = { | |
| tagName: el.tagName | |
| }; | |
| var i = 0; | |
| for (i ; i < el.attributes.length; i++) { | |
| o[el.attributes[i].name] = el.attributes[i].value; | |
| } |
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
| function toJSON(node) { | |
| node = node || this; | |
| var obj = { | |
| nodeType: node.nodeType | |
| }; | |
| if (node.tagName) { | |
| obj.tagName = node.tagName.toLowerCase(); | |
| } else | |
| if (node.nodeName) { | |
| obj.nodeName = node.nodeName; |
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
| // Changes XML to JSON | |
| function xmlToJson(xml) { | |
| // Create the return object | |
| var obj = {}; | |
| if (xml.nodeType == 1) { // element | |
| // do attributes | |
| if (xml.attributes.length > 0) { | |
| obj["@attributes"] = {}; |
OlderNewer