Skip to content

Instantly share code, notes, and snippets.

@thewheat
thewheat / league_fixture.php
Created October 3, 2013 12:31
Support for custom number of fixtures. Caveat: disables checking of proper number of fixtures for all leagues. Should work with https://github.com/thewheat/PHPLeague-for-WP/commit/0c47e97739d24a9b5e7b065b4ae85bf72ce6a24a Add to your existing files Lines ending with "// added for custom number of fixtures" Lines between "// new code - 1" and "// …
// new code - 1
if (isset($_POST['fixtures_add']) && check_admin_referer('phpleague'))
{
$nb_fixtures = $db->nb_fixtures_league($id_league);
$db->add_fixtures_league($nb_fixtures+1, $id_league);
}
if (isset($_POST['fixtures_delete']) && check_admin_referer('phpleague'))
{
$nb_fixtures = $db->nb_fixtures_league($id_league);
$db->remove_fixtures_league($id_league, $nb_fixtures);
import hashlib
import hmac
from flask import Flask
from flask import request, url_for
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def hello_world():
KEY = "" # REPLACE WITH YOUR HUB SECRET VALUE
@thewheat
thewheat / views.py
Last active April 9, 2019 08:13
Process Intercom's Webhook with Django
# Don't forget to modify urls.py accordingly to allow routing to the function
# url(r'', views.index)
from django.views.decorators.csrf import csrf_exempt
import hashlib
import hmac
from django.http import HttpResponse

Intercom user_hash

Remember that your secret key should never be exposed to the public

  • So Javascript code below should only be used for testing unless modified and used to run on a server
@thewheat
thewheat / intercom-teachable.com.rb
Last active July 8, 2020 09:57
Integrating Intercom with Teachable.com Power Editor > Templates > Layouts > partials > footer
{% endcache %}
<script>
// TODO: change the instances of APP_ID to your specific app_id value
{% if current_user == null %}
window.intercomSettings = {
app_id: "APP_ID"
};
@thewheat
thewheat / intercom-wix.js
Last active June 18, 2020 22:23
Intercom integration with wix.com. There are some caveats with this installation e.g. Product Tours won't work. See comment below for more details. We have had reports that it doesn't work in some cases but it does seem to function on some sites (e.g. http://timlim96.wix.com/acquire). If you can manually integrate it on your own test non Wix pag…
<script>
// just use the Vistor Install as per https://www.intercom.com/help/install-on-your-product-or-site/quick-install/install-intercom-on-your-website-for-logged-out-visitors
// Notes on Intercom and Wix including possible problems detailed in https://gist.github.com/thewheat/956aea06573143344ea9/
// Add > More > HTML code
// Select "Code" in settings
// paste this snippet
// update your APP_ID
@thewheat
thewheat / districts.geojson
Last active March 27, 2016 07:42
Data extracted from the Survey Department http://survey.gov.bn/web/survey_department/map as part of Brunei Geek Meet's Data Hackathon http://www.meetup.com/BruneiGeekMeet/events/229707511/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thewheat
thewheat / brunei_districts.geojson
Created March 27, 2016 07:45
Data extracted from the Brunei's Survey Department http://survey.gov.bn/web/survey_department/map as part of Brunei Geek Meet's Data Hackathon http://www.meetup.com/BruneiGeekMeet/events/229707511/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thewheat
thewheat / map 22.geojson
Created April 9, 2016 06:37
22 BSB -> Rimba/ITB/UBD/JIS -> BSB: Tamu Gadong - UNISSA - J. Tungku - Rimba - ITB - UBD - JIS
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thewheat
thewheat / intercom-clickfunnels.js
Last active November 16, 2016 07:05
Intercom Integration with ClickFunnels. Sample app https://tim-lim-clickfunnels.clickfunnels.com/optin
<script>
// just use the Acquire Install as per https://docs.intercom.io/install-on-your-web-product/use-javascript-to-install-intercom-on-any-web-site
// In the page editor go to Settings > Tracking Code > Footer Custom Tracking
// paste this snippet
// update your APP_ID
/* Replace 'APP_ID' with your app ID */
window.intercomSettings = {app_id: 'APP_ID'};
/* Replace 'APP_ID' with your app ID */