Skip to content

Instantly share code, notes, and snippets.

View mehdimehdi's full-sized avatar

Mehdi Ait Oufkir mehdimehdi

View GitHub Profile
@mehdimehdi
mehdimehdi / index.html
Created January 17, 2013 03:26
Reward enable Landing page (For example user coming from QR code scanning)
<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
var ptReady = ptReady || [];
ptReady.push(function(){
PT.event.bind('user.connected', function(event){
alert('user connected');
});
PT.event.bind('user.disconnected', function(event){
alert('user connected');
});
});
@mehdimehdi
mehdimehdi / gist:4119728
Created November 20, 2012 18:09
Social Bar snippet
<!-- this is the basic snippet which works for any HTML template -->
<div class="pt-social" data-referral="true" data-display="false" data-href="http://the_link_to_the_article" data-text="The description for twitter" data-with-pinterest="true" data-media="http://url_to_image_for_pinterest"></div>
<!-- this is the the snippet for wordpress implementation -->
<div class="pt-social" data-referral="true" data-display="false" data-href="<?php the_permalink() ?>" data-text="<?php the_title() ?>" data-with-pinterest="true" data-media="http://url_to_image_for_pinterest"></div>
Django==1.3
Fabric==1.4.1
MySQL-python==1.2.3
PIL==1.1.7
PyJWT==0.1.2
amqplib==1.0.2
anyjson==0.3.1
argparse==1.2.1
braintree==2.14.2
celery==2.5.3
@mehdimehdi
mehdimehdi / gist:4075232
Created November 14, 2012 22:14
reward users for multiple page views
var ptReady = ptReady || [];
ptReady.push(function(){
PT.event.bind('dom.ready', function(){
var route, c = PT.cookie.get('_ptroute');
if (c){
route = PT.serializer.jsonDecode(c);
} else {
route = [];
}
if (PT.util.indexOf(route, window.location.pathname) == -1){
@mehdimehdi
mehdimehdi / gist:4062901
Created November 12, 2012 23:55
Query to get number of points credited per publisher
SELECT sum(points),extract(MONTH from date_created)
FROM activity
WHERE publisher_id='9290' and date_created > '2012-09-01'
GROUP BY extract(MONTH from date_created)
ORDER BY EXTRACT(MONTH from date_created);
@mehdimehdi
mehdimehdi / gist:4004260
Created November 2, 2012 20:58
Mobile implementation
//usuall loyalty program, but hidden
var _ptq = _ptq || [];
var _punchtab_settings = {
key: "291747bccbb1e12abf93c56ecc73b03b",
language: "en",
display: "inline",
earningmap: true
};
(function() {
<div class="pt-social" data-href="www.YOURPAGE.com" data-text="YOUR CUSTOM TWEET MESSAGE GOES HERE"></div>
<iframe src="http://www.punchtab.com/mast/index?key=<YOUR KEY>&tab=catalog" frameborder="0" scrolling="no" width="680" height="640"></iframe>
[2012-09-07 08:19:01,584] ERROR django.request:209 Internal Server Error: /campaign2/31643
Traceback (most recent call last):
File "/home/dotcloud/env/lib/python2.6/site-packages/django/core/handlers/base.py", line 111, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/home/dotcloud/env/lib/python2.6/site-packages/newrelic-1.2.1.265/newrelic/hooks/framework_django.py", line 430, in __call__
return self.__wrapped(*args, **kwargs)
File "/home/dotcloud/env/lib/python2.6/site-packages/django/views/decorators/csrf.py", line 39, in wrapped_view
resp = view_func(*args, **kwargs)
File "/home/dotcloud/env/lib/python2.6/site-packages/django/views/decorators/csrf.py", line 52, in wrapped_view
return view_func(*args, **kwargs)