Skip to content

Instantly share code, notes, and snippets.

@lambtron
lambtron / text.js
Created January 10, 2013 07:52
This is the javascript file that is being imported with the bookmarklet script, so as to allow the bookmarklet to capture the highlighted text and also to send the necessary data points to the server for SMS delivery.
function getSelText() {
var txt = '';
if (window.getSelection) {
txt = window.getSelection();
} else if (document.getSelection) {
txt = document.getSelection();
} else if (document.selection) {
txt = document.selection.createRange().text;
} else return;
return txt;
@lambtron
lambtron / la_vs_sf_yelp_scraper.py
Created November 2, 2018 21:44
LA vs. SF: which city has more diverse cuisine?
#
# Module dependencies.
#
import os
import csv
import itertools
import collections
from yelpapi import YelpAPI
@lambtron
lambtron / inbox_controller.rb
Last active June 21, 2019 22:30
Parsing inbound email from Mandrill for the SF apartment hunt.
require 'mechanize'
class InboxController < ApplicationController
include Mandrill::Rails::WebHookProcessor
# For the apartment hunt.
def parse_inbound_sf_apartment_email
# Mandrill needs an ok in order to proceed to POST Mandrill events to this endpoint.
if request.head?
head :ok
@lambtron
lambtron / url_test.ts
Created March 29, 2022 01:58
Simple url test with `deno test`.
// url_test.ts
import { assertEquals } from "https://deno.land/std@0.132.0/testing/asserts.ts";
Deno.test("url test", () => {
const url = new URL("./foo.js", "https://deno.land/");
assertEquals(url.href, "https://deno.land/foo.js");
});
@lambtron
lambtron / css-in-deno.ts
Created January 24, 2023 21:14
console log css styles in deno
console.log(
"%cHello, %cworld!",
"text-decoration: underline",
"color: blue;"
);
@lambtron
lambtron / shopify.md
Last active October 23, 2023 17:48
segment event tracking for shopify
title sidebar
Segment Event Tracking for Shopify
Shopify

Segment makes it simple for Shopify merchants to integrate analytics, email marketing, advertising and optimization tools. Rather than installing all your tools individually, you just install Segment once. We collect your data, translate it, and route it to any tool you want to use with the flick of a switch. Using Segment as the single platform to manage and install your third-party services will save you time and money.

The guide below explains how to install Segment in your Shopify store. All you need to get up and running is copy and paste a few snippets of code into your theme editor. (You don't have to edit the code or be versed in JavaScript.) The following guide will show you how, step by step.