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
//cleanup and sort elemets that have repins | |
//grab all pins | |
var mylist = $('.Pin'); | |
//find all pins that have repins | |
var listitems = mylist.find('.socialItem'); | |
var list = listitems.filter(function(f,i){ | |
var test = Number( $(i).text().trim().replace("repins", "").replace("repin", "") ); | |
if(test>0){ |
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
//empty main section | |
$(".Grid").before('<div id="organized"/>').remove(); | |
//append sorted items | |
$.each(list, function(idx, itm) { | |
$("#organized").append($(itm).parents('.Pin')); | |
}); | |
//style it up | |
$('.Pin').css({'clear': 'both', 'position': 'static'}); |
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
//cleanup for likes | |
$(".likes").each(function() { | |
var num = Number($(this).text().trim().replace("likes", "").replace("like", "")); | |
$(this).html(num); | |
}); | |
//sort | |
var mylist = $('.Pin'); | |
var listitems = mylist.find('.likes:not(:contains(0))'); //do not match on elements that have 0 likes | |
listitems.sort(function(a, b) { |
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 | |
//get artist photo | |
function getArtistPhoto($artist, $size) { | |
$artist = urlencode($artist); | |
$xml = "http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist={$artist}&api_key=YOUR_KEY"; | |
$xml = @file_get_contents($xml); | |
if(!$xml) { |
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 | |
//initialize | |
$ch = curl_init(); | |
// 2. set the options, including the url | |
curl_setopt($ch, CURLOPT_URL, "https://api.pingdom.com/api/2.0/traceroute?host=techslides.com"); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array("App-Key: YOUR-KEY-HERE")); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_HEADER, 0); |
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 | |
//initialize | |
$ch = curl_init(); | |
// 2. set the options, including the url | |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | |
curl_setopt($ch, CURLOPT_URL, "https://api.pingdom.com/api/2.0/traceroute?host=techslides.com"); | |
curl_setopt($ch, CURLOPT_USERPWD, "EMAIL:PASSWORD"); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array("App-Key: YOUR-KEY-HERE")); |
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 | |
$host = $_GET["host"]; | |
if (empty($host)) { | |
echo 'Please provide host'; | |
} else { | |
//create the url for API call | |
$url = "https://api.pingdom.com/api/2.0/traceroute?host=".$host; |
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
mysql -u root -p root; | |
USE maxmind; | |
DROP TABLE IF EXISTS `blocks`; | |
CREATE TABLE `blocks` ( | |
`startIPNum` int(10) unsigned NOT NULL, | |
`endIPNum` int(10) unsigned NOT NULL, | |
`locID` int(10) unsigned NOT NULL, | |
PRIMARY KEY (`startIPNum`,`endIPNum`) |
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 | |
//check the POST | |
$ips = $_POST["ips"]; | |
if (empty($ips)) { | |
echo 'Please provide ips.'; | |
} else { | |
//connect to mysql and select the maxmind database |
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 convert(geo){ | |
var latlonrg = /(\d+(?:\.\d+)?)[\xb0\s]?\s*(?:(\d+(?:\.\d+)?)['\u2019\u2032\s])?\s*(?:(\d+(?:\.\d+)?)["\u201d\u2033\s])?\s*([SNEW])?/i; | |
var m = String(geo).split(latlonrg), | |
lat = m && +m[1] + (m[2] || 0) / 60 + (m[3] || 0) / 3600; | |
if (m[4].toUpperCase() == "S") { | |
lat = -lat; | |
} | |