Skip to content

Instantly share code, notes, and snippets.

@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
// Importing modules.
var express = require('express');
var fs = require('fs');
var image = require('./image');
// Configuration.
var app = express();
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use('/resources', express.static(__dirname + '/resources'));
{
"name": "the-daily-koala",
"description": "automated lulz generator",
"version": "0.0.1",
"private": true,
"engines": {
"node": "0.8.x",
"npm": "1.1.x"
},
"dependencies": {
@lambtron
lambtron / twiliocontroller.rb
Created January 10, 2013 08:39
Ruby server code that allows for CORS and sends an SMS via Twilio.
require 'rubygems'
require 'twilio-ruby'
require 'net/http'
require 'uri'
require 'json'
class TwilioController < ApplicationController
TWILIO_ACCOUNT_SID = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
TWILIO_ACCOUNT_TOKEN = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
SENDER_NUMBER = '+xxxxxxxxxx'
@lambtron
lambtron / textme.html
Last active December 10, 2015 22:09
This is the home page of the TextMe! application. This describes how the user would put in his/her phone number and generate a link that would be dragged to the toolbar to act as a bookmarklet.
<section class="form">
<input type="text" placeholder="xxx-xxx-xxxx">
<button type="submit">Make my bookmarklet!</button>
</section>
<section id="bookmarklet-container">
<span><p>Your link will be generated below and drag it to your toolbar!</p></span>
<div id="bookmarklet">
</div>
</section>
@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;