Skip to content

Instantly share code, notes, and snippets.

<?php
// include bv sdk
require('BVsdk.php');
// call constructor method passing client specific data
$bv = BV(array(
'productId' => 'test1',
'currentPageUrl' => 'http://www.client.com/productId/page.php',
'staging' => TRUE, // boolean,
@charleshimmer
charleshimmer / RRIntegrationCode.html
Last active January 1, 2016 22:29
Bazaarvoice RR integration code
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<script src="//display-stg.ugc.bazaarvoice.com/static/Bazaarvoice/bvapi.js"></script>
<script>
@charleshimmer
charleshimmer / Demo.html
Created December 18, 2012 16:47
GE Appliances demo integration code
<!DOCTYPE html>
<html>
<head>
<!-- using // means the bvapi.js file will load over whatever protocal the pages uses (either http or https) -->
<script src="//geappliances.ugc.bazaarvoice.com/bvstaging/static/1218-en_us/bvapi.js"></script>
<!-- JavaScript call to bazaarvoice to load reviews for the product test1 -->
<script>
$BV.ui('rr', 'show_reviews', {
productId: 'test1'
});
function santizeHTML(riskyHTML){
// create an invisible but fully functional HTML document
var doc = document.implementation.createHTMLDocument();
// set it's HTML to the HTML we need to santize
doc.body.innerHtml = riskyHTML;
// black list of tags we want to remove
var badNodes = doc.querySelectorAll("script,style,link,object");
@charleshimmer
charleshimmer / BV.html
Created December 7, 2012 21:03
NewYork & Company BV Integration Code
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<script src="//newyorkcompany.ugc.bazaarvoice.com/static/3510-en_us/bvapi.js"></script>
<script>
@charleshimmer
charleshimmer / exampleBV.js
Created November 7, 2012 18:21
Conversations 2013 Integration Code
// Step 1 - make sure the BV divs are on the page. The placement of these divs dictate where BV will inject it's content
// BV Summary Container (for both RR and QA)
<div id="BVRRSummaryContainer"></div>
// BV RR Container
<div id="BVRRContainer"></div>
// BV QA Container (Optional)
<div id="BVQAContainer"></div>
@charleshimmer
charleshimmer / gist:3834640
Created October 4, 2012 16:07
SkilTools sample display integration code
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<script src="//skiltools.ugc.bazaarvoice.com/bvstaging/static/4853/bvapi.js"></script>
@charleshimmer
charleshimmer / gist:2998747
Created June 26, 2012 20:34
Rough JSON schema for Salesforce data
[{
clientFamily: Walmart,
accounts:[{
name: Walmart-CA,
ASF: 500000,
numCase: 34,
productsSold: [...]
productsLive: [...]
folders:[{
name: Walmart
@charleshimmer
charleshimmer / gist:1790409
Created February 10, 2012 15:50
Lamen explanations of programming concepts

Objects

The concept of an “object” in programming is a made up abstraction to make programming easier. Computers don’t require us to use objects to code software. Humans invented this concept to make building, organizing, and maintaining code easier and consistent. What computer scientists really did was steal this pattern from dealing with real objects we work with everyday.

Let’s take a car for example. A car is an object that can do certain things. A car can drive, break, turn, and lock the doors. If we were to implement a car in our code we would create an object and call it “Car”. This car object would have methods (fancy word for functions that are defined in an object) that could drive(), turn(), brake(), and lockDoors(). The actual syntax would look something like this if you were doing this in JavaScript:

var car = new Car(); // manufacture a new car object and store it in a variable

car.drive(); // make the car drive
car.brake(); // make the car brake

@charleshimmer
charleshimmer / gist:1674669
Created January 25, 2012 04:14
One time computation
function getQueryParams(param) {
var qs = document.location.search.split("+").join(" "),
params = {},
tokens,
re = /[?&]?([^=]+)=([^&]*)/g;
while (tokens = re.exec(qs)) {
params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]);
}