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 request = require("request"); | |
| request({ | |
| uri: "http://www.google.com", | |
| }, function(error, response, body) { | |
| console.log(body); | |
| }); |
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
| # | |
| # Web crawler examples | |
| # | |
| require 'rubygems' | |
| require 'nokogiri' | |
| require 'open-uri' | |
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
| jQuery.fn.reverse = [].reverse; | |
| $(elements).reverse().each(function(index,item) { | |
| //...some awesome 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
| var i; | |
| for (i in document.images) { | |
| if (document.images[i].src) { | |
| var imgSrc = document.images[i].src; | |
| if (imgSrc.substr(imgSrc.length-4) === '.png' || imgSrc.substr(imgSrc.length-4) === '.PNG') { | |
| document.images[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod='crop',src='" + imgSrc + "')"; | |
| } | |
| } | |
| } |
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
| /* Smartphones (portrait and landscape) */ | |
| @media only screen and (min-device-width : 320px) and (max-device-width : 480px) {} | |
| /* Smartphones (landscape) */ | |
| @media only screen and (min-width : 321px) {} | |
| /* Smartphones (portrait) */ | |
| @media only screen and (max-width : 320px) {} | |
| /* iPads (portrait and landscape) */ |
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
| .cf { | |
| zoom: 1; | |
| &:before, | |
| &:after { | |
| content: ''; | |
| display: table; | |
| } | |
| &:after { | |
| clear: both; | |
| } |
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 serverPort = 3000; | |
| var express = require("express"), | |
| app = express(), | |
| port = serverPort; | |
| app.use(express.methodOverride()); | |
| app.use(express.bodyParser()); |
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 test_if_hashtag(string) { | |
| var thestring=string; | |
| var pattern = /#([a-zA-Z0-9]+)/g; | |
| return thestring.replace(pattern, "<a href='https://twitter.com/search?q=%23$1' target='_blank'>#$1</a>"); | |
| } |
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 test_if_link(string) { | |
| var thestring=string; | |
| var pattern = /(\b(www\.|http\:)\S+\b)/gi; | |
| return thestring.replace(pattern, "<a href='$1' target='_blank'>$1</a>"); | |
| } |