Skip to content

Instantly share code, notes, and snippets.

@mrico
mrico / campaignkit-auth0-actions.js
Created April 20, 2022 10:31
Email Address Validation for Auth0
const fetch = require('node-fetch');
/**
* Validate the given email address using CampaignKit.cc
*/
const validateEmail = async (event) => {
const token = event.secrets.TOKEN;
const { user: { email } } = event;
const body = {
emails: [email],
define([
'CollectionExtend',
'underscore',
'backbone',
'models/UserModel'
], function (Collection, _, Backbone, UserModel) {
'use strict';
Collection.namespace = 'users';
@mrico
mrico / changelog.rb
Last active December 12, 2015 00:28
#!/usr/bin/env ruby
require 'rubygems'
require 'set'
require 'net/http'
require "net/https"
require 'json'
require 'pathname'
config_file = "#{ENV['HOME']}/.changelog"
15:02:51.783 [http-8080-2] INFO io.leon.unitofwork.UOWManager - Starting new unit of work for thread [Thread[http-8080-2,5,main]] with context [org.apache.catalina.connector.RequestFacade@ffce2f2].
15:02:52.032 [http-8080-2] DEBUG i.l.w.r.ExposedUrlCheckFilter - Requested exposed URL /leon/comet/connect
15:02:52.406 [http-8080-2] ERROR org.atmosphere.cpr.AtmosphereServlet - AtmosphereServlet exception
java.lang.IllegalStateException: !(Jetty || Servlet 3.0 || ContinuationFilter)
at org.eclipse.jetty.continuation.ContinuationSupport.getContinuation(ContinuationSupport.java:145) ~[jetty-continuation-7.0.2.v20100331.jar:7.0.2.v20100331]
at org.atmosphere.container.Jetty7CometSupport.service(Jetty7CometSupport.java:78) ~[atmosphere-runtime-0.7.1.jar:0.7.1]
at org.atmosphere.container.Jetty8WebSocketSupport.service(Jetty8WebSocketSupport.java:72) ~[atmosphere-runtime-0.7.1.jar:0.7.1]
at org.atmosphere.cpr.AtmosphereServlet.doCometSupport(AtmosphereServlet.java:1185) [atmosphere-runtime-0.7.1.jar:0.7.1]
at or
@mrico
mrico / enumfield_question.scala
Created December 27, 2010 11:11
Question about Record's EnumField and Enumeration types
import net.liftweb._
import record._
import record.field._
object State extends State
sealed abstract class State extends Enumeration("created", "destroyed") {
type State = Value
val Created, Destroyed = Value
}
@mrico
mrico / GridFSHelper.scala
Created October 29, 2010 07:46
Helper for streaming MongoDB GridFS files in lift web applications.
package code.lib
import net.liftweb._
import http._
import util._
import Helpers._
import common._
import mongodb._
import com.mongodb._
@mrico
mrico / roller_wxr_exporter.scala
Created October 16, 2010 15:13
Basic script to import comments from a Apache Roller site to disqus.com.
#!/bin/sh
exec scala "$0" "$@"
!#
/*
Basic script to import comments from a Apache Roller site to disqus.com.
The script reads the entries and comments rss feeds from the roller website and generates a simple wxr file
that can be imported by disqus.com.
usage: roller_wxr_exporter.scala http://your_domain.com/your_blog