This file contains 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 to urlify a string */ | |
var urlify = function(a){return a.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "-").replace(/^-+|-+$/g, '')}; | |
/* usage example */ | |
var str_a = "* The Best Wallpaper Magazine in the . ? & world! : Rjer9238131 & "; | |
urlify(str_a) | |
/* returns */ | |
"the-best-wallpaper-magazine-in-the-world-rjer9238131" |
This file contains 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 validateEmailAddress(s) { | |
var atSym = "@", dot = "."; | |
if (s.indexOf(atSym) === -1 || s.indexOf(" ") !== -1 || s.indexOf(atSym) > s.lastIndexOf(dot) || s.length - s.lastIndexOf(atSym) < 3 || s.lastIndexOf(atSym) + 1 === s.lastIndexOf(dot) || s.length - s.lastIndexOf(dot) <== 2 ) return false; | |
else return true; | |
} |
This file contains 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 | |
require 'OAuth.php'; | |
$key = '<your_app_key>'; | |
$secret = '<your_app_secret>'; | |
$consumer = new OAuthConsumer($key, $secret); | |
$sig_method = new OAuthSignatureMethod_HMAC_SHA1; | |
$my_domain = 'http://www.mydomain.net'; |
This file contains 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
Connecting to the Tip or Skip API with Node.js. | |
In your package.json, require the oauth module and install it with `npm update`: | |
```javascript | |
// ... | |
dependencies: { | |
"oauth": "x.x.x" | |
}, | |
// ... |
This file contains 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
REQUEST_TOKEN_URL = 'https://tips.by/oauth/request_token' | |
ACCESS_TOKEN_URL = 'https://tips.by/oauth/access_token' | |
AUTHORIZATION_URL = 'https://tips.by/oauth/authorize' | |
CALLBACK_URL = '<your_encoded_callback_url>' | |
RESOURCE_URL = 'https://tips.by/api/1.0/product/5018324b18771ae13b000008/tip' | |
CONSUMER_KEY = '<consumer_key>' | |
CONSUMER_SECRET = '<consumer_secret>' | |
consumer = oauth.Consumer(key=CONSUMER_KEY, secret=CONSUMER_SECRET) | |
# Create our client. |
This file contains 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() { | |
function s() { | |
var e = document.createElement("div"); | |
e.style.height = "10001px"; | |
document.body.appendChild(e); | |
setTimeout(function() { | |
window.scrollTo(0, 0); | |
document.body.removeChild(e); | |
}, 1); |
This file contains 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 randomValue = function(a){ | |
return a[Math.floor(Math.random() * a.length)]; | |
}; |
This file contains 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
sudo ipfw -f flush | |
sudo ipfw add 1000 fwd 127.0.0.1,3000 tcp from any to me 80 | |
sudo ipfw add 2000 fwd 127.0.0.1,3131 tcp from any to me 443 |
This file contains 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> | |
<html lang="en-US"> | |
<head> | |
<title>CNN.com - Breaking News, U.S., World, Weather, Entertainment & Video News</title> | |
<meta http-equiv="content-type" content="text/html;charset=utf-8"/> | |
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/> | |
<meta name="viewport" content="width=1024"/> | |
<meta property="fb:app_id" content="80401312489"/> | |
<meta property="fb:page_id" content="129343697106537"/> | |
<style type="text/css"> |
This file contains 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
{"tips":[{"id":"52b3b3b4c49587b6761d6edd","name":"Interactive kaleidoscope floor #home #decor #cool #geekchic ","image":"http://d3t3tfuk4dded6.cloudfront.net/actionable/528d7909c49587b67618fbff/201310213754-0-interactive-kaleidoscope-floor-home-decor-cool-geekchic_570_361.jpg","thumbnail":"http://d3t3tfuk4dded6.cloudfront.net/actionable/528d7909c49587b67618fbff/201310213754-0-interactive-kaleidoscope-floor-home-decor-cool-geekchic_220_139.jpg","url":"http://","head":"528d7909c49587b67618fbff","type":"product","date":"2013-12-20T03:04:20.666Z","preload":"R0lGODdhBQADAPMAALS2tJ6loMOsk5ltfX9/lpGRjoFubpxyhnNshVxpeoB+fUo8RVtmdExta2V9bQAAACwAAAAABQADAAAECxAEMUgxByW1WHMRADs=","source":{"id":"4ec6b9c562fb694c0c000002","image":"http://d3t3tfuk4dded6.cloudfront.net/actor/4ec6b9c562fb694c0c000002/2012027213023-jz_430_461.jpg","preload":"R0lGODdhBQAFAPABAD9/I////ywAAAAABQAFAAACCAwQiWhsn2IBADs=","thumbnail":"http://d3t3tfuk4dded6.cloudfront.net/actor/4ec6b9c562fb694c0c000002/2012027213023-jz_187_200.jpg","type":"user","n |