Skip to content

Instantly share code, notes, and snippets.

@jice-lavocat
jice-lavocat / index.html
Created September 10, 2015 08:56
Getting Fb, Twitter and G+ count with JS (in 2015)
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<script src="https://apis.google.com/js/client:plusone.js" type="text/javascript"></script>
<script src="social_count.js"></script>
<h1>Social count</h1>
<script type="text/javascript">
$(document).ready(function($){
var url = window.location.href;
var iddivTwit="#twitter<?php echo $randid; ?>";
<?php
$target="http://www.wordiz.it";
$data="f.req=%5B%22".$target."%22%2Cnull%5D&";
$url = "https://plus.google.com/u/0/ripple/update";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
@jice-lavocat
jice-lavocat / swtln.css
Created November 23, 2015 09:46
Tweetwall css
header.head {
height:200px;
background:url('../img/swtln.png?1436228541') no-repeat center;
margin-right: 1100px;
/*float: left;*/
}
.blue {
color:#FFF
}
@jice-lavocat
jice-lavocat / chmod_visible_files.sh
Created August 11, 2016 13:55
Rend visibles les fichiers d'un dossier "visible" sur Unix (Centrale Marseille)
#!/bin/bash
find . -type f -exec chmod 644 {} \; # fichiers en général
find . -name ‘*.php’ -exec chmod 600 {} \; # tous les fichiers qui portent l’extension php
find . -type d -exec chmod 751 {} \; # tous les répertoires
chmod 755 visible # un répertoire visible de l’extérieur qui s’appelle ‘visible’
@jice-lavocat
jice-lavocat / ga_experiments.html
Created October 24, 2016 02:37
Google Experiments Generic Code
<!-- Load the Content Experiment JavaScript API client for the experiment -->
<!-- Place this just after your <head> -->
<script src="//www.google-analytics.com/cx/api.js?experiment=YOUR_EXPERIMENT_ID"></script>
@jice-lavocat
jice-lavocat / google_experiment_layout_change.html
Last active October 24, 2016 03:03
Change a page content/layout with GA Experiments
<!-- Load the JQuery library -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script>
// Needs to be loaded after jquery
var chosenVariation = cxApi.chooseVariation();
console.log("Experiments is ON. Visitor will see variant : ", chosenVariation);
// Define JavaScript for each page variation of this experiment.
var pageVariations = [
function() { // Original: We don't change the page at all
@jice-lavocat
jice-lavocat / export_mails.py
Created January 17, 2017 15:28
Django quick CSV export of user emails
from django.contrib.auth.models import User
import csv
writer = csv.writer(open("email.csv", 'w'))
qs = User.objects.all().values("email")
for obj in qs:
row = []
if type(obj['email']) == unicode:
email = obj['email'].encode("utf-8")
row.append(email)
writer.writerow(row)
@jice-lavocat
jice-lavocat / gtm_get_url_variable.js
Created June 14, 2017 09:53
Parse and reuse URL variable in GTM
function() {
var url = new URL({{Page URL}});
var final_price = url.searchParams.get("final_price");
return (final_price/100);
}
@jice-lavocat
jice-lavocat / send_offline_events_to_facebook_api.php
Last active August 10, 2017 10:02
Send offline events to Facebook API by using PHP curl
<?php
// Replace with your access token
$access_token = 'your_access_token';
// PURCHASE DATA
// Replace with your own customer/purchase data
$data = array();
$data["match_keys"]["lead_id"] = "1234";
$data["event_time"] = 1477632399;
@jice-lavocat
jice-lavocat / combination_to_csv.py
Last active October 4, 2018 05:31
Create all possible combinations from several list to CSV
# Based on https://stackoverflow.com/a/798893/2550237
import itertools
import csv
games = ["Angry Birds", "Clash of Clans"]
platforms = ["iOS", "Android"]
dates = ["1/1/2018", "1/2/2018", "1/3/2018", "1/4/2018", "1/5/2018",
"1/6/2018", "1/7/2018", "1/8/2018", "1/9/2018", "1/10/2018",
"1/11/2018", "1/12/2018"]