Skip to content

Instantly share code, notes, and snippets.

View mehdimehdi's full-sized avatar

Mehdi Ait Oufkir mehdimehdi

View GitHub Profile
<script type="text/javascript">
window._mfq = window._mfq || [];
(function() {
var mf = document.createElement("script");
mf.type = "text/javascript"; mf.async = true;
mf.src = "//cdn.mouseflow.com/projects/08ab6895-b885-4e9e-a827-5a8ece208524.js";
document.getElementsByTagName("head")[0].appendChild(mf);
})();
</script>
@mehdimehdi
mehdimehdi / internals.py
Created November 6, 2016 02:21
Handling SMS response from customers
""" more routes before, but does not affect the use case """
def follow_up_with_callee(twilio_data,event_id):
text = twilio_data.get('Body').upper()
task = import_module('switchboard.tasks')
if text == 'remove'.upper():
content = 'Great. will let him know.'
{% extends "base.html" %}
{% block content %}
<div>
Something special in my about page with a <button id="aboutbutton">about button</button>.
Something less special with some <button>other button</button> which is the same as the home.html button.
</div>
<script>
Delivered-To: mehdi.aitoufkir@gmail.com
Received: by 10.64.236.98 with SMTP id ut2csp3291479iec;
Thu, 30 Apr 2015 11:13:53 -0700 (PDT)
X-Received: by 10.107.4.196 with SMTP id 187mr7446259ioe.6.1430417633051;
Thu, 30 Apr 2015 11:13:53 -0700 (PDT)
Return-Path: <pm_bounces@pm.mtasv.net>
Received: from sc-ord-mta118.mtasv.net (sc-ord-mta118.mtasv.net. [50.31.156.118])
by mx.google.com with ESMTPS id m15si1876435igt.42.2015.04.30.11.13.52
for <mehdi.aitoufkir@gmail.com>
(version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
Delivered-To: mehdi.aitoufkir@gmail.com
Received: by 10.64.236.98 with SMTP id ut2csp3287972iec;
Thu, 30 Apr 2015 11:07:36 -0700 (PDT)
X-Received: by 10.236.23.42 with SMTP id u30mr4764701yhu.194.1430417256557;
Thu, 30 Apr 2015 11:07:36 -0700 (PDT)
Return-Path: <marcusmarcus@me.com>
Received: from st11p01mm-asmtp001.mac.com (st11p01mm-asmtp001.mac.com. [17.172.204.239])
by mx.google.com with ESMTPS id uu4si5103474vdc.11.2015.04.30.11.07.36
for <mehdi.aitoufkir@gmail.com>
(version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128/128);
var _ptq = _ptq || []; // define or reuse the queue
// pushing a "purchase" action which will be rewarded only once in a lifetime, this needs to be trigger onload.
_ptq.push(['purchase', {ref_id: <order number>}]);
<script type="text/javascript" charset="utf-8">
var _ptq = _ptq || [];
var _punchtab_settings = {
key: "<YOUR KEY>",
display: "tab",
position: {x:"left", y:"bottom"}
};
(function() {
var pt = document.createElement('script'); pt.type = 'text/javascript'; pt.async = true;
from django.db import transaction
from django.contrib.sessions.models import Session
Session.objects.filter(expire_date__lt=datetime.datetime.now()).delete()
transaction.commit_unless_managed()
DELETE FROM `django_session` WHERE `session_key` IN ('96ef0d60c319ede132c8de8885f63c5a', '96e4626aa69d9985867ad5514a4c00cc', '96d5188056118a99c13855a7da02d028', '96d254a4813e1fdfe9913b59e65bf85a', '96d22e236088cf93731a827a61bbf6e0', '96c63f7119e82a2ca3729d3ae76d3d51', '96b8996dcf4c192947d7f2e64d4c2476', '96aec7a2bdd47bf4c895bfb7520a9ec0', '96ad2a6caf9243abee04cb49aadbfe8f', '96a626af0581bdfa4e7ce3d26dff80f2', '96a388927a42b1261ca6e1551748ef8f', '96a054fe6ed54db4e3e82dc2a4a3e63c', '969c5830a37344727d90e7d449d5eb19', '969738a65fe61061ddef4818bf3cf73f', '969660ba7c2f1f786136cd43d75b0a87', '969292457c962a0402edaab9056e07fa', '9691309b10360be90830023588ed94c1', '9680c9ce3c8d504d7a6eb42d226d178d', '96808b78ecf93c11a33fd31a6014f5d1', '966f9c2cf56baa92a2e2e982b66d2999', '966d7b13800a9cb3af5c8aefe4d6d460', '966158f2383cd635e299098b382fc40f', '965e0191b1aaa02f19b030bcdf58bfa2', '965025517f804893cd00ddd8ae30f99b', '964afb5803fb57ed7fe5072efd62d776', '962452ea8c07b5ce6caa4ab542af443a', '9612a172041940469c7b537197493a0d',
@mehdimehdi
mehdimehdi / gist:8482929
Created January 17, 2014 22:34
Histogram exercise
Build a command line tool which takes a CSV file-like input, and creates an histogram in ASCII
data = [(0,1),
(2, 4),
(4, 2),
(3, 3)]
Each row in the CSV is data which helps build the histogram. The first value is the column #, the second value is the value of bar in the histogram.