Skip to content

Instantly share code, notes, and snippets.

import tornado.httpserver
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")
class AjaxHandler(tornado.web.RequestHandler):
def get(self):
@bialecki
bialecki / gist:1293556
Created October 17, 2011 19:40
Backbone View that listens to more events.
(function () {
// Cached regex to split keys for `delegate`.
var eventSplitter = /^(\S+)\s*(.*)$/;
var ExtendedView = Backbone.View.extend({
delegateViewEvents : function (events) {
if (!(events || (events = this.viewEvents))) return;
'''
Sam Keller
03/11/2012
routeTester.py
This file was written to get to know how bottle.py works and how to write
routes. If we wanted to, say, track which pages are clicked on our Wikipedia
extension for Firefox, this code would be helpful. This simple code just
takes in a Wikipedia page in the address and prints out a little message saying
@bialecki
bialecki / gist:2464827
Created April 22, 2012 15:51
New main.js
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var pageMod = require('page-mod');
var data = require('self').data;
var request = require('request').Request;
exports.main = function(options, callbacks) {
var pageMod = require("page-mod");
<html>
<head>
<title>Backbone Views</title>
</head>
<body>
<table id="foobar"></table>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="http://documentcloud.github.com/underscore/underscore-min.js"></script>
<script type="text/javascript" src="http://backbonejs.org/backbone-min.js"></script>
#header { display: none; }
@bialecki
bialecki / gist:4962832
Created February 15, 2013 19:38
Reddit Daily Email
import json
import requests
API_KEY = 'KLAVIYO_API_KEY'
TEMPLATE_ID = 'KLAVIYO_TEMPLATE_ID'
SUBREDDIT = 'corgi'
FROM_EMAIL = 'from@example.com'
FROM_NAME = 'Your Name'
TO_EMAIL = 'to@example.com'
@bialecki
bialecki / gist:57fafcc251564365629f
Created March 10, 2015 05:05
Track Started Checkout for Volusion in Klaviyo
<!-- Add this script to 'one-page-checkout.asp' -->
<script type="text/javascript">
var _learnq = _learnq || [];
// Get this from https://www.klaviyo.com/account#api-keys
_learnq.push(['account', 'PUBLIC_API_KEY']);
(function () {
var b = document.createElement('script'); b.type = 'text/javascript'; b.async = true;
b.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'a.klaviyo.com/media/js/analytics/analytics.js';
@bialecki
bialecki / blog.json-feed.liquid
Created July 11, 2016 02:03
Shopify Blog JSON Feed
{% layout none %}{% comment %}
/*
* Shopify JSON Blog Feed
*
* Copyright (c) 2016 Klaviyo (success@klaviyo.com)
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
*/
{% endcomment %}
@bialecki
bialecki / example.html
Last active August 12, 2017 17:11
Example Klaviyo Email Subscribe / Preferences Page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">