Skip to content

Instantly share code, notes, and snippets.

View mehdimehdi's full-sized avatar

Mehdi Ait Oufkir mehdimehdi

View GitHub Profile
@mehdimehdi
mehdimehdi / gist:6731916
Created September 27, 2013 17:17
Dotcloud push
# upload /Users/mehdi/Documents/attila ssh://dotcloud@uploader.dotcloud.com:443/analytics
# git
Warning: Permanently added '[uploader.dotcloud.com]:443,[23.21.128.228]:443' (RSA) to the list of known hosts.
Everything up-to-date
17:13:58 ---> Deploy of "analytics" scheduled for revision git-574d320 at 2013-09-27 17:13:58
17:13:58 ---> Building the application...
17:13:58 [extract] Build started for revision git-574d320-1 (clean build)
17:14:01 [extract] I am snapshotsworker_02/ec2-184-73-114-244, and I will be your builder today.
17:14:03 [extract] stdin: is not a tty
17:14:03 [extract] Get:1 http://us-east-1.ec2.archive.ubuntu.com.s3.amazonaws.com lucid Release.gpg [189B]
@mehdimehdi
mehdimehdi / gist:6502903
Created September 9, 2013 23:28
Connect to the loyalty program JS snippet (need to create a button with the id "connect-button"
var connectButton = PT.dom.$("connect-button");
PT.widget.connect.attachConnect(connectButton);
@mehdimehdi
mehdimehdi / gist:6500841
Created September 9, 2013 20:10
This is how to get the access token.
window.ptReady = window.ptReady || [];
window.ptReady.push(function(){
PT.event.bind('user.connected', function(event){
console.log(event.accessToken);//<- this is the token you need to call our API
});
});
<div id="rwd_tab" class="left bottom">
<div id="red_tab"></div>
<a id="pwd_below_tab" target="_blank" href="//www.punchtab.com?src=pwd-by-tab&amp;src_key=">
</a>
</div>
@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);