Skip to content

Instantly share code, notes, and snippets.

View bmarshall511's full-sized avatar

Ben Marshall bmarshall511

View GitHub Profile
<?php
if($_POST) {
$action_limit = 2 * 1000; // Should match the action_limit set in the script
$return = array('new_total' => 0);
// Do something here to get the user's current points
$previous_total = 0;
// DEMO STUFF
$previous_total = $_COOKIE['points'];
<div class="points"></div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="jquery.interactionPoints.js"></script>
<script>
$(function() {
// Initialize the User Interaction Points jQuery Plugin
$('.points').interactionPoints({
url: 'your-script-here.php', // The URL the points get posted to, required
container: window, // The element to track interactions on
value: 1, // The amount of points each second is worth
#overlay {
display: block;
position: fixed;
z-index: 999;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, .5);
}
<div id="your-content">
<h3 class="title">Traffic Pop jQuery Plugin</h3>
<div class="mid">
You content here (ex. social network sharing buttons)
</div>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="jquery.trafficPop.js"></script>
<script>
$(function() {
body { font-family: Arial, 'DejaVu Sans', 'Liberation Sans', Freesans, sans-serif }
.prettyfied-select {
height: 33px;
display: inline-block;
min-width: 200px;
position: relative;
background: #eee;
}
(function( $ ) {
$( "select.prettyfied" ).each( function() {
var $select = $( this ),
$container = $( "<div>", {
width: $select.outerWidth(),
className: "prettyfied-select",
html: '<div class="prettyfied-select-box"><span></span></div>',
}),
$dropDown = $( "<ul>", {
className: "dropDown",
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Coding Deliciously Styled Dropdown Select Lists | A Demo by Ben Marshall</title>
<link rel="stylesheet" href="assets/css/styles.css">
</head>
<body>
<form method="post" action="#">
<select name="prettyfied" class="prettyfied">
<?php
$api = new Mozscape_API_Class( 'accessId', 'secretKey' );
// Outputs the Mozscape logo
echo $api->attributionLink( 'logo', 'lg' );
echo $api->attributionLink( 'logo', 'med' );
echo $api->attributionLink( 'logo', 'sm' );
echo $api->attributionLink( 'logo', 'xlg' );
// Outputs the Mozscape icon
<?php
$top_pages = $api->topPages( 'www.benmarshall.me' );
print_r( $top_pages );
<?php
$api = new Mozscape_API_Class( 'accessId', 'secretKey' );
echo $api->responseFields( 'ut', 'name' ); // Returns 'Title'
echo $api->responseFields( 'ut', 'description' ); // Returns 'The title of the page if available. For example: "Request-Response Format"'
echo $api->responseFields( 'ut', 'bit_flag' ); // Returns '1'
echo $api->responseFields( 'ut', 'slug' ); // Returns 'title'
echo $api->responseFields( 'ut', 'free' ); // Returns 'yes'